Previous 15994 Revisions Next

r14897 Wednesday 11th April, 2012 at 14:52:11 UTC by Miodrag Milanović
Sync with MAME r15957 (no whatsnew)
[src/emu]devcpu.h diexec.c diexec.h driver.c driver.h emu.h emu.mak gamedrv.h machine.c machine.h mconfig.h
[src/emu/audio]generic.c generic.h
[src/emu/cpu/arm]arm.c
[src/emu/cpu/arm7]arm7core.c arm7core.h
[src/emu/cpu/cp1610]cp1610.c
[src/emu/cpu/e132xs]e132xs.c
[src/emu/cpu/f8]f8.c
[src/emu/cpu/g65816]g65816.c g65816cm.h
[src/emu/cpu/h6280]h6280.c h6280.h
[src/emu/cpu/h83002]h8priv.h
[src/emu/cpu/hcd62121]hcd62121.c
[src/emu/cpu/hd6309]hd6309.c
[src/emu/cpu/i386]i386.c i386priv.h
[src/emu/cpu/i8008]i8008.c
[src/emu/cpu/i8085]i8085.c
[src/emu/cpu/i86]i286.c i86.c
[src/emu/cpu/i960]i960.c
[src/emu/cpu/jaguar]jaguar.c
[src/emu/cpu/konami]konami.c
[src/emu/cpu/m37710]m37710.c m37710cm.h
[src/emu/cpu/m6502]m4510.c m6502.c m6509.c m65ce02.c
[src/emu/cpu/m6800]m6800.c
[src/emu/cpu/m68000]m68kcpu.c m68kcpu.h
[src/emu/cpu/m6805]m6805.c
[src/emu/cpu/m6809]m6809.c
[src/emu/cpu/mb88xx]mb88xx.c
[src/emu/cpu/mc68hc11]mc68hc11.c
[src/emu/cpu/mcs48]mcs48.c
[src/emu/cpu/mcs51]mcs51.c
[src/emu/cpu/minx]minx.c
[src/emu/cpu/mips]mips3com.c mips3com.h mips3drc.c r3000.c
[src/emu/cpu/nec]nec.c necpriv.h v25.c v25priv.h
[src/emu/cpu/pdp1]tx0.c
[src/emu/cpu/powerpc]ppc.c ppccom.c ppccom.h ppcdrc.c
[src/emu/cpu/rsp]rsp.h rspdrc.c
[src/emu/cpu/s2650]s2650.c
[src/emu/cpu/saturn]saturn.c
[src/emu/cpu/se3208]se3208.c
[src/emu/cpu/sh2]sh2.c sh2comn.c sh2comn.h sh2drc.c
[src/emu/cpu/sh4]sh4.c sh4comn.h
[src/emu/cpu/sharc]sharc.c
[src/emu/cpu/sm8500]sm8500.c
[src/emu/cpu/spc700]spc700.c
[src/emu/cpu/t11]t11.c
[src/emu/cpu/tlcs90]tlcs90.c
[src/emu/cpu/tlcs900]tlcs900.c
[src/emu/cpu/tms32025]tms32025.c
[src/emu/cpu/tms32031]tms32031.h
[src/emu/cpu/tms32051]tms32051.c
[src/emu/cpu/tms34010]tms34010.c
[src/emu/cpu/tms7000]tms7000.c
[src/emu/cpu/tms9900]99xxcore.h
[src/emu/cpu/upd7810]upd7810.c
[src/emu/cpu/v30mz]v30mz.c
[src/emu/cpu/v60]v60.c
[src/emu/cpu/v810]v810.c
[src/emu/cpu/z180]z180.c
[src/emu/cpu/z80]z80.c
[src/emu/cpu/z8000]z8000.c
[src/emu/machine]generic.c generic.h
[src/emu/video]generic.c generic.h
[src/lib/util]palette.h
[src/mame]mame.lst mame.mak
[src/mame/audio]8080bw.c astrof.c aztarac.c blockade.c cchasm.c cinemat.c circus.c copsnrob.c cyberbal.c dkong.c gotya.c harddriv.c hyprolyb.c irem.c jedi.c laserbat.c m72.c mario.c mcr.c mcr.h micro3d.c mw8080bw.c n8080.c redalert.c scramble.c segag80r.c segag80v.c senjyo.c spacefb.c starwars.c timeplt.c williams.c
[src/mame/drivers]1942.c 1943.c 1945kiii.c 2mindril.c 39in1.c 40love.c 5clown.c 8080bw.c 88games.c ace.c acefruit.c acommand.c actfancr.c aeroboto.c aerofgt.c airbustr.c ajax.c albazc.c albazg.c aliens.c alpha68k.c ambush.c amspdwy.c aquarium.c arcadecl.c argus.c aristmk4.c armedf.c ashnojoe.c asterix.c astinvad.c astrafr.c astrocde.c astrocorp.c astrof.c atarig1.c atarig42.c atarigt.c atarigx2.c atarisy1.c atarisy2.c atarisy4.c atetris.c attckufo.c avt.c aztarac.c backfire.c badlands.c batman.c battlane.c battlera.c battlnts.c bbusters.c beaminv.c berzerk.c bestleag.c bfcobra.c bfm_sc1.c bfm_sc4.c bfm_sc4h.c bfm_sc5.c bfmsys85.c bigstrkb.c bingoc.c bingor.c bionicc.c bishi.c bking.c blackt96.c bladestl.c blitz.c blktiger.c blockade.c blockhl.c blockout.c bloodbro.c blstroid.c blueprnt.c bmcbowl.c bogeyman.c bombjack.c boogwing.c bottom9.c boxer.c brkthru.c btime.c bublbobl.c buggychl.c buster.c bwing.c cabal.c cabaret.c calchase.c calorie.c capbowl.c cardline.c carjmbre.c carrera.c caswin.c cb2001.c cball.c cbasebal.c cbuster.c cchasm.c cclimber.c cd32.c cesclass.c champbas.c champbwl.c chanbara.c chinagat.c chinsan.c chqflag.c cinemat.c circus.c circusc.c citycon.c clayshoo.c clshroad.c cmmb.c cninja.c cntsteer.c coinmstr.c coinmvga.c combatsc.c commando.c contra.c coolridr.c cop01.c copsnrob.c corona.c cosmic.c cps1.c crbaloon.c crimfght.c crospang.c crshrace.c crystal.c cshooter.c csplayh5.c cultures.c cvs.c cyberbal.c cybertnk.c cyclemb.c d9final.c dacholer.c dai3wksi.c dambustr.c darius.c darkhors.c darkseal.c dassault.c dblewing.c dbz.c dcheese.c dcon.c ddayjlc.c ddealer.c ddenlovr.c ddragon.c ddragon3.c deadang.c dec0.c dec8.c deco156.c deco32.c deco_ld.c deniam.c deshoros.c destroyr.c dietgo.c discoboy.c diverboy.c djboy.c dkong.c dlair.c dmndrby.c dogfgt.c dominob.c dooyong.c dorachan.c dotrikun.c dreamwld.c drgnmst.c drmicro.c drtomy.c dynadice.c egghunt.c embargo.c enigma2.c eprom.c equites.c esd16.c esh.c espial.c ettrivia.c exedexes.c exerion.c exprraid.c exterm.c exzisus.c f-32.c f1gp.c fantland.c fastfred.c fcombat.c fcrash.c feversoc.c finalizr.c firebeat.c firefox.c firetrap.c fitfight.c flkatck.c flower.c flstory.c flyball.c foodf.c fortecar.c freekick.c fromanc2.c funkball.c funkyjet.c funybubl.c fuukifg2.c gaelco.c gaiden.c gal3.c galaga.c galaxi.c galaxia.c galaxian.c galaxold.c galivan.c galpani2.c galpani3.c galpanic.c galspnbl.c gamecstl.c gameplan.c gamtor.c gauntlet.c gberet.c gbusters.c gcpinbal.c gei.c ghosteo.c gijoe.c ginganin.c gladiatr.c glass.c gng.c go2000.c goal92.c goindol.c goldngam.c goldnpkr.c goldstar.c good.c goodejan.c gotcha.c gotya.c gpworld.c gradius3.c grchamp.c gstream.c gstriker.c gsword.c gticlub.c gts3.c gumbo.c gunsmoke.c gyruss.c halleys.c harddriv.c hcastle.c hexion.c highvdeo.c himesiki.c hitpoker.c homedata.c hotblock.c hotstuff.c hvyunit.c hyperspt.c igs009.c igs011.c igs017.c igs_m027.c igspoker.c imolagp.c intrscti.c inufuku.c iqblock.c ironhors.c istellar.c itech32.c itech8.c jack.c jackal.c jackie.c jackpool.c jaguar.c jailbrek.c jalmah.c jangou.c jchan.c jedi.c jokrwild.c jollyjgr.c jongkyo.c jubilee.c junofrst.c kaneko16.c kangaroo.c karnov.c kas89.c kchamp.c kickgoal.c kingdrby.c kingobox.c kinst.c klax.c kncljoe.c koftball.c koikoi.c konamigv.c konamim2.c ksayakyu.c ksys573.c ladyfrog.c laserbas.c laserbat.c lasso.c lastduel.c legionna.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 luckgrln.c lucky74.c lwings.c m107.c m14.c m63.c m72.c m79amb.c m90.c m92.c macs.c madalien.c madmotor.c magic10.c magicard.c magicfly.c magictg.c magtouch.c mainevt.c mainsnk.c mappy.c marinedt.c mario.c mastboy.c matmania.c mayumi.c mazerbla.c mcatadv.c mcr.c mcr3.c mcr68.c mediagx.c megasys1.c megazone.c meijinsn.c merit.c metlclsh.c metro.c mgolf.c micro3d.c midas.c midqslvr.c midvunit.c midyunit.c mikie.c mil4000.c miniboy7.c minivadr.c mirage.c mirax.c missb2.c missile.c mitchell.c mlanding.c model1.c model2.c model3.c mogura.c mole.c momoko.c moo.c mosaic.c mpoker.c mrflea.c ms32.c msisaac.c mugsmash.c multigam.c munchmo.c murogem.c murogmbl.c mw8080bw.c mwarr.c mystwarr.c n8080.c namconb1.c namcos11.c namcos12.c namcos22.c namcos23.c nbmj8991.c nbmj9195.c nemesis.c neogeo.c neoprint.c news.c nexus3d.c nightgal.c ninjakd2.c niyanpai.c nmg5.c nmk16.c nsmpoker.c nwk-tr.c nycaptor.c nyny.c offtwall.c ohmygod.c olibochu.c omegrace.c oneshot.c onetwo.c opwolf.c othello.c othldrby.c overdriv.c pacland.c pacman.c pandoras.c panicr.c parodius.c pasha2.c pass.c pbaction.c pcat_nit.c pcktgal.c pcxt.c peplus.c pgm.c photon2.c photoply.c pinkiri8.c pipedrm.c pipeline.c pirates.c pitnrun.c pkscram.c pktgaldx.c playmark.c plygonet.c pntnpuzl.c pokechmp.c poker72.c poo.c pooyan.c popeye.c popobear.c portrait.c powerins.c ppmast93.c prehisle.c progolf.c psikyo.c psychic5.c pturn.c punchout.c pushman.c pzletime.c qdrmfgp.c quantum.c quasar.c queen.c quizpani.c quizpun2.c quizshow.c r2dtank.c r2dx_v33.c raiden.c raiden2.c rainbow.c rallyx.c rampart.c rastan.c rbmk.c re900.c realbrk.c redalert.c relief.c renegade.c retofinv.c rgum.c rmhaihai.c rockrage.c rocnrope.c rohga.c rollerg.c rollrace.c rotaryf.c roul.c route16.c royalmah.c rpunch.c rungun.c safarir.c sandscrp.c sauro.c savquest.c sbasketb.c sbowling.c sbrkout.c scobra.c scotrsht.c scramble.c sderby.c seattle.c segae.c segag80r.c segag80v.c segahang.c segald.c segaorun.c segas16a.c segas16b.c segas18.c segas32.c segaxbd.c segaybd.c seibuspi.c sengokmj.c senjyo.c seta.c seta2.c sf.c sfbonus.c sfkick.c shadfrce.c shangha3.c shanghai.c shisen.c shootout.c shougi.c shuuz.c sidearms.c sidepckt.c sigmab98.c skeetsht.c skimaxx.c skullxbo.c skyarmy.c skyfox.c skylncr.c sliver.c slotcarn.c snesb.c snk.c snk68.c snowbros.c solomon.c sonson.c sothello.c spacefb.c spaceg.c spbactn.c spcforce.c spdodgeb.c speedbal.c speedspn.c speglsht.c splash.c splus.c spoker.c spool99.c spy.c srmp2.c srmp5.c srmp6.c srumbler.c ssfindo.c sshot.c sslam.c ssozumo.c sstrangr.c st0016.c stadhero.c starwars.c statriv2.c stlforce.c stv.c sub.c subsino.c subsino2.c summit.c suna16.c suna8.c supbtime.c supdrapo.c superdq.c superqix.c superwng.c suprgolf.c suprloco.c suprslam.c surpratk.c system1.c system16.c tagteam.c tail2nos.c taito_b.c taito_f2.c taito_h.c taito_o.c taito_x.c taito_z.c taitogn.c taitosj.c taitowlf.c tankbatt.c tankbust.c taotaido.c tapatune.c targeth.c tatsumi.c tattack.c taxidriv.c tbowl.c tecmo.c tecmo16.c tecmosys.c tehkanwc.c terracre.c tgtpanic.c thedeep.c thepit.c thoop2.c thunderj.c thunderx.c tickee.c tigeroad.c timelimt.c timeplt.c timetrv.c tmaster.c tmnt.c tmspoker.c tnzs.c toaplan2.c toki.c tomcat.c toobin.c topspeed.c toratora.c toypop.c tp84.c trackfld.c trvmadns.c tryout.c tsamurai.c ttchamp.c tugboat.c tumbleb.c tumblep.c tutankhm.c twin16.c twincobr.c twins.c tx1.c ultraman.c ultrsprt.c umipoker.c unkhorse.c vamphalf.c vaportra.c vastar.c vball.c vcombat.c vectrex.c vegas.c vendetta.c vigilant.c vindictr.c viper.c vmetal.c volfied.c vroulet.c vulgus.c wallc.c wardner.c warpsped.c warpwarp.c wc90.c wc90b.c wecleman.c welltris.c wgp.c whitestar.c williams.c wink.c witch.c wiz.c wldarrow.c wrally.c wwfsstar.c wwfwfest.c xain.c xexex.c xmen.c xtheball.c xtom3d.c xybots.c yunsun16.c yunsung8.c zaccaria.c zaxxon.c zerozone.c zn.c zodiack.c zr107.c
[src/mame/includes]8080bw.h arcadecl.h astrof.h atarig1.h atarig42.h atarigt.h atarigx2.h atarisy1.h atarisy2.h aztarac.h badlands.h batman.h bfm_sc45.h blockade.h blstroid.h cchasm.h cd32.h cinemat.h circus.h copsnrob.h cyberbal.h ddragon.h dkong.h eprom.h fastfred.h foodf.h galaga.h galaxia.h galaxian.h galpani2.h galpanic.h gauntlet.h gladiatr.h gotya.h gsword.h harddriv.h jedi.h klax.h laserbat.h liberatr.h lockon.h mario.h mcr.h mcr3.h mcr68.h micro3d.h midvunit.h model2.h model3.h mw8080bw.h n8080.h namconb1.h namcos22.h offtwall.h pgm.h psikyo.h quasar.h rampart.h redalert.h relief.h scramble.h segag80r.h segag80v.h segas32.h seibuspi.h senjyo.h seta.h seta2.h shuuz.h skullxbo.h spacefb.h st0016.h starwars.h stv.h thunderj.h toobin.h tx1.h vindictr.h xybots.h
[src/mame/machine]ajax.c bublbobl.c decocass.c decoprot.c leland.c mcr68.c midyunit.c mie.c pgmprot1.c scramble.c seicop.c ticket.c ticket.h williams.c wrally.c
[src/mame/video]1942.c 1943.c 40love.c aeroboto.c ambush.c amspdwy.c appoooh.c arkanoid.c armedf.c ashnojoe.c atarigt.c bagman.c bankp.c baraduke.c battlane.c battlex.c bionicc.c bking.c blktiger.c blueprnt.c bogeyman.c bombjack.c boogwing.c bosco.c btime.c bublbobl.c buggychl.c cabal.c cbuster.c champbas.c circusc.c cischeat.c citycon.c cloak.c clshroad.c cninja.c commando.c cop01.c cosmic.c cps1.c crbaloon.c cvs.c dassault.c ddragon.c ddragon3.c deadang.c dec0.c dec8.c decbac06.c deckarn.c decmxc06.c deco32.c decocass.c decospr.c dietgo.c digdug.c docastle.c dogfgt.c dooyong.c dynduke.c equites.c esd16.c exprraid.c exzisus.c fastfred.c finalizr.c firetrap.c flower.c flstory.c foodf.c freekick.c funkybee.c funkyjet.c fuukifg2.c fuukifg3.c gaelco2.c gaiden.c galaga.c galaxold.c gaplus.c gberet.c ginganin.c gladiatr.c gng.c goindol.c gottlieb.c gotya.c gunsmoke.c hanaawas.c higemaru.c himesiki.c holeland.c hyperspt.c hyprduel.c ironhors.c jack.c jackal.c jailbrek.c kan_panb.c kan_pand.c kchamp.c kingobox.c ksayakyu.c ladybug.c ladyfrog.c lasso.c lastduel.c liberate.c liberatr.c lkage.c lsasquad.c lwings.c m52.c m58.c m72.c m92.c madmotor.c mainsnk.c mappy.c markham.c mcr68.c mermaid.c metlclsh.c metro.c mikie.c mitchell.c mjkjidai.c mouser.c mrjong.c mustache.c n8080.c namcos1.c namcos86.c nbmj8891.c ninjakd2.c nmk16.c nova2001.c nycaptor.c othldrby.c pacland.c paradise.c pbaction.c pcktgal.c pitnrun.c pktgaldx.c pokechmp.c pooyan.c popeye.c powerins.c prehisle.c psikyo.c psychic5.c pushman.c quizdna.c rallyx.c realbrk.c redclash.c renegade.c retofinv.c rocnrope.c rohga.c sauro.c sbasketb.c scotrsht.c senjyo.c seta2.c sf.c shangha3.c shaolins.c shisen.c shootout.c sidearms.c simpl156.c simpsons.c skyfox.c skykid.c snk.c snk6502.c solomon.c sonson.c spcforce.c spdodgeb.c speedbal.c srumbler.c sshangha.c ssozumo.c st0016.c stfight.c strnskil.c suna16.c suna8.c supbtime.c superqix.c suprloco.c system1.c tagteam.c tecmo.c tecmo16.c tehkanwc.c terracre.c thedeep.c tigeroad.c timeplt.c toaplan1.c toki.c toypop.c trackfld.c travrusa.c tryout.c tsamurai.c tumblep.c twin16.c vaportra.c vastar.c vball.c vulgus.c warpwarp.c welltris.c wrally.c wwfsstar.c wwfwfest.c xain.c xevious.c xxmissio.c yiear.c yunsun16.c zaccaria.c zaxxon.c zodiack.c
[src/mess/drivers]ng_aes.c supracan.c

src/mame/mame.lst
r14896r14897
89348934haunthig      // (c) 200?
89358935
89368936// IGS PGM System Games
8937pgm
8938orlegend      // (c) 1997
8939orlegende      // (c) 1997
8940orlegendc      // (c) 1997
8941orlegendca      // (c) 1997
8942orlegend111c      // (c) 1997
8943orlegend105k      // (c) 1997
8944drgw2         // (c) 1997
8945dw2v100x      // (c) 1997
8946drgw2c         // (c) 1997
8947drgw2j         // (c) 1997
8948drgw3         // (c) 1998
8949drgw3105      // (c) 1998
8950drgw3100      // (c) 1998
8951dwex         // (c) 1998
8952killbld         // (c) 1998
8953killbld104      // (c) 1998
8954kov         // (c) 1999
8955kovplus         // (c) 1999
8956kovplusa      // (c) 1999
8937pgm            // Base Unit
8938orlegend      // (c) 1997 Oriental Legend
8939orlegende      //
8940orlegendc      //
8941orlegendca      //
8942orlegend111c   //
8943orlegend105k   //
8944drgw2         // (c) 1997 Dragon World 2
8945dw2v100x      //
8946drgw2c         //
8947drgw2j         //
8948drgw3         // (c) 1998 Dragon World 3
8949drgw3105      //
8950drgw3100      //
8951dwex         // (c) 1998 Dragon World 3 EX
8952killbld         // (c) 1998 The Killing Blade
8953killbld104      //
8954kov            // (c) 1999 Knights of Valor
8955kov115         //
8956kov100         //
8957kovplus         // (c) 1999 Knights of Valor Plus (aka 10 Character version)
8958kovplusa      //
89578959kovsgqyz      // bootleg
89588960kovsgqyza      // bootleg
89598961kovsgqyzb      // bootleg
8960kov115         // (c) 1999
8961kov100         // (c) 1999
8962kovsh         // (c) 1999
8963kovsh103      // (c) 1999
8962kovsh         // (c) 1999 Knights of Valor Superheroes
8963kovsh103      //
89648964kovqhsgs      // bootleg
8965photoy2k      // (c) 1999 Photo Y2k
8966photoy2k102      //
8967photoy2k104      //
8968puzlstar      // (c) 1999 Puzzle Star
8969olds         // (c) 1999 Oriental Legend Super / Special
8970olds100         //
8971olds100a      //
8972kov2         // (c) 2000 Knights of Valor 2
8973kov2106         //
8974kov2103         //
8975kov2102         //
8976kov2101         //
8977kov2100         //
8978kov2p         // (c) 2000 Knights of Valor 2 Nine Dragons
8979kov2p205      //
8980ddp2         // (c) 2001 DoDonPachi 2 - Bee Storm
8981ddp2100         //
8982ddp2101         //
8983puzzli2         // (c) 2001 Puzzli 2
8984martmast      // (c) 2001 Martial Masters
8985martmastc      //
8986martmastc102   //
8987theglad         // (c) 2001 The Gladiator
8988theglada      //
8989thegladpcb      //
8990dw2001         // (c) 2001 Dragon World 2001
8991dwpc         // (c) 2001 Dragon World Pretty Chance
8992py2k2         // (c) 2001 Photo Y2K2
8993dmnfrnt         // (c) 2002 Demon Front
8994dmnfrnta      //
8995dmnfrntpcb      //
8996kovshp         // (c) 200? Knights of Valor Superheroes PLUS
8997kovshxas      // bootleg
89658998kovlsqh         // bootleg
89668999kovlsqh2      // bootleg
89679000kovlsjb         // bootleg
89689001kovlsjba      // bootleg
8969photoy2k      // (c) 1999
8970photoy2k102      // (c) 1999
8971photoy2k104      // (c) 1999
8972puzlstar      // (c) 1999
8973olds         // (c) 1999
8974olds100         // (c) 1999
8975olds100a      // (c) 1999
8976kov2         // (c) 2000
8977kov2106         // (c) 2000
8978kov2103         // (c) 2000
8979kov2102         // (c) 2000
8980kov2101         // (c) 2000
8981kov2100         // (c) 2000
8982kov2p         // (c) 2000
8983kov2p205      // (c) 2000
8984ddp2         // (c) 2001
8985ddp2100         // (c) 2001
8986ddp2101         // (c) 2001
8987puzzli2         // (c) 2001
8988martmast      // (c) 2001
8989martmastc      // (c) 2001
8990martmastc102      // (c) 2001
8991theglad         // (c) 2001
8992theglada      // (c) 2001
8993thegladpcb
8994dw2001         // (c) 2001
8995dwpc         // (c) 2001
8996py2k2         // (c) 2001
8997dmnfrnt         // (c) 2002
8998dmnfrnta      // (c) 2002
8999dmnfrntpcb
9000kovshp
9001oldsplus
9002killbldp
9003happy6
9004svg
9005svgpcb
9006ket         // (c) 2002 Cave
9007keta         // (c) 2002 Cave
9008ketb         // (c) 2002 Cave
9009ddpdoj         // (c) 2002 Cave
9010ddpdoja         // (c) 2002 Cave
9011ddpdojb         // (c) 2002 Cave
9012ddpdojblk      // (c) 2002 Cave
9013espgal         // (c) 2003 Cave
9002oldsplus      // (c) 2004 Oriental Legend Super Plus
9003killbldp      // (c) 2004 Killing Blade Plus
9004happy6         // (c) 200? Happy 6
9005svg            // (c) 2003 Spectral vs Generation
9006svgpcb         //
9007ket            // (c) 2002 Ketsui
9008keta         //
9009ketb         //
9010ddpdoj         // (c) 2002 DoDonPachi Dai-Ou-Jou
9011ddpdoja         //
9012ddpdojb         //
9013ddpdojblk      //
9014espgal         // (c) 2003 Espgaluda
9015
9016// IGS PGM2 Platform
9017
90149018orleg2         // (c) 2007
90159019orleg2o         //
90169020kov2nl         // (c) 2008
r14896r14897
1722217226ad5tornc   // Tornado Club (Bellfruit)
1722317227ad5vpa      // Video Poker Ace (Bellfruit)
1722417228ad5vlv      // Viva Las Vegas (Bellfruit)
17225ad5u1337   // Unknown Scorpion '39211337' (Mazooma)
1722617229
1722717230
1722817231
src/mame/audio/micro3d.c
r14896r14897
370370***************************************************************************/
371371
372372
373WRITE8_HANDLER( micro3d_snd_dac_a )
373WRITE8_MEMBER(micro3d_state::micro3d_snd_dac_a)
374374{
375   micro3d_state *state = space->machine().driver_data<micro3d_state>();
376   state->m_dac_data = data;
375   m_dac_data = data;
377376}
378377
379WRITE8_HANDLER( micro3d_snd_dac_b )
378WRITE8_MEMBER(micro3d_state::micro3d_snd_dac_b)
380379{
381380   /* TODO: This controls upd7759 volume */
382381}
383382
384WRITE8_HANDLER( micro3d_sound_io_w )
383WRITE8_MEMBER(micro3d_state::micro3d_sound_io_w)
385384{
386   micro3d_state *state = space->machine().driver_data<micro3d_state>();
387385
388   state->m_sound_port_latch[offset] = data;
386   m_sound_port_latch[offset] = data;
389387
390388   switch (offset)
391389   {
392390      case 0x01:
393391      {
394         micro3d_noise_sh_w(space->machine(), data);
392         micro3d_noise_sh_w(machine(), data);
395393         break;
396394      }
397395      case 0x03:
398396      {
399         device_t *upd = space->machine().device("upd7759");
397         device_t *upd = machine().device("upd7759");
400398         upd7759_set_bank_base(upd, (data & 0x4) ? 0x20000 : 0);
401399         upd7759_reset_w(upd, (data & 0x10) ? 0 : 1);
402400         break;
r14896r14897
404402   }
405403}
406404
407READ8_HANDLER( micro3d_sound_io_r )
405READ8_MEMBER(micro3d_state::micro3d_sound_io_r)
408406{
409   micro3d_state *state = space->machine().driver_data<micro3d_state>();
410407
411408   switch (offset)
412409   {
413      case 0x01:   return (state->m_sound_port_latch[offset] & 0x7f) | input_port_read(space->machine(), "SOUND_SW");
414      case 0x03:   return (state->m_sound_port_latch[offset] & 0xf7) | (upd7759_busy_r(space->machine().device("upd7759")) ? 0x08 : 0);
410      case 0x01:   return (m_sound_port_latch[offset] & 0x7f) | input_port_read(machine(), "SOUND_SW");
411      case 0x03:   return (m_sound_port_latch[offset] & 0xf7) | (upd7759_busy_r(machine().device("upd7759")) ? 0x08 : 0);
415412      default:   return 0;
416413   }
417414}
src/mame/audio/spacefb.c
r14896r14897
1111#include "includes/spacefb.h"
1212
1313
14READ8_HANDLER( spacefb_audio_p2_r )
14READ8_MEMBER(spacefb_state::spacefb_audio_p2_r)
1515{
16   spacefb_state *state = space->machine().driver_data<spacefb_state>();
17   return (state->m_sound_latch & 0x18) << 1;
16   return (m_sound_latch & 0x18) << 1;
1817}
1918
2019
21READ8_HANDLER( spacefb_audio_t0_r )
20READ8_MEMBER(spacefb_state::spacefb_audio_t0_r)
2221{
23   spacefb_state *state = space->machine().driver_data<spacefb_state>();
24   return state->m_sound_latch & 0x20;
22   return m_sound_latch & 0x20;
2523}
2624
2725
28READ8_HANDLER( spacefb_audio_t1_r )
26READ8_MEMBER(spacefb_state::spacefb_audio_t1_r)
2927{
30   spacefb_state *state = space->machine().driver_data<spacefb_state>();
31   return state->m_sound_latch & 0x04;
28   return m_sound_latch & 0x04;
3229}
3330
3431
35WRITE8_HANDLER( spacefb_port_1_w )
32WRITE8_MEMBER(spacefb_state::spacefb_port_1_w)
3633{
37   spacefb_state *state = space->machine().driver_data<spacefb_state>();
38   samples_device *samples = space->machine().device<samples_device>("samples");
34   samples_device *samples = machine().device<samples_device>("samples");
3935
40   cputag_set_input_line(space->machine(), "audiocpu", 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
36   cputag_set_input_line(machine(), "audiocpu", 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
4137
4238   /* enemy killed */
43   if (!(data & 0x01) && (state->m_sound_latch & 0x01))  samples->start(0,0);
39   if (!(data & 0x01) && (m_sound_latch & 0x01))  samples->start(0,0);
4440
4541   /* ship fire */
46   if (!(data & 0x40) && (state->m_sound_latch & 0x40))  samples->start(1,1);
42   if (!(data & 0x40) && (m_sound_latch & 0x40))  samples->start(1,1);
4743
4844   /*
4945     *  Explosion Noise
5046     *
5147     *  Actual sample has a bit of attack at the start, but these doesn't seem to be an easy way
5248     *  to play the attack part, then loop the middle bit until the sample is turned off
53     *  Fortunately it seems like the recorded sample of the spaceship death is the longest the sample plays for.
49     *  Fortunately it seems like the recorded sample of the &spaceship death is the longest the sample plays for.
5450     *  We loop it just in case it runs out
5551     */
56   if ((data & 0x80) != (state->m_sound_latch & 0x80))
52   if ((data & 0x80) != (m_sound_latch & 0x80))
5753   {
5854      if (data & 0x80)
5955         /* play decaying noise */
r14896r14897
6359         samples->start(2,2, true);
6460   }
6561
66   state->m_sound_latch = data;
62   m_sound_latch = data;
6763}
6864
6965
src/mame/audio/n8080.c
r14896r14897
313313   if (~data & 0x20) state->m_curr_sound_pins |= 1 << 0xc;
314314
315315   if (state->m_n8080_hardware == 1)
316      flip_screen_set_no_update(machine, data & 0x20);
316      state->flip_screen_set_no_update(data & 0x20);
317317   if (state->m_n8080_hardware == 3)
318318      state->m_helifire_flash = data & 0x20;
319319
r14896r14897
327327}
328328
329329
330WRITE8_HANDLER( n8080_sound_1_w )
330WRITE8_MEMBER(n8080_state::n8080_sound_1_w)
331331{
332   space->machine().scheduler().synchronize(FUNC(delayed_sound_1_callback), data); /* force CPUs to sync */
332   machine().scheduler().synchronize(FUNC(delayed_sound_1_callback), data); /* force CPUs to sync */
333333}
334334
335WRITE8_HANDLER( n8080_sound_2_w )
335WRITE8_MEMBER(n8080_state::n8080_sound_2_w)
336336{
337   space->machine().scheduler().synchronize(FUNC(delayed_sound_2_callback), data); /* force CPUs to sync */
337   machine().scheduler().synchronize(FUNC(delayed_sound_2_callback), data); /* force CPUs to sync */
338338}
339339
340340
341static READ8_HANDLER( n8080_8035_p1_r )
341READ8_MEMBER(n8080_state::n8080_8035_p1_r)
342342{
343   n8080_state *state = space->machine().driver_data<n8080_state>();
344343   UINT8 val = 0;
345344
346   if ((state->m_curr_sound_pins >> 0xb) & 1) val |= 0x01;
347   if ((state->m_curr_sound_pins >> 0xa) & 1) val |= 0x02;
348   if ((state->m_curr_sound_pins >> 0x9) & 1) val |= 0x04;
349   if ((state->m_curr_sound_pins >> 0x8) & 1) val |= 0x08;
350   if ((state->m_curr_sound_pins >> 0x5) & 1) val |= 0x10;
351   if ((state->m_curr_sound_pins >> 0x3) & 1) val |= 0x20;
352   if ((state->m_curr_sound_pins >> 0x2) & 1) val |= 0x40;
353   if ((state->m_curr_sound_pins >> 0x1) & 1) val |= 0x80;
345   if ((m_curr_sound_pins >> 0xb) & 1) val |= 0x01;
346   if ((m_curr_sound_pins >> 0xa) & 1) val |= 0x02;
347   if ((m_curr_sound_pins >> 0x9) & 1) val |= 0x04;
348   if ((m_curr_sound_pins >> 0x8) & 1) val |= 0x08;
349   if ((m_curr_sound_pins >> 0x5) & 1) val |= 0x10;
350   if ((m_curr_sound_pins >> 0x3) & 1) val |= 0x20;
351   if ((m_curr_sound_pins >> 0x2) & 1) val |= 0x40;
352   if ((m_curr_sound_pins >> 0x1) & 1) val |= 0x80;
354353
355354   return val;
356355}
357356
358357
359static READ8_HANDLER( n8080_8035_t0_r )
358READ8_MEMBER(n8080_state::n8080_8035_t0_r)
360359{
361   n8080_state *state = space->machine().driver_data<n8080_state>();
362   return (state->m_curr_sound_pins >> 0x7) & 1;
360   return (m_curr_sound_pins >> 0x7) & 1;
363361}
364static READ8_HANDLER( n8080_8035_t1_r )
362READ8_MEMBER(n8080_state::n8080_8035_t1_r)
365363{
366   n8080_state *state = space->machine().driver_data<n8080_state>();
367   return (state->m_curr_sound_pins >> 0xc) & 1;
364   return (m_curr_sound_pins >> 0xc) & 1;
368365}
369366
370367
371static READ8_HANDLER( helifire_8035_t0_r )
368READ8_MEMBER(n8080_state::helifire_8035_t0_r)
372369{
373   n8080_state *state = space->machine().driver_data<n8080_state>();
374   return (state->m_curr_sound_pins >> 0x3) & 1;
370   return (m_curr_sound_pins >> 0x3) & 1;
375371}
376static READ8_HANDLER( helifire_8035_t1_r )
372READ8_MEMBER(n8080_state::helifire_8035_t1_r)
377373{
378   n8080_state *state = space->machine().driver_data<n8080_state>();
379   return (state->m_curr_sound_pins >> 0x4) & 1;
374   return (m_curr_sound_pins >> 0x4) & 1;
380375}
381376
382377
383static READ8_HANDLER( helifire_8035_external_ram_r )
378READ8_MEMBER(n8080_state::helifire_8035_external_ram_r)
384379{
385   n8080_state *state = space->machine().driver_data<n8080_state>();
386380   UINT8 val = 0;
387381
388   if ((state->m_curr_sound_pins >> 0x7) & 1) val |= 0x01;
389   if ((state->m_curr_sound_pins >> 0x8) & 1) val |= 0x02;
390   if ((state->m_curr_sound_pins >> 0x9) & 1) val |= 0x04;
391   if ((state->m_curr_sound_pins >> 0x1) & 1) val |= 0x08;
382   if ((m_curr_sound_pins >> 0x7) & 1) val |= 0x01;
383   if ((m_curr_sound_pins >> 0x8) & 1) val |= 0x02;
384   if ((m_curr_sound_pins >> 0x9) & 1) val |= 0x04;
385   if ((m_curr_sound_pins >> 0x1) & 1) val |= 0x08;
392386
393387   return val;
394388}
395389
396390
397static READ8_HANDLER( helifire_8035_p2_r )
391READ8_MEMBER(n8080_state::helifire_8035_p2_r)
398392{
399   n8080_state *state = space->machine().driver_data<n8080_state>();
400   return ((state->m_curr_sound_pins >> 0xc) & 1) ? 0x10 : 0x00; /* not used */
393   return ((m_curr_sound_pins >> 0xc) & 1) ? 0x10 : 0x00; /* not used */
401394}
402395
403396
404static WRITE8_HANDLER( n8080_dac_w )
397WRITE8_MEMBER(n8080_state::n8080_dac_w)
405398{
406   dac_data_w(space->machine().device("dac"), data & 0x80);
399   dac_data_w(machine().device("dac"), data & 0x80);
407400}
408401
409402
410static WRITE8_HANDLER( helifire_dac_w )
403WRITE8_MEMBER(n8080_state::helifire_dac_w)
411404{
412   n8080_state *state = space->machine().driver_data<n8080_state>();
413   dac_data_w(space->machine().device("dac"), data * state->m_helifire_dac_volume);
405   dac_data_w(machine().device("dac"), data * m_helifire_dac_volume);
414406}
415407
416408
417static WRITE8_HANDLER( helifire_sound_ctrl_w )
409WRITE8_MEMBER(n8080_state::helifire_sound_ctrl_w)
418410{
419   n8080_state *state = space->machine().driver_data<n8080_state>();
420   state->m_helifire_dac_phase = data & 0x80;
411   m_helifire_dac_phase = data & 0x80;
421412
422413   /* data & 0x40 not emulated */
423414   /* data & 0x20 not emulated */
424415
425   if (state->m_helifire_dac_phase)
416   if (m_helifire_dac_phase)
426417   {
427      state->m_helifire_dac_timing = ATTACK_RATE * log(1 - state->m_helifire_dac_volume);
418      m_helifire_dac_timing = ATTACK_RATE * log(1 - m_helifire_dac_volume);
428419   }
429420   else
430421   {
431      state->m_helifire_dac_timing = DECAY_RATE * log(state->m_helifire_dac_volume);
422      m_helifire_dac_timing = DECAY_RATE * log(m_helifire_dac_volume);
432423   }
433424
434   state->m_helifire_dac_timing += space->machine().time().as_double();
425   m_helifire_dac_timing += machine().time().as_double();
435426}
436427
437428
r14896r14897
558549}
559550
560551
561static ADDRESS_MAP_START( n8080_sound_cpu_map, AS_PROGRAM, 8, driver_device )
552static ADDRESS_MAP_START( n8080_sound_cpu_map, AS_PROGRAM, 8, n8080_state )
562553   ADDRESS_MAP_GLOBAL_MASK(0x3ff)
563554   AM_RANGE(0x0000, 0x03ff) AM_ROM
564555ADDRESS_MAP_END
565556
566557
567static ADDRESS_MAP_START( n8080_sound_io_map, AS_IO, 8, driver_device )
568   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ_LEGACY(n8080_8035_t0_r)
569   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ_LEGACY(n8080_8035_t1_r)
570   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ_LEGACY(n8080_8035_p1_r)
558static ADDRESS_MAP_START( n8080_sound_io_map, AS_IO, 8, n8080_state )
559   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(n8080_8035_t0_r)
560   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(n8080_8035_t1_r)
561   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(n8080_8035_p1_r)
571562
572   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE_LEGACY(n8080_dac_w)
563   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(n8080_dac_w)
573564ADDRESS_MAP_END
574565
575566
576static ADDRESS_MAP_START( helifire_sound_io_map, AS_IO, 8, driver_device )
577   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ_LEGACY(helifire_8035_t0_r)
578   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ_LEGACY(helifire_8035_t1_r)
579   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ_LEGACY(helifire_8035_p2_r)
567static ADDRESS_MAP_START( helifire_sound_io_map, AS_IO, 8, n8080_state )
568   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(helifire_8035_t0_r)
569   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(helifire_8035_t1_r)
570   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(helifire_8035_p2_r)
580571
581   AM_RANGE(0x00, 0x7f) AM_READ_LEGACY(helifire_8035_external_ram_r)
572   AM_RANGE(0x00, 0x7f) AM_READ(helifire_8035_external_ram_r)
582573
583   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE_LEGACY(helifire_dac_w)
584   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE_LEGACY(helifire_sound_ctrl_w)
574   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(helifire_dac_w)
575   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(helifire_sound_ctrl_w)
585576ADDRESS_MAP_END
586577
587578
src/mame/audio/cyberbal.c
r14896r14897
3535 *
3636 *************************************/
3737
38READ8_HANDLER( cyberbal_special_port3_r )
38READ8_MEMBER(cyberbal_state::cyberbal_special_port3_r)
3939{
40   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
41   int temp = input_port_read(space->machine(), "JSAII");
42   if (!(input_port_read(space->machine(), "IN0") & 0x8000)) temp ^= 0x80;
43   if (state->m_cpu_to_sound_ready) temp ^= 0x40;
44   if (state->m_sound_to_cpu_ready) temp ^= 0x20;
40   int temp = input_port_read(machine(), "JSAII");
41   if (!(input_port_read(machine(), "IN0") & 0x8000)) temp ^= 0x80;
42   if (m_cpu_to_sound_ready) temp ^= 0x40;
43   if (m_sound_to_cpu_ready) temp ^= 0x20;
4544   return temp;
4645}
4746
4847
49READ8_HANDLER( cyberbal_sound_6502_stat_r )
48READ8_MEMBER(cyberbal_state::cyberbal_sound_6502_stat_r)
5049{
51   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
5250   int temp = 0xff;
53   if (state->m_sound_data_from_6502_ready) temp ^= 0x80;
54   if (state->m_sound_data_from_68k_ready) temp ^= 0x40;
51   if (m_sound_data_from_6502_ready) temp ^= 0x80;
52   if (m_sound_data_from_68k_ready) temp ^= 0x40;
5553   return temp;
5654}
5755
5856
59WRITE8_HANDLER( cyberbal_sound_bank_select_w )
57WRITE8_MEMBER(cyberbal_state::cyberbal_sound_bank_select_w)
6058{
61   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
62   memory_set_bankptr(space->machine(), "soundbank", &state->m_bank_base[0x1000 * ((data >> 6) & 3)]);
63   coin_counter_w(space->machine(), 1, (data >> 5) & 1);
64   coin_counter_w(space->machine(), 0, (data >> 4) & 1);
65   cputag_set_input_line(space->machine(), "dac", INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
66   if (!(data & 0x01)) devtag_reset(space->machine(), "ymsnd");
59   memory_set_bankptr(machine(), "soundbank", &m_bank_base[0x1000 * ((data >> 6) & 3)]);
60   coin_counter_w(machine(), 1, (data >> 5) & 1);
61   coin_counter_w(machine(), 0, (data >> 4) & 1);
62   cputag_set_input_line(machine(), "dac", INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
63   if (!(data & 0x01)) devtag_reset(machine(), "ymsnd");
6764}
6865
6966
70READ8_HANDLER( cyberbal_sound_68k_6502_r )
67READ8_MEMBER(cyberbal_state::cyberbal_sound_68k_6502_r)
7168{
72   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
73   state->m_sound_data_from_68k_ready = 0;
74   return state->m_sound_data_from_68k;
69   m_sound_data_from_68k_ready = 0;
70   return m_sound_data_from_68k;
7571}
7672
7773
78WRITE8_HANDLER( cyberbal_sound_68k_6502_w )
74WRITE8_MEMBER(cyberbal_state::cyberbal_sound_68k_6502_w)
7975{
80   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
8176
82   state->m_sound_data_from_6502 = data;
83   state->m_sound_data_from_6502_ready = 1;
77   m_sound_data_from_6502 = data;
78   m_sound_data_from_6502_ready = 1;
8479
85   if (!state->m_io_68k_int)
80   if (!m_io_68k_int)
8681   {
87      state->m_io_68k_int = 1;
88      update_sound_68k_interrupts(space->machine());
82      m_io_68k_int = 1;
83      update_sound_68k_interrupts(machine());
8984   }
9085}
9186
r14896r14897
116111}
117112
118113
119WRITE16_HANDLER( cyberbal_io_68k_irq_ack_w )
114WRITE16_MEMBER(cyberbal_state::cyberbal_io_68k_irq_ack_w)
120115{
121   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
122   if (state->m_io_68k_int)
116   if (m_io_68k_int)
123117   {
124      state->m_io_68k_int = 0;
125      update_sound_68k_interrupts(space->machine());
118      m_io_68k_int = 0;
119      update_sound_68k_interrupts(machine());
126120   }
127121}
128122
129123
130READ16_HANDLER( cyberbal_sound_68k_r )
124READ16_MEMBER(cyberbal_state::cyberbal_sound_68k_r)
131125{
132   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
133   int temp = (state->m_sound_data_from_6502 << 8) | 0xff;
126   int temp = (m_sound_data_from_6502 << 8) | 0xff;
134127
135   state->m_sound_data_from_6502_ready = 0;
128   m_sound_data_from_6502_ready = 0;
136129
137   if (state->m_sound_data_from_6502_ready) temp ^= 0x08;
138   if (state->m_sound_data_from_68k_ready) temp ^= 0x04;
130   if (m_sound_data_from_6502_ready) temp ^= 0x08;
131   if (m_sound_data_from_68k_ready) temp ^= 0x04;
139132   return temp;
140133}
141134
142135
143WRITE16_HANDLER( cyberbal_sound_68k_w )
136WRITE16_MEMBER(cyberbal_state::cyberbal_sound_68k_w)
144137{
145   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
146138   if (ACCESSING_BITS_8_15)
147139   {
148      state->m_sound_data_from_68k = (data >> 8) & 0xff;
149      state->m_sound_data_from_68k_ready = 1;
140      m_sound_data_from_68k = (data >> 8) & 0xff;
141      m_sound_data_from_68k_ready = 1;
150142   }
151143}
152144
153145
154WRITE16_HANDLER( cyberbal_sound_68k_dac_w )
146WRITE16_MEMBER(cyberbal_state::cyberbal_sound_68k_dac_w)
155147{
156   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
157   device_t *dac = space->machine().device((offset & 8) ? "dac2" : "dac1");
148   device_t *dac = machine().device((offset & 8) ? "dac2" : "dac1");
158149   dac_data_16_w(dac, (((data >> 3) & 0x800) | ((data >> 2) & 0x7ff)) << 4);
159150
160   if (state->m_fast_68k_int)
151   if (m_fast_68k_int)
161152   {
162      state->m_fast_68k_int = 0;
163      update_sound_68k_interrupts(space->machine());
153      m_fast_68k_int = 0;
154      update_sound_68k_interrupts(machine());
164155   }
165156}
src/mame/audio/laserbat.c
r14896r14897
33#include "sound/tms3615.h"
44#include "includes/laserbat.h"
55
6WRITE8_HANDLER( laserbat_csound1_w )
6WRITE8_MEMBER(laserbat_state::laserbat_csound1_w)
77{
8   laserbat_state *state = space->machine().driver_data<laserbat_state>();
9   state->m_csound1 = data;
8   m_csound1 = data;
109}
1110
12WRITE8_HANDLER( laserbat_csound2_w )
11WRITE8_MEMBER(laserbat_state::laserbat_csound2_w)
1312{
14   laserbat_state *state = space->machine().driver_data<laserbat_state>();
1513   int ksound = 0;
1614
1715   if (data & 0x01)
1816   {
1917      int noise_filter_res = 0, vco_res = 0;
2018
21      switch(state->m_csound1 & 0x07)
19      switch(m_csound1 & 0x07)
2220      {
2321      case 0x00:
2422         noise_filter_res = RES_K(270);
r14896r14897
5452         break;
5553      }
5654
57      sn76477_noise_filter_res_w(state->m_sn, noise_filter_res);
58      sn76477_vco_res_w(state->m_sn, vco_res);
55      sn76477_noise_filter_res_w(m_sn, noise_filter_res);
56      sn76477_vco_res_w(m_sn, vco_res);
5957
60      sn76477_enable_w(state->m_sn, (state->m_csound1 & 0x08) ? 1 : 0); // AB SOUND
61      sn76477_mixer_b_w(state->m_sn, (state->m_csound1 & 0x10) ? 1 : 0); // _VCO/NOISE
58      sn76477_enable_w(m_sn, (m_csound1 & 0x08) ? 1 : 0); // AB SOUND
59      sn76477_mixer_b_w(m_sn, (m_csound1 & 0x10) ? 1 : 0); // _VCO/NOISE
6260
63      state->m_degr = (state->m_csound1 & 0x20) ? 1 : 0;
64      state->m_filt = (state->m_csound1 & 0x40) ? 1 : 0;
65      state->m_a = (state->m_csound1 & 0x80) ? 1 : 0;
66      state->m_us = 0; // sn76477 pin 12
61      m_degr = (m_csound1 & 0x20) ? 1 : 0;
62      m_filt = (m_csound1 & 0x40) ? 1 : 0;
63      m_a = (m_csound1 & 0x80) ? 1 : 0;
64      m_us = 0; // sn76477 pin 12
6765   }
6866
69   sn76477_vco_w(state->m_sn, (data & 0x40) ? 0 : 1);
67   sn76477_vco_w(m_sn, (data & 0x40) ? 0 : 1);
7068
7169   switch((data & 0x1c) >> 2)
7270   {
7371   case 0x00:
74      sn76477_slf_res_w(state->m_sn, RES_K(27));
72      sn76477_slf_res_w(m_sn, RES_K(27));
7573      break;
7674   case 0x01:
77      sn76477_slf_res_w(state->m_sn, RES_K(22));
75      sn76477_slf_res_w(m_sn, RES_K(22));
7876      break;
7977   case 0x02:
80      sn76477_slf_res_w(state->m_sn, RES_K(22));
78      sn76477_slf_res_w(m_sn, RES_K(22));
8179      break;
8280   case 0x03:
83      sn76477_slf_res_w(state->m_sn, RES_K(12));
81      sn76477_slf_res_w(m_sn, RES_K(12));
8482      break;
8583   case 0x04: // not connected
8684      break;
8785   case 0x05: // SL1
88      state->m_ksound1 = state->m_csound1;
86      m_ksound1 = m_csound1;
8987      break;
9088   case 0x06: // SL2
91      state->m_ksound2 = state->m_csound1;
89      m_ksound2 = m_csound1;
9290      break;
9391   case 0x07: // SL3
94      state->m_ksound3 = state->m_csound1;
92      m_ksound3 = m_csound1;
9593      break;
9694   }
9795
98   ksound = ((data & 0x02) << 23) + (state->m_ksound3 << 16) + (state->m_ksound2 << 8) + state->m_ksound1;
96   ksound = ((data & 0x02) << 23) + (m_ksound3 << 16) + (m_ksound2 << 8) + m_ksound1;
9997
100   tms3615_enable_w(state->m_tms1, ksound & 0x1fff);
101   tms3615_enable_w(state->m_tms2, (ksound >> 13) << 1);
98   tms3615_enable_w(m_tms1, ksound & 0x1fff);
99   tms3615_enable_w(m_tms2, (ksound >> 13) << 1);
102100
103   state->m_bit14 = (data & 0x20) ? 1 : 0;
101   m_bit14 = (data & 0x20) ? 1 : 0;
104102
105103   // (data & 0x80) = reset
106104}
src/mame/audio/senjyo.c
r14896r14897
4646};
4747
4848
49WRITE8_HANDLER( senjyo_volume_w )
49WRITE8_MEMBER(senjyo_state::senjyo_volume_w)
5050{
51   senjyo_state *state = space->machine().driver_data<senjyo_state>();
52   samples_device *samples = space->machine().device<samples_device>("samples");
51   samples_device *samples = machine().device<samples_device>("samples");
5352
54   state->m_single_volume = data & 0x0f;
55   samples->set_volume(0, state->m_single_volume / 15.0);
53   m_single_volume = data & 0x0f;
54   samples->set_volume(0, m_single_volume / 15.0);
5655}
5756
5857
src/mame/audio/copsnrob.c
r14896r14897
686686DISCRETE_SOUND_END
687687
688688
689WRITE8_HANDLER( copsnrob_misc_w )
689WRITE8_MEMBER(copsnrob_state::copsnrob_misc_w)
690690{
691   device_t *device = space->machine().device("discrete");
692   copsnrob_state *state = space->machine().driver_data<copsnrob_state>();
693   UINT8 latched_data = state->m_ic_h3_data;
691   device_t *device = machine().device("discrete");
692   UINT8 latched_data = m_ic_h3_data;
694693   UINT8 special_data = data & 0x01;
695694
696695   /* ignore if no change */
r14896r14897
730729
731730      case 0x06:
732731         /* One Start */
733         set_led_status(space->machine(), 0, !special_data);
732         set_led_status(machine(), 0, !special_data);
734733         break;
735734
736735      case 0x07:
737736         discrete_sound_w(device, COPSNROB_AUDIO_ENABLE, special_data);
738         //space->machine().sound().system_mute(special_data);
737         //machine().sound().system_mute(special_data);
739738         break;
740739
741740   }
742741
743   state->m_ic_h3_data = latched_data;
742   m_ic_h3_data = latched_data;
744743}
src/mame/audio/blockade.c
r14896r14897
4242   return;
4343}
4444
45WRITE8_HANDLER( blockade_env_on_w )
45WRITE8_MEMBER(blockade_state::blockade_env_on_w)
4646{
47   samples_device *samples = space->machine().device<samples_device>("samples");
47   samples_device *samples = machine().device<samples_device>("samples");
4848   if (BLOCKADE_LOG) mame_printf_debug("Boom Start\n");
4949   samples->start(0,0);
5050   return;
5151}
5252
53WRITE8_HANDLER( blockade_env_off_w )
53WRITE8_MEMBER(blockade_state::blockade_env_off_w)
5454{
5555   if (BLOCKADE_LOG) mame_printf_debug("Boom End\n");
5656   return;
src/mame/audio/segag80r.c
r14896r14897
217217 *
218218 *************************************/
219219
220WRITE8_HANDLER( astrob_sound_w )
220WRITE8_MEMBER(segag80r_state::astrob_sound_w)
221221{
222   segag80r_state *state = space->machine().driver_data<segag80r_state>();
223222   static const float attack_resistor[10] =
224223   {
225224      120.0f, 82.0f, 62.0f, 56.0f, 47.0f, 39.0f, 33.0f, 27.0f, 24.0f, 22.0f
226225   };
227   samples_device *samples = space->machine().device<samples_device>("samples");
226   samples_device *samples = machine().device<samples_device>("samples");
228227   float freq_factor;
229228
230   UINT8 diff = data ^ state->m_sound_state[offset];
231   state->m_sound_state[offset] = data;
229   UINT8 diff = data ^ m_sound_state[offset];
230   m_sound_state[offset] = data;
232231
233232   switch (offset)
234233   {
r14896r14897
254253         if ((data & 0x10) && samples->playing(4)) samples->stop(4);
255254
256255         /* MUTE */
257         space->machine().sound().system_mute(data & 0x20);
256         machine().sound().system_mute(data & 0x20);
258257
259258         /* REFILL: channel 5 */
260259         if (!(data & 0x40) && !samples->playing(5)) samples->start(5, 9);
r14896r14897
284283         if ((diff & 0x08) && !(data & 0x08)) samples->start(8, 13);
285284
286285         /* ATTACK RATE */
287         if ((diff & 0x10) && !(data & 0x10)) state->m_sound_rate = (state->m_sound_rate + 1) % 10;
286         if ((diff & 0x10) && !(data & 0x10)) m_sound_rate = (m_sound_rate + 1) % 10;
288287
289288         /* RATE RESET */
290         if (!(data & 0x20)) state->m_sound_rate = 0;
289         if (!(data & 0x20)) m_sound_rate = 0;
291290
292291         /* BONUS: channel 9 */
293292         if ((diff & 0x40) && !(data & 0x40)) samples->start(9, 14);
r14896r14897
303302   /* account for the fact that frequency goes up as CV goes down */
304303   /* WARP is already taken into account by the differing samples above */
305304   freq_factor  = (11.5f - 8.163f) * (-22.0f / attack_resistor[0]) + 8.163f;
306   freq_factor /= (11.5f - 8.163f) * (-22.0f / attack_resistor[state->m_sound_rate]) + 8.163f;
305   freq_factor /= (11.5f - 8.163f) * (-22.0f / attack_resistor[m_sound_rate]) + 8.163f;
307306
308307   /* adjust the sample rate of invader sounds based the sound_rate */
309308   /* this is an approximation */
r14896r14897
688687 *
689688 *************************************/
690689
691WRITE8_HANDLER( spaceod_sound_w )
690WRITE8_MEMBER(segag80r_state::spaceod_sound_w)
692691{
693   segag80r_state *state = space->machine().driver_data<segag80r_state>();
694   samples_device *samples = space->machine().device<samples_device>("samples");
695   UINT8 diff = data ^ state->m_sound_state[offset];
696   state->m_sound_state[offset] = data;
692   samples_device *samples = machine().device<samples_device>("samples");
693   UINT8 diff = data ^ m_sound_state[offset];
694   m_sound_state[offset] = data;
697695
698696   switch (offset)
699697   {
r14896r14897
751749static READ8_DEVICE_HANDLER( n7751_status_r );
752750static WRITE8_DEVICE_HANDLER( n7751_command_w );
753751static WRITE8_DEVICE_HANDLER( n7751_rom_control_w );
754static READ8_HANDLER( n7751_rom_r );
755static READ8_HANDLER( n7751_command_r );
752
753
756754static WRITE8_DEVICE_HANDLER( n7751_p2_w );
757static READ8_HANDLER( n7751_t1_r );
758755
756
759757/*
760758    Monster Bash
761759
r14896r14897
797795 *
798796 *************************************/
799797
800static ADDRESS_MAP_START( monsterb_7751_portmap, AS_IO, 8, driver_device )
801   AM_RANGE(MCS48_PORT_T1,   MCS48_PORT_T1) AM_READ_LEGACY(n7751_t1_r)
802   AM_RANGE(MCS48_PORT_P2,   MCS48_PORT_P2) AM_READ_LEGACY(n7751_command_r)
803   AM_RANGE(MCS48_PORT_BUS,  MCS48_PORT_BUS) AM_READ_LEGACY(n7751_rom_r)
798static ADDRESS_MAP_START( monsterb_7751_portmap, AS_IO, 8, segag80r_state )
799   AM_RANGE(MCS48_PORT_T1,   MCS48_PORT_T1) AM_READ(n7751_t1_r)
800   AM_RANGE(MCS48_PORT_P2,   MCS48_PORT_P2) AM_READ(n7751_command_r)
801   AM_RANGE(MCS48_PORT_BUS,  MCS48_PORT_BUS) AM_READ(n7751_rom_r)
804802   AM_RANGE(MCS48_PORT_P1,   MCS48_PORT_P1) AM_DEVWRITE_LEGACY("dac", dac_w)
805803   AM_RANGE(MCS48_PORT_P2,   MCS48_PORT_P2) AM_DEVWRITE_LEGACY("audio_8243", n7751_p2_w)
806804   AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE_LEGACY("audio_8243", i8243_prog_w)
r14896r14897
976974}
977975
978976
979static READ8_HANDLER( n7751_rom_r )
977READ8_MEMBER(segag80r_state::n7751_rom_r)
980978{
981   segag80r_state *state = space->machine().driver_data<segag80r_state>();
982979   /* read from BUS */
983   return space->machine().region("n7751")->base()[state->m_sound_addr];
980   return machine().region("n7751")->base()[m_sound_addr];
984981}
985982
986983
987static READ8_HANDLER( n7751_command_r )
984READ8_MEMBER(segag80r_state::n7751_command_r)
988985{
989   segag80r_state *state = space->machine().driver_data<segag80r_state>();
990986   /* read from P2 - 8255's PC0-2 connects to 7751's S0-2 (P24-P26 on an 8048) */
991987   /* bit 0x80 is an alternate way to control the sample on/off; doesn't appear to be used */
992   return 0x80 | ((state->m_n7751_command & 0x07) << 4);
988   return 0x80 | ((m_n7751_command & 0x07) << 4);
993989}
994990
995991
r14896r14897
10051001}
10061002
10071003
1008static READ8_HANDLER( n7751_t1_r )
1004READ8_MEMBER(segag80r_state::n7751_t1_r)
10091005{
10101006   /* T1 - labelled as "TEST", connected to ground */
10111007   return 0;
src/mame/audio/segag80v.c
r14896r14897
135135
136136*/
137137
138WRITE8_HANDLER( elim1_sh_w )
138WRITE8_MEMBER(segag80v_state::elim1_sh_w)
139139{
140   samples_device *samples = space->machine().device<samples_device>("samples");
140   samples_device *samples = machine().device<samples_device>("samples");
141141   data ^= 0xff;
142142
143143   /* Play fireball sample */
r14896r14897
169169   }
170170}
171171
172WRITE8_HANDLER( elim2_sh_w )
172WRITE8_MEMBER(segag80v_state::elim2_sh_w)
173173{
174   samples_device *samples = space->machine().device<samples_device>("samples");
174   samples_device *samples = machine().device<samples_device>("samples");
175175   data ^= 0xff;
176176
177177   /* Play thrust sample */
r14896r14897
196196}
197197
198198
199WRITE8_HANDLER( zektor1_sh_w )
199WRITE8_MEMBER(segag80v_state::zektor1_sh_w)
200200{
201   samples_device *samples = space->machine().device<samples_device>("samples");
201   samples_device *samples = machine().device<samples_device>("samples");
202202
203203   data ^= 0xff;
204204
r14896r14897
231231   }
232232}
233233
234WRITE8_HANDLER( zektor2_sh_w )
234WRITE8_MEMBER(segag80v_state::zektor2_sh_w)
235235{
236   samples_device *samples = space->machine().device<samples_device>("samples");
236   samples_device *samples = machine().device<samples_device>("samples");
237237   data ^= 0xff;
238238
239239   /* Play thrust sample */
r14896r14897
259259
260260
261261
262WRITE8_HANDLER( spacfury1_sh_w )
262WRITE8_MEMBER(segag80v_state::spacfury1_sh_w)
263263{
264   samples_device *samples = space->machine().device<samples_device>("samples");
264   samples_device *samples = machine().device<samples_device>("samples");
265265   data ^= 0xff;
266266
267267   /* craft growing */
r14896r14897
296296
297297}
298298
299WRITE8_HANDLER( spacfury2_sh_w )
299WRITE8_MEMBER(segag80v_state::spacfury2_sh_w)
300300{
301   samples_device *samples = space->machine().device<samples_device>("samples");
301   samples_device *samples = machine().device<samples_device>("samples");
302302   data ^= 0xff;
303303
304304   /* craft joining */
src/mame/audio/scramble.c
r14896r14897
117117   cputag_set_input_line(device->machine(), "audiocpu", 0, !state ? ASSERT_LINE : CLEAR_LINE);
118118}
119119
120WRITE8_HANDLER( hotshock_sh_irqtrigger_w )
120WRITE8_MEMBER(scramble_state::hotshock_sh_irqtrigger_w)
121121{
122   cputag_set_input_line(space->machine(), "audiocpu", 0, ASSERT_LINE);
122   cputag_set_input_line(machine(), "audiocpu", 0, ASSERT_LINE);
123123}
124124
125125READ8_DEVICE_HANDLER( hotshock_soundlatch_r )
126126{
127127   driver_device *drvstate = device->machine().driver_data<driver_device>();
128128   cputag_set_input_line(device->machine(), "audiocpu", 0, CLEAR_LINE);
129   return drvstate->soundlatch_r(*device->machine().device("audiocpu")->memory().space(AS_PROGRAM),0);
129   return drvstate->soundlatch_byte_r(*device->machine().device("audiocpu")->memory().space(AS_PROGRAM),0);
130130}
131131
132132static void filter_w(device_t *device, int data)
r14896r14897
143143      filter_rc_set_RC(device,FLT_RC_LOWPASS,1000,5100,0,CAP_P(C));
144144}
145145
146WRITE8_HANDLER( scramble_filter_w )
146WRITE8_MEMBER(scramble_state::scramble_filter_w)
147147{
148   filter_w(space->machine().device("filter.1.0"), (offset >>  0) & 3);
149   filter_w(space->machine().device("filter.1.1"), (offset >>  2) & 3);
150   filter_w(space->machine().device("filter.1.2"), (offset >>  4) & 3);
151   filter_w(space->machine().device("filter.0.0"), (offset >>  6) & 3);
152   filter_w(space->machine().device("filter.0.1"), (offset >>  8) & 3);
153   filter_w(space->machine().device("filter.0.2"), (offset >> 10) & 3);
148   filter_w(machine().device("filter.1.0"), (offset >>  0) & 3);
149   filter_w(machine().device("filter.1.1"), (offset >>  2) & 3);
150   filter_w(machine().device("filter.1.2"), (offset >>  4) & 3);
151   filter_w(machine().device("filter.0.0"), (offset >>  6) & 3);
152   filter_w(machine().device("filter.0.1"), (offset >>  8) & 3);
153   filter_w(machine().device("filter.0.2"), (offset >> 10) & 3);
154154}
155155
156WRITE8_HANDLER( frogger_filter_w )
156WRITE8_MEMBER(scramble_state::frogger_filter_w)
157157{
158   filter_w(space->machine().device("filter.0.0"), (offset >>  6) & 3);
159   filter_w(space->machine().device("filter.0.1"), (offset >>  8) & 3);
160   filter_w(space->machine().device("filter.0.2"), (offset >> 10) & 3);
158   filter_w(machine().device("filter.0.0"), (offset >>  6) & 3);
159   filter_w(machine().device("filter.0.1"), (offset >>  8) & 3);
160   filter_w(machine().device("filter.0.2"), (offset >> 10) & 3);
161161}
162162
163163void scramble_sh_init(running_machine &machine)
src/mame/audio/jedi.c
r14896r14897
5858 *
5959 *************************************/
6060
61static WRITE8_HANDLER( irq_ack_w )
61WRITE8_MEMBER(jedi_state::irq_ack_w)
6262{
63   cputag_set_input_line(space->machine(), "audiocpu", M6502_IRQ_LINE, CLEAR_LINE);
63   cputag_set_input_line(machine(), "audiocpu", M6502_IRQ_LINE, CLEAR_LINE);
6464}
6565
6666
r14896r14897
7171 *
7272 *************************************/
7373
74WRITE8_HANDLER( jedi_audio_reset_w )
74WRITE8_MEMBER(jedi_state::jedi_audio_reset_w)
7575{
76   cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
76   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
7777}
7878
7979
r14896r14897
8686}
8787
8888
89WRITE8_HANDLER( jedi_audio_latch_w )
89WRITE8_MEMBER(jedi_state::jedi_audio_latch_w)
9090{
91   space->machine().scheduler().synchronize(FUNC(delayed_audio_latch_w), data);
91   machine().scheduler().synchronize(FUNC(delayed_audio_latch_w), data);
9292}
9393
9494
95static READ8_HANDLER( audio_latch_r )
95READ8_MEMBER(jedi_state::audio_latch_r)
9696{
97   jedi_state *state = space->machine().driver_data<jedi_state>();
9897
99   *state->m_audio_comm_stat &= ~0x80;
100   return state->m_audio_latch;
98   *m_audio_comm_stat &= ~0x80;
99   return m_audio_latch;
101100}
102101
103102
r14896r14897
114113 *
115114 *************************************/
116115
117READ8_HANDLER( jedi_audio_ack_latch_r )
116READ8_MEMBER(jedi_state::jedi_audio_ack_latch_r)
118117{
119   jedi_state *state = space->machine().driver_data<jedi_state>();
120118
121   *state->m_audio_comm_stat &= ~0x40;
122   return state->m_audio_ack_latch;
119   *m_audio_comm_stat &= ~0x40;
120   return m_audio_ack_latch;
123121}
124122
125123
126static WRITE8_HANDLER( audio_ack_latch_w )
124WRITE8_MEMBER(jedi_state::audio_ack_latch_w)
127125{
128   jedi_state *state = space->machine().driver_data<jedi_state>();
129126
130   state->m_audio_ack_latch = data;
131   *state->m_audio_comm_stat |= 0x40;
127   m_audio_ack_latch = data;
128   *m_audio_comm_stat |= 0x40;
132129}
133130
134131
r14896r14897
139136 *
140137 *************************************/
141138
142static WRITE8_HANDLER( speech_strobe_w )
139WRITE8_MEMBER(jedi_state::speech_strobe_w)
143140{
144   jedi_state *state = space->machine().driver_data<jedi_state>();
145141   int new_speech_strobe_state = (~offset >> 8) & 1;
146142
147   if ((new_speech_strobe_state != state->m_speech_strobe_state) && new_speech_strobe_state)
143   if ((new_speech_strobe_state != m_speech_strobe_state) && new_speech_strobe_state)
148144   {
149      device_t *tms = space->machine().device("tms");
150      tms5220_data_w(tms, 0, *state->m_speech_data);
145      device_t *tms = machine().device("tms");
146      tms5220_data_w(tms, 0, *m_speech_data);
151147   }
152   state->m_speech_strobe_state = new_speech_strobe_state;
148   m_speech_strobe_state = new_speech_strobe_state;
153149}
154150
155151
156static READ8_HANDLER( speech_ready_r )
152READ8_MEMBER(jedi_state::speech_ready_r)
157153{
158   return (tms5220_readyq_r(space->machine().device("tms"))) << 7;
154   return (tms5220_readyq_r(machine().device("tms"))) << 7;
159155}
160156
161157
162static WRITE8_HANDLER( speech_reset_w )
158WRITE8_MEMBER(jedi_state::speech_reset_w)
163159{
164160   /* not supported by the TMS5220 emulator */
165161}
r14896r14897
178174   AM_RANGE(0x0810, 0x081f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
179175   AM_RANGE(0x0820, 0x082f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey3", pokey_r, pokey_w)
180176   AM_RANGE(0x0830, 0x083f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey4", pokey_r, pokey_w)
181   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x00ff) AM_READNOP AM_WRITE_LEGACY(irq_ack_w)
177   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x00ff) AM_READNOP AM_WRITE(irq_ack_w)
182178   AM_RANGE(0x1100, 0x1100) AM_MIRROR(0x00ff) AM_READNOP AM_WRITEONLY AM_BASE(m_speech_data)
183   AM_RANGE(0x1200, 0x13ff) AM_READNOP AM_WRITE_LEGACY(speech_strobe_w)
184   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x00ff) AM_READNOP AM_WRITE_LEGACY(audio_ack_latch_w)
185   AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x00ff) AM_READNOP AM_WRITE_LEGACY(speech_reset_w)
179   AM_RANGE(0x1200, 0x13ff) AM_READNOP AM_WRITE(speech_strobe_w)
180   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x00ff) AM_READNOP AM_WRITE(audio_ack_latch_w)
181   AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x00ff) AM_READNOP AM_WRITE(speech_reset_w)
186182   AM_RANGE(0x1600, 0x17ff) AM_NOP
187   AM_RANGE(0x1800, 0x1800) AM_MIRROR(0x03ff) AM_READ_LEGACY(audio_latch_r) AM_WRITENOP
188   AM_RANGE(0x1c00, 0x1c00) AM_MIRROR(0x03fe) AM_READ_LEGACY(speech_ready_r) AM_WRITENOP
183   AM_RANGE(0x1800, 0x1800) AM_MIRROR(0x03ff) AM_READ(audio_latch_r) AM_WRITENOP
184   AM_RANGE(0x1c00, 0x1c00) AM_MIRROR(0x03fe) AM_READ(speech_ready_r) AM_WRITENOP
189185   AM_RANGE(0x1c01, 0x1c01) AM_MIRROR(0x03fe) AM_READONLY AM_WRITENOP AM_BASE(m_audio_comm_stat)
190186   AM_RANGE(0x2000, 0x7fff) AM_NOP
191187   AM_RANGE(0x8000, 0xffff) AM_ROM
src/mame/audio/8080bw.c
r14896r14897
3131/*                                                     */
3232/*******************************************************/
3333
34WRITE8_HANDLER( invadpt2_sh_port_1_w )
34WRITE8_MEMBER(_8080bw_state::invadpt2_sh_port_1_w)
3535{
36   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
37   UINT8 rising_bits = data & ~state->m_port_1_last_extra;
36   UINT8 rising_bits = data & ~m_port_1_last_extra;
3837
39   sn76477_enable_w(state->m_sn, !(data & 0x01));         /* SAUCER SOUND */
38   sn76477_enable_w(m_sn, !(data & 0x01));         /* SAUCER SOUND */
4039
41   if (rising_bits & 0x02) state->m_samples->start(0, 0);      /* MISSLE SOUND */
42   if (rising_bits & 0x04) state->m_samples->start(1, 1);      /* EXPLOSION */
43   if (rising_bits & 0x08) state->m_samples->start(2, 2);      /* INVADER HIT */
44   if (rising_bits & 0x10) state->m_samples->start(5, 8);      /* BONUS MISSILE BASE */
40   if (rising_bits & 0x02) m_samples->start(0, 0);      /* MISSLE SOUND */
41   if (rising_bits & 0x04) m_samples->start(1, 1);      /* EXPLOSION */
42   if (rising_bits & 0x08) m_samples->start(2, 2);      /* INVADER HIT */
43   if (rising_bits & 0x10) m_samples->start(5, 8);      /* BONUS MISSILE BASE */
4544
46   state->m_screen_red = data & 0x04;
45   m_screen_red = data & 0x04;
4746
48   space->machine().sound().system_enable(data & 0x20);
47   machine().sound().system_enable(data & 0x20);
4948
50   state->m_port_1_last_extra = data;
49   m_port_1_last_extra = data;
5150
5251}
5352
54WRITE8_HANDLER( invadpt2_sh_port_2_w )
53WRITE8_MEMBER(_8080bw_state::invadpt2_sh_port_2_w)
5554{
5655   /* FLEET (movement)
5756
r14896r14897
6059       D2 = 82K
6160       D3 = 100K */
6261
63   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
64   UINT8 rising_bits = data & ~state->m_port_2_last_extra;
62   UINT8 rising_bits = data & ~m_port_2_last_extra;
6563
66   if (rising_bits & 0x01) state->m_samples->start(4, 3);      /* FLEET */
67   if (rising_bits & 0x02) state->m_samples->start(4, 4);      /* FLEET */
68   if (rising_bits & 0x04) state->m_samples->start(4, 5);      /* FLEET */
69   if (rising_bits & 0x08) state->m_samples->start(4, 6);      /* FLEET */
70   if (rising_bits & 0x10) state->m_samples->start(3, 7);      /* SAUCER HIT */
64   if (rising_bits & 0x01) m_samples->start(4, 3);      /* FLEET */
65   if (rising_bits & 0x02) m_samples->start(4, 4);      /* FLEET */
66   if (rising_bits & 0x04) m_samples->start(4, 5);      /* FLEET */
67   if (rising_bits & 0x08) m_samples->start(4, 6);      /* FLEET */
68   if (rising_bits & 0x10) m_samples->start(3, 7);      /* SAUCER HIT */
7169
72   state->m_c8080bw_flip_screen = data & 0x20;
70   m_c8080bw_flip_screen = data & 0x20;
7371
74   state->m_port_2_last_extra = data;
72   m_port_2_last_extra = data;
7573}
7674
7775
r14896r14897
8179/*                                                     */
8280/*******************************************************/
8381
84WRITE8_HANDLER( spcewars_sh_port_w )
82WRITE8_MEMBER(_8080bw_state::spcewars_sh_port_w)
8583{
86   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
87   UINT8 rising_bits = data & ~state->m_port_1_last_extra;
84   UINT8 rising_bits = data & ~m_port_1_last_extra;
8885
89   sn76477_enable_w(state->m_sn, !(data & 0x01));         /* Saucer Sound */
86   sn76477_enable_w(m_sn, !(data & 0x01));         /* Saucer Sound */
9087
91   if (rising_bits & 0x02) state->m_samples->start(0, 0);      /* Shot Sound */
92   if (rising_bits & 0x04) state->m_samples->start(1, 1);      /* Base Hit */
93   if (rising_bits & 0x08) state->m_samples->start(2, 2);      /* Invader Hit */
88   if (rising_bits & 0x02) m_samples->start(0, 0);      /* Shot Sound */
89   if (rising_bits & 0x04) m_samples->start(1, 1);      /* Base Hit */
90   if (rising_bits & 0x08) m_samples->start(2, 2);      /* Invader Hit */
9491
95   speaker_level_w(state->m_speaker, (data & 0x10) ? 1 : 0);      /* Various bitstream tunes */
92   speaker_level_w(m_speaker, (data & 0x10) ? 1 : 0);      /* Various bitstream tunes */
9693
97   state->m_port_1_last_extra = data;
94   m_port_1_last_extra = data;
9895}
9996
10097
r14896r14897
125122   lrescue_sample_names
126123};
127124
128WRITE8_HANDLER( lrescue_sh_port_1_w )
125WRITE8_MEMBER(_8080bw_state::lrescue_sh_port_1_w)
129126{
130   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
131   UINT8 rising_bits = data & ~state->m_port_1_last_extra;
127   UINT8 rising_bits = data & ~m_port_1_last_extra;
132128
133   if (rising_bits & 0x01) state->m_samples->start(0, 3);      /* Thrust */
134   if (rising_bits & 0x02) state->m_samples->start(1, 2);      /* Shot Sound */
135   if (rising_bits & 0x04) state->m_samples->start(0, 1);      /* Death */
136   if (rising_bits & 0x08) state->m_samples->start(1, 0);      /* Alien Hit */
137   if (rising_bits & 0x10) state->m_samples->start(2, 5);      /* Bonus Ship (not confirmed) */
129   if (rising_bits & 0x01) m_samples->start(0, 3);      /* Thrust */
130   if (rising_bits & 0x02) m_samples->start(1, 2);      /* Shot Sound */
131   if (rising_bits & 0x04) m_samples->start(0, 1);      /* Death */
132   if (rising_bits & 0x08) m_samples->start(1, 0);      /* Alien Hit */
133   if (rising_bits & 0x10) m_samples->start(2, 5);      /* Bonus Ship (not confirmed) */
138134
139   space->machine().sound().system_enable(data & 0x20);
135   machine().sound().system_enable(data & 0x20);
140136
141   state->m_screen_red = data & 0x04;
137   m_screen_red = data & 0x04;
142138
143   state->m_port_1_last_extra = data;
139   m_port_1_last_extra = data;
144140}
145141
146WRITE8_HANDLER( lrescue_sh_port_2_w )
142WRITE8_MEMBER(_8080bw_state::lrescue_sh_port_2_w)
147143{
148   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
149   UINT8 rising_bits = data & ~state->m_port_2_last_extra;
144   UINT8 rising_bits = data & ~m_port_2_last_extra;
150145
151   if (rising_bits & 0x01) state->m_samples->start(1, 8);      /* Footstep high tone */
152   if (rising_bits & 0x02) state->m_samples->start(1, 7);      /* Footstep low tone */
153   if (rising_bits & 0x04) state->m_samples->start(1, 4);      /* Bonus when counting men saved */
146   if (rising_bits & 0x01) m_samples->start(1, 8);      /* Footstep high tone */
147   if (rising_bits & 0x02) m_samples->start(1, 7);      /* Footstep low tone */
148   if (rising_bits & 0x04) m_samples->start(1, 4);      /* Bonus when counting men saved */
154149
155   speaker_level_w(state->m_speaker, (data & 0x08) ? 1 : 0);      /* Bitstream tunes - endlevel and bonus1 */
150   speaker_level_w(m_speaker, (data & 0x08) ? 1 : 0);      /* Bitstream tunes - endlevel and bonus1 */
156151
157   if (rising_bits & 0x10) state->m_samples->start(3, 6);      /* Shooting Star and Rescue Ship sounds */
158   if ((~data & 0x10) && (state->m_port_2_last_extra & 0x10)) state->m_samples->stop(3);   /* This makes the rescue ship sound beep on and off */
152   if (rising_bits & 0x10) m_samples->start(3, 6);      /* Shooting Star and Rescue Ship sounds */
153   if ((~data & 0x10) && (m_port_2_last_extra & 0x10)) m_samples->stop(3);   /* This makes the rescue ship sound beep on and off */
159154
160   state->m_c8080bw_flip_screen = data & 0x20;
155   m_c8080bw_flip_screen = data & 0x20;
161156
162   state->m_port_2_last_extra = data;
157   m_port_2_last_extra = data;
163158}
164159
165160
r14896r14897
169164/*                                                     */
170165/*******************************************************/
171166
172WRITE8_HANDLER( cosmo_sh_port_2_w )
167WRITE8_MEMBER(_8080bw_state::cosmo_sh_port_2_w)
173168{
174169   /* inverted flip screen bit */
175170   invadpt2_sh_port_2_w(space, offset, data ^ 0x20);
r14896r14897
183178/*                                                     */
184179/*******************************************************/
185180
186WRITE8_HANDLER( ballbomb_sh_port_1_w )
181WRITE8_MEMBER(_8080bw_state::ballbomb_sh_port_1_w)
187182{
188   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
189   UINT8 rising_bits = data & ~state->m_port_1_last_extra;
183   UINT8 rising_bits = data & ~m_port_1_last_extra;
190184
191   if (rising_bits & 0x01) state->m_samples->start(1, 2);      /* Hit a balloon */
192   if (rising_bits & 0x02) state->m_samples->start(2, 0);      /* Shot Sound */
193   if (rising_bits & 0x04) state->m_samples->start(2, 1);      /* Base Hit */
194   if (rising_bits & 0x08) state->m_samples->start(1, 7);      /* Hit a Bomb */
195   if (rising_bits & 0x10) state->m_samples->start(3, 8);      /* Bonus Base at 1500 points */
185   if (rising_bits & 0x01) m_samples->start(1, 2);      /* Hit a balloon */
186   if (rising_bits & 0x02) m_samples->start(2, 0);      /* Shot Sound */
187   if (rising_bits & 0x04) m_samples->start(2, 1);      /* Base Hit */
188   if (rising_bits & 0x08) m_samples->start(1, 7);      /* Hit a Bomb */
189   if (rising_bits & 0x10) m_samples->start(3, 8);      /* Bonus Base at 1500 points */
196190
197   space->machine().sound().system_enable(data & 0x20);
191   machine().sound().system_enable(data & 0x20);
198192
199   state->m_screen_red = data & 0x04;
193   m_screen_red = data & 0x04;
200194
201   state->m_port_1_last_extra = data;
195   m_port_1_last_extra = data;
202196}
203197
204WRITE8_HANDLER( ballbomb_sh_port_2_w )
198WRITE8_MEMBER(_8080bw_state::ballbomb_sh_port_2_w)
205199{
206   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
207   UINT8 rising_bits = data & ~state->m_port_2_last_extra;
200   UINT8 rising_bits = data & ~m_port_2_last_extra;
208201
209   if (data & 0x01) state->m_samples->start(0, 7);      /* Indicates plane will drop bombs */
210   if (data & 0x04) state->m_samples->start(0, 4);      /* Plane is dropping new balloons at start of level */
211   if (rising_bits & 0x10) state->m_samples->start(2, 2);      /* Balloon hit and bomb drops */
202   if (data & 0x01) m_samples->start(0, 7);      /* Indicates plane will drop bombs */
203   if (data & 0x04) m_samples->start(0, 4);      /* Plane is dropping new balloons at start of level */
204   if (rising_bits & 0x10) m_samples->start(2, 2);      /* Balloon hit and bomb drops */
212205
213   state->m_c8080bw_flip_screen = data & 0x20;
206   m_c8080bw_flip_screen = data & 0x20;
214207
215   state->m_port_2_last_extra = data;
208   m_port_2_last_extra = data;
216209}
217210
218211
r14896r14897
259252
260253DISCRETE_SOUND_END
261254
262WRITE8_HANDLER( indianbt_sh_port_1_w )
255WRITE8_MEMBER(_8080bw_state::indianbt_sh_port_1_w)
263256{
264257   /* bit 4 occurs every 5.25 seconds during gameplay */
265   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
266   UINT8 rising_bits = data & ~state->m_port_1_last_extra;
258   UINT8 rising_bits = data & ~m_port_1_last_extra;
267259
268   if (rising_bits & 0x01) state->m_samples->start(1, 7);      /* Death */
269   if (rising_bits & 0x02) state->m_samples->start(0, 1);      /* Shot Sound */
270   if (rising_bits & 0x04) state->m_samples->start(2, 3);      /* Move */
271   if (rising_bits & 0x08) state->m_samples->start(3, 2);      /* Hit */
260   if (rising_bits & 0x01) m_samples->start(1, 7);      /* Death */
261   if (rising_bits & 0x02) m_samples->start(0, 1);      /* Shot Sound */
262   if (rising_bits & 0x04) m_samples->start(2, 3);      /* Move */
263   if (rising_bits & 0x08) m_samples->start(3, 2);      /* Hit */
272264
273   space->machine().sound().system_enable(data & 0x20);
265   machine().sound().system_enable(data & 0x20);
274266
275   state->m_screen_red = data & 0x01;
267   m_screen_red = data & 0x01;
276268
277   state->m_port_1_last_extra = data;
269   m_port_1_last_extra = data;
278270}
279271
280WRITE8_HANDLER( indianbt_sh_port_2_w )
272WRITE8_MEMBER(_8080bw_state::indianbt_sh_port_2_w)
281273{
282   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
283   UINT8 rising_bits = data & ~state->m_port_2_last_extra;
274   UINT8 rising_bits = data & ~m_port_2_last_extra;
284275
285   if (rising_bits & 0x01) state->m_samples->start(4, 0);      /* Bird dropped an egg, Lasso used */
286   if (rising_bits & 0x02) state->m_samples->start(4, 2);      /* Egg hatches, egg shot */
287   if (rising_bits & 0x08) state->m_samples->start(5, 0);      /* Grabber, Lasso caught something */
288   if (rising_bits & 0x10) state->m_samples->start(3, 7);      /* Lasso sound */
276   if (rising_bits & 0x01) m_samples->start(4, 0);      /* Bird dropped an egg, Lasso used */
277   if (rising_bits & 0x02) m_samples->start(4, 2);      /* Egg hatches, egg shot */
278   if (rising_bits & 0x08) m_samples->start(5, 0);      /* Grabber, Lasso caught something */
279   if (rising_bits & 0x10) m_samples->start(3, 7);      /* Lasso sound */
289280
290   state->m_port_2_last_extra = data;
281   m_port_2_last_extra = data;
291282}
292283
293284WRITE8_DEVICE_HANDLER( indianbt_sh_port_3_w )
r14896r14897
787778   (1.0/ (1.0/RES_K(82) + 1.0/RES_K(39) + 1.0/RES_K(15)) + RES_K(20)) * CAP_U(1)
788779};
789780
790WRITE8_HANDLER( schaser_sh_port_1_w )
781WRITE8_MEMBER(_8080bw_state::schaser_sh_port_1_w)
791782{
792   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
793783   int effect;
794784
795785   /* bit 0 - Dot Sound Enable (SX0)
r14896r14897
800790       bit 5 - Explosion (SX5) */
801791
802792    //printf( "schaser_sh_port_1_w: %02x\n", data );
803   discrete_sound_w(state->m_discrete, SCHASER_DOT_EN, data & 0x01);
804   discrete_sound_w(state->m_discrete, SCHASER_DOT_SEL, data & 0x02);
793   discrete_sound_w(m_discrete, SCHASER_DOT_EN, data & 0x01);
794   discrete_sound_w(m_discrete, SCHASER_DOT_SEL, data & 0x02);
805795
806796   /* The effect is a variable rate 555 timer.  A diode/resistor array is used to
807797     * select the frequency.  Because of the diode voltage drop, we can not use the
r14896r14897
810800     * but the bleed time is so long, that we can just cheat and put the time on hold
811801     * when effect = 0. */
812802   effect = (data >> 2) & 0x07;
813   if (state->m_schaser_last_effect != effect)
803   if (m_schaser_last_effect != effect)
814804   {
815805      if (effect)
816806      {
817         if (state->m_schaser_effect_555_time_remain != attotime::zero)
807         if (m_schaser_effect_555_time_remain != attotime::zero)
818808         {
819809            /* timer re-enabled, use up remaining 555 high time */
820            state->m_schaser_effect_555_timer->adjust(state->m_schaser_effect_555_time_remain, effect);
810            m_schaser_effect_555_timer->adjust(m_schaser_effect_555_time_remain, effect);
821811         }
822         else if (!state->m_schaser_effect_555_is_low)
812         else if (!m_schaser_effect_555_is_low)
823813         {
824814            /* set 555 high time */
825815            attotime new_time = attotime(0, ATTOSECONDS_PER_SECOND * .8873 * schaser_effect_rc[effect]);
826            state->m_schaser_effect_555_timer->adjust(new_time, effect);
816            m_schaser_effect_555_timer->adjust(new_time, effect);
827817         }
828818      }
829819      else
830820      {
831821         /* disable effect - stops at end of low cycle */
832         if (!state->m_schaser_effect_555_is_low)
822         if (!m_schaser_effect_555_is_low)
833823         {
834            state->m_schaser_effect_555_time_remain = state->m_schaser_effect_555_timer->remaining();
835                  state->m_schaser_effect_555_time_remain_savable = state->m_schaser_effect_555_time_remain.as_double();
836            state->m_schaser_effect_555_timer->adjust(attotime::never);
824            m_schaser_effect_555_time_remain = m_schaser_effect_555_timer->remaining();
825                  m_schaser_effect_555_time_remain_savable = m_schaser_effect_555_time_remain.as_double();
826            m_schaser_effect_555_timer->adjust(attotime::never);
837827         }
838828      }
839      state->m_schaser_last_effect = effect;
829      m_schaser_last_effect = effect;
840830   }
841831
842   state->m_schaser_explosion = (data >> 5) & 0x01;
843   if (state->m_schaser_explosion)
832   m_schaser_explosion = (data >> 5) & 0x01;
833   if (m_schaser_explosion)
844834   {
845      sn76477_amplitude_res_w(state->m_sn, 1.0 / (1.0/RES_K(200) + 1.0/RES_K(68)));
835      sn76477_amplitude_res_w(m_sn, 1.0 / (1.0/RES_K(200) + 1.0/RES_K(68)));
846836   }
847837   else
848838   {
849      sn76477_amplitude_res_w(state->m_sn, RES_K(200));
839      sn76477_amplitude_res_w(m_sn, RES_K(200));
850840   }
851   sn76477_enable_w(state->m_sn, !(state->m_schaser_effect_555_is_low || state->m_schaser_explosion));
852   sn76477_one_shot_cap_voltage_w(state->m_sn, !(state->m_schaser_effect_555_is_low || state->m_schaser_explosion) ? 0 : SN76477_EXTERNAL_VOLTAGE_DISCONNECT);
853   sn76477_mixer_b_w(state->m_sn, state->m_schaser_explosion);
841   sn76477_enable_w(m_sn, !(m_schaser_effect_555_is_low || m_schaser_explosion));
842   sn76477_one_shot_cap_voltage_w(m_sn, !(m_schaser_effect_555_is_low || m_schaser_explosion) ? 0 : SN76477_EXTERNAL_VOLTAGE_DISCONNECT);
843   sn76477_mixer_b_w(m_sn, m_schaser_explosion);
854844}
855845
856WRITE8_HANDLER( schaser_sh_port_2_w )
846WRITE8_MEMBER(_8080bw_state::schaser_sh_port_2_w)
857847{
858848   /* bit 0 - Music (DAC) (SX6)
859849       bit 1 - Sound Enable (SX7)
r14896r14897
862852       bit 4 - Field Control B (SX10)
863853       bit 5 - Flip Screen */
864854
865   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
866855
867856   //printf( "schaser_sh_port_2_w: %02x\n", data );
868857
869   discrete_sound_w(state->m_discrete, SCHASER_MUSIC_BIT, data & 0x01);
858   discrete_sound_w(m_discrete, SCHASER_MUSIC_BIT, data & 0x01);
870859
871   discrete_sound_w(state->m_discrete, SCHASER_SND_EN, data & 0x02);
872   space->machine().sound().system_enable(data & 0x02);
860   discrete_sound_w(m_discrete, SCHASER_SND_EN, data & 0x02);
861   machine().sound().system_enable(data & 0x02);
873862
874   coin_lockout_global_w(space->machine(), data & 0x04);
863   coin_lockout_global_w(machine(), data & 0x04);
875864
876   state->m_schaser_background_disable = (data >> 3) & 0x01;
877   state->m_schaser_background_select = (data >> 4) & 0x01;
865   m_schaser_background_disable = (data >> 3) & 0x01;
866   m_schaser_background_select = (data >> 4) & 0x01;
878867
879   state->m_c8080bw_flip_screen = (data & 0x20) && (input_port_read(space->machine(), CABINET_PORT_TAG) & 0x01);
868   m_c8080bw_flip_screen = (data & 0x20) && (input_port_read(machine(), CABINET_PORT_TAG) & 0x01);
880869
881   state->m_port_2_last_extra = data;
870   m_port_2_last_extra = data;
882871}
883872
884873
r14896r14897
911900{
912901   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
913902   state->m_schaser_effect_555_time_remain = attotime::from_double(state->m_schaser_effect_555_time_remain_savable);
914   schaser_sh_port_2_w(space, 0, state->m_port_2_last_extra);
903   state->schaser_sh_port_2_w(*space, 0, state->m_port_2_last_extra);
915904}
916905
917906
r14896r14897
936925
937926   state->m_schaser_effect_555_is_low = 0;
938927   state->m_schaser_effect_555_timer->adjust(attotime::never);
939   schaser_sh_port_1_w(space, 0, 0);
940   schaser_sh_port_2_w(space, 0, 0);
928   state->schaser_sh_port_1_w(*space, 0, 0);
929   state->schaser_sh_port_2_w(*space, 0, 0);
941930   state->m_schaser_effect_555_time_remain = attotime::zero;
942931   state->m_schaser_effect_555_time_remain_savable = state->m_schaser_effect_555_time_remain.as_double();
943932}
r14896r14897
949938/* - Press Left or Right to choose game to play     */
950939/****************************************************/
951940
952WRITE8_HANDLER( rollingc_sh_port_w )
941WRITE8_MEMBER(_8080bw_state::rollingc_sh_port_w)
953942{
954   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
955   UINT8 rising_bits = data & ~state->m_port_3_last_extra;
943   UINT8 rising_bits = data & ~m_port_3_last_extra;
956944
957   if (rising_bits & 0x02) state->m_samples->start(4, 0);   /* Steering */
958   if (rising_bits & 0x04) state->m_samples->start(0, 1);   /* Collision */
959   if (rising_bits & 0x10) state->m_samples->start(1, 8);   /* Computer car is starting to move */
945   if (rising_bits & 0x02) m_samples->start(4, 0);   /* Steering */
946   if (rising_bits & 0x04) m_samples->start(0, 1);   /* Collision */
947   if (rising_bits & 0x10) m_samples->start(1, 8);   /* Computer car is starting to move */
960948
961   state->m_port_3_last_extra = data;
949   m_port_3_last_extra = data;
962950}
963951
964952
r14896r14897
973961/*************************************************************************************/
974962
975963
976WRITE8_HANDLER( invrvnge_sh_port_w )
964WRITE8_MEMBER(_8080bw_state::invrvnge_sh_port_w)
977965{
978   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
979966
980967   switch (data)
981968   {
982969      case 0x06:
983         state->m_samples->start(1, 0);            /* Shoot */
970         m_samples->start(1, 0);            /* Shoot */
984971         break;
985972
986973      case 0x14:
987         state->m_samples->start(2, 2);            /* Hit Alien */
974         m_samples->start(2, 2);            /* Hit Alien */
988975         break;
989976
990977      case 0x16:
991         state->m_samples->start(2, 5);            /* Hit Asteroid */
978         m_samples->start(2, 5);            /* Hit Asteroid */
992979         break;
993980
994981      case 0x1e:
995         state->m_samples->start(3, 1);            /* Death (followed by 0x0a byte), also bit 4 of port 5 */
982         m_samples->start(3, 1);            /* Death (followed by 0x0a byte), also bit 4 of port 5 */
996983         break;
997984
998985      case 0x18:                  /* Fuel Low */
999986      case 0x30:                  /* Fuel bar filling up */
1000         state->m_samples->start(4, 7);
987         m_samples->start(4, 7);
1001988         break;
1002989
1003990      case 0x02:                  /* Coin */
r14896r14897
1007994         break;
1008995
1009996      case 0x3a:                  /* Thrust, Docking, extra ship? */
1010         state->m_samples->start(0, 8);
997         m_samples->start(0, 8);
1011998         break;
1012999   }
10131000}
r14896r14897
10181005/* Correct samples not available         */
10191006/*****************************************/
10201007
1021WRITE8_HANDLER( lupin3_sh_port_1_w )
1008WRITE8_MEMBER(_8080bw_state::lupin3_sh_port_1_w)
10221009{
1023   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
1024   UINT8 rising_bits = data & ~state->m_port_1_last_extra;
1010   UINT8 rising_bits = data & ~m_port_1_last_extra;
10251011
1026   if (rising_bits & 0x01) state->m_samples->start(0, 6);      /* Walking, get money */
1012   if (rising_bits & 0x01) m_samples->start(0, 6);      /* Walking, get money */
10271013
1028   sn76477_enable_w(state->m_sn, data & 0x02 ? 0:1);         /* Helicopter */
1014   sn76477_enable_w(m_sn, data & 0x02 ? 0:1);         /* Helicopter */
10291015
1030   if (rising_bits & 0x04) state->m_samples->start(0, 7);      /* Translocate */
1031   if (rising_bits & 0x08) state->m_samples->start(0, 1);      /* Jail */
1032   if (rising_bits & 0x10) state->m_samples->start(3, 8);      /* Bonus Man */
1016   if (rising_bits & 0x04) m_samples->start(0, 7);      /* Translocate */
1017   if (rising_bits & 0x08) m_samples->start(0, 1);      /* Jail */
1018   if (rising_bits & 0x10) m_samples->start(3, 8);      /* Bonus Man */
10331019
1034   state->m_port_1_last_extra = data;
1020   m_port_1_last_extra = data;
10351021}
10361022
1037WRITE8_HANDLER( lupin3_sh_port_2_w )
1023WRITE8_MEMBER(_8080bw_state::lupin3_sh_port_2_w)
10381024{
1039   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
1040   UINT8 rising_bits = data & ~state->m_port_2_last_extra;
1025   UINT8 rising_bits = data & ~m_port_2_last_extra;
10411026
1042   if (rising_bits & 0x01) state->m_samples->start(0, 3);      /* Lands on top of building, wife kicks man */
1043   if (rising_bits & 0x02) state->m_samples->start(1, 2);      /* deposit money, start intermission, end game */
1044   if (rising_bits & 0x04) state->m_samples->start(2, 5);      /* deposit money, start intermission, Slides down rope */
1045   if (rising_bits & 0x08) state->m_samples->start(3, 0);      /* start intermission, end game */
1046   //if (rising_bits & 0x10) state->m_samples->start(3, 9);        /* Dog barking */
1027   if (rising_bits & 0x01) m_samples->start(0, 3);      /* Lands on top of building, wife kicks man */
1028   if (rising_bits & 0x02) m_samples->start(1, 2);      /* deposit money, start intermission, end game */
1029   if (rising_bits & 0x04) m_samples->start(2, 5);      /* deposit money, start intermission, Slides down rope */
1030   if (rising_bits & 0x08) m_samples->start(3, 0);      /* start intermission, end game */
1031   //if (rising_bits & 0x10) m_samples->start(3, 9);        /* Dog barking */
10471032
1048   state->m_color_map = data & 0x40;
1033   m_color_map = data & 0x40;
10491034
1050   state->m_c8080bw_flip_screen = (data & 0x20) && (input_port_read(space->machine(), "IN2") & 0x04);
1035   m_c8080bw_flip_screen = (data & 0x20) && (input_port_read(machine(), "IN2") & 0x04);
10511036
1052   state->m_port_2_last_extra = data;
1037   m_port_2_last_extra = data;
10531038}
10541039
10551040
r14896r14897
10581043/* Much more work needs to be done       */
10591044/*****************************************/
10601045
1061WRITE8_HANDLER( schasercv_sh_port_1_w )
1046WRITE8_MEMBER(_8080bw_state::schasercv_sh_port_1_w)
10621047{
10631048
10641049   /* bit 2 = 2nd speedup
10651050       bit 3 = 1st speedup
10661051       Death is a stream of ff's with some fe's thrown in */
10671052
1068   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
1069   UINT8 rising_bits = data & ~state->m_port_1_last_extra;
1053   UINT8 rising_bits = data & ~m_port_1_last_extra;
10701054
1071   if (rising_bits & 0x02) state->m_samples->start(1, 6);      /* Ran over a dot */
1072   if (rising_bits & 0x10) state->m_samples->start(0, 1);      /* Death */
1055   if (rising_bits & 0x02) m_samples->start(1, 6);      /* Ran over a dot */
1056   if (rising_bits & 0x10) m_samples->start(0, 1);      /* Death */
10731057
1074   state->m_port_1_last_extra = data;
1058   m_port_1_last_extra = data;
10751059}
10761060
1077WRITE8_HANDLER( schasercv_sh_port_2_w )
1061WRITE8_MEMBER(_8080bw_state::schasercv_sh_port_2_w)
10781062{
1079   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
10801063
1081   speaker_level_w(state->m_speaker, (data & 0x01) ? 1 : 0);      /* End-of-Level */
1064   speaker_level_w(m_speaker, (data & 0x01) ? 1 : 0);      /* End-of-Level */
10821065
1083   space->machine().sound().system_enable(data & 0x10);
1066   machine().sound().system_enable(data & 0x10);
10841067
1085   state->m_c8080bw_flip_screen = data & 0x20;
1068   m_c8080bw_flip_screen = data & 0x20;
10861069}
10871070
10881071
r14896r14897
10911074/* No information available as what the correct sounds are         */
10921075/*******************************************************************/
10931076
1094WRITE8_HANDLER( yosakdon_sh_port_1_w )
1077WRITE8_MEMBER(_8080bw_state::yosakdon_sh_port_1_w)
10951078{
1096   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
1097   UINT8 rising_bits = data & ~state->m_port_1_last_extra;
1079   UINT8 rising_bits = data & ~m_port_1_last_extra;
10981080
1099   if (rising_bits & 0x01) state->m_samples->start(0, 3);         /* Game Over */
1100   if (rising_bits & 0x02) state->m_samples->start(2, 0);         /* Bird dead */
1101   if (rising_bits & 0x04) state->m_samples->start(0, 1);         /* Rifle being fired */
1102   if (rising_bits & 0x08) state->m_samples->start(1, 2);         /* Man dead */
1103   if (rising_bits & 0x10) state->m_samples->start(5, 8);         /* Bonus Man? */
1081   if (rising_bits & 0x01) m_samples->start(0, 3);         /* Game Over */
1082   if (rising_bits & 0x02) m_samples->start(2, 0);         /* Bird dead */
1083   if (rising_bits & 0x04) m_samples->start(0, 1);         /* Rifle being fired */
1084   if (rising_bits & 0x08) m_samples->start(1, 2);         /* Man dead */
1085   if (rising_bits & 0x10) m_samples->start(5, 8);         /* Bonus Man? */
11041086
1105   space->machine().sound().system_enable(data & 0x20);
1087   machine().sound().system_enable(data & 0x20);
11061088
1107   state->m_port_1_last_extra = data;
1089   m_port_1_last_extra = data;
11081090}
11091091
1110WRITE8_HANDLER( yosakdon_sh_port_2_w )
1092WRITE8_MEMBER(_8080bw_state::yosakdon_sh_port_2_w)
11111093{
1112   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
1113   UINT8 rising_bits = data & ~state->m_port_2_last_extra;
1094   UINT8 rising_bits = data & ~m_port_2_last_extra;
11141095
1115   if (rising_bits & 0x01) state->m_samples->start(1, 6);         /* Ready? , Game Over */
1116   if (rising_bits & 0x04) state->m_samples->start(3, 7);         /* Big bird dead */
1096   if (rising_bits & 0x01) m_samples->start(1, 6);         /* Ready? , Game Over */
1097   if (rising_bits & 0x04) m_samples->start(3, 7);         /* Big bird dead */
11171098
1118   sn76477_enable_w(state->m_sn, data & 0x08 ? 0:1);            /* Big bird */
1099   sn76477_enable_w(m_sn, data & 0x08 ? 0:1);            /* Big bird */
11191100
1120   if (rising_bits & 0x10) state->m_samples->start(2, 7);         /* Game Over */
1101   if (rising_bits & 0x10) m_samples->start(2, 7);         /* Game Over */
11211102
1122   state->m_c8080bw_flip_screen = data & 0x20;
1103   m_c8080bw_flip_screen = data & 0x20;
11231104
1124   state->m_port_2_last_extra = data;
1105   m_port_2_last_extra = data;
11251106}
11261107
11271108
r14896r14897
11301111/* Proper samples are unavailable        */
11311112/*****************************************/
11321113
1133WRITE8_HANDLER( shuttlei_sh_port_1_w )
1114WRITE8_MEMBER(_8080bw_state::shuttlei_sh_port_1_w)
11341115{
11351116   /* bit 3 is high while you are alive and playing */
1136   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
1137   UINT8 rising_bits = data & ~state->m_port_1_last_extra;
1117   UINT8 rising_bits = data & ~m_port_1_last_extra;
11381118
1139   if (rising_bits & 0x01) state->m_samples->start(4, 4);         /* Fleet move */
1140   if (rising_bits & 0x02) state->m_samples->start(5, 8);         /* Extra Tank */
1119   if (rising_bits & 0x01) m_samples->start(4, 4);         /* Fleet move */
1120   if (rising_bits & 0x02) m_samples->start(5, 8);         /* Extra Tank */
11411121
1142   sn76477_enable_w(state->m_sn, data & 0x04 ? 0:1);            /* UFO */
1122   sn76477_enable_w(m_sn, data & 0x04 ? 0:1);            /* UFO */
11431123
1144   state->m_port_1_last_extra = data;
1124   m_port_1_last_extra = data;
11451125}
11461126
1147WRITE8_HANDLER( shuttlei_sh_port_2_w )
1127WRITE8_MEMBER(_8080bw_state::shuttlei_sh_port_2_w)
11481128{
1149   _8080bw_state *state = space->machine().driver_data<_8080bw_state>();
11501129
11511130   switch (data)
11521131   {
11531132      case 0x23:
1154         state->m_samples->start(2, 2);            /* Hit */
1133         m_samples->start(2, 2);            /* Hit */
11551134         break;
11561135
11571136      case 0x2b:
1158         state->m_samples->start(0, 0);            /* Shoot */
1137         m_samples->start(0, 0);            /* Shoot */
11591138         break;
11601139
11611140      case 0xa3:
1162         state->m_samples->start(3, 7);            /* Hit UFO */
1141         m_samples->start(3, 7);            /* Hit UFO */
11631142         break;
11641143
11651144      case 0xab:
1166         state->m_samples->start(1, 1);            /* Death */
1145         m_samples->start(1, 1);            /* Death */
11671146         break;
11681147   }
11691148}
src/mame/audio/cchasm.c
r14896r14897
1212#include "sound/dac.h"
1313
1414
15WRITE8_HANDLER( cchasm_reset_coin_flag_w )
15WRITE8_MEMBER(cchasm_state::cchasm_reset_coin_flag_w)
1616{
17   cchasm_state *state = space->machine().driver_data<cchasm_state>();
18   if (state->m_coin_flag)
17   if (m_coin_flag)
1918   {
20      state->m_coin_flag = 0;
21      z80ctc_trg0_w(state->m_ctc, state->m_coin_flag);
19      m_coin_flag = 0;
20      z80ctc_trg0_w(m_ctc, m_coin_flag);
2221   }
2322}
2423
r14896r14897
3231   }
3332}
3433
35READ8_HANDLER( cchasm_coin_sound_r )
34READ8_MEMBER(cchasm_state::cchasm_coin_sound_r)
3635{
37   cchasm_state *state = space->machine().driver_data<cchasm_state>();
38   UINT8 coin = (input_port_read(space->machine(), "IN3") >> 4) & 0x7;
39   return state->m_sound_flags | (state->m_coin_flag << 3) | coin;
36   UINT8 coin = (input_port_read(machine(), "IN3") >> 4) & 0x7;
37   return m_sound_flags | (m_coin_flag << 3) | coin;
4038}
4139
42READ8_HANDLER( cchasm_soundlatch2_r )
40READ8_MEMBER(cchasm_state::cchasm_soundlatch2_r)
4341{
44   cchasm_state *state = space->machine().driver_data<cchasm_state>();
45   state->m_sound_flags &= ~0x80;
46   z80ctc_trg2_w(state->m_ctc, 0);
47   return state->soundlatch2_r(*space, offset);
42   m_sound_flags &= ~0x80;
43   z80ctc_trg2_w(m_ctc, 0);
44   return soundlatch2_byte_r(*&space, offset);
4845}
4946
50WRITE8_HANDLER( cchasm_soundlatch4_w )
47WRITE8_MEMBER(cchasm_state::cchasm_soundlatch4_w)
5148{
52   cchasm_state *state = space->machine().driver_data<cchasm_state>();
53   state->m_sound_flags |= 0x40;
54   state->soundlatch4_w(*space, offset, data);
55   cputag_set_input_line(space->machine(), "maincpu", 1, HOLD_LINE);
49   m_sound_flags |= 0x40;
50   soundlatch4_byte_w(*&space, offset, data);
51   cputag_set_input_line(machine(), "maincpu", 1, HOLD_LINE);
5652}
5753
58WRITE16_HANDLER( cchasm_io_w )
54WRITE16_MEMBER(cchasm_state::cchasm_io_w)
5955{
60   cchasm_state *state = space->machine().driver_data<cchasm_state>();
6156   //static int led;
6257
6358   if (ACCESSING_BITS_8_15)
r14896r14897
6661      switch (offset & 0xf)
6762      {
6863      case 0:
69         state->soundlatch_w(*space, offset, data);
64         soundlatch_byte_w(*&space, offset, data);
7065         break;
7166      case 1:
72         state->m_sound_flags |= 0x80;
73         state->soundlatch2_w(*space, offset, data);
74         z80ctc_trg2_w(state->m_ctc, 1);
75         cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
67         m_sound_flags |= 0x80;
68         soundlatch2_byte_w(*&space, offset, data);
69         z80ctc_trg2_w(m_ctc, 1);
70         cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
7671         break;
7772      case 2:
7873         //led = data;
r14896r14897
8176   }
8277}
8378
84READ16_HANDLER( cchasm_io_r )
79READ16_MEMBER(cchasm_state::cchasm_io_r)
8580{
86   cchasm_state *state = space->machine().driver_data<cchasm_state>();
8781   switch (offset & 0xf)
8882   {
8983   case 0x0:
90      return state->soundlatch3_r(*space, offset) << 8;
84      return soundlatch3_byte_r(*&space, offset) << 8;
9185   case 0x1:
92      state->m_sound_flags &= ~0x40;
93      return state->soundlatch4_r(*space,offset) << 8;
86      m_sound_flags &= ~0x40;
87      return soundlatch4_byte_r(*&space,offset) << 8;
9488   case 0x2:
95      return (state->m_sound_flags| (input_port_read(space->machine(), "IN3") & 0x07) | 0x08) << 8;
89      return (m_sound_flags| (input_port_read(machine(), "IN3") & 0x07) | 0x08) << 8;
9690   case 0x5:
97      return input_port_read(space->machine(), "IN2") << 8;
91      return input_port_read(machine(), "IN2") << 8;
9892   case 0x8:
99      return input_port_read(space->machine(), "IN1") << 8;
93      return input_port_read(machine(), "IN1") << 8;
10094   default:
10195      return 0xff << 8;
10296   }
src/mame/audio/hyprolyb.c
r14896r14897
4646{
4747   hyprolyb_adpcm_state *state = get_safe_token(device);
4848   driver_device *drvstate = device->machine().driver_data<driver_device>();
49   drvstate->soundlatch2_w(*state->m_space, offset, data);
49   drvstate->soundlatch2_byte_w(*state->m_space, offset, data);
5050   state->m_adpcm_ready = 0x80;
5151}
5252
r14896r14897
8686   hyprolyb_adpcm_state *state = get_safe_token(device);
8787   driver_device *drvstate = device->machine().driver_data<driver_device>();
8888   state->m_adpcm_ready = 0x00;
89   return drvstate->soundlatch2_r(*state->m_space, offset);
89   return drvstate->soundlatch2_byte_r(*state->m_space, offset);
9090}
9191
9292static ADDRESS_MAP_START( hyprolyb_adpcm_map, AS_PROGRAM, 8, driver_device )
src/mame/audio/timeplt.c
r14896r14897
198198{
199199   AY8910_LEGACY_OUTPUT,
200200   AY8910_DEFAULT_LOADS,
201   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
201   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
202202   DEVCB_DEVICE_HANDLER("timeplt_audio", timeplt_portB_r),
203203   DEVCB_NULL,
204204   DEVCB_NULL
src/mame/audio/cinemat.c
r14896r14897
5151 *
5252 *************************************/
5353
54WRITE8_HANDLER( cinemat_sound_control_w )
54WRITE8_MEMBER(cinemat_state::cinemat_sound_control_w)
5555{
56   cinemat_state *state = space->machine().driver_data<cinemat_state>();
57   UINT8 oldval = state->m_sound_control;
56   UINT8 oldval = m_sound_control;
5857
5958   /* form an 8-bit value with the new bit */
60   state->m_sound_control = (state->m_sound_control & ~(1 << offset)) | ((data & 1) << offset);
59   m_sound_control = (m_sound_control & ~(1 << offset)) | ((data & 1) << offset);
6160
6261   /* if something changed, call the sound subroutine */
63   if ((state->m_sound_control != oldval) && state->m_sound_handler)
64      (*state->m_sound_handler)(space->machine(), state->m_sound_control, state->m_sound_control ^ oldval);
62   if ((m_sound_control != oldval) && m_sound_handler)
63      (*m_sound_handler)(machine(), m_sound_control, m_sound_control ^ oldval);
6564}
6665
6766
r14896r14897
15981597 *
15991598 *************************************/
16001599
1601static WRITE8_HANDLER( qb3_sound_w )
1600WRITE8_MEMBER(cinemat_state::qb3_sound_w)
16021601{
1603   UINT16 rega = cpu_get_reg(space->machine().device("maincpu"), CCPU_A);
1604   demon_sound_w(space->machine(), 0x00 | (~rega & 0x0f), 0x10);
1602   UINT16 rega = cpu_get_reg(machine().device("maincpu"), CCPU_A);
1603   demon_sound_w(machine(), 0x00 | (~rega & 0x0f), 0x10);
16051604}
16061605
16071606
16081607static MACHINE_RESET( qb3_sound )
16091608{
1609   cinemat_state *state = machine.driver_data<cinemat_state>();
16101610   MACHINE_RESET_CALL(demon_sound);
1611   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x04, 0x04, FUNC(qb3_sound_w));
1611   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x04, 0x04, write8_delegate(FUNC(cinemat_state::qb3_sound_w),state));
16121612
16131613   /* this patch prevents the sound ROM from eating itself when command $0A is sent */
16141614   /* on a cube rotate */
src/mame/audio/circus.c
r14896r14897
170170/* and also is used to enable the amplifier and trigger the   */
171171/* discrete circuitry that produces sound effects and music   */
172172
173WRITE8_HANDLER( circus_clown_z_w )
173WRITE8_MEMBER(circus_state::circus_clown_z_w)
174174{
175   circus_state *state = space->machine().driver_data<circus_state>();
176175
177   state->m_clown_z = (data & 0x0f);
178   *(space->machine().region("maincpu")->base() + 0x8000) = data; logerror("Z:%02x\n",data); //DEBUG
176   m_clown_z = (data & 0x0f);
177   *(machine().region("maincpu")->base() + 0x8000) = data; logerror("Z:%02x\n",data); //DEBUG
179178
180179   /* Bits 4-6 enable/disable trigger different events */
181   switch (state->m_game_id)
180   switch (m_game_id)
182181   {
183182      case 1:   /* circus */
184183      case 4:   /* ripcord */
185184         switch ((data & 0x70) >> 4)
186185         {
187186            case 0 : /* All Off */
188               discrete_sound_w(state->m_discrete, CIRCUS_MUSIC_BIT, 0);
187               discrete_sound_w(m_discrete, CIRCUS_MUSIC_BIT, 0);
189188               break;
190189
191190            case 1 : /* Music */
192               discrete_sound_w(state->m_discrete, CIRCUS_MUSIC_BIT, 1);
191               discrete_sound_w(m_discrete, CIRCUS_MUSIC_BIT, 1);
193192               break;
194193
195194            case 2 : /* Circus = Pop; Rip Cord = Splash */
196               state->m_samples->start(0, 0);
195               m_samples->start(0, 0);
197196               break;
198197
199198            case 3 : /* Normal Video */
200199               break;
201200
202201            case 4 : /* Circus = Miss; Rip Cord = Scream */
203               state->m_samples->start(1, 1);
202               m_samples->start(1, 1);
204203               break;
205204
206205            case 5 : /* Invert Video */
207206               break;
208207
209208            case 6 : /* Circus = Bounce; Rip Cord = Chute Open */
210               state->m_samples->start(2, 2);
209               m_samples->start(2, 2);
211210               break;
212211
213212            case 7 : /* Circus = not used; Rip Cord = Whistle */
214               if (state->m_game_id == 4)
215                  state->m_samples->start(3, 3);
213               if (m_game_id == 4)
214                  m_samples->start(3, 3);
216215               break;
217216         }
218217         break;
219218
220219      case 2:   /* robotbwl */
221         discrete_sound_w(state->m_discrete, ROBOTBWL_MUSIC_BIT, data & 0x08);   /* Footsteps */
220         discrete_sound_w(m_discrete, ROBOTBWL_MUSIC_BIT, data & 0x08);   /* Footsteps */
222221
223222         if (data & 0x40)   /* Hit */
224            state->m_samples->start(0, 0);
223            m_samples->start(0, 0);
225224
226225         if (data & 0x20)   /* Roll */
227            state->m_samples->start(1, 1);
226            m_samples->start(1, 1);
228227
229228         if (data & 0x10)   /* Ball Drop */
230            state->m_samples->start(2, 2);
229            m_samples->start(2, 2);
231230
232231         if (data & 0x02)   /* Demerit */
233            state->m_samples->start(3, 3);
232            m_samples->start(3, 3);
234233
235234         if (data & 0x01)   /* Reward */
236            state->m_samples->start(4, 4);
235            m_samples->start(4, 4);
237236
238237         // if (data & 0x04) /* Invert */
239238         break;
r14896r14897
243242         switch ((data & 0x70) >> 4)
244243         {
245244            case 0 : /* All Off */
246               discrete_sound_w(state->m_discrete, CRASH_MUSIC_BIT, 0);
245               discrete_sound_w(m_discrete, CRASH_MUSIC_BIT, 0);
247246               break;
248247
249248            case 1 : /* Music */
250               discrete_sound_w(state->m_discrete, CRASH_MUSIC_BIT, 1);
249               discrete_sound_w(m_discrete, CRASH_MUSIC_BIT, 1);
251250               break;
252251
253252            case 2 : /* Crash */
254               state->m_samples->start(0, 0);
253               m_samples->start(0, 0);
255254               break;
256255
257256            case 3 : /* Normal Video and Beep */
258               discrete_sound_w(state->m_discrete, CRASH_BEEPER_EN, 0);
257               discrete_sound_w(m_discrete, CRASH_BEEPER_EN, 0);
259258               break;
260259
261260            case 4 : /* Skid */
262261               break;
263262
264263            case 5 : /* Invert Video and Beep */
265               discrete_sound_w(state->m_discrete, CRASH_BEEPER_EN, 0);
264               discrete_sound_w(m_discrete, CRASH_BEEPER_EN, 0);
266265               break;
267266
268267            case 6 : /* Hi Motor */
r14896r14897
275274   }
276275
277276   /* Bit 7 enables amplifier (0 = on) */
278   space->machine().sound().system_mute(data & 0x80);
277   machine().sound().system_mute(data & 0x80);
279278}
src/mame/audio/astrof.c
r14896r14897
3232#define CHANNEL_FUEL     3
3333
3434
35WRITE8_HANDLER( astrof_audio_1_w )
35WRITE8_MEMBER(astrof_state::astrof_audio_1_w)
3636{
37   astrof_state *state = space->machine().driver_data<astrof_state>();
38   UINT8 rising_bits = data & ~state->m_port_1_last;
37   UINT8 rising_bits = data & ~m_port_1_last;
3938
40   if (state->m_astrof_death_playing)
41      state->m_astrof_death_playing = state->m_samples->playing(CHANNEL_EXPLOSION);
39   if (m_astrof_death_playing)
40      m_astrof_death_playing = m_samples->playing(CHANNEL_EXPLOSION);
4241
43   if (state->m_astrof_bosskill_playing)
44      state->m_astrof_bosskill_playing = state->m_samples->playing(CHANNEL_EXPLOSION);
42   if (m_astrof_bosskill_playing)
43      m_astrof_bosskill_playing = m_samples->playing(CHANNEL_EXPLOSION);
4544
4645   /* D2 - explosion */
4746   if (rising_bits & 0x04)
4847   {
4948      /* I *know* that the effect select port will be written shortly
5049           after this one, so this works */
51      state->m_astrof_start_explosion = 1;
50      m_astrof_start_explosion = 1;
5251   }
5352
5453   /* D0,D1,D3 - background noise */
55   if ((data & 0x08) && (~state->m_port_1_last & 0x08))
54   if ((data & 0x08) && (~m_port_1_last & 0x08))
5655   {
5756      int sample = SAMPLE_WAVE + (data & 3);
58      state->m_samples->start(CHANNEL_WAVE, sample, 1);
57      m_samples->start(CHANNEL_WAVE, sample, 1);
5958   }
6059
61   if ((~data & 0x08) && (state->m_port_1_last & 0x08))
62      state->m_samples->stop(CHANNEL_WAVE);
60   if ((~data & 0x08) && (m_port_1_last & 0x08))
61      m_samples->stop(CHANNEL_WAVE);
6362
6463   /* D4 - boss laser */
65   if ((rising_bits & 0x10) && !state->m_astrof_bosskill_playing)
66      state->m_samples->start(CHANNEL_BOSSFIRE, SAMPLE_BOSSFIRE, 0);
64   if ((rising_bits & 0x10) && !m_astrof_bosskill_playing)
65      m_samples->start(CHANNEL_BOSSFIRE, SAMPLE_BOSSFIRE, 0);
6766
6867   /* D5 - fire */
69   if ((rising_bits & 0x20) && !state->m_astrof_bosskill_playing)
70      state->m_samples->start(CHANNEL_FIRE, SAMPLE_FIRE, 0);
68   if ((rising_bits & 0x20) && !m_astrof_bosskill_playing)
69      m_samples->start(CHANNEL_FIRE, SAMPLE_FIRE, 0);
7170
7271   /* D6 - don't know. Probably something to do with the explosion sounds */
7372
7473   /* D7 - sound enable bit */
75   space->machine().sound().system_enable(data & 0x80);
74   machine().sound().system_enable(data & 0x80);
7675
77   state->m_port_1_last = data;
76   m_port_1_last = data;
7877}
7978
8079
81WRITE8_HANDLER( astrof_audio_2_w )
80WRITE8_MEMBER(astrof_state::astrof_audio_2_w)
8281{
83   astrof_state *state = space->machine().driver_data<astrof_state>();
84   UINT8 rising_bits = data & ~state->m_port_2_last;
82   UINT8 rising_bits = data & ~m_port_2_last;
8583
8684   /* D0-D2 - explosion select (triggered by D2 of the other port */
87   if (state->m_astrof_start_explosion)
85   if (m_astrof_start_explosion)
8886   {
8987      /* this is really a compound effect, made up of I believe 3 sound
9088           effects, but since our sample contains them all, disable playing
r14896r14897
9391      logerror("Explosion: %x\n", data);
9492      if (data & 0x04)
9593      {
96         if (!state->m_astrof_bosskill_playing)
94         if (!m_astrof_bosskill_playing)
9795         {
98            state->m_samples->start(CHANNEL_EXPLOSION, SAMPLE_BOSSKILL, 0);
99            state->m_astrof_bosskill_playing = 1;
96            m_samples->start(CHANNEL_EXPLOSION, SAMPLE_BOSSKILL, 0);
97            m_astrof_bosskill_playing = 1;
10098         }
10199      }
102100      else if (data & 0x02)
103         state->m_samples->start(CHANNEL_EXPLOSION, SAMPLE_BOSSHIT, 0);
101         m_samples->start(CHANNEL_EXPLOSION, SAMPLE_BOSSHIT, 0);
104102      else if (data & 0x01)
105         state->m_samples->start(CHANNEL_EXPLOSION, SAMPLE_EKILLED, 0);
103         m_samples->start(CHANNEL_EXPLOSION, SAMPLE_EKILLED, 0);
106104      else
107105      {
108         if (!state->m_astrof_death_playing)
106         if (!m_astrof_death_playing)
109107         {
110            state->m_samples->start(CHANNEL_EXPLOSION, SAMPLE_DEATH, 0);
111            state->m_astrof_death_playing = 1;
108            m_samples->start(CHANNEL_EXPLOSION, SAMPLE_DEATH, 0);
109            m_astrof_death_playing = 1;
112110         }
113111      }
114112
115      state->m_astrof_start_explosion = 0;
113      m_astrof_start_explosion = 0;
116114   }
117115
118116   /* D3 - low fuel warning */
119117   if (rising_bits & 0x08)
120      state->m_samples->start(CHANNEL_FUEL, SAMPLE_FUEL, 0);
118      m_samples->start(CHANNEL_FUEL, SAMPLE_FUEL, 0);
121119
122   state->m_port_2_last = data;
120   m_port_2_last = data;
123121}
124122
125123
r14896r14897
163161 *
164162 *************************************/
165163
166WRITE8_HANDLER( spfghmk2_audio_w )
164WRITE8_MEMBER(astrof_state::spfghmk2_audio_w)
167165{
168166   /* nothing yet */
169167}
r14896r14897
181179 *
182180 *************************************/
183181
184WRITE8_HANDLER( tomahawk_audio_w )
182WRITE8_MEMBER(astrof_state::tomahawk_audio_w)
185183{
186   astrof_state *state = space->machine().driver_data<astrof_state>();
187184
188185   /* D0 - sonar */
189186
r14896r14897
196193   /* D4 - UFO */
197194
198195   /* D5 - UFO under water */
199   sn76477_enable_w(state->m_sn, (~data >> 5) & 0x01);
196   sn76477_enable_w(m_sn, (~data >> 5) & 0x01);
200197
201198   /* D6 - explosion */
202199
203200   /* D7 - sound enable bit */
204   space->machine().sound().system_enable(data & 0x80);
201   machine().sound().system_enable(data & 0x80);
205202}
206203
207204
src/mame/audio/mcr.c
r14896r14897
6363static UINT8 ssio_ayvolume_lookup[16];
6464static UINT8 ssio_custom_input_mask[5];
6565static UINT8 ssio_custom_output_mask[2];
66static read8_space_func ssio_custom_input[5];
67static write8_space_func ssio_custom_output[2];
66static read8_delegate ssio_custom_input[5];
67static write8_delegate ssio_custom_output[2];
6868
6969/* Chip Squeak Deluxe-specific globals */
7070static device_t *csdeluxe_sound_cpu;
r14896r14897
291291      device_set_input_line(device, 0, (ssio_14024_count & 0x40) ? ASSERT_LINE : CLEAR_LINE);
292292}
293293
294static READ8_HANDLER( ssio_irq_clear )
294READ8_MEMBER(mcr_state::ssio_irq_clear)
295295{
296296   /* a read here asynchronously resets the 14024 count, clearing /SINT */
297297   ssio_14024_count = 0;
r14896r14897
299299   return 0xff;
300300}
301301
302static WRITE8_HANDLER( ssio_status_w )
302WRITE8_MEMBER(mcr_state::ssio_status_w)
303303{
304304   ssio_status = data;
305305}
306306
307static READ8_HANDLER( ssio_data_r )
307READ8_MEMBER(mcr_state::ssio_data_r)
308308{
309309   return ssio_data[offset];
310310}
r14896r14897
356356}
357357
358358/********* external interfaces ***********/
359WRITE8_HANDLER( ssio_data_w )
359WRITE8_MEMBER(mcr_state::ssio_data_w)
360360{
361   space->machine().scheduler().synchronize(FUNC(ssio_delayed_data_w), (offset << 8) | (data & 0xff));
361   machine().scheduler().synchronize(FUNC(ssio_delayed_data_w), (offset << 8) | (data & 0xff));
362362}
363363
364READ8_HANDLER( ssio_status_r )
364READ8_MEMBER(mcr_state::ssio_status_r)
365365{
366366   return ssio_status;
367367}
r14896r14897
386386      device_set_input_line(ssio_sound_cpu, INPUT_LINE_RESET, CLEAR_LINE);
387387}
388388
389READ8_HANDLER( ssio_input_port_r )
389READ8_MEMBER(mcr_state::ssio_input_port_r)
390390{
391391   static const char *const port[] = { "SSIO.IP0", "SSIO.IP1", "SSIO.IP2", "SSIO.IP3", "SSIO.IP4" };
392   UINT8 result = input_port_read_safe(space->machine(), port[offset], 0xff);
393   if (ssio_custom_input[offset])
392   UINT8 result = input_port_read_safe(machine(), port[offset], 0xff);
393   if (!ssio_custom_input[offset].isnull())
394394      result = (result & ~ssio_custom_input_mask[offset]) |
395               ((*ssio_custom_input[offset])(space, offset) & ssio_custom_input_mask[offset]);
395               (ssio_custom_input[offset](*&space, offset, 0xff) & ssio_custom_input_mask[offset]);
396396   return result;
397397}
398398
399WRITE8_HANDLER( ssio_output_port_w )
399WRITE8_MEMBER(mcr_state::ssio_output_port_w)
400400{
401   mcr_state *state = space->machine().driver_data<mcr_state>();
402401   int which = offset >> 2;
403402   if (which == 0)
404      state->mcr_control_port_w(*space, offset, data);
405   if (ssio_custom_output[which])
406      (*ssio_custom_output[which])(space, offset, data & ssio_custom_output_mask[which]);
403      mcr_control_port_w(*&space, offset, data);
404   if (!ssio_custom_output[which].isnull())
405      ssio_custom_output[which](*&space, offset, data & ssio_custom_output_mask[which],0xff);
407406}
408407
409void ssio_set_custom_input(int which, int mask, read8_space_func handler)
408void ssio_set_custom_input(int which, int mask, read8_delegate handler)
410409{
411410   ssio_custom_input[which] = handler;
412411   ssio_custom_input_mask[which] = mask;
413412}
414413
415void ssio_set_custom_output(int which, int mask, write8_space_func handler)
414void ssio_set_custom_output(int which, int mask, write8_delegate handler)
416415{
417416   ssio_custom_output[which/4] = handler;
418417   ssio_custom_output_mask[which/4] = mask;
r14896r14897
444443/********* memory interfaces ***********/
445444
446445/* address map verified from schematics */
447static ADDRESS_MAP_START( ssio_map, AS_PROGRAM, 8, driver_device )
446static ADDRESS_MAP_START( ssio_map, AS_PROGRAM, 8, mcr_state )
448447   ADDRESS_MAP_UNMAP_HIGH
449448   AM_RANGE(0x0000, 0x3fff) AM_ROM
450449   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x0c00) AM_RAM
451   AM_RANGE(0x9000, 0x9003) AM_MIRROR(0x0ffc) AM_READ_LEGACY(ssio_data_r)
450   AM_RANGE(0x9000, 0x9003) AM_MIRROR(0x0ffc) AM_READ(ssio_data_r)
452451   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x0ffc) AM_DEVWRITE_LEGACY("ssio.1", ay8910_address_w)
453452   AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x0ffc) AM_DEVREAD_LEGACY("ssio.1", ay8910_r)
454453   AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x0ffc) AM_DEVWRITE_LEGACY("ssio.1", ay8910_data_w)
455454   AM_RANGE(0xb000, 0xb000) AM_MIRROR(0x0ffc) AM_DEVWRITE_LEGACY("ssio.2", ay8910_address_w)
456455   AM_RANGE(0xb001, 0xb001) AM_MIRROR(0x0ffc) AM_DEVREAD_LEGACY("ssio.2", ay8910_r)
457456   AM_RANGE(0xb002, 0xb002) AM_MIRROR(0x0ffc) AM_DEVWRITE_LEGACY("ssio.2", ay8910_data_w)
458   AM_RANGE(0xc000, 0xcfff) AM_READNOP AM_WRITE_LEGACY(ssio_status_w)
457   AM_RANGE(0xc000, 0xcfff) AM_READNOP AM_WRITE(ssio_status_w)
459458   AM_RANGE(0xd000, 0xdfff) AM_WRITENOP   /* low bit controls yellow LED */
460   AM_RANGE(0xe000, 0xefff) AM_READ_LEGACY(ssio_irq_clear)
459   AM_RANGE(0xe000, 0xefff) AM_READ(ssio_irq_clear)
461460   AM_RANGE(0xf000, 0xffff) AM_READ_PORT("SSIO.DIP")   /* 6 DIP switches */
462461ADDRESS_MAP_END
463462
r14896r14897
550549
551550
552551/********* external interfaces ***********/
553WRITE8_HANDLER( csdeluxe_data_w )
552WRITE8_MEMBER(mcr_state::csdeluxe_data_w)
554553{
555   space->machine().scheduler().synchronize(FUNC(csdeluxe_delayed_data_w), data);
554   machine().scheduler().synchronize(FUNC(csdeluxe_delayed_data_w), data);
556555}
557556
558READ8_HANDLER( csdeluxe_status_r )
557READ8_MEMBER(mcr_state::csdeluxe_status_r)
559558{
560559   return csdeluxe_status;
561560}
r14896r14897
569568/********* memory interfaces ***********/
570569
571570/* address map determined by PAL; not verified */
572static ADDRESS_MAP_START( csdeluxe_map, AS_PROGRAM, 16, driver_device )
571static ADDRESS_MAP_START( csdeluxe_map, AS_PROGRAM, 16, mcr_state )
573572   ADDRESS_MAP_UNMAP_HIGH
574573   ADDRESS_MAP_GLOBAL_MASK(0x1ffff)
575574   AM_RANGE(0x000000, 0x007fff) AM_ROM
r14896r14897
669668
670669
671670/********* external interfaces ***********/
672WRITE8_HANDLER( soundsgood_data_w )
671WRITE8_MEMBER(mcr_state::soundsgood_data_w)
673672{
674   space->machine().scheduler().synchronize(FUNC(soundsgood_delayed_data_w), data);
673   machine().scheduler().synchronize(FUNC(soundsgood_delayed_data_w), data);
675674}
676675
677READ8_HANDLER( soundsgood_status_r )
676READ8_MEMBER(mcr_state::soundsgood_status_r)
678677{
679678   return soundsgood_status;
680679}
r14896r14897
689688/********* memory interfaces ***********/
690689
691690/* address map determined by PAL; not verified */
692static ADDRESS_MAP_START( soundsgood_map, AS_PROGRAM, 16, driver_device )
691static ADDRESS_MAP_START( soundsgood_map, AS_PROGRAM, 16, mcr_state )
693692   ADDRESS_MAP_UNMAP_HIGH
694693   ADDRESS_MAP_GLOBAL_MASK(0x7ffff)
695694   AM_RANGE(0x000000, 0x03ffff) AM_ROM
r14896r14897
774773
775774
776775/********* external interfaces ***********/
777WRITE8_HANDLER( turbocs_data_w )
776WRITE8_MEMBER(mcr_state::turbocs_data_w)
778777{
779   space->machine().scheduler().synchronize(FUNC(turbocs_delayed_data_w), data);
778   machine().scheduler().synchronize(FUNC(turbocs_delayed_data_w), data);
780779}
781780
782READ8_HANDLER( turbocs_status_r )
781READ8_MEMBER(mcr_state::turbocs_status_r)
783782{
784783   return turbocs_status;
785784}
r14896r14897
793792/********* memory interfaces ***********/
794793
795794/* address map verified from schematics */
796static ADDRESS_MAP_START( turbocs_map, AS_PROGRAM, 8, driver_device )
795static ADDRESS_MAP_START( turbocs_map, AS_PROGRAM, 8, mcr_state )
797796   ADDRESS_MAP_UNMAP_HIGH
798797   AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x3800) AM_RAM
799798   AM_RANGE(0x4000, 0x4003) AM_MIRROR(0x3ffc) AM_DEVREADWRITE("tcspia", pia6821_device, read_alt, write_alt)
r14896r14897
847846   logerror("Write to AY-8912 = %02X\n", data);
848847}
849848
850static WRITE8_HANDLER( squawkntalk_dac_w )
849WRITE8_MEMBER(mcr_state::squawkntalk_dac_w)
851850{
852851   logerror("Write to DAC = %02X\n", data);
853852}
r14896r14897
908907
909908
910909/********* external interfaces ***********/
911WRITE8_HANDLER( squawkntalk_data_w )
910WRITE8_MEMBER(mcr_state::squawkntalk_data_w)
912911{
913   space->machine().scheduler().synchronize(FUNC(squawkntalk_delayed_data_w), data);
912   machine().scheduler().synchronize(FUNC(squawkntalk_delayed_data_w), data);
914913}
915914
916915void squawkntalk_reset_w(running_machine &machine, int state)
r14896r14897
924923/* address map verified from schematics */
925924/* note that jumpers control the ROM sizes; if these are changed, use the alternate */
926925/* address map below */
927static ADDRESS_MAP_START( squawkntalk_map, AS_PROGRAM, 8, driver_device )
926static ADDRESS_MAP_START( squawkntalk_map, AS_PROGRAM, 8, mcr_state )
928927   ADDRESS_MAP_UNMAP_HIGH
929928   AM_RANGE(0x0000, 0x007f) AM_RAM      /* internal RAM */
930929   AM_RANGE(0x0080, 0x0083) AM_MIRROR(0x4f6c) AM_DEVREADWRITE("sntpia0", pia6821_device, read, write)
931930   AM_RANGE(0x0090, 0x0093) AM_MIRROR(0x4f6c) AM_DEVREADWRITE("sntpia1", pia6821_device, read, write)
932   AM_RANGE(0x1000, 0x1fff) AM_MIRROR(0x4000) AM_WRITE_LEGACY(squawkntalk_dac_w)
931   AM_RANGE(0x1000, 0x1fff) AM_MIRROR(0x4000) AM_WRITE(squawkntalk_dac_w)
933932   AM_RANGE(0x8000, 0xbfff) AM_MIRROR(0x4000) AM_ROM
934933ADDRESS_MAP_END
935934
936935/* alternate address map if the ROM jumpers are changed to support a smaller */
937936/* ROM size of 2k */
938937#ifdef UNUSED_FUNCTION
939ADDRESS_MAP_START( squawkntalk_alt_map, AS_PROGRAM, 8, driver_device )
938ADDRESS_MAP_START( squawkntalk_alt_map, AS_PROGRAM, 8, mcr_state )
940939   ADDRESS_MAP_UNMAP_HIGH
941940   AM_RANGE(0x0000, 0x007f) AM_RAM      /* internal RAM */
942941   AM_RANGE(0x0080, 0x0083) AM_MIRROR(0x676c) AM_DEVREADWRITE("sntpia0", pia6821_device, read, write)
943942   AM_RANGE(0x0090, 0x0093) AM_MIRROR(0x676c) AM_DEVREADWRITE("sntpia1", pia6821_device, read, write)
944   AM_RANGE(0x0800, 0x0fff) AM_MIRROR(0x6000) AM_WRITE_LEGACY(squawkntalk_dac_w)
943   AM_RANGE(0x0800, 0x0fff) AM_MIRROR(0x6000) AM_WRITE(squawkntalk_dac_w)
945944   AM_RANGE(0x8000, 0x9fff) AM_MIRROR(0x6000) AM_ROM
946945ADDRESS_MAP_END
947946#endif
src/mame/audio/gotya.c
r14896r14897
3939   {   -1, 0, 0 }      /* end of array */
4040};
4141
42WRITE8_HANDLER( gotya_soundlatch_w )
42WRITE8_MEMBER(gotya_state::gotya_soundlatch_w)
4343{
44   gotya_state *state = space->machine().driver_data<gotya_state>();
4544   int sample_number;
4645
4746   if (data == 0)
4847   {
49      state->m_samples->stop(0);
50      state->m_theme_playing = 0;
48      m_samples->stop(0);
49      m_theme_playing = 0;
5150      return;
5251   }
5352
r14896r14897
5655   {
5756      if (gotya_samples[sample_number].sound_command == data)
5857      {
59         if (gotya_samples[sample_number].looping && state->m_theme_playing)
58         if (gotya_samples[sample_number].looping && m_theme_playing)
6059         {
6160            /* don't restart main theme */
6261            return;
6362         }
6463
65         state->m_samples->start(gotya_samples[sample_number].channel, sample_number, gotya_samples[sample_number].looping);
64         m_samples->start(gotya_samples[sample_number].channel, sample_number, gotya_samples[sample_number].looping);
6665
6766         if (gotya_samples[sample_number].channel == 0)
6867         {
69            state->m_theme_playing = gotya_samples[sample_number].looping;
68            m_theme_playing = gotya_samples[sample_number].looping;
7069         }
7170         return;
7271      }
src/mame/audio/aztarac.c
r14896r14897
99#include "includes/aztarac.h"
1010
1111
12READ16_HANDLER( aztarac_sound_r )
12READ16_MEMBER(aztarac_state::aztarac_sound_r)
1313{
14   aztarac_state *state = space->machine().driver_data<aztarac_state>();
15    return state->m_sound_status & 0x01;
14    return m_sound_status & 0x01;
1615}
1716
18WRITE16_HANDLER( aztarac_sound_w )
17WRITE16_MEMBER(aztarac_state::aztarac_sound_w)
1918{
20   aztarac_state *state = space->machine().driver_data<aztarac_state>();
2119   if (ACCESSING_BITS_0_7)
2220   {
2321      data &= 0xff;
24      state->soundlatch_w(*space, offset, data);
25      state->m_sound_status ^= 0x21;
26      if (state->m_sound_status & 0x20)
27         cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
22      soundlatch_byte_w(*&space, offset, data);
23      m_sound_status ^= 0x21;
24      if (m_sound_status & 0x20)
25         cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
2826   }
2927}
3028
31READ8_HANDLER( aztarac_snd_command_r )
29READ8_MEMBER(aztarac_state::aztarac_snd_command_r)
3230{
33   aztarac_state *state = space->machine().driver_data<aztarac_state>();
34    state->m_sound_status |= 0x01;
35    state->m_sound_status &= ~0x20;
36    return state->soundlatch_r(*space,offset);
31    m_sound_status |= 0x01;
32    m_sound_status &= ~0x20;
33    return soundlatch_byte_r(*&space,offset);
3734}
3835
39READ8_HANDLER( aztarac_snd_status_r )
36READ8_MEMBER(aztarac_state::aztarac_snd_status_r)
4037{
41   aztarac_state *state = space->machine().driver_data<aztarac_state>();
42    return state->m_sound_status & ~0x01;
38    return m_sound_status & ~0x01;
4339}
4440
45WRITE8_HANDLER( aztarac_snd_status_w )
41WRITE8_MEMBER(aztarac_state::aztarac_snd_status_w)
4642{
47   aztarac_state *state = space->machine().driver_data<aztarac_state>();
48    state->m_sound_status &= ~0x10;
43    m_sound_status &= ~0x10;
4944}
5045
5146INTERRUPT_GEN( aztarac_snd_timed_irq )
src/mame/audio/mcr.h
r14896r14897
1515void mcr_sound_init(running_machine &machine, UINT8 config);
1616void mcr_sound_reset(running_machine &machine);
1717
18WRITE8_HANDLER( ssio_data_w );
19READ8_HANDLER( ssio_status_r );
20READ8_HANDLER( ssio_input_port_r );
21WRITE8_HANDLER( ssio_output_port_w );
2218void ssio_reset_w(running_machine &machine, int state);
23void ssio_set_custom_input(int which, int mask, read8_space_func handler);
24void ssio_set_custom_output(int which, int mask, write8_space_func handler);
19void ssio_set_custom_input(int which, int mask, read8_delegate handler);
20void ssio_set_custom_output(int which, int mask, write8_delegate handler);
2521
26WRITE8_HANDLER( csdeluxe_data_w );
27READ8_HANDLER( csdeluxe_status_r );
2822void csdeluxe_reset_w(running_machine &machine, int state);
2923
30WRITE8_HANDLER( turbocs_data_w );
31READ8_HANDLER( turbocs_status_r );
3224void turbocs_reset_w(running_machine &machine, int state);
3325
34WRITE8_HANDLER( soundsgood_data_w );
35READ8_HANDLER( soundsgood_status_r );
3626void soundsgood_reset_w(running_machine &machine, int state);
3727
38WRITE8_HANDLER( squawkntalk_data_w );
3928void squawkntalk_reset_w(running_machine &machine, int state);
4029
4130
r14896r14897
5443/************ SSIO input ports ***************/
5544
5645#define SSIO_INPUT_PORTS \
57   AM_RANGE(0x00, 0x04) AM_MIRROR(0x18) AM_READ_LEGACY(ssio_input_port_r) \
58   AM_RANGE(0x07, 0x07) AM_MIRROR(0x18) AM_READ_LEGACY(ssio_status_r) \
59   AM_RANGE(0x00, 0x07) AM_MIRROR(0x03) AM_WRITE_LEGACY(ssio_output_port_w) \
60   AM_RANGE(0x1c, 0x1f) AM_WRITE_LEGACY(ssio_data_w)
46   AM_RANGE(0x00, 0x04) AM_MIRROR(0x18) AM_READ(ssio_input_port_r) \
47   AM_RANGE(0x07, 0x07) AM_MIRROR(0x18) AM_READ(ssio_status_r) \
48   AM_RANGE(0x00, 0x07) AM_MIRROR(0x03) AM_WRITE(ssio_output_port_w) \
49   AM_RANGE(0x1c, 0x1f) AM_WRITE(ssio_data_w)
6150
6251
6352
src/mame/audio/irem.c
r14896r14897
6666{
6767   driver_device *drvstate = space->machine().driver_data<driver_device>();
6868   if ((data & 0x80) == 0)
69      drvstate->soundlatch_w(*space, 0, data & 0x7f);
69      drvstate->soundlatch_byte_w(*space, 0, data & 0x7f);
7070   else
7171      cputag_set_input_line(space->machine(), "iremsound", 0, ASSERT_LINE);
7272}
r14896r14897
251251{
252252   AY8910_SINGLE_OUTPUT | AY8910_DISCRETE_OUTPUT,
253253   {470, 0, 0},
254   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
254   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
255255   DEVCB_NULL,
256256   DEVCB_NULL,
257257   DEVCB_DEVICE_HANDLER("irem_audio", ay8910_0_portb_w)
src/mame/audio/dkong.c
r14896r14897
12261226 *
12271227 ****************************************************************/
12281228
1229static WRITE8_HANDLER( dkong_voice_w )
1229WRITE8_MEMBER(dkong_state::dkong_voice_w)
12301230{
12311231   /* only provided for documentation purposes
12321232     * not actually used
r14896r14897
12701270 *
12711271 ****************************************************************/
12721272
1273WRITE8_HANDLER( dkong_audio_irq_w )
1273WRITE8_MEMBER(dkong_state::dkong_audio_irq_w)
12741274{
12751275   if (data)
1276      cputag_set_input_line(space->machine(), "soundcpu", 0, ASSERT_LINE);
1276      cputag_set_input_line(machine(), "soundcpu", 0, ASSERT_LINE);
12771277   else
1278      cputag_set_input_line(space->machine(), "soundcpu", 0, CLEAR_LINE);
1278      cputag_set_input_line(machine(), "soundcpu", 0, CLEAR_LINE);
12791279}
12801280
12811281
r14896r14897
12851285 *
12861286 *************************************/
12871287
1288static ADDRESS_MAP_START( dkong_sound_map, AS_PROGRAM, 8, driver_device )
1288static ADDRESS_MAP_START( dkong_sound_map, AS_PROGRAM, 8, dkong_state )
12891289   AM_RANGE(0x0000, 0x0fff) AM_ROM
12901290ADDRESS_MAP_END
12911291
1292static ADDRESS_MAP_START( dkong_sound_io_map, AS_IO, 8, driver_device )
1292static ADDRESS_MAP_START( dkong_sound_io_map, AS_IO, 8, dkong_state )
12931293   AM_RANGE(0x00, 0xFF) AM_DEVREAD_LEGACY("ls175.3d", dkong_tune_r)
1294                   AM_WRITE_LEGACY(dkong_voice_w)
1294                   AM_WRITE(dkong_voice_w)
12951295   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_DEVREAD_LEGACY("ls175.3d", dkong_tune_r)
1296                           AM_WRITE_LEGACY(dkong_voice_w)
1296                           AM_WRITE(dkong_voice_w)
12971297   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE_LEGACY("discrete", dkong_p1_w) /* only write to dac */
12981298   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_LATCH8_READWRITE("virtual_p2")
12991299   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_LATCH8_READBIT("ls259.6h", 5)
13001300   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_LATCH8_READBIT("ls259.6h", 4)
13011301ADDRESS_MAP_END
13021302
1303static ADDRESS_MAP_START( dkongjr_sound_io_map, AS_IO, 8, driver_device )
1303static ADDRESS_MAP_START( dkongjr_sound_io_map, AS_IO, 8, dkong_state )
13041304   AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_LATCH8_READ("ls174.3d")
13051305   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE_LEGACY("discrete", dkong_p1_w) /* only write to dac */
13061306   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_LATCH8_READWRITE("virtual_p2")
r14896r14897
13081308   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_LATCH8_READBIT("ls259.6h", 4)
13091309ADDRESS_MAP_END
13101310
1311static ADDRESS_MAP_START( radarscp1_sound_io_map, AS_IO, 8, driver_device )
1311static ADDRESS_MAP_START( radarscp1_sound_io_map, AS_IO, 8, dkong_state )
13121312   AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_DEVREAD_LEGACY("ls175.3d", latch8_r)
13131313   AM_RANGE(0x00, 0xff) AM_DEVWRITE_LEGACY("discrete", dkong_p1_w) /* DAC here */
13141314   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_LATCH8_READ("virtual_p1")
r14896r14897
13181318   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_LATCH8_READBIT("ls259.6h", 4)
13191319ADDRESS_MAP_END
13201320
1321static ADDRESS_MAP_START( dkong3_sound1_map, AS_PROGRAM, 8, driver_device )
1321static ADDRESS_MAP_START( dkong3_sound1_map, AS_PROGRAM, 8, dkong_state )
13221322   AM_RANGE(0x0000, 0x01ff) AM_RAM
13231323   AM_RANGE(0x4016, 0x4016) AM_LATCH8_READ("latch1")      /* overwrite default */
13241324   AM_RANGE(0x4017, 0x4017) AM_LATCH8_READ("latch2")
r14896r14897
13271327   AM_RANGE(0xe000, 0xffff) AM_ROM
13281328ADDRESS_MAP_END
13291329
1330static ADDRESS_MAP_START( dkong3_sound2_map, AS_PROGRAM, 8, driver_device )
1330static ADDRESS_MAP_START( dkong3_sound2_map, AS_PROGRAM, 8, dkong_state )
13311331   AM_RANGE(0x0000, 0x01ff) AM_RAM
13321332   AM_RANGE(0x4016, 0x4016) AM_LATCH8_READ("latch3")      /* overwrite default */
13331333   AM_RANGE(0x4000, 0x4017) AM_DEVREAD_LEGACY("nes2", nes_psg_r)
src/mame/audio/harddriv.c
r14896r14897
5151 *
5252 *************************************/
5353
54READ16_HANDLER( hd68k_snd_data_r )
54READ16_MEMBER(harddriv_state::hd68k_snd_data_r)
5555{
56   harddriv_state *state = space->machine().driver_data<harddriv_state>();
57   state->m_soundflag = 0;
58   logerror("%06X:main read from sound=%04X\n", cpu_get_previouspc(&space->device()), state->m_sounddata);
59   return state->m_sounddata;
56   m_soundflag = 0;
57   logerror("%06X:main read from sound=%04X\n", cpu_get_previouspc(&space.device()), m_sounddata);
58   return m_sounddata;
6059}
6160
6261
63READ16_HANDLER( hd68k_snd_status_r )
62READ16_MEMBER(harddriv_state::hd68k_snd_status_r)
6463{
65   harddriv_state *state = space->machine().driver_data<harddriv_state>();
66   return (state->m_mainflag << 15) | (state->m_soundflag << 14) | 0x1fff;
64   return (m_mainflag << 15) | (m_soundflag << 14) | 0x1fff;
6765}
6866
6967
r14896r14897
7674}
7775
7876
79WRITE16_HANDLER( hd68k_snd_data_w )
77WRITE16_MEMBER(harddriv_state::hd68k_snd_data_w)
8078{
81   space->machine().scheduler().synchronize(FUNC(delayed_68k_w), data);
82   logerror("%06X:main write to sound=%04X\n", cpu_get_previouspc(&space->device()), data);
79   machine().scheduler().synchronize(FUNC(delayed_68k_w), data);
80   logerror("%06X:main write to sound=%04X\n", cpu_get_previouspc(&space.device()), data);
8381}
8482
8583
86WRITE16_HANDLER( hd68k_snd_reset_w )
84WRITE16_MEMBER(harddriv_state::hd68k_snd_reset_w)
8785{
88   harddriv_state *state = space->machine().driver_data<harddriv_state>();
89   device_set_input_line(state->m_soundcpu, INPUT_LINE_RESET, ASSERT_LINE);
90   device_set_input_line(state->m_soundcpu, INPUT_LINE_RESET, CLEAR_LINE);
91   state->m_mainflag = state->m_soundflag = 0;
92   update_68k_interrupts(space->machine());
93   logerror("%06X:Reset sound\n", cpu_get_previouspc(&space->device()));
86   device_set_input_line(m_soundcpu, INPUT_LINE_RESET, ASSERT_LINE);
87   device_set_input_line(m_soundcpu, INPUT_LINE_RESET, CLEAR_LINE);
88   m_mainflag = m_soundflag = 0;
89   update_68k_interrupts(machine());
90   logerror("%06X:Reset sound\n", cpu_get_previouspc(&space.device()));
9491}
9592
9693
r14896r14897
10198 *
10299 *************************************/
103100
104READ16_HANDLER( hdsnd68k_data_r )
101READ16_MEMBER(harddriv_state::hdsnd68k_data_r)
105102{
106   harddriv_state *state = space->machine().driver_data<harddriv_state>();
107   state->m_mainflag = 0;
108   update_68k_interrupts(space->machine());
109   logerror("%06X:sound read from main=%04X\n", cpu_get_previouspc(&space->device()), state->m_maindata);
110   return state->m_maindata;
103   m_mainflag = 0;
104   update_68k_interrupts(machine());
105   logerror("%06X:sound read from main=%04X\n", cpu_get_previouspc(&space.device()), m_maindata);
106   return m_maindata;
111107}
112108
113109
114WRITE16_HANDLER( hdsnd68k_data_w )
110WRITE16_MEMBER(harddriv_state::hdsnd68k_data_w)
115111{
116   harddriv_state *state = space->machine().driver_data<harddriv_state>();
117   COMBINE_DATA(&state->m_sounddata);
118   state->m_soundflag = 1;
119   logerror("%06X:sound write to main=%04X\n", cpu_get_previouspc(&space->device()), data);
112   COMBINE_DATA(&m_sounddata);
113   m_soundflag = 1;
114   logerror("%06X:sound write to main=%04X\n", cpu_get_previouspc(&space.device()), data);
120115}
121116
122117
r14896r14897
127122 *
128123 *************************************/
129124
130READ16_HANDLER( hdsnd68k_switches_r )
125READ16_MEMBER(harddriv_state::hdsnd68k_switches_r)
131126{
132   logerror("%06X:hdsnd68k_switches_r(%04X)\n", cpu_get_previouspc(&space->device()), offset);
127   logerror("%06X:hdsnd68k_switches_r(%04X)\n", cpu_get_previouspc(&space.device()), offset);
133128   return 0;
134129}
135130
136131
137READ16_HANDLER( hdsnd68k_320port_r )
132READ16_MEMBER(harddriv_state::hdsnd68k_320port_r)
138133{
139   logerror("%06X:hdsnd68k_320port_r(%04X)\n", cpu_get_previouspc(&space->device()), offset);
134   logerror("%06X:hdsnd68k_320port_r(%04X)\n", cpu_get_previouspc(&space.device()), offset);
140135   return 0;
141136}
142137
143138
144READ16_HANDLER( hdsnd68k_status_r )
139READ16_MEMBER(harddriv_state::hdsnd68k_status_r)
145140{
146141//FFFF 3000 R   READSTAT    Read Status
147142//            D15 = 'Main Flag'
148143//            D14 = 'Sound Flag'
149144//            D13 = Test Switch
150145//            D12 = 5220 Ready Flag (0=Ready)
151   harddriv_state *state = space->machine().driver_data<harddriv_state>();
152   logerror("%06X:hdsnd68k_status_r(%04X)\n", cpu_get_previouspc(&space->device()), offset);
153   return (state->m_mainflag << 15) | (state->m_soundflag << 14) | 0x2000 | 0;//((input_port_read(space->machine(), "IN0") & 0x0020) << 8) | 0;
146   logerror("%06X:hdsnd68k_status_r(%04X)\n", cpu_get_previouspc(&space.device()), offset);
147   return (m_mainflag << 15) | (m_soundflag << 14) | 0x2000 | 0;//((input_port_read(machine(), "IN0") & 0x0020) << 8) | 0;
154148}
155149
156150
r14896r14897
161155 *
162156 *************************************/
163157
164WRITE16_HANDLER( hdsnd68k_latches_w )
158WRITE16_MEMBER(harddriv_state::hdsnd68k_latches_w)
165159{
166   harddriv_state *state = space->machine().driver_data<harddriv_state>();
167160
168161   /* bit 3 selects the value; data is ignored */
169162   data = (offset >> 3) & 1;
r14896r14897
174167   {
175168      case 0:   /* SPWR - 5220 write strobe */
176169         /* data == 0 means high, 1 means low */
177         logerror("%06X:SPWR=%d\n", cpu_get_previouspc(&space->device()), data);
170         logerror("%06X:SPWR=%d\n", cpu_get_previouspc(&space.device()), data);
178171         break;
179172
180173      case 1:   /* SPRES - 5220 hard reset */
181174         /* data == 0 means low, 1 means high */
182         logerror("%06X:SPRES=%d\n", cpu_get_previouspc(&space->device()), data);
175         logerror("%06X:SPRES=%d\n", cpu_get_previouspc(&space.device()), data);
183176         break;
184177
185178      case 2:   /* SPRATE */
186179         /* data == 0 means 8kHz, 1 means 10kHz */
187         logerror("%06X:SPRATE=%d\n", cpu_get_previouspc(&space->device()), data);
180         logerror("%06X:SPRATE=%d\n", cpu_get_previouspc(&space.device()), data);
188181         break;
189182
190183      case 3:   /* CRAMEN */
191184         /* data == 0 means disable 68k access to COM320, 1 means enable */
192         state->m_cramen = data;
185         m_cramen = data;
193186         break;
194187
195188      case 4:   /* RES320 */
196         logerror("%06X:RES320=%d\n", cpu_get_previouspc(&space->device()), data);
197         if (state->m_sounddsp != NULL)
198            device_set_input_line(state->m_sounddsp, INPUT_LINE_HALT, data ? CLEAR_LINE : ASSERT_LINE);
189         logerror("%06X:RES320=%d\n", cpu_get_previouspc(&space.device()), data);
190         if (m_sounddsp != NULL)
191            device_set_input_line(m_sounddsp, INPUT_LINE_HALT, data ? CLEAR_LINE : ASSERT_LINE);
199192         break;
200193
201194      case 7:   /* LED */
r14896r14897
204197}
205198
206199
207WRITE16_HANDLER( hdsnd68k_speech_w )
200WRITE16_MEMBER(harddriv_state::hdsnd68k_speech_w)
208201{
209   logerror("%06X:hdsnd68k_speech_w(%04X)=%04X\n", cpu_get_previouspc(&space->device()), offset, data);
202   logerror("%06X:hdsnd68k_speech_w(%04X)=%04X\n", cpu_get_previouspc(&space.device()), offset, data);
210203}
211204
212205
213WRITE16_HANDLER( hdsnd68k_irqclr_w )
206WRITE16_MEMBER(harddriv_state::hdsnd68k_irqclr_w)
214207{
215   harddriv_state *state = space->machine().driver_data<harddriv_state>();
216   state->m_irq68k = 0;
217   update_68k_interrupts(space->machine());
208   m_irq68k = 0;
209   update_68k_interrupts(machine());
218210}
219211
220212
r14896r14897
225217 *
226218 *************************************/
227219
228READ16_HANDLER( hdsnd68k_320ram_r )
220READ16_MEMBER(harddriv_state::hdsnd68k_320ram_r)
229221{
230   harddriv_state *state = space->machine().driver_data<harddriv_state>();
231   return state->m_sounddsp_ram[offset & 0xfff];
222   return m_sounddsp_ram[offset & 0xfff];
232223}
233224
234225
235WRITE16_HANDLER( hdsnd68k_320ram_w )
226WRITE16_MEMBER(harddriv_state::hdsnd68k_320ram_w)
236227{
237   harddriv_state *state = space->machine().driver_data<harddriv_state>();
238   COMBINE_DATA(&state->m_sounddsp_ram[offset & 0xfff]);
228   COMBINE_DATA(&m_sounddsp_ram[offset & 0xfff]);
239229}
240230
241231
242READ16_HANDLER( hdsnd68k_320ports_r )
232READ16_MEMBER(harddriv_state::hdsnd68k_320ports_r)
243233{
244   harddriv_state *state = space->machine().driver_data<harddriv_state>();
245   address_space *iospace = state->m_sounddsp->memory().space(AS_IO);
234   address_space *iospace = m_sounddsp->memory().space(AS_IO);
246235   return iospace->read_word((offset & 7) << 1);
247236}
248237
249238
250WRITE16_HANDLER( hdsnd68k_320ports_w )
239WRITE16_MEMBER(harddriv_state::hdsnd68k_320ports_w)
251240{
252   harddriv_state *state = space->machine().driver_data<harddriv_state>();
253   address_space *iospace = state->m_sounddsp->memory().space(AS_IO);
241   address_space *iospace = m_sounddsp->memory().space(AS_IO);
254242   iospace->write_word((offset & 7) << 1, data);
255243}
256244
257245
258READ16_HANDLER( hdsnd68k_320com_r )
246READ16_MEMBER(harddriv_state::hdsnd68k_320com_r)
259247{
260   harddriv_state *state = space->machine().driver_data<harddriv_state>();
261248
262   if (state->m_cramen)
263      return state->m_comram[offset & 0x1ff];
249   if (m_cramen)
250      return m_comram[offset & 0x1ff];
264251
265   logerror("%06X:hdsnd68k_320com_r(%04X) -- not allowed\n", cpu_get_previouspc(&space->device()), offset);
252   logerror("%06X:hdsnd68k_320com_r(%04X) -- not allowed\n", cpu_get_previouspc(&space.device()), offset);
266253   return 0xffff;
267254}
268255
269256
270WRITE16_HANDLER( hdsnd68k_320com_w )
257WRITE16_MEMBER(harddriv_state::hdsnd68k_320com_w)
271258{
272   harddriv_state *state = space->machine().driver_data<harddriv_state>();
273259
274   if (state->m_cramen)
275      COMBINE_DATA(&state->m_comram[offset & 0x1ff]);
260   if (m_cramen)
261      COMBINE_DATA(&m_comram[offset & 0x1ff]);
276262   else
277      logerror("%06X:hdsnd68k_320com_w(%04X)=%04X -- not allowed\n", cpu_get_previouspc(&space->device()), offset, data);
263      logerror("%06X:hdsnd68k_320com_w(%04X)=%04X -- not allowed\n", cpu_get_previouspc(&space.device()), offset, data);
278264}
279265
280266
r14896r14897
285271 *
286272 *************************************/
287273
288READ16_HANDLER( hdsnddsp_get_bio )
274READ16_MEMBER(harddriv_state::hdsnddsp_get_bio)
289275{
290   harddriv_state *state = space->machine().driver_data<harddriv_state>();
291   UINT64 cycles_since_last_bio = state->m_sounddsp->total_cycles() - state->m_last_bio_cycles;
276   UINT64 cycles_since_last_bio = m_sounddsp->total_cycles() - m_last_bio_cycles;
292277   INT32 cycles_until_bio = CYCLES_PER_BIO - cycles_since_last_bio;
293278
294279   /* if we're not at the next BIO yet, advance us there */
295280   if (cycles_until_bio > 0)
296281   {
297      device_adjust_icount(&space->device(), -cycles_until_bio);
298      state->m_last_bio_cycles += CYCLES_PER_BIO;
282      device_adjust_icount(&space.device(), -cycles_until_bio);
283      m_last_bio_cycles += CYCLES_PER_BIO;
299284   }
300285   else
301      state->m_last_bio_cycles = state->m_sounddsp->total_cycles();
286      m_last_bio_cycles = m_sounddsp->total_cycles();
302287   return ASSERT_LINE;
303288}
304289
r14896r14897
320305}
321306
322307
323WRITE16_HANDLER( hdsnddsp_comport_w )
308WRITE16_MEMBER(harddriv_state::hdsnddsp_comport_w)
324309{
325310   /* COM port TD0-7 */
326   logerror("%06X:hdsnddsp_comport_w=%d\n", cpu_get_previouspc(&space->device()), data);
311   logerror("%06X:hdsnddsp_comport_w=%d\n", cpu_get_previouspc(&space.device()), data);
327312}
328313
329314
330WRITE16_HANDLER( hdsnddsp_mute_w )
315WRITE16_MEMBER(harddriv_state::hdsnddsp_mute_w)
331316{
332317   /* mute DAC audio, D0=1 */
333/*  state->m_dacmute = data & 1;     -- NOT STUFFED */
334   logerror("%06X:mute DAC=%d\n", cpu_get_previouspc(&space->device()), data);
318/*  m_dacmute = data & 1;     -- NOT STUFFED */
319   logerror("%06X:mute DAC=%d\n", cpu_get_previouspc(&space.device()), data);
335320}
336321
337322
338WRITE16_HANDLER( hdsnddsp_gen68kirq_w )
323WRITE16_MEMBER(harddriv_state::hdsnddsp_gen68kirq_w)
339324{
340325   /* generate 68k IRQ */
341   harddriv_state *state = space->machine().driver_data<harddriv_state>();
342   state->m_irq68k = 1;
343   update_68k_interrupts(space->machine());
326   m_irq68k = 1;
327   update_68k_interrupts(machine());
344328}
345329
346330
347WRITE16_HANDLER( hdsnddsp_soundaddr_w )
331WRITE16_MEMBER(harddriv_state::hdsnddsp_soundaddr_w)
348332{
349   harddriv_state *state = space->machine().driver_data<harddriv_state>();
350333   if (offset == 0)
351334   {
352335      /* select sound ROM block */
353      state->m_sound_rom_offs = (state->m_sound_rom_offs & 0xffff) | ((data & 15) << 16);
336      m_sound_rom_offs = (m_sound_rom_offs & 0xffff) | ((data & 15) << 16);
354337   }
355338   else
356339   {
357340      /* sound memory address */
358      state->m_sound_rom_offs = (state->m_sound_rom_offs & ~0xffff) | (data & 0xffff);
341      m_sound_rom_offs = (m_sound_rom_offs & ~0xffff) | (data & 0xffff);
359342   }
360343}
361344
362345
363READ16_HANDLER( hdsnddsp_rom_r )
346READ16_MEMBER(harddriv_state::hdsnddsp_rom_r)
364347{
365   harddriv_state *state = space->machine().driver_data<harddriv_state>();
366   if (state->m_sound_rom_offs < state->m_romsize)
367      return state->m_rombase[state->m_sound_rom_offs++] << 7;
368   state->m_sound_rom_offs++;
348   if (m_sound_rom_offs < m_romsize)
349      return m_rombase[m_sound_rom_offs++] << 7;
350   m_sound_rom_offs++;
369351   return 0;
370352}
371353
372354
373READ16_HANDLER( hdsnddsp_comram_r )
355READ16_MEMBER(harddriv_state::hdsnddsp_comram_r)
374356{
375   harddriv_state *state = space->machine().driver_data<harddriv_state>();
376   return state->m_comram[state->m_sound_rom_offs++ & 0x1ff];
357   return m_comram[m_sound_rom_offs++ & 0x1ff];
377358}
378359
379360
380READ16_HANDLER( hdsnddsp_compare_r )
361READ16_MEMBER(harddriv_state::hdsnddsp_compare_r)
381362{
382   logerror("%06X:hdsnddsp_compare_r(%04X)\n", cpu_get_previouspc(&space->device()), offset);
363   logerror("%06X:hdsnddsp_compare_r(%04X)\n", cpu_get_previouspc(&space.device()), offset);
383364   return 0;
384365}
src/mame/audio/m72.c
r14896r14897
154154   {
155155      m72_audio_state *state = get_safe_token(device);
156156      driver_device *drvstate = device->machine().driver_data<driver_device>();
157      drvstate->soundlatch_w(*state->space, offset, data);
157      drvstate->soundlatch_byte_w(*state->space, offset, data);
158158      device->machine().scheduler().synchronize(FUNC(setvector_callback), Z80_ASSERT, state);
159159   }
160160}
r14896r14897
163163{
164164   m72_audio_state *state = get_safe_token(device);
165165   driver_device *drvstate = device->machine().driver_data<driver_device>();
166   drvstate->soundlatch_w(*state->space, offset, data);
166   drvstate->soundlatch_byte_w(*state->space, offset, data);
167167   device->machine().scheduler().synchronize(FUNC(setvector_callback), Z80_ASSERT, state);
168168}
169169
src/mame/audio/williams.c
r14896r14897
544544   driver_device *drvstate = space->machine().driver_data<driver_device>();
545545   device_set_input_line(state->sound_cpu, M6809_IRQ_LINE, CLEAR_LINE);
546546   state->sound_int_state = 0;
547   return drvstate->soundlatch_r(*space, 0);
547   return drvstate->soundlatch_byte_r(*space, 0);
548548}
549549
550550
r14896r14897
552552{
553553   williams_audio_state *state = &audio;
554554   driver_device *drvstate = space->machine().driver_data<driver_device>();
555   drvstate->soundlatch2_w(*space, 0, data & 0xff);
555   drvstate->soundlatch2_byte_w(*space, 0, data & 0xff);
556556   device_set_input_line(state->soundalt_cpu, M6809_FIRQ_LINE, ASSERT_LINE);
557557}
558558
r14896r14897
562562   williams_audio_state *state = &audio;
563563   driver_device *drvstate = space->machine().driver_data<driver_device>();
564564   device_set_input_line(state->soundalt_cpu, M6809_FIRQ_LINE, CLEAR_LINE);
565   return drvstate->soundlatch2_r(*space, 0);
565   return drvstate->soundlatch2_byte_r(*space, 0);
566566}
567567
568568
r14896r14897
619619   device_t *sound_cpu = state->sound_cpu;
620620   address_space *space = sound_cpu->memory().space(AS_PROGRAM);
621621   driver_device *drvstate = space->machine().driver_data<driver_device>();
622   drvstate->soundlatch_w(*space, 0, data & 0xff);
622   drvstate->soundlatch_byte_w(*space, 0, data & 0xff);
623623   device_set_input_line(sound_cpu, INPUT_LINE_NMI, (data & 0x100) ? CLEAR_LINE : ASSERT_LINE);
624624   if (!(data & 0x200))
625625   {
r14896r14897
697697       self-tests to pass */
698698   space->machine().scheduler().timer_set(attotime::from_usec(10), FUNC(clear_irq_state));
699699   driver_device *drvstate = space->machine().driver_data<driver_device>();
700   return drvstate->soundlatch_r(*space, 0);
700   return drvstate->soundlatch_byte_r(*space, 0);
701701}
702702
703703
r14896r14897
720720   device_t *sound_cpu = state->sound_cpu;
721721   address_space *space = sound_cpu->memory().space(AS_PROGRAM);
722722   driver_device *drvstate = space->machine().driver_data<driver_device>();
723   drvstate->soundlatch_w(*space, 0, data & 0xff);
723   drvstate->soundlatch_byte_w(*space, 0, data & 0xff);
724724   if (!(data & 0x200))
725725   {
726726      device_set_input_line(sound_cpu, M6809_IRQ_LINE, ASSERT_LINE);
src/mame/audio/redalert.c
r14896r14897
6262 *
6363 *************************************/
6464
65WRITE8_HANDLER( redalert_audio_command_w )
65WRITE8_MEMBER(redalert_state::redalert_audio_command_w)
6666{
67   redalert_state *state = space->machine().driver_data<redalert_state>();
6867   /* the byte is connected to port A of the AY8910 */
69   state->soundlatch_w(*space, 0, data);
68   soundlatch_byte_w(*&space, 0, data);
7069
7170   /* D7 is also connected to the NMI input of the CPU -
7271       the NMI is actually toggled by a 74121 */
7372   if ((data & 0x80) == 0x00)
74      cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
73      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
7574}
7675
7776
r14896r14897
101100}
102101
103102
104static READ8_HANDLER( redalert_ay8910_latch_1_r )
103READ8_MEMBER(redalert_state::redalert_ay8910_latch_1_r)
105104{
106   redalert_state *state = space->machine().driver_data<redalert_state>();
107   return state->m_ay8910_latch_1;
105   return m_ay8910_latch_1;
108106}
109107
110108
111static WRITE8_HANDLER( redalert_ay8910_latch_2_w )
109WRITE8_MEMBER(redalert_state::redalert_ay8910_latch_2_w)
112110{
113   redalert_state *state = space->machine().driver_data<redalert_state>();
114   state->m_ay8910_latch_2 = data;
111   m_ay8910_latch_2 = data;
115112}
116113
117114
r14896r14897
119116{
120117   AY8910_LEGACY_OUTPUT,
121118   AY8910_DEFAULT_LOADS,
122   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
119   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
123120   DEVCB_NULL,      /* port A/B read */
124121   DEVCB_NULL,
125122   DEVCB_HANDLER(redalert_analog_w)   /* port A/B write */
126123};
127124
128125
129static ADDRESS_MAP_START( redalert_audio_map, AS_PROGRAM, 8, driver_device )
126static ADDRESS_MAP_START( redalert_audio_map, AS_PROGRAM, 8, redalert_state )
130127   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
131128   AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM
132129   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0ffe) AM_READNOP AM_DEVWRITE_LEGACY("aysnd", redalert_AY8910_w)
133   AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x0ffe) AM_READWRITE_LEGACY(redalert_ay8910_latch_1_r, redalert_ay8910_latch_2_w)
130   AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x0ffe) AM_READWRITE(redalert_ay8910_latch_1_r, redalert_ay8910_latch_2_w)
134131   AM_RANGE(0x2000, 0x6fff) AM_NOP
135132   AM_RANGE(0x7000, 0x77ff) AM_MIRROR(0x0800) AM_ROM
136133ADDRESS_MAP_END
r14896r14897
155152 *
156153 *************************************/
157154
158WRITE8_HANDLER( redalert_voice_command_w )
155WRITE8_MEMBER(redalert_state::redalert_voice_command_w)
159156{
160   redalert_state *state = space->machine().driver_data<redalert_state>();
161   state->soundlatch2_w(*space, 0, (data & 0x78) >> 3);
162   cputag_set_input_line(space->machine(), "voice", I8085_RST75_LINE, (~data & 0x80) ? ASSERT_LINE : CLEAR_LINE);
157   soundlatch2_byte_w(*&space, 0, (data & 0x78) >> 3);
158   cputag_set_input_line(machine(), "voice", I8085_RST75_LINE, (~data & 0x80) ? ASSERT_LINE : CLEAR_LINE);
163159}
164160
165161
r14896r14897
184180};
185181
186182
187static ADDRESS_MAP_START( redalert_voice_map, AS_PROGRAM, 8, driver_device )
183static ADDRESS_MAP_START( redalert_voice_map, AS_PROGRAM, 8, redalert_state )
188184   AM_RANGE(0x0000, 0x3fff) AM_ROM
189185   AM_RANGE(0x4000, 0x7fff) AM_NOP
190186   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x3c00) AM_RAM
191   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x3fff) AM_READ(soundlatch2_r) AM_WRITENOP
187   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x3fff) AM_READ(soundlatch2_byte_r) AM_WRITENOP
192188ADDRESS_MAP_END
193189
194190
r14896r14897
282278 *************************************/
283279
284280
285WRITE8_HANDLER( demoneye_audio_command_w )
281WRITE8_MEMBER(redalert_state::demoneye_audio_command_w)
286282{
287   redalert_state *state = space->machine().driver_data<redalert_state>();
288283   /* the byte is connected to port A of the AY8910 */
289   state->soundlatch_w(*space, 0, data);
290   cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
284   soundlatch_byte_w(*&space, 0, data);
285   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
291286}
292287
293288
r14896r14897
347342}
348343
349344
350static ADDRESS_MAP_START( demoneye_audio_map, AS_PROGRAM, 8, driver_device )
345static ADDRESS_MAP_START( demoneye_audio_map, AS_PROGRAM, 8, redalert_state )
351346   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
352347   AM_RANGE(0x0000, 0x007f) AM_RAM
353348   AM_RANGE(0x0500, 0x0503) AM_DEVREADWRITE("sndpia", pia6821_device, read, write)
r14896r14897
359354{
360355   AY8910_LEGACY_OUTPUT,
361356   AY8910_DEFAULT_LOADS,
362   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
357   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
363358   DEVCB_NULL,   /* port A/B read */
364359   DEVCB_NULL,
365360   DEVCB_NULL            /* port A/B write */
src/mame/audio/starwars.c
r14896r14897
9090}
9191
9292
93READ8_HANDLER( starwars_sin_r )
93READ8_MEMBER(starwars_state::starwars_sin_r)
9494{
95   starwars_state *state = space->machine().driver_data<starwars_state>();
96   riot6532_porta_in_set(state->m_riot, 0x00, 0x80);
97   return state->m_sound_data;
95   riot6532_porta_in_set(m_riot, 0x00, 0x80);
96   return m_sound_data;
9897}
9998
10099
101WRITE8_HANDLER( starwars_sout_w )
100WRITE8_MEMBER(starwars_state::starwars_sout_w)
102101{
103   space->machine().scheduler().synchronize(FUNC(sound_callback), data);
102   machine().scheduler().synchronize(FUNC(sound_callback), data);
104103}
105104
106105
r14896r14897
111110 *
112111 *************************************/
113112
114READ8_HANDLER( starwars_main_read_r )
113READ8_MEMBER(starwars_state::starwars_main_read_r)
115114{
116   starwars_state *state = space->machine().driver_data<starwars_state>();
117   riot6532_porta_in_set(state->m_riot, 0x00, 0x40);
118   return state->m_main_data;
115   riot6532_porta_in_set(m_riot, 0x00, 0x40);
116   return m_main_data;
119117}
120118
121119
122READ8_HANDLER( starwars_main_ready_flag_r )
120READ8_MEMBER(starwars_state::starwars_main_ready_flag_r)
123121{
124   starwars_state *state = space->machine().driver_data<starwars_state>();
125   return riot6532_porta_in_get(state->m_riot) & 0xc0;   /* only upper two flag bits mapped */
122   return riot6532_porta_in_get(m_riot) & 0xc0;   /* only upper two flag bits mapped */
126123}
127124
128125static TIMER_CALLBACK( main_callback )
r14896r14897
136133   machine.scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
137134}
138135
139WRITE8_HANDLER( starwars_main_wr_w )
136WRITE8_MEMBER(starwars_state::starwars_main_wr_w)
140137{
141   space->machine().scheduler().synchronize(FUNC(main_callback), data);
138   machine().scheduler().synchronize(FUNC(main_callback), data);
142139}
143140
144141
145WRITE8_HANDLER( starwars_soundrst_w )
142WRITE8_MEMBER(starwars_state::starwars_soundrst_w)
146143{
147   starwars_state *state = space->machine().driver_data<starwars_state>();
148   riot6532_porta_in_set(state->m_riot, 0x00, 0xc0);
144   riot6532_porta_in_set(m_riot, 0x00, 0xc0);
149145
150146   /* reset sound CPU here  */
151   cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, PULSE_LINE);
147   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_RESET, PULSE_LINE);
152148}
src/mame/audio/mario.c
r14896r14897
2222#define ACTIVELOW_PORT_BIT(P,A,D)   ((P & (~(1 << A))) | ((D ^ 1) << A))
2323#define ACTIVEHIGH_PORT_BIT(P,A,D)   ((P & (~(1 << A))) | (D << A))
2424
25#define I8035_T_R(M,N) ((state->soundlatch2_r(M,0) >> (N)) & 1)
26#define I8035_T_W_AH(M,N,D) do { state->m_portT = ACTIVEHIGH_PORT_BIT(state->m_portT,N,D); state->soundlatch2_w(M, 0, state->m_portT); } while (0)
25#define I8035_T_R(M,N) ((soundlatch2_byte_r(M,0) >> (N)) & 1)
26#define I8035_T_W_AH(M,N,D) do { m_portT = ACTIVEHIGH_PORT_BIT(m_portT,N,D); soundlatch2_byte_w(M, 0, m_portT); } while (0)
2727
28#define I8035_P1_R(M) (state->soundlatch3_r(M,0))
29#define I8035_P2_R(M) (state->soundlatch4_r(M,0))
30#define I8035_P1_W(M,D) state->soundlatch3_w(M,0,D)
28#define I8035_P1_R(M) (soundlatch3_byte_r(M,0))
29#define I8035_P2_R(M) (soundlatch4_byte_r(M,0))
30#define I8035_P1_W(M,D) soundlatch3_byte_w(M,0,D)
3131
3232#if (USE_8039)
33#define I8035_P2_W(M,D) do { state->soundlatch4_w(M,0,D); } while (0)
33#define I8035_P2_W(M,D) do { state->soundlatch4_byte_w(M,0,D); } while (0)
3434#else
35#define I8035_P2_W(M,D) do { set_ea(M, ((D) & 0x20) ? 0 : 1);  state->soundlatch4_w(M,0,D); } while (0)
35#define I8035_P2_W(M,D) do { set_ea(M, ((D) & 0x20) ? 0 : 1);  state->soundlatch4_byte_w(M,0,D); } while (0)
3636#endif
3737
3838#define I8035_P1_W_AH(M,B,D) I8035_P1_W(M,ACTIVEHIGH_PORT_BIT(I8035_P1_R(M),B,(D)))
r14896r14897
444444#endif
445445
446446    /* FIXME: convert to latch8 */
447   state->soundlatch_clear_w(*space, 0, 0);
448   state->soundlatch2_clear_w(*space, 0, 0);
449   state->soundlatch3_clear_w(*space, 0, 0);
450   state->soundlatch4_clear_w(*space, 0, 0);
451   I8035_P1_W(*space, 0x00); /* Input port */
447   state->soundlatch_clear_byte_w(*space, 0, 0);
448   state->soundlatch2_clear_byte_w(*space, 0, 0);
449   state->soundlatch3_clear_byte_w(*space, 0, 0);
450   state->soundlatch4_clear_byte_w(*space, 0, 0);
451   state->I8035_P1_W(*space, 0x00); /* Input port */
452452   I8035_P2_W(*space, 0xff); /* Port is in high impedance state after reset */
453453
454454   state->m_last = 0;
r14896r14897
460460 *
461461 ****************************************************************/
462462
463static READ8_HANDLER( mario_sh_p1_r )
463READ8_MEMBER(mario_state::mario_sh_p1_r)
464464{
465   mario_state   *state = space->machine().driver_data<mario_state>();
466   return I8035_P1_R(*space);
465   return I8035_P1_R(*&space);
467466}
468467
469static READ8_HANDLER( mario_sh_p2_r )
468READ8_MEMBER(mario_state::mario_sh_p2_r)
470469{
471   mario_state   *state = space->machine().driver_data<mario_state>();
472   return I8035_P2_R(*space) & 0xEF; /* Bit 4 connected to GND! */
470   return I8035_P2_R(*&space) & 0xEF; /* Bit 4 connected to GND! */
473471}
474472
475static READ8_HANDLER( mario_sh_t0_r )
473READ8_MEMBER(mario_state::mario_sh_t0_r)
476474{
477   mario_state   *state = space->machine().driver_data<mario_state>();
478   return I8035_T_R(*space, 0);
475   return I8035_T_R(*&space, 0);
479476}
480477
481static READ8_HANDLER( mario_sh_t1_r )
478READ8_MEMBER(mario_state::mario_sh_t1_r)
482479{
483   mario_state   *state = space->machine().driver_data<mario_state>();
484   return I8035_T_R(*space, 1);
480   return I8035_T_R(*&space, 1);
485481}
486482
487static READ8_HANDLER( mario_sh_tune_r )
483READ8_MEMBER(mario_state::mario_sh_tune_r)
488484{
489   UINT8 *SND = space->machine().region("audiocpu")->base();
490   UINT16 mask = space->machine().region("audiocpu")->bytes()-1;
491   mario_state   *state = space->machine().driver_data<mario_state>();
492   UINT8 p2 = I8035_P2_R(*space);
485   UINT8 *SND = machine().region("audiocpu")->base();
486   UINT16 mask = machine().region("audiocpu")->bytes()-1;
487   UINT8 p2 = I8035_P2_R(*&space);
493488
494489   if ((p2 >> 7) & 1)
495      return state->soundlatch_r(*space, offset);
490      return soundlatch_byte_r(*&space, offset);
496491   else
497492      return (SND[(0x1000 + (p2 & 0x0f) * 256 + offset) & mask]);
498493}
r14896r14897
502497   discrete_sound_w(device, DS_DAC, data);
503498}
504499
505static WRITE8_HANDLER( mario_sh_p1_w )
500WRITE8_MEMBER(mario_state::mario_sh_p1_w)
506501{
507   mario_state   *state = space->machine().driver_data<mario_state>();
508   I8035_P1_W(*space, data);
502   I8035_P1_W(*&space, data);
509503}
510504
511static WRITE8_HANDLER( mario_sh_p2_w )
505WRITE8_MEMBER(mario_state::mario_sh_p2_w)
512506{
513   mario_state   *state = space->machine().driver_data<mario_state>();
514   I8035_P2_W(*space, data);
507   mario_state   *state = machine().driver_data<mario_state>();
508   I8035_P2_W(*&space, data);
515509}
516510
517511/****************************************************************
r14896r14897
520514 *
521515 ****************************************************************/
522516
523WRITE8_HANDLER( masao_sh_irqtrigger_w )
517WRITE8_MEMBER(mario_state::masao_sh_irqtrigger_w)
524518{
525   mario_state   *state = space->machine().driver_data<mario_state>();
526519
527   if (state->m_last == 1 && data == 0)
520   if (m_last == 1 && data == 0)
528521   {
529522      /* setting bit 0 high then low triggers IRQ on the sound CPU */
530      cputag_set_input_line_and_vector(space->machine(), "audiocpu", 0, HOLD_LINE, 0xff);
523      cputag_set_input_line_and_vector(machine(), "audiocpu", 0, HOLD_LINE, 0xff);
531524   }
532525
533   state->m_last = data;
526   m_last = data;
534527}
535528
536WRITE8_HANDLER( mario_sh_tuneselect_w )
529WRITE8_MEMBER(mario_state::mario_sh_tuneselect_w)
537530{
538   mario_state   *state = space->machine().driver_data<mario_state>();
539   state->soundlatch_w(*space, offset, data);
531   soundlatch_byte_w(*&space, offset, data);
540532}
541533
542534/* Sound 0 and 1 are pulsed !*/
r14896r14897
554546}
555547
556548/* Misc samples */
557WRITE8_HANDLER( mario_sh3_w )
549WRITE8_MEMBER(mario_state::mario_sh3_w)
558550{
559   mario_state   *state = space->machine().driver_data<mario_state>();
560551
561552   switch (offset)
562553   {
563554      case 0: /* death */
564555         if (data)
565            cputag_set_input_line(space->machine(), "audiocpu",0,ASSERT_LINE);
556            cputag_set_input_line(machine(), "audiocpu",0,ASSERT_LINE);
566557         else
567            cputag_set_input_line(space->machine(), "audiocpu",0,CLEAR_LINE);
558            cputag_set_input_line(machine(), "audiocpu",0,CLEAR_LINE);
568559         break;
569560      case 1: /* get coin */
570         I8035_T_W_AH(*space, 0,data & 1);
561         I8035_T_W_AH(*&space, 0,data & 1);
571562         break;
572563      case 2: /* ice */
573         I8035_T_W_AH(*space, 1, data & 1);
564         I8035_T_W_AH(*&space, 1, data & 1);
574565         break;
575566      case 3: /* crab */
576         I8035_P1_W_AH(*space, 0, data & 1);
567         I8035_P1_W_AH(*&space, 0, data & 1);
577568         break;
578569      case 4: /* turtle */
579         I8035_P1_W_AH(*space, 1, data & 1);
570         I8035_P1_W_AH(*&space, 1, data & 1);
580571         break;
581572      case 5: /* fly */
582         I8035_P1_W_AH(*space, 2, data & 1);
573         I8035_P1_W_AH(*&space, 2, data & 1);
583574         break;
584575      case 6: /* coin */
585         I8035_P1_W_AH(*space, 3, data & 1);
576         I8035_P1_W_AH(*&space, 3, data & 1);
586577         break;
587578      case 7: /* skid */
588         discrete_sound_w(space->machine().device("discrete"), DS_SOUND7_INP, data & 1);
579         discrete_sound_w(machine().device("discrete"), DS_SOUND7_INP, data & 1);
589580         break;
590581   }
591582}
r14896r14897
596587 *
597588 *************************************/
598589
599static ADDRESS_MAP_START( mario_sound_map, AS_PROGRAM, 8, driver_device )
590static ADDRESS_MAP_START( mario_sound_map, AS_PROGRAM, 8, mario_state )
600591   AM_RANGE(0x0000, 0x07ff) AM_ROMBANK("bank1") AM_REGION("audiocpu", 0)
601592   AM_RANGE(0x0800, 0x0fff) AM_ROM
602593ADDRESS_MAP_END
603594
604static ADDRESS_MAP_START( mario_sound_io_map, AS_IO, 8, driver_device )
605   AM_RANGE(0x00, 0xff) AM_READ_LEGACY(mario_sh_tune_r) AM_DEVWRITE_LEGACY("discrete", mario_sh_sound_w)
606   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE_LEGACY(mario_sh_p1_r, mario_sh_p1_w)
607   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE_LEGACY(mario_sh_p2_r, mario_sh_p2_w)
608   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ_LEGACY(mario_sh_t0_r)
609   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ_LEGACY(mario_sh_t1_r)
595static ADDRESS_MAP_START( mario_sound_io_map, AS_IO, 8, mario_state )
596   AM_RANGE(0x00, 0xff) AM_READ(mario_sh_tune_r) AM_DEVWRITE_LEGACY("discrete", mario_sh_sound_w)
597   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(mario_sh_p1_r, mario_sh_p1_w)
598   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mario_sh_p2_r, mario_sh_p2_w)
599   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(mario_sh_t0_r)
600   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(mario_sh_t1_r)
610601ADDRESS_MAP_END
611602
612static ADDRESS_MAP_START( masao_sound_map, AS_PROGRAM, 8, driver_device )
603static ADDRESS_MAP_START( masao_sound_map, AS_PROGRAM, 8, mario_state )
613604   AM_RANGE(0x0000, 0x0fff) AM_ROM
614605   AM_RANGE(0x2000, 0x23ff) AM_RAM
615606   AM_RANGE(0x4000, 0x4000) AM_DEVREADWRITE_LEGACY("aysnd", ay8910_r, ay8910_data_w)
r14896r14897
626617{
627618   AY8910_LEGACY_OUTPUT,
628619   AY8910_DEFAULT_LOADS,
629   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
620   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
630621   DEVCB_NULL,
631622   DEVCB_NULL,
632623   DEVCB_NULL
src/mame/audio/mw8080bw.c
r14896r14897
162162MACHINE_CONFIG_END
163163
164164
165WRITE8_HANDLER( seawolf_audio_w )
165WRITE8_MEMBER(mw8080bw_state::seawolf_audio_w)
166166{
167   mw8080bw_state *state = space->machine().driver_data<mw8080bw_state>();
168   UINT8 rising_bits = data & ~state->m_port_1_last;
167   UINT8 rising_bits = data & ~m_port_1_last;
169168
170169   /* if (data & 0x01)  enable SHIP HIT sound */
171   if (rising_bits & 0x01) state->m_samples->start(0, 0);
170   if (rising_bits & 0x01) m_samples->start(0, 0);
172171
173172   /* if (data & 0x02)  enable TORPEDO sound */
174   if (rising_bits & 0x02) state->m_samples->start(1, 1);
173   if (rising_bits & 0x02) m_samples->start(1, 1);
175174
176175   /* if (data & 0x04)  enable DIVE sound */
177   if (rising_bits & 0x04) state->m_samples->start(2, 2);
176   if (rising_bits & 0x04) m_samples->start(2, 2);
178177
179178   /* if (data & 0x08)  enable SONAR sound */
180   if (rising_bits & 0x08) state->m_samples->start(3, 3);
179   if (rising_bits & 0x08) m_samples->start(3, 3);
181180
182181   /* if (data & 0x10)  enable MINE HIT sound */
183   if (rising_bits & 0x10) state->m_samples->start(4, 4);
182   if (rising_bits & 0x10) m_samples->start(4, 4);
184183
185   coin_counter_w(space->machine(), 0, (data >> 5) & 0x01);
184   coin_counter_w(machine(), 0, (data >> 5) & 0x01);
186185
187186   /* D6 and D7 are not connected */
188187
189   state->m_port_1_last = data;
188   m_port_1_last = data;
190189}
191190
192191
r14896r14897
226225MACHINE_CONFIG_END
227226
228227
229WRITE8_HANDLER( gunfight_audio_w )
228WRITE8_MEMBER(mw8080bw_state::gunfight_audio_w)
230229{
231   mw8080bw_state *state = space->machine().driver_data<mw8080bw_state>();
232230
233231   /* D0 and D1 are just tied to 1k resistors */
234232
235   coin_counter_w(space->machine(), 0, (data >> 2) & 0x01);
233   coin_counter_w(machine(), 0, (data >> 2) & 0x01);
236234
237235   /* the 74175 latches and inverts the top 4 bits */
238236   switch ((~data >> 4) & 0x0f)
r14896r14897
242240
243241   case 0x01:
244242      /* enable LEFT SHOOT sound (left speaker) */
245      state->m_samples1->start(0, 0);
243      m_samples1->start(0, 0);
246244      break;
247245
248246   case 0x02:
249247      /* enable RIGHT SHOOT sound (right speaker) */
250      state->m_samples2->start(0, 0);
248      m_samples2->start(0, 0);
251249      break;
252250
253251   case 0x03:
254252      /* enable LEFT HIT sound (left speaker) */
255      state->m_samples1->start(0, 1);
253      m_samples1->start(0, 1);
256254      break;
257255
258256   case 0x04:
259257      /* enable RIGHT HIT sound (right speaker) */
260      state->m_samples2->start(0, 1);
258      m_samples2->start(0, 1);
261259      break;
262260
263261   default:
264      logerror("%04x:  Unknown sh port write %02x\n", cpu_get_pc(&space->device()), data);
262      logerror("%04x:  Unknown sh port write %02x\n", cpu_get_pc(&space.device()), data);
265263      break;
266264   }
267265}
r14896r14897
369367MACHINE_CONFIG_END
370368
371369
372WRITE8_HANDLER( zzzap_audio_1_w )
370WRITE8_MEMBER(mw8080bw_state::zzzap_audio_1_w)
373371{
374372   /* set ENGINE SOUND FREQ(data & 0x0f)  the value written is
375373                                           the gas pedal position */
r14896r14897
382380}
383381
384382
385WRITE8_HANDLER( zzzap_audio_2_w )
383WRITE8_MEMBER(mw8080bw_state::zzzap_audio_2_w)
386384{
387385   /* if (data & 0x01)  enable BOOM sound */
388386
r14896r14897
394392                                            before it appears again, not sure what
395393                                            it is supposed to sound like) */
396394
397   coin_counter_w(space->machine(), 0, (data >> 5) & 0x01);
395   coin_counter_w(machine(), 0, (data >> 5) & 0x01);
398396
399397   /* D4, D6 and D7 are not connected */
400398}
r14896r14897
15821580MACHINE_CONFIG_END
15831581
15841582
1585WRITE8_HANDLER( gmissile_audio_1_w )
1583WRITE8_MEMBER(mw8080bw_state::gmissile_audio_1_w)
15861584{
15871585   /* note that the schematics shows the left and right explosions
15881586       reversed (D5=R, D7=L), but the software confirms that
15891587       ours is right */
15901588
1591   mw8080bw_state *state = space->machine().driver_data<mw8080bw_state>();
1592   UINT8 rising_bits = data & ~state->m_port_1_last;
1589   UINT8 rising_bits = data & ~m_port_1_last;
15931590
15941591   /* D0 and D1 are not connected */
15951592
1596   coin_counter_w(space->machine(), 0, (data >> 2) & 0x01);
1593   coin_counter_w(machine(), 0, (data >> 2) & 0x01);
15971594
1598   space->machine().sound().system_enable((data >> 3) & 0x01);
1595   machine().sound().system_enable((data >> 3) & 0x01);
15991596
16001597   /* if (data & 0x10)  enable RIGHT MISSILE sound (goes to right speaker) */
1601   if (rising_bits & 0x10) state->m_samples2->start(0, 0);
1598   if (rising_bits & 0x10) m_samples2->start(0, 0);
16021599
16031600   /* if (data & 0x20)  enable LEFT EXPLOSION sound (goes to left speaker) */
16041601   output_set_value("L_EXP_LIGHT", (data >> 5) & 0x01);
1605   if (rising_bits & 0x20) state->m_samples1->start(0, 1);
1602   if (rising_bits & 0x20) m_samples1->start(0, 1);
16061603
16071604   /* if (data & 0x40)  enable LEFT MISSILE sound (goes to left speaker) */
1608   if (rising_bits & 0x40) state->m_samples1->start(0, 0);
1605   if (rising_bits & 0x40) m_samples1->start(0, 0);
16091606
16101607   /* if (data & 0x80)  enable RIGHT EXPLOSION sound (goes to right speaker) */
16111608   output_set_value("R_EXP_LIGHT", (data >> 7) & 0x01);
1612   if (rising_bits & 0x80) state->m_samples2->start(0, 1);
1609   if (rising_bits & 0x80) m_samples2->start(0, 1);
16131610
1614   state->m_port_1_last = data;
1611   m_port_1_last = data;
16151612}
16161613
16171614
1618WRITE8_HANDLER( gmissile_audio_2_w )
1615WRITE8_MEMBER(mw8080bw_state::gmissile_audio_2_w)
16191616{
16201617   /* set AIRPLANE/COPTER/JET PAN(data & 0x07) */
16211618
r14896r14897
16251622}
16261623
16271624
1628WRITE8_HANDLER( gmissile_audio_3_w )
1625WRITE8_MEMBER(mw8080bw_state::gmissile_audio_3_w)
16291626{
16301627   /* if (data & 0x01)  enable AIRPLANE (bi-plane) sound (goes to AIRPLANE/COPTER/JET panning circuit) */
16311628
r14896r14897
16791676MACHINE_CONFIG_END
16801677
16811678
1682WRITE8_HANDLER( m4_audio_1_w )
1679WRITE8_MEMBER(mw8080bw_state::m4_audio_1_w)
16831680{
1684   mw8080bw_state *state = space->machine().driver_data<mw8080bw_state>();
1685   UINT8 rising_bits = data & ~state->m_port_1_last;
1681   UINT8 rising_bits = data & ~m_port_1_last;
16861682
16871683   /* D0 and D1 are not connected */
16881684
1689   coin_counter_w(space->machine(), 0, (data >> 2) & 0x01);
1685   coin_counter_w(machine(), 0, (data >> 2) & 0x01);
16901686
1691   space->machine().sound().system_enable((data >> 3) & 0x01);
1687   machine().sound().system_enable((data >> 3) & 0x01);
16921688
16931689   /* if (data & 0x10)  enable LEFT PLAYER SHOT sound (goes to left speaker) */
1694   if (rising_bits & 0x10) state->m_samples1->start(0, 0);
1690   if (rising_bits & 0x10) m_samples1->start(0, 0);
16951691
16961692   /* if (data & 0x20)  enable RIGHT PLAYER SHOT sound (goes to right speaker) */
1697   if (rising_bits & 0x20) state->m_samples2->start(0, 0);
1693   if (rising_bits & 0x20) m_samples2->start(0, 0);
16981694
16991695   /* if (data & 0x40)  enable LEFT PLAYER EXPLOSION sound via 300K res (goes to left speaker) */
1700   if (rising_bits & 0x40) state->m_samples1->start(1, 1);
1696   if (rising_bits & 0x40) m_samples1->start(1, 1);
17011697
17021698   /* if (data & 0x80)  enable RIGHT PLAYER EXPLOSION sound via 300K res (goes to right speaker) */
1703   if (rising_bits & 0x80) state->m_samples2->start(1, 1);
1699   if (rising_bits & 0x80) m_samples2->start(1, 1);
17041700
1705   state->m_port_1_last = data;
1701   m_port_1_last = data;
17061702}
17071703
17081704
1709WRITE8_HANDLER( m4_audio_2_w )
1705WRITE8_MEMBER(mw8080bw_state::m4_audio_2_w)
17101706{
1711   mw8080bw_state *state = space->machine().driver_data<mw8080bw_state>();
1712   UINT8 rising_bits = data & ~state->m_port_2_last;
1707   UINT8 rising_bits = data & ~m_port_2_last;
17131708
17141709   /* if (data & 0x01)  enable LEFT PLAYER EXPLOSION sound via 510K res (goes to left speaker) */
1715   if (rising_bits & 0x01) state->m_samples1->start(1, 1);
1710   if (rising_bits & 0x01) m_samples1->start(1, 1);
17161711
17171712   /* if (data & 0x02)  enable RIGHT PLAYER EXPLOSION sound via 510K res (goes to right speaker) */
1718   if (rising_bits & 0x02) state->m_samples2->start(1, 1);
1713   if (rising_bits & 0x02) m_samples2->start(1, 1);
17191714
17201715   /* if (data & 0x04)  enable LEFT TANK MOTOR sound (goes to left speaker) */
17211716
r14896r14897
17291724
17301725   /* D6 and D7 are not connected */
17311726
1732   state->m_port_2_last = data;
1727   m_port_2_last = data;
17331728}
17341729
17351730
r14896r14897
19401935MACHINE_CONFIG_END
19411936
19421937
1943WRITE8_HANDLER( clowns_audio_1_w )
1938WRITE8_MEMBER(mw8080bw_state::clowns_audio_1_w)
19441939{
1945   mw8080bw_state *state = space->machine().driver_data<mw8080bw_state>();
1946   coin_counter_w(space->machine(), 0, (data >> 0) & 0x01);
1940   coin_counter_w(machine(), 0, (data >> 0) & 0x01);
19471941
1948   state->m_clowns_controller_select = (data >> 1) & 0x01;
1942   m_clowns_controller_select = (data >> 1) & 0x01;
19491943
19501944   /* D2-D7 are not connected */
19511945}
r14896r14897
33383332MACHINE_CONFIG_END
33393333
33403334
3341WRITE8_HANDLER( phantom2_audio_1_w )
3335WRITE8_MEMBER(mw8080bw_state::phantom2_audio_1_w)
33423336{
3343   mw8080bw_state *state = space->machine().driver_data<mw8080bw_state>();
3344   UINT8 rising_bits = data & ~state->m_port_1_last;
3337   UINT8 rising_bits = data & ~m_port_1_last;
33453338
33463339   /* if (data & 0x01)  enable PLAYER SHOT sound */
3347   if (rising_bits & 0x01) state->m_samples->start(0, 0);
3340   if (rising_bits & 0x01) m_samples->start(0, 0);
33483341
33493342   /* if (data & 0x02)  enable ENEMY SHOT sound */
33503343
3351   space->machine().sound().system_mute(!(data & 0x20));
3352   space->machine().sound().system_enable((data >> 2) & 0x01);
3344   machine().sound().system_mute(!(data & 0x20));
3345   machine().sound().system_enable((data >> 2) & 0x01);
33533346
3354   coin_counter_w(space->machine(), 0, (data >> 3) & 0x01);
3347   coin_counter_w(machine(), 0, (data >> 3) & 0x01);
33553348
33563349   /* if (data & 0x10)  enable RADAR sound */
33573350
33583351   /* D5-D7 are not connected */
33593352
3360   state->m_port_1_last = data;
3353   m_port_1_last = data;
33613354}
33623355
33633356
3364WRITE8_HANDLER( phantom2_audio_2_w )
3357WRITE8_MEMBER(mw8080bw_state::phantom2_audio_2_w)
33653358{
3366   mw8080bw_state *state = space->machine().driver_data<mw8080bw_state>();
3367   UINT8 rising_bits = data & ~state->m_port_2_last;
3359   UINT8 rising_bits = data & ~m_port_2_last;
33683360
33693361   /* D0-D2 are not connected */
33703362
33713363   /* if (data & 0x08)  enable EXPLOSION sound */
3372   if (rising_bits & 0x08) state->m_samples->start(1, 1);
3364   if (rising_bits & 0x08) m_samples->start(1, 1);
33733365
33743366   output_set_value("EXPLAMP", (data >> 4) & 0x01);
33753367
33763368   /* set JET SOUND FREQ((data >> 5) & 0x07)  0, if no jet sound */
33773369
3378   state->m_port_2_last = data;
3370   m_port_2_last = data;
33793371}
33803372
33813373
r14896r14897
34883480}
34893481
34903482
3491WRITE8_HANDLER( bowler_audio_2_w )
3483WRITE8_MEMBER(mw8080bw_state::bowler_audio_2_w)
34923484{
34933485   /* set BALL ROLLING SOUND FREQ(data & 0x0f)
34943486       0, if no rolling, 0x08 used during ball return */
r14896r14897
35023494}
35033495
35043496
3505WRITE8_HANDLER( bowler_audio_3_w )
3497WRITE8_MEMBER(mw8080bw_state::bowler_audio_3_w)
35063498{
35073499   /* regardless of the data, enable BALL HITS PIN 1 sound
35083500       (top circuit on the schematics) */
35093501}
35103502
35113503
3512WRITE8_HANDLER( bowler_audio_4_w )
3504WRITE8_MEMBER(mw8080bw_state::bowler_audio_4_w)
35133505{
35143506   /* regardless of the data, enable BALL HITS PIN 2 sound
35153507       (bottom circuit on the schematics) */
35163508}
35173509
35183510
3519WRITE8_HANDLER( bowler_audio_5_w )
3511WRITE8_MEMBER(mw8080bw_state::bowler_audio_5_w)
35203512{
35213513   /* not sure, appears to me trigerred alongside the two
35223514       BALL HITS PIN sounds */
35233515}
35243516
35253517
3526WRITE8_HANDLER( bowler_audio_6_w )
3518WRITE8_MEMBER(mw8080bw_state::bowler_audio_6_w)
35273519{
35283520   /* D0 is not connected */
35293521
src/mame/machine/bublbobl.c
r14896r14897
3131   m_video_enable = data & 0x40;
3232
3333   /* bit 7 flips screen */
34   flip_screen_set(machine(), data & 0x80);
34   flip_screen_set(data & 0x80);
3535}
3636
3737WRITE8_MEMBER(bublbobl_state::tokio_bankswitch_w)
r14896r14897
4545WRITE8_MEMBER(bublbobl_state::tokio_videoctrl_w)
4646{
4747   /* bit 7 flips screen */
48   flip_screen_set(machine(), data & 0x80);
48   flip_screen_set(data & 0x80);
4949
5050   /* other bits unknown */
5151}
r14896r14897
9898
9999WRITE8_MEMBER(bublbobl_state::bublbobl_sound_command_w)
100100{
101   soundlatch_w(space, offset, data);
101   soundlatch_byte_w(space, offset, data);
102102   machine().scheduler().synchronize(FUNC(nmi_callback), data);
103103}
104104
src/mame/machine/midyunit.c
r14896r14897
616616            break;
617617
618618         case SOUND_YAWDIM:
619            soundlatch_w(space, 0, data);
619            soundlatch_byte_w(space, 0, data);
620620            cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
621621            break;
622622      }
src/mame/machine/pgmprot1.c
r14896r14897
299299   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
300300}
301301
302/* Fake remapping of ASIC commands to the ones used by KOVSH due to the lack of the real ARM rom for this set */
303WRITE16_HANDLER( kovshp_asic27a_write_word )
304{
305   pgm_arm_type1_state *state = space->machine().driver_data<pgm_arm_type1_state>();
306
307   switch (offset)
308   {
309      case 0:
310         state->m_pgm_arm_type1_lowlatch_68k_w = data;
311      return;
312
313      case 1:
314      {
315         unsigned char asic_key = data >> 8;
316         unsigned char asic_cmd = (data & 0xff) ^ asic_key;
317
318         switch (asic_cmd)
319         {
320            case 0x9a: asic_cmd = 0x99; break; // kovshxas
321
322                case 0x38: asic_cmd = 0xad; break;
323                case 0x43: asic_cmd = 0xca; break;
324                case 0x56: asic_cmd = 0xac; break;
325                case 0x73: asic_cmd = 0x93; break;
326                case 0x84: asic_cmd = 0xb3; break;
327                case 0x87: asic_cmd = 0xb1; break;
328                case 0x89: asic_cmd = 0xb6; break;
329                case 0x93: asic_cmd = 0x73; break;
330                case 0xa5: asic_cmd = 0xa9; break;
331                case 0xac: asic_cmd = 0x56; break;
332                case 0xad: asic_cmd = 0x38; break;
333                case 0xb1: asic_cmd = 0x87; break;
334                case 0xb3: asic_cmd = 0x84; break;
335                case 0xb4: asic_cmd = 0x90; break;
336                case 0xb6: asic_cmd = 0x89; break;
337                case 0xc5: asic_cmd = 0x8c; break;
338                case 0xca: asic_cmd = 0x43; break;
339                case 0xcc: asic_cmd = 0xf0; break;
340                case 0xd0: asic_cmd = 0xe0; break;
341                case 0xe0: asic_cmd = 0xd0; break;
342                case 0xe7: asic_cmd = 0x70; break;
343                case 0xed: asic_cmd = 0xcb; break;
344                case 0xf0: asic_cmd = 0xcc; break;
345                case 0xf1: asic_cmd = 0xf5; break;
346                case 0xf2: asic_cmd = 0xf1; break;
347                case 0xf4: asic_cmd = 0xf2; break;
348                case 0xf5: asic_cmd = 0xf4; break;
349                case 0xfc: asic_cmd = 0xc0; break;
350                case 0xfe: asic_cmd = 0xc3; break;
351
352            case 0xa6: asic_cmd = 0xa9; break;
353            case 0xaa: asic_cmd = 0x56; break;
354            case 0xf8: asic_cmd = 0xf3; break;
355         }
356
357         state->m_pgm_arm_type1_highlatch_68k_w = asic_cmd ^ (asic_key | (asic_key << 8));
358      }
359      return;
360   }
361}
362
363
302364DRIVER_INIT( kovshp )
303365{
304366   pgm_basic_init(machine);
305367   pgm_kovshp_decrypt(machine);
306368   pgm_arm7_type1_latch_init(machine);
307   /* we only have a china internal ROM dumped for now.. allow region to be changed for debugging (to ensure all alt titles / regions can be seen) */
308369   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
370   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x500000, 0x500005, FUNC(kovshp_asic27a_write_word));
309371}
310372
373
374
311375/* bootleg inits */
312376
377DRIVER_INIT( kovshxas )
378{
379   pgm_basic_init(machine);
380//   pgm_kovshp_decrypt(machine);
381   pgm_arm7_type1_latch_init(machine);
382   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
383   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x500000, 0x500005, FUNC(kovshp_asic27a_write_word));
384}
385
313386static void pgm_decode_kovlsqh2_tiles( running_machine &machine )
314387{
315388   int i, j;
r14896r14897
411484   pgm_decode_kovlsqh2_samples(machine);
412485   pgm_basic_init(machine);
413486   pgm_arm7_type1_latch_init(machine);
414   /* we only have a china internal ROM dumped for now.. allow region to be changed for debugging (to ensure all alt titles / regions can be seen) */
415487   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
488   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x500000, 0x500005, FUNC(kovshp_asic27a_write_word));
416489}
417490
418491DRIVER_INIT( kovqhsgs )
src/mame/machine/mie.c
r14896r14897
101101   maple_device::device_start();
102102   cpu = subdevice<z80_device>("mie");
103103   timer = timer_alloc(0);
104   cpu->set_irq_callback(irq_callback_1);
104   cpu->set_irq_acknowledge_callback(irq_callback_1);
105105   jvs = machine().device<mie_jvs_device>(jvs_name);
106106
107107   save_item(NAME(gpiodir));
src/mame/machine/decoprot.c
r14896r14897
111111   driver_device *state = space->machine().driver_data<driver_device>();
112112   if (offset == (0x150 / 2))
113113   {
114      state->soundlatch_w(*space, 0, data & 0xff);
114      state->soundlatch_byte_w(*space, 0, data & 0xff);
115115      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
116116      return;
117117   }
r14896r14897
231231   driver_device *state = space->machine().driver_data<driver_device>();
232232   if (offset == (0x64 / 2))
233233   {
234      state->soundlatch_w(*space, 0, data & 0xff);
234      state->soundlatch_byte_w(*space, 0, data & 0xff);
235235      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
236236   }
237237
r14896r14897
422422   driver_device *state = space->machine().driver_data<driver_device>();
423423   if (offset == (0x64 / 2))
424424   {
425      state->soundlatch_w(*space, 0, data & 0xff);
425      state->soundlatch_byte_w(*space, 0, data & 0xff);
426426      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
427427      return;
428428   }
r14896r14897
610610   driver_device *state = space->machine().driver_data<driver_device>();
611611   if (offset == (0xa8 / 2))
612612   {
613      state->soundlatch_w(*space, 0, data & 0xff);
613      state->soundlatch_byte_w(*space, 0, data & 0xff);
614614      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
615615      return;
616616   }
r14896r14897
674674
675675   if (offset == (0x10a >> 1))
676676   {
677      state->soundlatch_w(*space, 0, data & 0xff);
677      state->soundlatch_byte_w(*space, 0, data & 0xff);
678678      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
679679      return;
680680   }
r14896r14897
794794   driver_device *state = space->machine().driver_data<driver_device>();
795795   if (offset == (0xa8 / 2))
796796   {
797      state->soundlatch_w(*space, 0, data & 0xff);
797      state->soundlatch_byte_w(*space, 0, data & 0xff);
798798      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
799799      return;
800800   }
r14896r14897
12251225   const int maskport=0x6c0;
12261226   if (writeport == sndport)
12271227   {
1228      state->soundlatch_w(*space, 0, data & 0xff);
1228      state->soundlatch_byte_w(*space, 0, data & 0xff);
12291229      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
12301230      return;
12311231   }
r14896r14897
17551755   driver_device *state = space->machine().driver_data<driver_device>();
17561756   if (offset == (0x380 / 2))
17571757   {
1758      state->soundlatch_w(*space, 0, data & 0xff);
1758      state->soundlatch_byte_w(*space, 0, data & 0xff);
17591759      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
17601760      return;
17611761   }
src/mame/machine/mcr68.c
r14896r14897
66
77#include "emu.h"
88#include "audio/mcr.h"
9#include "includes/mcr.h"
910#include "includes/mcr68.h"
1011
1112#define VERBOSE 0
r14896r14897
295296{
296297   mcr68_state *drvstate = device->machine().driver_data<mcr68_state>();
297298   address_space *space = device->machine().device("maincpu")->memory().space(AS_PROGRAM);
298   csdeluxe_data_w(space, 0, (state << 4) | drvstate->m_zwackery_sound_data);
299   drvstate->csdeluxe_data_w(*space, 0, (state << 4) | drvstate->m_zwackery_sound_data);
299300}
300301
301302
src/mame/machine/decocass.c
r14896r14897
6161{
6262   decocass_state *state = space->machine().driver_data<decocass_state>();
6363   LOG(2,("CPU %s sound command -> $%02x\n", space->device().tag(), data));
64   state->soundlatch_w(*space, 0, data);
64   state->soundlatch_byte_w(*space, 0, data);
6565   state->m_sound_ack |= 0x80;
6666   /* remove snd cpu data ack bit. i don't see it in the schems, but... */
6767   state->m_sound_ack &= ~0x40;
r14896r14897
7171READ8_HANDLER( decocass_sound_data_r )
7272{
7373   decocass_state *state = space->machine().driver_data<decocass_state>();
74   UINT8 data = state->soundlatch2_r(*space, 0);
74   UINT8 data = state->soundlatch2_byte_r(*space, 0);
7575   LOG(2,("CPU %s sound data    <- $%02x\n", space->device().tag(), data));
7676   return data;
7777}
r14896r14897
8888{
8989   decocass_state *state = space->machine().driver_data<decocass_state>();
9090   LOG(2,("CPU %s sound data    -> $%02x\n", space->device().tag(), data));
91   state->soundlatch2_w(*space, 0, data);
91   state->soundlatch2_byte_w(*space, 0, data);
9292   state->m_sound_ack |= 0x40;
9393}
9494
9595READ8_HANDLER( decocass_sound_command_r )
9696{
9797   decocass_state *state = space->machine().driver_data<decocass_state>();
98   UINT8 data = state->soundlatch_r(*space, 0);
98   UINT8 data = state->soundlatch_byte_r(*space, 0);
9999   LOG(4,("CPU %s sound command <- $%02x\n", space->device().tag(), data));
100100   device_set_input_line(state->m_audiocpu, M6502_IRQ_LINE, CLEAR_LINE);
101101   state->m_sound_ack &= ~0x80;
src/mame/machine/leland.c
r14896r14897
12361236WRITE8_MEMBER(leland_state::leland_gated_paletteram_w)
12371237{
12381238   if (m_wcol_enable)
1239      paletteram_BBGGGRRR_w(space, offset, data);
1239      paletteram_BBGGGRRR_byte_w(space, offset, data);
12401240}
12411241
12421242
r14896r14897
12511251WRITE8_MEMBER(leland_state::ataxx_paletteram_and_misc_w)
12521252{
12531253   if (m_wcol_enable)
1254      paletteram_xxxxRRRRGGGGBBBB_le_w(space, offset, data);
1254      paletteram_xxxxRRRRGGGGBBBB_byte_le_w(space, offset, data);
12551255   else if (offset == 0x7f8 || offset == 0x7f9)
12561256      leland_master_video_addr_w(space, offset - 0x7f8, data);
12571257   else if (offset == 0x7fc)
src/mame/machine/ticket.c
r14896r14897
11/***************************************************************************
22
3  machine.c
3    ticket.c
44
5  Functions to emulate a prototypical ticket dispenser hardware.
5  Generic ticket dispensing device.
66
7  Right now, this is an *extremely* basic ticket dispenser.
8  TODO: Active Bit may not be Bit 7 in all applications.
9        Add a ticket dispenser interface instead of passing a bunch
10        of arguments to ticket_dispenser_init.
7****************************************************************************
8
9    Copyright Aaron Giles
10    All rights reserved.
11
12    Redistribution and use in source and binary forms, with or without
13    modification, are permitted provided that the following conditions are
14    met:
15
16        * Redistributions of source code must retain the above copyright
17          notice, this list of conditions and the following disclaimer.
18        * Redistributions in binary form must reproduce the above copyright
19          notice, this list of conditions and the following disclaimer in
20          the documentation and/or other materials provided with the
21          distribution.
22        * Neither the name 'MAME' nor the names of its contributors may be
23          used to endorse or promote products derived from this software
24          without specific prior written permission.
25
26    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
27    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
30    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36    POSSIBILITY OF SUCH DAMAGE.
37
1138***************************************************************************/
1239
1340#include "emu.h"
1441#include "machine/ticket.h"
1542
43
44//**************************************************************************
45//  DEBUGGING
46//**************************************************************************
47
1648#define DEBUG_TICKET 0
1749#define LOG(x) do { if (DEBUG_TICKET) logerror x; } while (0)
1850
1951
20typedef struct _ticket_state ticket_state;
21struct _ticket_state
52
53//**************************************************************************
54//  GLOBAL VARIABLES
55//**************************************************************************
56
57// device type definition
58const device_type TICKET_DISPENSER = &device_creator<ticket_dispenser_device>;
59
60
61
62//**************************************************************************
63//  LIVE DEVICE
64//**************************************************************************
65
66//-------------------------------------------------
67//  speaker_device - constructor
68//-------------------------------------------------
69
70ticket_dispenser_device::ticket_dispenser_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
71   : device_t(mconfig, TICKET_DISPENSER, "Ticket Dispenser", tag, owner, clock),
72     m_motor_sense(TICKET_MOTOR_ACTIVE_LOW),
73     m_status_sense(TICKET_STATUS_ACTIVE_LOW),
74     m_period(attotime::from_msec(100)),
75     m_active_bit(0x80),
76     m_motoron(0),
77     m_ticketdispensed(0),
78     m_ticketnotdispensed(0),
79     m_status(0),
80     m_power(0),
81     m_timer(NULL)
2282{
23   int m_active_bit;
24   int m_time_msec;
25   int m_motoron;
26   int m_ticketdispensed;
27   int m_ticketnotdispensed;
83}
2884
29   UINT8 m_status;
30   UINT8 m_power;
31   emu_timer *m_timer;
32};
3385
34INLINE ticket_state *get_safe_token(device_t *device)
86//-------------------------------------------------
87//  ~ticket_dispenser_device - destructor
88//-------------------------------------------------
89
90ticket_dispenser_device::~ticket_dispenser_device()
3591{
36   assert(device != NULL);
37   assert(device->type() == TICKET_DISPENSER);
38
39   return (ticket_state *)downcast<legacy_device_base *>(device)->token();
4092}
4193
4294
43static TIMER_CALLBACK( ticket_dispenser_toggle )
95//**************************************************************************
96//  CONFIGURATION HELPERS
97//**************************************************************************
98
99//-------------------------------------------------
100//  static_set_period - configure the clock period
101//  for dispensing
102//-------------------------------------------------
103
104void ticket_dispenser_device::static_set_period(device_t &device, attotime period)
44105{
45   ticket_state *state = get_safe_token((device_t *)ptr);
106   downcast<ticket_dispenser_device &>(device).m_period = period;
107}
46108
47   /* If we still have power, keep toggling ticket states. */
48   if (state->m_power)
49   {
50      state->m_status ^= state->m_active_bit;
51      LOG(("Ticket Status Changed to %02X\n", state->m_status));
52      state->m_timer->adjust(attotime::from_msec(state->m_time_msec));
53   }
54109
55   if (state->m_status == state->m_ticketdispensed)
56   {
57      set_led_status(machine, 2,1);
58      increment_dispensed_tickets(machine, 1);
110//-------------------------------------------------
111//  static_set_senses - configure the senses of
112//  the motor and status bits
113//-------------------------------------------------
59114
60      LOG(("Ticket Dispensed\n"));
61   }
62   else
63   {
64      set_led_status(machine, 2,0);
65   }
115void ticket_dispenser_device::static_set_senses(device_t &device, UINT8 motor_sense, UINT8 status_sense)
116{
117   ticket_dispenser_device &ticket = downcast<ticket_dispenser_device &>(device);
118   ticket.m_motor_sense = motor_sense;
119   ticket.m_status_sense = status_sense;
66120}
67121
68122
69READ8_DEVICE_HANDLER( ticket_dispenser_r )
123
124//**************************************************************************
125//  READ/WRITE HANDLERS
126//**************************************************************************
127
128//-------------------------------------------------
129//  read - read the status line via the active bit
130//-------------------------------------------------
131
132READ8_MEMBER( ticket_dispenser_device::read )
70133{
71   ticket_state *state = get_safe_token(device);
72   LOG(("%s: Ticket Status Read = %02X\n", device->machine().describe_context(), state->m_status));
73   return state->m_status;
134   LOG(("%s: Ticket Status Read = %02X\n", machine().describe_context(), m_status));
135   return m_status;
74136}
75137
76138
77READ_LINE_DEVICE_HANDLER( ticket_dispenser_line_r )
139//-------------------------------------------------
140//  line_r - read the status line as a proper line
141//-------------------------------------------------
142
143READ_LINE_MEMBER( ticket_dispenser_device::line_r )
78144{
79   ticket_state *state = get_safe_token(device);
80   return state->m_status ? 1 : 0;
145   return m_status ? 1 : 0;
81146}
82147
83148
84WRITE8_DEVICE_HANDLER( ticket_dispenser_w )
149//-------------------------------------------------
150//  write - write the control line via the active
151//  bit
152//-------------------------------------------------
153
154WRITE8_MEMBER( ticket_dispenser_device::write )
85155{
86   ticket_state *state = get_safe_token(device);
87
88   /* On an activate signal, start dispensing! */
89   if ((data & state->m_active_bit) == state->m_motoron)
156   // On an activate signal, start dispensing!
157   if ((data & m_active_bit) == m_motoron)
90158   {
91      if (!state->m_power)
159      if (!m_power)
92160      {
93         LOG(("%s: Ticket Power On\n", device->machine().describe_context()));
94         state->m_timer->adjust(attotime::from_msec(state->m_time_msec));
95         state->m_power = 1;
96
97         state->m_status = state->m_ticketnotdispensed;
161         LOG(("%s: Ticket Power On\n", machine().describe_context()));
162         m_timer->adjust(m_period);
163         m_power = 1;
164         m_status = m_ticketnotdispensed;
98165      }
99166   }
100167   else
101168   {
102      if (state->m_power)
169      if (m_power)
103170      {
104         LOG(("%s: Ticket Power Off\n", device->machine().describe_context()));
105         state->m_timer->adjust(attotime::never);
106         set_led_status(device->machine(), 2,0);
107         state->m_power = 0;
171         LOG(("%s: Ticket Power Off\n", machine().describe_context()));
172         m_timer->adjust(attotime::never);
173         set_led_status(machine(), 2,0);
174         m_power = 0;
108175      }
109176   }
110177}
111178
112179
113180
114/***************************************************************************
115    DEVICE INTERFACE
116***************************************************************************/
181//**************************************************************************
182//  DEVICE INTERFACE
183//**************************************************************************
117184
118/*-------------------------------------------------
119    device start callback
120-------------------------------------------------*/
185//-------------------------------------------------
186//  device_start - handle device startup
187//-------------------------------------------------
121188
122static DEVICE_START( ticket )
189void ticket_dispenser_device::device_start()
123190{
124   const ticket_config *config = (const ticket_config *)downcast<const legacy_device_base *>(device)->inline_config();
125   ticket_state *state = get_safe_token(device);
191   m_active_bit = 0x80;
192   m_motoron = (m_motor_sense == TICKET_MOTOR_ACTIVE_HIGH) ? m_active_bit : 0;
193   m_ticketdispensed = (m_status_sense == TICKET_STATUS_ACTIVE_HIGH) ? m_active_bit : 0;
194   m_ticketnotdispensed = m_ticketdispensed ^ m_active_bit;
126195
127   assert(config != NULL);
196   m_timer = timer_alloc();
128197
129   /* initialize the state */
130   state->m_active_bit         = 0x80;
131   state->m_time_msec         = device->clock();
132   state->m_motoron            = config->motorhigh  ? state->m_active_bit : 0;
133   state->m_ticketdispensed      = config->statushigh ? state->m_active_bit : 0;
134   state->m_ticketnotdispensed   = state->m_ticketdispensed ^ state->m_active_bit;
135
136   state->m_timer            = device->machine().scheduler().timer_alloc(FUNC(ticket_dispenser_toggle), (void *)device);
137
138   device->save_item(NAME(state->m_status));
139   device->save_item(NAME(state->m_power));
198   save_item(NAME(m_status));
199   save_item(NAME(m_power));
140200}
141201
142202
143/*-------------------------------------------------
144    device reset callback
145-------------------------------------------------*/
203//-------------------------------------------------
204//  device_reset - handle device startup
205//-------------------------------------------------
146206
147static DEVICE_RESET( ticket )
207void ticket_dispenser_device::device_reset()
148208{
149   ticket_state *state = get_safe_token(device);
150   state->m_status            = state->m_ticketnotdispensed;
151   state->m_power            = 0x00;
209   m_status = m_ticketnotdispensed;
210   m_power = 0x00;
152211}
153212
154213
155/*-------------------------------------------------
156    device definition
157-------------------------------------------------*/
214//-------------------------------------------------
215//  device_timer - handle timer callbacks
216//-------------------------------------------------
158217
159static const char DEVTEMPLATE_SOURCE[] = __FILE__;
218void ticket_dispenser_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
219{
220   // if we still have power, keep toggling ticket states
221   if (m_power)
222   {
223      m_status ^= m_active_bit;
224      LOG(("Ticket Status Changed to %02X\n", m_status));
225      m_timer->adjust(m_period);
226   }
160227
161#define DEVTEMPLATE_ID(p,s)      p##ticket##s
162#define DEVTEMPLATE_FEATURES   DT_HAS_START | DT_HAS_RESET | DT_HAS_INLINE_CONFIG
163#define DEVTEMPLATE_NAME      "Ticket Dispenser"
164#define DEVTEMPLATE_FAMILY      "Generic"
165#include "devtempl.h"
166
167
168DEFINE_LEGACY_DEVICE(TICKET_DISPENSER, ticket);
228   // update LED status (fixme: should map to an output)
229   set_led_status(machine(), 2, (m_status == m_ticketdispensed));
230   
231   // if we just dispensed, increment global count
232   if (m_status == m_ticketdispensed)
233   {
234      increment_dispensed_tickets(machine(), 1);
235      LOG(("Ticket Dispensed\n"));
236   }
237}
src/mame/machine/scramble.c
r14896r14897
162162   DEVCB_NULL,                                    /* Port A read */
163163   DEVCB_NULL,                                    /* Port B read */
164164   DEVCB_NULL,                                    /* Port C read */
165   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_w),   /* Port A write */
165   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),   /* Port A write */
166166   DEVCB_HANDLER(scramble_sh_irqtrigger_w),            /* Port B write */
167167   DEVCB_NULL                                    /* Port C write */
168168};
r14896r14897
173173   DEVCB_NULL,                                    /* Port A read */
174174   DEVCB_NULL,                                    /* Port B read */
175175   DEVCB_INPUT_PORT("IN3"),                        /* Port C read */
176   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_w),   /* Port A write */
176   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),   /* Port A write */
177177   DEVCB_HANDLER(scramble_sh_irqtrigger_w),            /* Port B write */
178178   DEVCB_NULL                                    /* Port C write */
179179};
r14896r14897
184184   DEVCB_NULL,                                    /* Port A read */
185185   DEVCB_NULL,                                    /* Port B read */
186186   DEVCB_HANDLER(scramble_protection_r),               /* Port C read */
187   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_w),   /* Port A write */
187   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),   /* Port A write */
188188   DEVCB_HANDLER(scramble_sh_irqtrigger_w),            /* Port B write */
189189   DEVCB_HANDLER(scramble_protection_w)               /* Port C write */
190190};
r14896r14897
195195   DEVCB_NULL,                                    /* Port A read */
196196   DEVCB_NULL,                                    /* Port B read */
197197   DEVCB_NULL,                                    /* Port C read */
198   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_w),   /* Port A write */
198   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),   /* Port A write */
199199   DEVCB_HANDLER(mrkougar_sh_irqtrigger_w),            /* Port B write */
200200   DEVCB_NULL                                    /* Port C write */
201201};
src/mame/machine/ticket.h
r14896r14897
11/***************************************************************************
22
3    Function prototypes and constants for the ticket dispenser emulator
3    ticket.h
44
5    Generic ticket dispensing device.
6
7****************************************************************************
8
9    Copyright Aaron Giles
10    All rights reserved.
11
12    Redistribution and use in source and binary forms, with or without
13    modification, are permitted provided that the following conditions are
14    met:
15
16        * Redistributions of source code must retain the above copyright
17          notice, this list of conditions and the following disclaimer.
18        * Redistributions in binary form must reproduce the above copyright
19          notice, this list of conditions and the following disclaimer in
20          the documentation and/or other materials provided with the
21          distribution.
22        * Neither the name 'MAME' nor the names of its contributors may be
23          used to endorse or promote products derived from this software
24          without specific prior written permission.
25
26    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
27    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
30    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36    POSSIBILITY OF SUCH DAMAGE.
37
538***************************************************************************/
639
7#include "devlegcy.h"
40#pragma once
841
942
10#define TICKET_MOTOR_ACTIVE_LOW    0    /* Ticket motor is triggered by D7=0 */
11#define TICKET_MOTOR_ACTIVE_HIGH   1    /* Ticket motor is triggered by D7=1 */
43//**************************************************************************
44//  GLOBAL VARIABLES
45//**************************************************************************
1246
13#define TICKET_STATUS_ACTIVE_LOW   0    /* Ticket is done dispensing when D7=0 */
14#define TICKET_STATUS_ACTIVE_HIGH  1    /* Ticket is done dispensing when D7=1 */
47// device type definition
48extern const device_type TICKET_DISPENSER;
1549
1650
1751
18typedef struct _ticket_config ticket_config;
19struct _ticket_config
52//**************************************************************************
53//  DEVICE CONFIGURATION MACROS
54//**************************************************************************
55
56// add/remove speakers
57#define MCFG_TICKET_DISPENSER_ADD(_tag, _period_in_msec, _motor_sense, _status_sense) \
58   MCFG_DEVICE_ADD(_tag, TICKET_DISPENSER, 0) \
59   ticket_dispenser_device::static_set_period(*device, _period_in_msec); \
60   ticket_dispenser_device::static_set_senses(*device, _motor_sense, _status_sense); \
61
62
63
64//**************************************************************************
65//  CONSTANTS
66//**************************************************************************
67
68const UINT8 TICKET_MOTOR_ACTIVE_LOW = 0;    /* Ticket motor is triggered by D7=0 */
69const UINT8 TICKET_MOTOR_ACTIVE_HIGH = 1;    /* Ticket motor is triggered by D7=1 */
70
71const UINT8 TICKET_STATUS_ACTIVE_LOW = 0;    /* Ticket is done dispensing when D7=0 */
72const UINT8 TICKET_STATUS_ACTIVE_HIGH = 1;    /* Ticket is done dispensing when D7=1 */
73
74
75
76//**************************************************************************
77//  TYPE DEFINITIONS
78//**************************************************************************
79
80// ======================> ticket_dispenser_device
81
82class ticket_dispenser_device : public device_t
2083{
21   UINT8   motorhigh;
22   UINT8   statushigh;
23};
84public:
85   // construction/destruction
86   ticket_dispenser_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
87   virtual ~ticket_dispenser_device();
2488
89   // inline configuration helpers
90   static void static_set_period(device_t &device, attotime period);
91   static void static_set_senses(device_t &device, UINT8 motor_sense, UINT8 status_sense);
2592
26#define MCFG_TICKET_DISPENSER_ADD(_tag, _clock, _motorhigh, _statushigh) \
27   MCFG_DEVICE_ADD(_tag, TICKET_DISPENSER, _clock) \
28   MCFG_DEVICE_CONFIG_DATA32(ticket_config, motorhigh, _motorhigh) \
29   MCFG_DEVICE_CONFIG_DATA32(ticket_config, statushigh, _statushigh)
93   // read/write handlers
94   DECLARE_READ8_MEMBER( read );
95   DECLARE_READ_LINE_MEMBER( line_r );
96   DECLARE_WRITE8_MEMBER( write );
3097
98protected:
99   // device-level overrides
100   virtual void device_start() ATTR_COLD;
101   virtual void device_reset() ATTR_COLD;
102   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
31103
32READ8_DEVICE_HANDLER( ticket_dispenser_r );
33WRITE8_DEVICE_HANDLER( ticket_dispenser_w );
104   // configuration state
105   UINT8 m_motor_sense;
106   UINT8 m_status_sense;
107   attotime m_period;
108   
109   // active state
110   UINT8 m_active_bit;
111   UINT8 m_motoron;
112   UINT8 m_ticketdispensed;
113   UINT8 m_ticketnotdispensed;
34114
35READ_LINE_DEVICE_HANDLER( ticket_dispenser_line_r );
36
37DECLARE_LEGACY_DEVICE(TICKET_DISPENSER, ticket);
115   UINT8 m_status;
116   UINT8 m_power;
117   emu_timer *m_timer;
118};
src/mame/machine/williams.c
r14896r14897
122122const pia6821_interface lottofun_pia_0_intf =
123123{
124124   /*inputs : A/B,CA/B1,CA/B2 */ DEVCB_INPUT_PORT("IN0"), DEVCB_INPUT_PORT("IN1"), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
125   /*outputs: A/B,CA/B2       */ DEVCB_NULL, DEVCB_DEVICE_HANDLER("ticket", ticket_dispenser_w), DEVCB_HANDLER(lottofun_coin_lock_w), DEVCB_NULL,
125   /*outputs: A/B,CA/B2       */ DEVCB_NULL, DEVCB_DEVICE_MEMBER("ticket", ticket_dispenser_device, write), DEVCB_HANDLER(lottofun_coin_lock_w), DEVCB_NULL,
126126   /*irqs   : A/B             */ DEVCB_NULL, DEVCB_NULL
127127};
128128
src/mame/machine/wrally.c
r14896r14897
2828
2929WRITE16_MEMBER(wrally_state::wrally_flipscreen_w)
3030{
31   flip_screen_set(machine(), data & 0x01);
31   flip_screen_set(data & 0x01);
3232}
3333
3434WRITE16_MEMBER(wrally_state::OKIM6295_bankswitch_w)
src/mame/machine/seicop.c
r14896r14897
15341534
15351535   switch(offset)
15361536   {
1537      case (0x01a/2): { flip_screen_set(space->machine(), seibu_vregs[offset] & 0x01); break; }
1537      case (0x01a/2): { state->flip_screen_set(seibu_vregs[offset] & 0x01); break; }
15381538      case (0x01c/2): { state->m_layer_disable =  seibu_vregs[offset]; break; }
15391539      case (0x020/2): { state->m_scrollram16[0] = seibu_vregs[offset]; break; }
15401540      case (0x022/2): { state->m_scrollram16[1] = seibu_vregs[offset]; break; }
r14896r14897
17131713
17141714      case (0x740/2):
17151715      {
1716         state->soundlatch_w(*space, 0, data & 0xff);
1716         state->soundlatch_byte_w(*space, 0, data & 0xff);
17171717         cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE );
17181718         break;
17191719      }
src/mame/machine/ajax.c
r14896r14897
149149         device_set_input_line(m_audiocpu, 0, HOLD_LINE);
150150         break;
151151      case 0x02:   /* Sound command number */
152         soundlatch_w(space, offset, data);
152         soundlatch_byte_w(space, offset, data);
153153         break;
154154      case 0x03:   /* Bankswitch + coin counters + priority*/
155155         ajax_bankswitch_w(space, 0, data);
src/mame/includes/eprom.h
r14896r14897
1616   int          m_video_disable;
1717   UINT16 *      m_sync_data;
1818   int         m_last_offset;
19   DECLARE_READ16_MEMBER(special_port1_r);
20   DECLARE_READ16_MEMBER(adc_r);
21   DECLARE_WRITE16_MEMBER(eprom_latch_w);
22   DECLARE_READ16_MEMBER(sync_r);
23   DECLARE_WRITE16_MEMBER(sync_w);
1924};
2025
2126
src/mame/includes/rampart.h
r14896r14897
1414
1515   UINT16 *      m_bitmap;
1616   UINT8         m_has_mo;
17   DECLARE_WRITE16_MEMBER(latch_w);
1718};
1819
1920
src/mame/includes/senjyo.h
r14896r14897
4949   DECLARE_WRITE8_MEMBER(senjyo_bg2videoram_w);
5050   DECLARE_WRITE8_MEMBER(senjyo_bg3videoram_w);
5151   DECLARE_WRITE8_MEMBER(senjyo_bgstripes_w);
52   DECLARE_WRITE8_MEMBER(senjyo_volume_w);
5253};
5354
5455
r14896r14897
5960extern const z80ctc_interface senjyo_ctc_intf;
6061
6162SAMPLES_START( senjyo_sh_start );
62WRITE8_HANDLER( senjyo_volume_w );
6363
6464
6565/*----------- defined in video/senjyo.c -----------*/
src/mame/includes/copsnrob.h
r14896r14897
2727   UINT8          m_ic_h3_data;
2828   DECLARE_READ8_MEMBER(copsnrob_misc_r);
2929   DECLARE_WRITE8_MEMBER(copsnrob_misc2_w);
30   DECLARE_WRITE8_MEMBER(copsnrob_misc_w);
3031};
3132
3233
r14896r14897
4344/*----------- defined in audio/copsnrob.c -----------*/
4445
4546DISCRETE_SOUND_EXTERN( copsnrob );
46WRITE8_HANDLER( copsnrob_misc_w );
src/mame/includes/galpani2.h
r14896r14897
2525
2626   required_device<cpu_device> m_maincpu;
2727   required_device<cpu_device> m_subcpu;
28   DECLARE_WRITE8_MEMBER(galpani2_mcu_init_w);
29   DECLARE_WRITE8_MEMBER(galpani2_mcu_nmi1_w);
30   DECLARE_WRITE8_MEMBER(galpani2_mcu_nmi2_w);
31   DECLARE_WRITE8_MEMBER(galpani2_coin_lockout_w);
32   DECLARE_READ16_MEMBER(galpani2_bankedrom_r);
2833};
2934
3035
src/mame/includes/seibuspi.h
r14896r14897
5555   DECLARE_WRITE32_MEMBER(video_dma_address_w);
5656   DECLARE_CUSTOM_INPUT_MEMBER(ejsakura_keyboard_r);
5757   DECLARE_CUSTOM_INPUT_MEMBER(ejanhs_encode);
58   DECLARE_READ32_MEMBER(sb_coin_r);
59   DECLARE_WRITE8_MEMBER(sb_coin_w);
60   DECLARE_READ32_MEMBER(sound_fifo_r);
61   DECLARE_WRITE32_MEMBER(sound_fifo_w);
62   DECLARE_READ32_MEMBER(sound_fifo_status_r);
63   DECLARE_READ32_MEMBER(spi_int_r);
64   DECLARE_READ32_MEMBER(spi_unknown_r);
65   DECLARE_WRITE32_MEMBER(z80_prg_fifo_w);
66   DECLARE_WRITE32_MEMBER(z80_enable_w);
67   DECLARE_READ32_MEMBER(spi_controls1_r);
68   DECLARE_READ32_MEMBER(spi_controls2_r);
69   DECLARE_READ8_MEMBER(z80_soundfifo_r);
70   DECLARE_WRITE8_MEMBER(z80_soundfifo_w);
71   DECLARE_READ8_MEMBER(z80_soundfifo_status_r);
72   DECLARE_WRITE8_MEMBER(z80_bank_w);
73   DECLARE_READ8_MEMBER(z80_jp1_r);
74   DECLARE_READ8_MEMBER(z80_coin_r);
75   DECLARE_READ32_MEMBER(soundrom_r);
76   DECLARE_WRITE32_MEMBER(input_select_w);
77   DECLARE_READ32_MEMBER(senkyu_speedup_r);
78   DECLARE_READ32_MEMBER(senkyua_speedup_r);
79   DECLARE_READ32_MEMBER(batlball_speedup_r);
80   DECLARE_READ32_MEMBER(rdft_speedup_r);
81   DECLARE_READ32_MEMBER(viprp1_speedup_r);
82   DECLARE_READ32_MEMBER(viprp1o_speedup_r);
83   DECLARE_READ32_MEMBER(rf2_speedup_r);
84   DECLARE_READ32_MEMBER(rfjet_speedup_r);
5885};
5986
6087
src/mame/includes/jedi.h
r14896r14897
5555   DECLARE_WRITE8_MEMBER(jedi_vscroll_w);
5656   DECLARE_WRITE8_MEMBER(jedi_hscroll_w);
5757   DECLARE_CUSTOM_INPUT_MEMBER(jedi_audio_comm_stat_r);
58   DECLARE_WRITE8_MEMBER(irq_ack_w);
59   DECLARE_WRITE8_MEMBER(jedi_audio_reset_w);
60   DECLARE_WRITE8_MEMBER(jedi_audio_latch_w);
61   DECLARE_READ8_MEMBER(audio_latch_r);
62   DECLARE_READ8_MEMBER(jedi_audio_ack_latch_r);
63   DECLARE_WRITE8_MEMBER(audio_ack_latch_w);
64   DECLARE_WRITE8_MEMBER(speech_strobe_w);
65   DECLARE_READ8_MEMBER(speech_ready_r);
66   DECLARE_WRITE8_MEMBER(speech_reset_w);
5867};
5968
6069
r14896r14897
6271
6372MACHINE_CONFIG_EXTERN( jedi_audio );
6473
65WRITE8_HANDLER( jedi_audio_reset_w );
66WRITE8_HANDLER( jedi_audio_latch_w );
67READ8_HANDLER( jedi_audio_ack_latch_r );
6874
6975
7076/*----------- defined in video/jedi.c -----------*/
src/mame/includes/seta2.h
r14896r14897
2929   UINT8 m_funcube_serial_fifo[4];
3030   UINT8 m_funcube_serial_count;
3131   DECLARE_WRITE16_MEMBER(seta2_vregs_w);
32   DECLARE_WRITE16_MEMBER(seta2_sound_bank_w);
33   DECLARE_WRITE16_MEMBER(grdians_lockout_w);
34   DECLARE_READ16_MEMBER(mj4simai_p1_r);
35   DECLARE_READ16_MEMBER(mj4simai_p2_r);
36   DECLARE_WRITE16_MEMBER(mj4simai_keyboard_w);
37   DECLARE_READ16_MEMBER(pzlbowl_protection_r);
38   DECLARE_READ16_MEMBER(pzlbowl_coins_r);
39   DECLARE_WRITE16_MEMBER(pzlbowl_coin_counter_w);
40   DECLARE_WRITE16_MEMBER(reelquak_leds_w);
41   DECLARE_WRITE16_MEMBER(reelquak_coin_w);
42   DECLARE_WRITE16_MEMBER(samshoot_coin_w);
43   DECLARE_READ32_MEMBER(funcube_nvram_dword_r);
44   DECLARE_WRITE32_MEMBER(funcube_nvram_dword_w);
45   DECLARE_WRITE16_MEMBER(spriteram16_word_w);
46   DECLARE_READ16_MEMBER(spriteram16_word_r);
47   DECLARE_WRITE32_MEMBER(coldfire_regs_w);
48   DECLARE_READ32_MEMBER(coldfire_regs_r);
49   DECLARE_READ32_MEMBER(funcube_debug_r);
50   DECLARE_READ8_MEMBER(funcube_coins_r);
51   DECLARE_READ8_MEMBER(funcube_serial_r);
52   DECLARE_WRITE8_MEMBER(funcube_leds_w);
53   DECLARE_READ8_MEMBER(funcube_outputs_r);
54   DECLARE_WRITE8_MEMBER(funcube_outputs_w);
3255};
3356
3457/*----------- defined in video/seta2.c -----------*/
src/mame/includes/fastfred.h
r14896r14897
3131
3232   UINT8 m_nmi_mask;
3333   UINT8 m_sound_nmi_mask;
34   DECLARE_READ8_MEMBER(fastfred_custom_io_r);
35   DECLARE_READ8_MEMBER(flyboy_custom1_io_r);
36   DECLARE_READ8_MEMBER(flyboy_custom2_io_r);
37   DECLARE_READ8_MEMBER(jumpcoas_custom_io_r);
38   DECLARE_READ8_MEMBER(boggy84_custom_io_r);
39   DECLARE_WRITE8_MEMBER(imago_dma_irq_w);
40   DECLARE_WRITE8_MEMBER(imago_sprites_bank_w);
41   DECLARE_WRITE8_MEMBER(imago_sprites_dma_w);
42   DECLARE_READ8_MEMBER(imago_sprites_offset_r);
43   DECLARE_WRITE8_MEMBER(nmi_mask_w);
44   DECLARE_WRITE8_MEMBER(sound_nmi_mask_w);
3445};
3546
3647
src/mame/includes/astrof.h
r14896r14897
5151   DECLARE_CUSTOM_INPUT_MEMBER(astrof_p1_controls_r);
5252   DECLARE_CUSTOM_INPUT_MEMBER(astrof_p2_controls_r);
5353   DECLARE_CUSTOM_INPUT_MEMBER(tomahawk_controls_r);
54   DECLARE_WRITE8_MEMBER(astrof_audio_1_w);
55   DECLARE_WRITE8_MEMBER(astrof_audio_2_w);
56   DECLARE_WRITE8_MEMBER(spfghmk2_audio_w);
57   DECLARE_WRITE8_MEMBER(tomahawk_audio_w);
5458};
5559
5660/*----------- defined in audio/astrof.c -----------*/
5761
5862MACHINE_CONFIG_EXTERN( astrof_audio );
59WRITE8_HANDLER( astrof_audio_1_w );
60WRITE8_HANDLER( astrof_audio_2_w );
6163
6264MACHINE_CONFIG_EXTERN( spfghmk2_audio );
63WRITE8_HANDLER( spfghmk2_audio_w );
6465
6566MACHINE_CONFIG_EXTERN( tomahawk_audio );
66WRITE8_HANDLER( tomahawk_audio_w );
src/mame/includes/galpanic.h
r14896r14897
1313   bitmap_ind16 m_sprites_bitmap;
1414   UINT16 *m_spriteram;
1515   size_t m_spriteram_size;
16   DECLARE_WRITE16_MEMBER(galpanic_6295_bankswitch_w);
17   DECLARE_WRITE16_MEMBER(galpanica_6295_bankswitch_w);
18   DECLARE_WRITE16_MEMBER(galpanica_misc_w);
19   DECLARE_WRITE16_MEMBER(galpanic_coin_w);
20   DECLARE_WRITE16_MEMBER(galpanic_bgvideoram_mirror_w);
21   DECLARE_READ16_MEMBER(comad_timer_r);
22   DECLARE_READ16_MEMBER(zipzap_random_read);
1623};
1724
1825
src/mame/includes/shuuz.h
r14896r14897
1313      : atarigen_state(mconfig, type, tag) { }
1414
1515   int m_cur[2];
16   DECLARE_READ16_MEMBER(shuuz_atarivc_r);
17   DECLARE_WRITE16_MEMBER(shuuz_atarivc_w);
18   DECLARE_WRITE16_MEMBER(latch_w);
19   DECLARE_READ16_MEMBER(leta_r);
20   DECLARE_READ16_MEMBER(special_port0_r);
1621};
1722
1823
src/mame/includes/foodf.h
r14896r14897
2323
2424   UINT8         m_whichport;
2525   UINT16 *m_spriteram;
26   DECLARE_WRITE16_MEMBER(nvram_recall_w);
27   DECLARE_WRITE8_MEMBER(digital_w);
28   DECLARE_READ16_MEMBER(analog_r);
29   DECLARE_WRITE16_MEMBER(analog_w);
30   DECLARE_WRITE16_MEMBER(foodf_paletteram_w);
31   void foodf_set_flip(int flip);
2632};
2733
2834
2935/*----------- defined in video/foodf.c -----------*/
3036
31WRITE16_HANDLER( foodf_paletteram_w );
32
33void foodf_set_flip(foodf_state *state, int flip);
3437VIDEO_START( foodf );
3538SCREEN_UPDATE_IND16( foodf );
src/mame/includes/dkong.h
r14896r14897
223223   DECLARE_WRITE8_MEMBER(radarscp_grid_color_w);
224224   DECLARE_WRITE8_MEMBER(dkong_flipscreen_w);
225225   DECLARE_WRITE8_MEMBER(dkong_spritebank_w);
226   DECLARE_WRITE8_MEMBER(dkong_voice_w);
227   DECLARE_WRITE8_MEMBER(dkong_audio_irq_w);
226228};
227229
228230/*----------- defined in video/dkong.c -----------*/
r14896r14897
241243
242244/*----------- defined in audio/dkong.c -----------*/
243245
244WRITE8_HANDLER( dkong_audio_irq_w );
245246
246247MACHINE_CONFIG_EXTERN( radarscp_audio );
247248MACHINE_CONFIG_EXTERN( dkong2b_audio );
src/mame/includes/gauntlet.h
r14896r14897
1616   UINT8         m_vindctr2_screen_refresh;
1717   UINT8         m_playfield_tile_bank;
1818   UINT8         m_playfield_color_bank;
19   DECLARE_READ16_MEMBER(port4_r);
20   DECLARE_WRITE16_MEMBER(sound_reset_w);
21   DECLARE_READ8_MEMBER(switch_6502_r);
22   DECLARE_WRITE8_MEMBER(sound_ctl_w);
23   DECLARE_WRITE8_MEMBER(mixer_w);
1924};
2025
2126
src/mame/includes/redalert.h
r14896r14897
2626   DECLARE_READ8_MEMBER(panther_interrupt_clear_r);
2727   DECLARE_READ8_MEMBER(panther_unk_r);
2828   DECLARE_WRITE8_MEMBER(redalert_bitmap_videoram_w);
29   DECLARE_WRITE8_MEMBER(redalert_audio_command_w);
30   DECLARE_READ8_MEMBER(redalert_ay8910_latch_1_r);
31   DECLARE_WRITE8_MEMBER(redalert_ay8910_latch_2_w);
32   DECLARE_WRITE8_MEMBER(redalert_voice_command_w);
33   DECLARE_WRITE8_MEMBER(demoneye_audio_command_w);
2934};
3035
3136
3237/*----------- defined in audio/redalert.c -----------*/
3338
34WRITE8_HANDLER( redalert_audio_command_w );
35WRITE8_HANDLER( redalert_voice_command_w );
3639
37WRITE8_HANDLER( demoneye_audio_command_w );
3840
3941MACHINE_CONFIG_EXTERN( redalert_audio );
4042MACHINE_CONFIG_EXTERN( ww3_audio );
src/mame/includes/mcr3.h
r14896r14897
1class mcr3_state : public driver_device
1class mcr3_state : public mcr_state
22{
33public:
44   mcr3_state(const machine_config &mconfig, device_type type, const char *tag)
5      : driver_device(mconfig, type, tag) { }
5      : mcr_state(mconfig, type, tag) { }
66
77   UINT8 *m_videoram;
88   UINT8 *m_spriteram;
r14896r14897
2727   DECLARE_WRITE8_MEMBER(spyhunt_videoram_w);
2828   DECLARE_WRITE8_MEMBER(spyhunt_alpharam_w);
2929   DECLARE_WRITE8_MEMBER(spyhunt_scroll_value_w);
30   DECLARE_WRITE8_MEMBER(mcrmono_control_port_w);
31   DECLARE_READ8_MEMBER(demoderm_ip1_r);
32   DECLARE_READ8_MEMBER(demoderm_ip2_r);
33   DECLARE_WRITE8_MEMBER(demoderm_op6_w);
34   DECLARE_READ8_MEMBER(maxrpm_ip1_r);
35   DECLARE_READ8_MEMBER(maxrpm_ip2_r);
36   DECLARE_WRITE8_MEMBER(maxrpm_op5_w);
37   DECLARE_WRITE8_MEMBER(maxrpm_op6_w);
38   DECLARE_READ8_MEMBER(rampage_ip4_r);
39   DECLARE_WRITE8_MEMBER(rampage_op6_w);
40   DECLARE_READ8_MEMBER(powerdrv_ip2_r);
41   DECLARE_WRITE8_MEMBER(powerdrv_op5_w);
42   DECLARE_WRITE8_MEMBER(powerdrv_op6_w);
43   DECLARE_READ8_MEMBER(stargrds_ip0_r);
44   DECLARE_WRITE8_MEMBER(stargrds_op5_w);
45   DECLARE_WRITE8_MEMBER(stargrds_op6_w);
46   DECLARE_READ8_MEMBER(spyhunt_ip1_r);
47   DECLARE_READ8_MEMBER(spyhunt_ip2_r);
48   DECLARE_WRITE8_MEMBER(spyhunt_op4_w);
49   DECLARE_READ8_MEMBER(turbotag_ip2_r);
50   DECLARE_READ8_MEMBER(turbotag_kludge_r);
3051};
3152
3253
src/mame/includes/mw8080bw.h
r14896r14897
107107   DECLARE_CUSTOM_INPUT_MEMBER(invaders_in0_control_r);
108108   DECLARE_CUSTOM_INPUT_MEMBER(invaders_in1_control_r);
109109   DECLARE_CUSTOM_INPUT_MEMBER(invaders_in2_control_r);
110   DECLARE_WRITE8_MEMBER(seawolf_audio_w);
111   DECLARE_WRITE8_MEMBER(gunfight_audio_w);
112   DECLARE_WRITE8_MEMBER(zzzap_audio_1_w);
113   DECLARE_WRITE8_MEMBER(zzzap_audio_2_w);
114   DECLARE_WRITE8_MEMBER(gmissile_audio_1_w);
115   DECLARE_WRITE8_MEMBER(gmissile_audio_2_w);
116   DECLARE_WRITE8_MEMBER(gmissile_audio_3_w);
117   DECLARE_WRITE8_MEMBER(m4_audio_1_w);
118   DECLARE_WRITE8_MEMBER(m4_audio_2_w);
119   DECLARE_WRITE8_MEMBER(clowns_audio_1_w);
120   DECLARE_WRITE8_MEMBER(phantom2_audio_1_w);
121   DECLARE_WRITE8_MEMBER(phantom2_audio_2_w);
122   DECLARE_WRITE8_MEMBER(bowler_audio_2_w);
123   DECLARE_WRITE8_MEMBER(bowler_audio_3_w);
124   DECLARE_WRITE8_MEMBER(bowler_audio_4_w);
125   DECLARE_WRITE8_MEMBER(bowler_audio_5_w);
126   DECLARE_WRITE8_MEMBER(bowler_audio_6_w);
110127};
111128
112129
r14896r14897
169186WRITE8_DEVICE_HANDLER( midway_tone_generator_hi_w );
170187
171188MACHINE_CONFIG_EXTERN( seawolf_audio );
172WRITE8_HANDLER( seawolf_audio_w );
173189
174190MACHINE_CONFIG_EXTERN( gunfight_audio );
175WRITE8_HANDLER( gunfight_audio_w );
176191
177192MACHINE_CONFIG_EXTERN( tornbase_audio );
178193WRITE8_DEVICE_HANDLER( tornbase_audio_w );
179194
180195MACHINE_CONFIG_EXTERN( zzzap_audio );
181WRITE8_HANDLER( zzzap_audio_1_w );
182WRITE8_HANDLER( zzzap_audio_2_w );
183196
184197MACHINE_CONFIG_EXTERN( maze_audio );
185198void maze_write_discrete(device_t *device, UINT8 maze_tone_timing_state);
r14896r14897
198211WRITE8_DEVICE_HANDLER( dplay_audio_w );
199212
200213MACHINE_CONFIG_EXTERN( gmissile_audio );
201WRITE8_HANDLER( gmissile_audio_1_w );
202WRITE8_HANDLER( gmissile_audio_2_w );
203WRITE8_HANDLER( gmissile_audio_3_w );
204214
205215MACHINE_CONFIG_EXTERN( m4_audio );
206WRITE8_HANDLER( m4_audio_1_w );
207WRITE8_HANDLER( m4_audio_2_w );
208216
209217MACHINE_CONFIG_EXTERN( clowns_audio );
210WRITE8_HANDLER( clowns_audio_1_w );
211218WRITE8_DEVICE_HANDLER( clowns_audio_2_w );
212219
213220MACHINE_CONFIG_EXTERN( spacwalk_audio );
r14896r14897
227234WRITE8_DEVICE_HANDLER( spcenctr_audio_3_w );
228235
229236MACHINE_CONFIG_EXTERN( phantom2_audio );
230WRITE8_HANDLER( phantom2_audio_1_w );
231WRITE8_HANDLER( phantom2_audio_2_w );
232237
233238MACHINE_CONFIG_EXTERN( bowler_audio );
234239WRITE8_DEVICE_HANDLER( bowler_audio_1_w );
235WRITE8_HANDLER( bowler_audio_2_w );
236WRITE8_HANDLER( bowler_audio_3_w );
237WRITE8_HANDLER( bowler_audio_4_w );
238WRITE8_HANDLER( bowler_audio_5_w );
239WRITE8_HANDLER( bowler_audio_6_w );
240240
241241MACHINE_CONFIG_EXTERN( invaders_samples_audio );
242242MACHINE_CONFIG_EXTERN( invaders_audio );
src/mame/includes/galaxian.h
r14896r14897
9696   DECLARE_CUSTOM_INPUT_MEMBER(kingball_muxbit_r);
9797   DECLARE_CUSTOM_INPUT_MEMBER(kingball_noise_r);
9898   DECLARE_CUSTOM_INPUT_MEMBER(moonwar_dial_r);
99   DECLARE_WRITE8_MEMBER(irq_enable_w);
100   DECLARE_WRITE8_MEMBER(start_lamp_w);
101   DECLARE_WRITE8_MEMBER(coin_lock_w);
102   DECLARE_WRITE8_MEMBER(coin_count_0_w);
103   DECLARE_WRITE8_MEMBER(coin_count_1_w);
104   DECLARE_READ8_MEMBER(konami_ay8910_r);
105   DECLARE_WRITE8_MEMBER(konami_ay8910_w);
106   DECLARE_WRITE8_MEMBER(konami_sound_filter_w);
107   DECLARE_READ8_MEMBER(theend_ppi8255_r);
108   DECLARE_WRITE8_MEMBER(theend_ppi8255_w);
109   DECLARE_WRITE8_MEMBER(explorer_sound_control_w);
110   DECLARE_READ8_MEMBER(sfx_sample_io_r);
111   DECLARE_WRITE8_MEMBER(sfx_sample_io_w);
112   DECLARE_READ8_MEMBER(monsterz_protection_r);
113   DECLARE_READ8_MEMBER(frogger_ppi8255_r);
114   DECLARE_WRITE8_MEMBER(frogger_ppi8255_w);
115   DECLARE_READ8_MEMBER(frogger_ay8910_r);
116   DECLARE_WRITE8_MEMBER(frogger_ay8910_w);
117   DECLARE_WRITE8_MEMBER(froggrmc_sound_control_w);
118   DECLARE_READ8_MEMBER(frogf_ppi8255_r);
119   DECLARE_WRITE8_MEMBER(frogf_ppi8255_w);
120   DECLARE_READ8_MEMBER(turtles_ppi8255_0_r);
121   DECLARE_READ8_MEMBER(turtles_ppi8255_1_r);
122   DECLARE_WRITE8_MEMBER(turtles_ppi8255_0_w);
123   DECLARE_WRITE8_MEMBER(turtles_ppi8255_1_w);
124   DECLARE_READ8_MEMBER(scorpion_ay8910_r);
125   DECLARE_WRITE8_MEMBER(scorpion_ay8910_w);
126   DECLARE_READ8_MEMBER(scorpion_digitalker_intr_r);
127   DECLARE_WRITE8_MEMBER(zigzag_bankswap_w);
128   DECLARE_WRITE8_MEMBER(zigzag_ay8910_w);
129   DECLARE_WRITE8_MEMBER(kingball_speech_dip_w);
130   DECLARE_WRITE8_MEMBER(kingball_sound1_w);
131   DECLARE_WRITE8_MEMBER(kingball_sound2_w);
132   DECLARE_WRITE8_MEMBER(mshuttle_ay8910_cs_w);
133   DECLARE_WRITE8_MEMBER(mshuttle_ay8910_control_w);
134   DECLARE_WRITE8_MEMBER(mshuttle_ay8910_data_w);
135   DECLARE_READ8_MEMBER(mshuttle_ay8910_data_r);
136   DECLARE_READ8_MEMBER(jumpbug_protection_r);
137   DECLARE_WRITE8_MEMBER(checkman_sound_command_w);
138   DECLARE_READ8_MEMBER(checkmaj_protection_r);
139   DECLARE_READ8_MEMBER(dingo_3000_r);
140   DECLARE_READ8_MEMBER(dingo_3035_r);
141   DECLARE_READ8_MEMBER(dingoe_3001_r);
142   DECLARE_WRITE8_MEMBER(tenspot_unk_6000_w);
143   DECLARE_WRITE8_MEMBER(tenspot_unk_8000_w);
144   DECLARE_WRITE8_MEMBER(tenspot_unk_e000_w);
145   DECLARE_WRITE8_MEMBER(artic_gfxbank_w);
146   DECLARE_READ8_MEMBER(tenspot_dsw_read);
99147};
100148
101149
src/mame/includes/namconb1.h
r14896r14897
3737   required_device<cpu_device> m_mcu;
3838   DECLARE_READ32_MEMBER(randgen_r);
3939   DECLARE_WRITE32_MEMBER(srand_w);
40   DECLARE_WRITE32_MEMBER(namconb1_cpureg_w);
41   DECLARE_WRITE32_MEMBER(namconb2_cpureg_w);
42   DECLARE_READ32_MEMBER(namconb_cpureg_r);
43   DECLARE_READ32_MEMBER(custom_key_r);
44   DECLARE_READ32_MEMBER(gunbulet_gun_r);
45   DECLARE_READ32_MEMBER(namconb_share_r);
46   DECLARE_WRITE32_MEMBER(namconb_share_w);
47   DECLARE_WRITE16_MEMBER(nbmcu_shared_w);
48   DECLARE_READ8_MEMBER(port6_r);
49   DECLARE_WRITE8_MEMBER(port6_w);
50   DECLARE_READ8_MEMBER(port7_r);
51   DECLARE_READ8_MEMBER(dac7_r);
52   DECLARE_READ8_MEMBER(dac6_r);
53   DECLARE_READ8_MEMBER(dac5_r);
54   DECLARE_READ8_MEMBER(dac4_r);
55   DECLARE_READ8_MEMBER(dac3_r);
56   DECLARE_READ8_MEMBER(dac2_r);
57   DECLARE_READ8_MEMBER(dac1_r);
58   DECLARE_READ8_MEMBER(dac0_r);
4059};
4160
4261
src/mame/includes/arcadecl.h
r14896r14897
1515
1616   UINT16 *      m_bitmap;
1717   UINT8         m_has_mo;
18   DECLARE_WRITE16_MEMBER(latch_w);
1819};
1920
2021/*----------- defined in video/arcadecl.c -----------*/
src/mame/includes/model2.h
r14896r14897
7272   DECLARE_CUSTOM_INPUT_MEMBER(_1c00000_r);
7373   DECLARE_CUSTOM_INPUT_MEMBER(_1c0001c_r);
7474   DECLARE_CUSTOM_INPUT_MEMBER(rchase2_devices_r);
75   DECLARE_READ32_MEMBER(timers_r);
76   DECLARE_WRITE32_MEMBER(timers_w);
77   DECLARE_WRITE32_MEMBER(pal32_w);
78   DECLARE_WRITE32_MEMBER(ctrl0_w);
79   DECLARE_WRITE32_MEMBER(analog_2b_w);
80   DECLARE_READ32_MEMBER(fifoctl_r);
81   DECLARE_READ32_MEMBER(videoctl_r);
82   DECLARE_WRITE32_MEMBER(rchase2_devices_w);
83   DECLARE_WRITE32_MEMBER(srallyc_devices_w);
84   DECLARE_READ32_MEMBER(copro_prg_r);
85   DECLARE_WRITE32_MEMBER(copro_prg_w);
86   DECLARE_WRITE32_MEMBER(copro_ctl1_w);
87   DECLARE_WRITE32_MEMBER(copro_function_port_w);
88   DECLARE_READ32_MEMBER(copro_fifo_r);
89   DECLARE_WRITE32_MEMBER(copro_fifo_w);
90   DECLARE_WRITE32_MEMBER(copro_sharc_iop_w);
91   DECLARE_WRITE32_MEMBER(geo_ctl1_w);
92   DECLARE_WRITE32_MEMBER(geo_sharc_ctl1_w);
93   DECLARE_READ32_MEMBER(geo_sharc_fifo_r);
94   DECLARE_WRITE32_MEMBER(geo_sharc_fifo_w);
95   DECLARE_WRITE32_MEMBER(geo_sharc_iop_w);
96   DECLARE_READ32_MEMBER(geo_prg_r);
97   DECLARE_WRITE32_MEMBER(geo_prg_w);
98   DECLARE_READ32_MEMBER(geo_r);
99   DECLARE_WRITE32_MEMBER(geo_w);
100   DECLARE_READ32_MEMBER(hotd_unk_r);
101   DECLARE_READ32_MEMBER(sonic_unk_r);
102   DECLARE_READ32_MEMBER(daytona_unk_r);
103   DECLARE_READ32_MEMBER(desert_unk_r);
104   DECLARE_READ32_MEMBER(model2_irq_r);
105   DECLARE_WRITE32_MEMBER(model2_irq_w);
106   DECLARE_READ32_MEMBER(model2_serial_r);
107   DECLARE_WRITE32_MEMBER(model2o_serial_w);
108   DECLARE_WRITE32_MEMBER(model2_serial_w);
109   DECLARE_READ32_MEMBER(model2_prot_r);
110   DECLARE_WRITE32_MEMBER(model2_prot_w);
111   DECLARE_READ32_MEMBER(maxx_r);
112   DECLARE_READ32_MEMBER(network_r);
113   DECLARE_WRITE32_MEMBER(network_w);
114   DECLARE_WRITE32_MEMBER(copro_w);
115   DECLARE_WRITE32_MEMBER(mode_w);
116   DECLARE_WRITE32_MEMBER(model2o_tex_w0);
117   DECLARE_WRITE32_MEMBER(model2o_tex_w1);
118   DECLARE_WRITE32_MEMBER(model2o_luma_w);
119   DECLARE_WRITE32_MEMBER(model2_3d_zclip_w);
120   DECLARE_READ16_MEMBER(m1_snd_68k_latch_r);
121   DECLARE_READ16_MEMBER(m1_snd_v60_ready_r);
122   DECLARE_WRITE16_MEMBER(m1_snd_68k_latch1_w);
123   DECLARE_WRITE16_MEMBER(m1_snd_68k_latch2_w);
124   DECLARE_WRITE16_MEMBER(model2snd_ctrl);
125   DECLARE_READ32_MEMBER(copro_sharc_input_fifo_r);
126   DECLARE_WRITE32_MEMBER(copro_sharc_output_fifo_w);
127   DECLARE_READ32_MEMBER(copro_sharc_buffer_r);
128   DECLARE_WRITE32_MEMBER(copro_sharc_buffer_w);
129   DECLARE_READ32_MEMBER(copro_tgp_buffer_r);
130   DECLARE_WRITE32_MEMBER(copro_tgp_buffer_w);
131   DECLARE_READ8_MEMBER(driveio_port_r);
132   DECLARE_WRITE8_MEMBER(driveio_port_w);
133   DECLARE_READ8_MEMBER(driveio_port_str_r);
134   DECLARE_READ32_MEMBER(jaleco_network_r);
135   DECLARE_WRITE32_MEMBER(jaleco_network_w);
136   void push_geo_data(UINT32 data);
75137};
76138
77139
src/mame/includes/blockade.h
r14896r14897
1818   DECLARE_READ8_MEMBER(blockade_input_port_0_r);
1919   DECLARE_WRITE8_MEMBER(blockade_coin_latch_w);
2020   DECLARE_WRITE8_MEMBER(blockade_videoram_w);
21   DECLARE_WRITE8_MEMBER(blockade_env_on_w);
22   DECLARE_WRITE8_MEMBER(blockade_env_off_w);
2123};
2224
2325
r14896r14897
3335DISCRETE_SOUND_EXTERN( blockade );
3436
3537WRITE8_DEVICE_HANDLER( blockade_sound_freq_w );
36WRITE8_HANDLER( blockade_env_on_w );
37WRITE8_HANDLER( blockade_env_off_w );
src/mame/includes/segag80r.h
r14896r14897
6666   DECLARE_WRITE8_MEMBER(pignewt_back_port_w);
6767   DECLARE_WRITE8_MEMBER(sindbadm_videoram_w);
6868   DECLARE_WRITE8_MEMBER(sindbadm_back_port_w);
69   DECLARE_WRITE8_MEMBER(astrob_sound_w);
70   DECLARE_WRITE8_MEMBER(spaceod_sound_w);
71   DECLARE_READ8_MEMBER(n7751_rom_r);
72   DECLARE_READ8_MEMBER(n7751_command_r);
73   DECLARE_READ8_MEMBER(n7751_t1_r);
6974};
7075
7176
r14896r14897
7681MACHINE_CONFIG_EXTERN( spaceod_sound_board );
7782MACHINE_CONFIG_EXTERN( monsterb_sound_board );
7883
79WRITE8_HANDLER( astrob_sound_w );
8084
81WRITE8_HANDLER( spaceod_sound_w );
8285
8386
8487/*----------- defined in video/segag80r.c -----------*/
src/mame/includes/scramble.h
r14896r14897
1313   UINT8 m_xb;
1414   DECLARE_CUSTOM_INPUT_MEMBER(darkplnt_custom_r);
1515   DECLARE_CUSTOM_INPUT_MEMBER(ckongs_coinage_r);
16   DECLARE_READ8_MEMBER(hncholms_prot_r);
17   DECLARE_READ8_MEMBER(scramble_soundram_r);
18   DECLARE_WRITE8_MEMBER(scramble_soundram_w);
19   DECLARE_WRITE8_MEMBER(hotshock_sh_irqtrigger_w);
20   DECLARE_WRITE8_MEMBER(scramble_filter_w);
21   DECLARE_WRITE8_MEMBER(frogger_filter_w);
1622};
1723
1824
r14896r14897
6268void scramble_sh_init(running_machine &machine);
6369WRITE_LINE_DEVICE_HANDLER( scramble_sh_7474_q_callback );
6470
65WRITE8_HANDLER( scramble_filter_w );
66WRITE8_HANDLER( frogger_filter_w );
6771
6872READ8_DEVICE_HANDLER( scramble_portB_r );
6973READ8_DEVICE_HANDLER( frogger_portB_r );
r14896r14897
7276
7377WRITE8_DEVICE_HANDLER( scramble_sh_irqtrigger_w );
7478WRITE8_DEVICE_HANDLER( mrkougar_sh_irqtrigger_w );
75WRITE8_HANDLER( hotshock_sh_irqtrigger_w );
7679
7780MACHINE_CONFIG_EXTERN( ad2083_audio );
7881
src/mame/includes/liberatr.h
r14896r14897
2121        m_bitmapram(*this, "bitmapram"),
2222        m_colorram(*this, "colorram") { }
2323
24   void machine_start_liberatr();
25   void video_start_liberatr();
26
2427   DECLARE_WRITE8_MEMBER( led_w );
2528   DECLARE_WRITE8_MEMBER( coin_counter_w );
2629
r14896r14897
3639protected:
3740   struct planet;
3841
39   virtual void machine_start();
40
41   virtual void video_start();
42
4342   void init_planet(planet &liberatr_planet, UINT8 *planet_rom);
4443   void get_pens(pen_t *pens);
4544   void draw_planet(bitmap_rgb32 &bitmap, pen_t *pens);
src/mame/includes/psikyo.h
r14896r14897
6161   DECLARE_WRITE32_MEMBER(s1945_mcu_w);
6262   DECLARE_READ32_MEMBER(s1945_mcu_r);
6363   DECLARE_READ32_MEMBER(s1945_input_r);
64   DECLARE_READ32_MEMBER(paletteram32_dword_r);
65   DECLARE_WRITE32_MEMBER(paletteram32_xRRRRRGGGGGBBBBB_dword_w);
6664   DECLARE_READ32_MEMBER(s1945bl_oki_r);
6765   DECLARE_WRITE32_MEMBER(s1945bl_oki_w);
6866   DECLARE_READ8_MEMBER(psikyo_soundlatch_r);
src/mame/includes/pgm.h
r14896r14897
286286DRIVER_INIT( kovshp );
287287DRIVER_INIT( kovlsqh2 );
288288DRIVER_INIT( kovqhsgs );
289DRIVER_INIT( kovshxas );
289290
290
291291/* simulations */
292292DRIVER_INIT( ddp3 );
293293DRIVER_INIT( ket );
src/mame/includes/model3.h
r14896r14897
116116   DECLARE_WRITE64_MEMBER(real3d_display_list_w);
117117   DECLARE_WRITE64_MEMBER(real3d_polygon_ram_w);
118118   DECLARE_WRITE64_MEMBER(real3d_cmd_w);
119   DECLARE_READ64_MEMBER(mpc105_addr_r);
120   DECLARE_WRITE64_MEMBER(mpc105_addr_w);
121   DECLARE_READ64_MEMBER(mpc105_data_r);
122   DECLARE_WRITE64_MEMBER(mpc105_data_w);
123   DECLARE_READ64_MEMBER(mpc105_reg_r);
124   DECLARE_WRITE64_MEMBER(mpc105_reg_w);
125   DECLARE_READ64_MEMBER(mpc106_addr_r);
126   DECLARE_WRITE64_MEMBER(mpc106_addr_w);
127   DECLARE_READ64_MEMBER(mpc106_data_r);
128   DECLARE_WRITE64_MEMBER(mpc106_data_w);
129   DECLARE_READ64_MEMBER(mpc106_reg_r);
130   DECLARE_WRITE64_MEMBER(mpc106_reg_w);
131   DECLARE_READ64_MEMBER(scsi_r);
132   DECLARE_WRITE64_MEMBER(scsi_w);
133   DECLARE_READ64_MEMBER(real3d_dma_r);
134   DECLARE_WRITE64_MEMBER(real3d_dma_w);
135   DECLARE_READ64_MEMBER(model3_ctrl_r);
136   DECLARE_WRITE64_MEMBER(model3_ctrl_w);
137   DECLARE_READ64_MEMBER(model3_sys_r);
138   DECLARE_WRITE64_MEMBER(model3_sys_w);
139   DECLARE_READ64_MEMBER(model3_rtc_r);
140   DECLARE_WRITE64_MEMBER(model3_rtc_w);
141   DECLARE_READ64_MEMBER(real3d_status_r);
142   DECLARE_WRITE8_MEMBER(model3_sound_w);
143   DECLARE_READ64_MEMBER(network_r);
144   DECLARE_WRITE64_MEMBER(network_w);
145   DECLARE_READ64_MEMBER(model3_security_r);
146   DECLARE_WRITE64_MEMBER(daytona2_rombank_w);
147   DECLARE_WRITE16_MEMBER(model3snd_ctrl);
148   UINT32 pci_device_get_reg();
149   void pci_device_set_reg(UINT32 value);
119150};
120151
121152
src/mame/includes/st0016.h
r14896r14897
88      { }
99
1010   int mux_port;
11   UINT32 m_st0016_rom_bank;
12   
1113   required_device<cpu_device> m_maincpu;
1214   DECLARE_READ8_MEMBER(mux_r);
1315   DECLARE_WRITE8_MEMBER(mux_select_w);
r14896r14897
2931   DECLARE_READ8_MEMBER(st0016_vregs_r);
3032   DECLARE_READ8_MEMBER(st0016_dma_r);
3133   DECLARE_WRITE8_MEMBER(st0016_vregs_w);
34   DECLARE_WRITE8_MEMBER(st0016_rom_bank_w);
3235};
3336
3437#define ISMACS  (st0016_game&0x80)
r14896r14897
5255
5356/*----------- defined in drivers/st0016.c -----------*/
5457
55extern UINT32 st0016_rom_bank;
56WRITE8_HANDLER   (st0016_rom_bank_w);
5758
5859
5960/*----------- defined in video/st0016.c -----------*/
src/mame/includes/cchasm.h
r14896r14897
2222   int m_ycenter;
2323   DECLARE_WRITE16_MEMBER(cchasm_led_w);
2424   DECLARE_WRITE16_MEMBER(cchasm_refresh_control_w);
25   DECLARE_WRITE8_MEMBER(cchasm_reset_coin_flag_w);
26   DECLARE_READ8_MEMBER(cchasm_coin_sound_r);
27   DECLARE_READ8_MEMBER(cchasm_soundlatch2_r);
28   DECLARE_WRITE8_MEMBER(cchasm_soundlatch4_w);
29   DECLARE_WRITE16_MEMBER(cchasm_io_w);
30   DECLARE_READ16_MEMBER(cchasm_io_r);
2531};
2632
2733
r14896r14897
3238
3339extern const z80ctc_interface cchasm_ctc_intf;
3440
35WRITE8_HANDLER( cchasm_reset_coin_flag_w );
3641INPUT_CHANGED( cchasm_set_coin_flag );
37READ8_HANDLER( cchasm_coin_sound_r );
38READ8_HANDLER( cchasm_soundlatch2_r );
39WRITE8_HANDLER( cchasm_soundlatch4_w );
4042
41WRITE16_HANDLER( cchasm_io_w );
42READ16_HANDLER( cchasm_io_r );
4343
4444SOUND_START( cchasm );
4545
src/mame/includes/skullxbo.h
r14896r14897
1111public:
1212   skullxbo_state(const machine_config &mconfig, device_type type, const char *tag)
1313      : atarigen_state(mconfig, type, tag) { }
14   DECLARE_WRITE16_MEMBER(skullxbo_halt_until_hblank_0_w);
15   DECLARE_READ16_MEMBER(special_port1_r);
16   DECLARE_WRITE16_MEMBER(skullxbo_mobwr_w);
1417};
1518
1619
src/mame/includes/cinemat.h
r14896r14897
4848   DECLARE_READ8_MEMBER(qb3_frame_r);
4949   DECLARE_WRITE8_MEMBER(qb3_ram_bank_w);
5050   DECLARE_WRITE8_MEMBER(cinemat_vector_control_w);
51   DECLARE_WRITE8_MEMBER(cinemat_sound_control_w);
52   DECLARE_WRITE8_MEMBER(qb3_sound_w);
5153};
5254
5355
r14896r14897
5860
5961/*----------- defined in audio/cinemat.c -----------*/
6062
61WRITE8_HANDLER( cinemat_sound_control_w );
6263
6364MACHINE_CONFIG_EXTERN( spacewar_sound );
6465MACHINE_CONFIG_EXTERN( barrier_sound );
src/mame/includes/namcos22.h
r14896r14897
128128   DECLARE_READ16_MEMBER(namcos22_dspram16_r);
129129   DECLARE_WRITE16_MEMBER(namcos22_dspram16_w);
130130   DECLARE_CUSTOM_INPUT_MEMBER(alpine_motor_read);
131   DECLARE_READ16_MEMBER(pdp_status_r);
132   DECLARE_READ16_MEMBER(pdp_begin_r);
133   DECLARE_READ16_MEMBER(slave_external_ram_r);
134   DECLARE_WRITE16_MEMBER(slave_external_ram_w);
135   DECLARE_READ16_MEMBER(dsp_HOLD_signal_r);
136   DECLARE_WRITE16_MEMBER(dsp_HOLD_ACK_w);
137   DECLARE_WRITE16_MEMBER(dsp_XF_output_w);
138   DECLARE_WRITE16_MEMBER(point_ram_idx_w);
139   DECLARE_WRITE16_MEMBER(point_ram_loword_iw);
140   DECLARE_WRITE16_MEMBER(point_ram_hiword_w);
141   DECLARE_READ16_MEMBER(point_ram_loword_r);
142   DECLARE_READ16_MEMBER(point_ram_hiword_ir);
143   DECLARE_WRITE16_MEMBER(dsp_unk2_w);
144   DECLARE_READ16_MEMBER(dsp_unk_port3_r);
145   DECLARE_WRITE16_MEMBER(upload_code_to_slave_dsp_w);
146   DECLARE_READ16_MEMBER(dsp_unk8_r);
147   DECLARE_READ16_MEMBER(custom_ic_status_r);
148   DECLARE_READ16_MEMBER(dsp_upload_status_r);
149   DECLARE_READ16_MEMBER(master_external_ram_r);
150   DECLARE_WRITE16_MEMBER(master_external_ram_w);
151   DECLARE_WRITE16_MEMBER(slave_serial_io_w);
152   DECLARE_READ16_MEMBER(master_serial_io_r);
153   DECLARE_WRITE16_MEMBER(dsp_unk_porta_w);
154   DECLARE_WRITE16_MEMBER(dsp_led_w);
155   DECLARE_WRITE16_MEMBER(dsp_unk8_w);
156   DECLARE_WRITE16_MEMBER(master_render_device_w);
157   DECLARE_READ16_MEMBER(dsp_BIOZ_r);
158   DECLARE_READ16_MEMBER(dsp_slave_port3_r);
159   DECLARE_READ16_MEMBER(dsp_slave_port4_r);
160   DECLARE_READ16_MEMBER(dsp_slave_port5_r);
161   DECLARE_READ16_MEMBER(dsp_slave_port6_r);
162   DECLARE_WRITE16_MEMBER(dsp_slave_portc_w);
163   DECLARE_READ16_MEMBER(dsp_slave_port8_r);
164   DECLARE_READ16_MEMBER(dsp_slave_portb_r);
165   DECLARE_WRITE16_MEMBER(dsp_slave_portb_w);
166   DECLARE_READ32_MEMBER(namcos22_C139_SCI_r);
167   DECLARE_WRITE32_MEMBER(namcos22_C139_SCI_w);
168   DECLARE_READ32_MEMBER(namcos22_system_controller_r);
169   DECLARE_WRITE32_MEMBER(namcos22s_system_controller_w);
170   DECLARE_WRITE32_MEMBER(namcos22_system_controller_w);
171   DECLARE_READ32_MEMBER(namcos22_keycus_r);
172   DECLARE_WRITE32_MEMBER(namcos22_keycus_w);
173   DECLARE_READ32_MEMBER(namcos22_portbit_r);
174   DECLARE_WRITE32_MEMBER(namcos22_portbit_w);
175   DECLARE_READ32_MEMBER(namcos22_dipswitch_r);
176   DECLARE_READ32_MEMBER(namcos22_mcuram_r);
177   DECLARE_WRITE32_MEMBER(namcos22_mcuram_w);
178   DECLARE_READ32_MEMBER(namcos22_gun_r);
179   DECLARE_WRITE32_MEMBER(namcos22_cpuleds_w);
180   DECLARE_READ32_MEMBER(alpinesa_prot_r);
181   DECLARE_WRITE32_MEMBER(alpinesa_prot_w);
182   DECLARE_WRITE32_MEMBER(namcos22s_nvmem_w);
183   DECLARE_WRITE32_MEMBER(namcos22s_chipselect_w);
184   DECLARE_READ16_MEMBER(s22mcu_shared_r);
185   DECLARE_WRITE16_MEMBER(s22mcu_shared_w);
186   DECLARE_WRITE8_MEMBER(mcu_port4_w);
187   DECLARE_READ8_MEMBER(mcu_port4_r);
188   DECLARE_WRITE8_MEMBER(mcu_port5_w);
189   DECLARE_READ8_MEMBER(mcu_port5_r);
190   DECLARE_WRITE8_MEMBER(mcu_port6_w);
191   DECLARE_READ8_MEMBER(mcu_port6_r);
192   DECLARE_WRITE8_MEMBER(mcu_port7_w);
193   DECLARE_READ8_MEMBER(mcu_port7_r);
194   DECLARE_WRITE8_MEMBER(propcycle_mcu_port5_w);
195   DECLARE_READ8_MEMBER(propcycle_mcu_adc_r);
196   DECLARE_WRITE8_MEMBER(alpine_mcu_port5_w);
197   DECLARE_READ8_MEMBER(alpineracer_mcu_adc_r);
198   DECLARE_READ8_MEMBER(cybrcycc_mcu_adc_r);
199   DECLARE_READ8_MEMBER(tokyowar_mcu_adc_r);
200   DECLARE_READ8_MEMBER(aquajet_mcu_adc_r);
201   DECLARE_READ8_MEMBER(airco22_mcu_adc_r);
202   DECLARE_READ8_MEMBER(mcu_port4_s22_r);
203   DECLARE_READ16_MEMBER(mcu141_speedup_r);
204   DECLARE_WRITE16_MEMBER(mcu_speedup_w);
205   DECLARE_READ16_MEMBER(mcu130_speedup_r);
206   DECLARE_READ16_MEMBER(mcuc74_speedup_r);
207   UINT32 ReadFromCommRAM(offs_t offs );
208   void WriteToCommRAM(offs_t offs, UINT32 data );
209   void WriteToPointRAM(offs_t offs, UINT32 data );
131210};
132211
133212
src/mame/includes/xybots.h
r14896r14897
1313      : atarigen_state(mconfig, type, tag) { }
1414
1515   UINT16         m_h256;
16   DECLARE_READ16_MEMBER(special_port1_r);
1617};
1718
1819
src/mame/includes/atarisy1.h
r14896r14897
4242   UINT8         m_bank_color_shift[MAX_GFX_ELEMENTS];
4343
4444   UINT8         m_cur[2][2];
45   DECLARE_READ16_MEMBER(joystick_r);
46   DECLARE_WRITE16_MEMBER(joystick_w);
47   DECLARE_READ16_MEMBER(trakball_r);
48   DECLARE_READ16_MEMBER(port4_r);
49   DECLARE_READ8_MEMBER(switch_6502_r);
50   DECLARE_WRITE8_MEMBER(led_w);
4551};
4652
4753
src/mame/includes/atarig42.h
r14896r14897
3131
3232   device_t *      m_rle;
3333   UINT32         m_last_accesses[8];
34   DECLARE_READ16_MEMBER(special_port2_r);
35   DECLARE_WRITE16_MEMBER(a2d_select_w);
36   DECLARE_READ16_MEMBER(a2d_data_r);
37   DECLARE_WRITE16_MEMBER(io_latch_w);
38   DECLARE_WRITE16_MEMBER(mo_command_w);
39   DECLARE_READ16_MEMBER(roadriot_sloop_data_r);
40   DECLARE_WRITE16_MEMBER(roadriot_sloop_data_w);
41   DECLARE_READ16_MEMBER(guardians_sloop_data_r);
42   DECLARE_WRITE16_MEMBER(guardians_sloop_data_w);
43   void roadriot_sloop_tweak(int offset);
44   void guardians_sloop_tweak(int offset);
3445};
3546
3647
src/mame/includes/vindictr.h
r14896r14897
1515   UINT8         m_playfield_tile_bank;
1616   UINT16         m_playfield_xscroll;
1717   UINT16         m_playfield_yscroll;
18   DECLARE_READ16_MEMBER(port1_r);
1819};
1920
2021
src/mame/includes/midvunit.h
r14896r14897
7878   DECLARE_WRITE32_MEMBER(midvunit_paletteram_w);
7979   DECLARE_WRITE32_MEMBER(midvunit_textureram_w);
8080   DECLARE_READ32_MEMBER(midvunit_textureram_r);
81   DECLARE_READ32_MEMBER(port0_r);
82   DECLARE_READ32_MEMBER(midvunit_adc_r);
83   DECLARE_WRITE32_MEMBER(midvunit_adc_w);
84   DECLARE_WRITE32_MEMBER(midvunit_cmos_protect_w);
85   DECLARE_WRITE32_MEMBER(midvunit_cmos_w);
86   DECLARE_READ32_MEMBER(midvunit_cmos_r);
87   DECLARE_WRITE32_MEMBER(midvunit_control_w);
88   DECLARE_WRITE32_MEMBER(crusnwld_control_w);
89   DECLARE_WRITE32_MEMBER(midvunit_sound_w);
90   DECLARE_READ32_MEMBER(tms32031_control_r);
91   DECLARE_WRITE32_MEMBER(tms32031_control_w);
92   DECLARE_READ32_MEMBER(crusnwld_serial_status_r);
93   DECLARE_READ32_MEMBER(crusnwld_serial_data_r);
94   DECLARE_WRITE32_MEMBER(crusnwld_serial_data_w);
95   DECLARE_READ32_MEMBER(bit_data_r);
96   DECLARE_WRITE32_MEMBER(bit_reset_w);
97   DECLARE_READ32_MEMBER(offroadc_serial_status_r);
98   DECLARE_READ32_MEMBER(offroadc_serial_data_r);
99   DECLARE_WRITE32_MEMBER(offroadc_serial_data_w);
100   DECLARE_READ32_MEMBER(midvplus_misc_r);
101   DECLARE_WRITE32_MEMBER(midvplus_misc_w);
102   DECLARE_READ32_MEMBER(generic_speedup_r);
81103};
82104
83105
src/mame/includes/atarisy2.h
r14896r14897
4545   UINT32         m_spin_center_count;
4646
4747   UINT16         m_vram[0x8000/2];
48   DECLARE_WRITE16_MEMBER(int0_ack_w);
49   DECLARE_WRITE16_MEMBER(int1_ack_w);
50   DECLARE_WRITE16_MEMBER(int_enable_w);
51   DECLARE_WRITE16_MEMBER(bankselect_w);
52   DECLARE_READ16_MEMBER(switch_r);
53   DECLARE_READ8_MEMBER(switch_6502_r);
54   DECLARE_WRITE8_MEMBER(switch_6502_w);
55   DECLARE_WRITE16_MEMBER(adc_strobe_w);
56   DECLARE_READ16_MEMBER(adc_r);
57   DECLARE_READ8_MEMBER(leta_r);
58   DECLARE_WRITE8_MEMBER(mixer_w);
59   DECLARE_WRITE8_MEMBER(sound_reset_w);
60   DECLARE_READ16_MEMBER(sound_r);
61   DECLARE_WRITE8_MEMBER(sound_6502_w);
62   DECLARE_READ8_MEMBER(sound_6502_r);
63   DECLARE_WRITE8_MEMBER(tms5220_w);
64   DECLARE_WRITE8_MEMBER(tms5220_strobe_w);
65   DECLARE_WRITE8_MEMBER(coincount_w);
4866};
4967
5068
src/mame/includes/spacefb.h
r14896r14897
4242   double m_color_weights_b[2];
4343   DECLARE_WRITE8_MEMBER(spacefb_port_0_w);
4444   DECLARE_WRITE8_MEMBER(spacefb_port_2_w);
45   DECLARE_READ8_MEMBER(spacefb_audio_p2_r);
46   DECLARE_READ8_MEMBER(spacefb_audio_t0_r);
47   DECLARE_READ8_MEMBER(spacefb_audio_t1_r);
48   DECLARE_WRITE8_MEMBER(spacefb_port_1_w);
4549};
4650
4751
r14896r14897
4953
5054MACHINE_CONFIG_EXTERN( spacefb_audio );
5155
52READ8_HANDLER( spacefb_audio_p2_r );
53READ8_HANDLER( spacefb_audio_t0_r );
54READ8_HANDLER( spacefb_audio_t1_r );
55WRITE8_HANDLER( spacefb_port_1_w );
5656
5757
5858/*----------- defined in video/spacefb.c -----------*/
src/mame/includes/n8080.h
r14896r14897
4242   DECLARE_WRITE8_MEMBER(n8080_shift_data_w);
4343   DECLARE_READ8_MEMBER(n8080_shift_r);
4444   DECLARE_WRITE8_MEMBER(n8080_video_control_w);
45   DECLARE_WRITE8_MEMBER(n8080_sound_1_w);
46   DECLARE_WRITE8_MEMBER(n8080_sound_2_w);
47   DECLARE_READ8_MEMBER(n8080_8035_p1_r);
48   DECLARE_READ8_MEMBER(n8080_8035_t0_r);
49   DECLARE_READ8_MEMBER(n8080_8035_t1_r);
50   DECLARE_READ8_MEMBER(helifire_8035_t0_r);
51   DECLARE_READ8_MEMBER(helifire_8035_t1_r);
52   DECLARE_READ8_MEMBER(helifire_8035_external_ram_r);
53   DECLARE_READ8_MEMBER(helifire_8035_p2_r);
54   DECLARE_WRITE8_MEMBER(n8080_dac_w);
55   DECLARE_WRITE8_MEMBER(helifire_dac_w);
56   DECLARE_WRITE8_MEMBER(helifire_sound_ctrl_w);
4557};
4658
4759
r14896r14897
7587MACHINE_RESET( sheriff_sound );
7688MACHINE_RESET( helifire_sound );
7789
78WRITE8_HANDLER( n8080_sound_1_w );
79WRITE8_HANDLER( n8080_sound_2_w );
src/mame/includes/seta.h
r14896r14897
9292   DECLARE_WRITE16_MEMBER(seta_vram_0_w);
9393   DECLARE_WRITE16_MEMBER(seta_vram_2_w);
9494   DECLARE_WRITE16_MEMBER(twineagl_tilebank_w);
95   DECLARE_WRITE16_MEMBER(timer_regs_w);
96   DECLARE_READ16_MEMBER(sharedram_68000_r);
97   DECLARE_WRITE16_MEMBER(sharedram_68000_w);
98   DECLARE_WRITE16_MEMBER(sub_ctrl_w);
99   DECLARE_READ16_MEMBER(seta_dsw_r);
100   DECLARE_READ16_MEMBER(calibr50_ip_r);
101   DECLARE_WRITE16_MEMBER(calibr50_soundlatch_w);
102   DECLARE_READ16_MEMBER(usclssic_dsw_r);
103   DECLARE_READ16_MEMBER(usclssic_trackball_x_r);
104   DECLARE_READ16_MEMBER(usclssic_trackball_y_r);
105   DECLARE_WRITE16_MEMBER(usclssic_lockout_w);
106   DECLARE_READ16_MEMBER(zombraid_gun_r);
107   DECLARE_WRITE16_MEMBER(zombraid_gun_w);
108   DECLARE_READ16_MEMBER(zingzipbl_unknown_r);
109   DECLARE_READ16_MEMBER(keroppi_protection_r);
110   DECLARE_READ16_MEMBER(keroppi_protection_init_r);
111   DECLARE_READ16_MEMBER(keroppi_coin_r);
112   DECLARE_WRITE16_MEMBER(keroppi_prize_w);
113   DECLARE_WRITE16_MEMBER(setaroul_spriteylow_w);
114   DECLARE_WRITE16_MEMBER(setaroul_spritectrl_w);
115   DECLARE_WRITE16_MEMBER(setaroul_spritecode_w);
116   DECLARE_READ16_MEMBER(setaroul_spritecode_r);
117   DECLARE_READ16_MEMBER(krzybowl_input_r);
118   DECLARE_WRITE16_MEMBER(msgundam_vregs_w);
119   DECLARE_READ16_MEMBER(kiwame_nvram_r);
120   DECLARE_WRITE16_MEMBER(kiwame_nvram_w);
121   DECLARE_READ16_MEMBER(kiwame_input_r);
122   DECLARE_READ16_MEMBER(thunderl_protection_r);
123   DECLARE_WRITE16_MEMBER(thunderl_protection_w);
124   DECLARE_READ8_MEMBER(wiggie_soundlatch_r);
125   DECLARE_WRITE16_MEMBER(wiggie_soundlatch_w);
126   DECLARE_WRITE16_MEMBER(utoukond_soundlatch_w);
127   DECLARE_READ16_MEMBER(pairlove_prot_r);
128   DECLARE_WRITE16_MEMBER(pairlove_prot_w);
129   DECLARE_READ16_MEMBER(inttoote_dsw_r);
130   DECLARE_READ16_MEMBER(inttoote_key_r);
131   DECLARE_READ16_MEMBER(inttoote_700000_r);
132   DECLARE_READ16_MEMBER(jockeyc_mux_r);
133   DECLARE_WRITE16_MEMBER(jockeyc_mux_w);
134   DECLARE_READ16_MEMBER(unk_r);
135   DECLARE_WRITE8_MEMBER(sub_bankswitch_w);
136   DECLARE_WRITE8_MEMBER(sub_bankswitch_lockout_w);
137   DECLARE_READ8_MEMBER(ff_r);
138   DECLARE_READ8_MEMBER(downtown_ip_r);
139   DECLARE_WRITE8_MEMBER(calibr50_soundlatch2_w);
140   DECLARE_READ16_MEMBER(twineagl_debug_r);
141   DECLARE_READ16_MEMBER(twineagl_200100_r);
142   DECLARE_WRITE16_MEMBER(twineagl_200100_w);
143   DECLARE_READ16_MEMBER(downtown_protection_r);
144   DECLARE_WRITE16_MEMBER(downtown_protection_w);
145   DECLARE_READ16_MEMBER(arbalest_debug_r);
95146};
96147
97148/*----------- defined in video/seta.c -----------*/
src/mame/includes/laserbat.h
r14896r14897
6363   DECLARE_READ8_MEMBER(laserbat_input_r);
6464   DECLARE_WRITE8_MEMBER(laserbat_cnteff_w);
6565   DECLARE_WRITE8_MEMBER(laserbat_cntmov_w);
66   DECLARE_WRITE8_MEMBER(laserbat_csound1_w);
67   DECLARE_WRITE8_MEMBER(laserbat_csound2_w);
6668};
6769
6870
6971/*----------- defined in audio/laserbat.c -----------*/
7072
71WRITE8_HANDLER( laserbat_csound1_w );
72WRITE8_HANDLER( laserbat_csound2_w );
src/mame/includes/bfm_sc45.h
r14896r14897
1919   ROM_LOAD( "95009013.bin", 0x0000, 0x0f3ee2, CRC(f324a590) SHA1(0533af3304100c99af5fdeba2773d92384101f43) ) \
2020
2121#define sc_a40_others \
22   ROM_REGION( 0x1000000, "ymz", ROMREGION_ERASE00 ) \
23   ROM_LOAD( "95008511.bin", 0x0000, 0x0ff5c3, CRC(6fac2014) SHA1(5b364406f7b5d8f4c54561e3977571e4a47273a0) ) \
2224   ROM_REGION( 0x5000, "pics", 0 ) \
2325   ROM_LOAD( "95890123.bin", 0x0000, 0x5000, CRC(e3f5466e) SHA1(ae2f45f79d0113e651b8cf5f655a9ceb32a3ddaa) ) \
2426   ROM_LOAD( "95890124.bin", 0x0000, 0x5000, CRC(9663025a) SHA1(097246412fd4084c1185d8dfd91e884abc5a3f8a) ) \
2527   ROM_LOAD( "95890125.bin", 0x0000, 0x5000, CRC(08d9ce06) SHA1(9087170d6c6edad735ab5a2abbc0a2191aabfd03) ) \
26   ROM_REGION( 0x1000000, "ymz", ROMREGION_ERASE00 ) \
27   ROM_LOAD( "95008511.bin", 0x0000, 0x0ff5c3, CRC(6fac2014) SHA1(5b364406f7b5d8f4c54561e3977571e4a47273a0) ) \
2828
2929#define sc_acesh_others \
3030   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
r14896r14897
9696   ROM_LOAD( "95890436.bin", 0x0000, 0x5000, CRC(dc58813d) SHA1(9bad2c6cdacaa016f5239e578600f1ff03f1ed63) ) \
9797
9898#define sc_bar7_others \
99   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
99   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) /* PR1433 BAR SEVENS SOUNDS11 */ \
100100   ROM_LOAD( "95008409.bin", 0x0000, 0x080000, CRC(ec29c758) SHA1(ceb99fb6edcab5c5e1b0ec46d622ee0f2cdb20be) ) \
101   ROM_REGION( 0x400000, "others1", ROMREGION_ERASE00 )  /* PR1436 TRIPLE CASINO SOUNDS11 */ \
101102   ROM_LOAD( "95008423.bin", 0x0000, 0x100000, CRC(4cab20ee) SHA1(e27221a94e54db340eaf7fc30e722b354c85686d) ) \
102   ROM_LOAD( "95008502.bin", 0x0000, 0x080000, CRC(d9bc2c75) SHA1(b9e637d47287a844a6ff1f0b1d1a34b48a806aad) ) \
103   ROM_REGION( 0x400000, "other", ROMREGION_ERASE00 ) /* shouldn't be here? - sc1/2 */ \
103   ROM_REGION( 0x400000, "others3", ROMREGION_ERASE00 ) /* shouldn't be here? - sc1/2 */ \
104104   ROM_LOAD( "95751960.p1", 0x0000, 0x010000, CRC(9f944d0c) SHA1(feb8fe4ce0a8f5c4a034aafec0f5aae29a834e8d) ) \
105105
106#define PR1492_CAS_BAR_SEVENS_SOUNDS11 \
107   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) /* PR1492 CAS BAR SEVENS SOUNDS11 */ \
108   ROM_LOAD( "95008502.bin", 0x0000, 0x080000, CRC(d9bc2c75) SHA1(b9e637d47287a844a6ff1f0b1d1a34b48a806aad) ) \
109
106110#define sc_batl_others \
107111   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
108112   ROM_LOAD( "95008541.bin", 0x000000, 0x100000, CRC(a739cba8) SHA1(b968cfa18c671aaf027909961a843fc01101d68a) ) \
r14896r14897
183187
184188#define sc_bull_others \
185189   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
186   ROM_LOAD( "95008520.bin", 0x0000, 0x100000, CRC(ab418ce0) SHA1(39afbd449a21a31016acaffcfb4f6d684db300e7) ) /* PR1702 BULLSEYE */ \
187   ROM_LOAD( "95008521.bin", 0x0000, 0x100000, CRC(7fd0f70c) SHA1(e6bf85b9e2528dac5811277ee89599e58e6358b0) ) \
188   ROM_LOAD( "95008544.bin", 0x0000, 0x100000, CRC(19777f20) SHA1(da0cc08b00f9ab565a0e559761adbf7bcd7c327b) ) /* PR1743 CASINO BULLSEYE */ \
189   ROM_LOAD( "95008575.bin", 0x0000, 0x100000, CRC(715901d2) SHA1(a7d3d0c7b9fc3eefb0df372cdf0cae7abe8bd959) ) /* PR1758 BULLSEYE TRIPLE */ \
190   ROM_LOAD( "95009116.bin", 0x0000, 0x100000, CRC(5a01e206) SHA1(38ee3706d9edb68d17c90bb627aa17b4f908d721) ) /* PR3318 BULLSEYE */ \
191   ROM_LOAD( "95009117.bin", 0x0000, 0x100000, CRC(c3623829) SHA1(92b0cf89678023bb02394699e2e214389317ec6c) ) \
190   ROM_LOAD( "95008520.bin", 0x000000, 0x100000, CRC(ab418ce0) SHA1(39afbd449a21a31016acaffcfb4f6d684db300e7) ) \
191   ROM_LOAD( "95008521.bin", 0x100000, 0x100000, CRC(7fd0f70c) SHA1(e6bf85b9e2528dac5811277ee89599e58e6358b0) ) \
192192
193#define PR1743_CASINO_BULLSEYE_SOUNDS11 \
194   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
195   ROM_LOAD( "95008544.bin", 0x000000, 0x100000, CRC(19777f20) SHA1(da0cc08b00f9ab565a0e559761adbf7bcd7c327b) ) \
196
197#define PR1758_BULLSEYE_TRIPLE_SOUNDS11 \
198   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
199   ROM_LOAD( "95008575.bin", 0x000000, 0x100000, CRC(715901d2) SHA1(a7d3d0c7b9fc3eefb0df372cdf0cae7abe8bd959) ) \
200
201#define PR3318_BULLSEYE_SOUNDS11 \
202   ROM_LOAD( "95009116.bin", 0x000000, 0x100000, CRC(5a01e206) SHA1(38ee3706d9edb68d17c90bb627aa17b4f908d721) ) \
203   ROM_LOAD( "95009117.bin", 0x100000, 0x100000, CRC(c3623829) SHA1(92b0cf89678023bb02394699e2e214389317ec6c) ) \
204
205
206
193207#define sc_butch_others \
194208   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
195209   ROM_LOAD( "95008604.bin", 0x000000, 0x100000, CRC(dede59e0) SHA1(de56b80d0a53fbb18acce2b907f48801e8fced12) ) \
r14896r14897
237251   ROM_LOAD( "95891125.bin", 0x0000, 0x5000, CRC(9a241a4a) SHA1(3383c31a1de5f4a0ced5e3346de7b7e1f7fdbe04) ) \
238252   ROM_LOAD( "95891126.bin", 0x0000, 0x5000, CRC(049ed616) SHA1(2c29271dfebff92b3f537dd3cc89aea53decf978) ) \
239253   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
240   ROM_LOAD( "95009017.bin", 0x0000, 0x100000, CRC(4df62a63) SHA1(1d3b7927683d45bf81c038527b57881a58657e21) ) \
241   ROM_LOAD( "95009018.bin", 0x0000, 0x030022, CRC(90c95f34) SHA1(a63d52b7ec202f6757ed24251e542be2409ba2a9) ) \
254   ROM_LOAD( "95009017.bin", 0x000000, 0x100000, CRC(4df62a63) SHA1(1d3b7927683d45bf81c038527b57881a58657e21) ) \
255   ROM_LOAD( "95009018.bin", 0x100000, 0x030022, CRC(90c95f34) SHA1(a63d52b7ec202f6757ed24251e542be2409ba2a9) ) \
242256
243257#define sc_clcas_others \
244258   ROM_REGION( 0x5000, "pics", 0 ) \
r14896r14897
261275   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
262276   ROM_LOAD( "95008988.bin", 0x0000, 0x0d23ea, CRC(b33581a0) SHA1(667bf4e499b50fd072313bad671ffcbd299fd97b) ) \
263277
264#define sc_cmony_others \
278#define PR3502_C_OF_M_TEN_SOUNDS11 \
265279   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
266280   ROM_LOAD( "95009031.bin", 0x000000, 0x100000, CRC(58ded502) SHA1(27c05614b03b51fe4a168b8c64535ec3ca9e85c1) ) \
267281   ROM_LOAD( "95009032.bin", 0x100000, 0x100000, CRC(e1eb711a) SHA1(f6c0c10992f2aacd6f9fadc4e15d8ad5ba5b4ed8) ) \
282
283#define PR3317_COLOUR_OF_MONEY_SOUNDS11 \
284   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
268285   ROM_LOAD( "95009124.bin", 0x000000, 0x100000, CRC(798d8d5a) SHA1(931bfca5d204c62fc834959d9babcd9488fc7f07) ) \
269286   ROM_LOAD( "95009125.bin", 0x100000, 0x100000, CRC(d6090812) SHA1(16ca4868725eff0cc4bd056d751dc7861c1e53a1) ) \
270287
r14896r14897
279296   ROM_LOAD( "95009036.bin", 0x100000, 0x100000, CRC(757f44b9) SHA1(61fe15024f7c7f97f865b1b666a5f837a57446a5) ) \
280297
281298#define sc_cfpt_others \
282   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
283   ROM_LOAD( "95008363.bin", 0x000000, 0x100000, CRC(6d211d7b) SHA1(59dbb6201aa355a585253d17302e4f8ceed9a220) ) \
299   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) /* PR1359 CRAZY F PARTY SOUNDS11 */ \
284300   ROM_LOAD( "95008348.bin", 0x000000, 0x100000, CRC(9c6db3d1) SHA1(f2f613326d0a8c0a1c2e1eea1e91ed34cd344f41) ) \
301   ROM_REGION( 0x400000, "others1", ROMREGION_ERASE00 ) /* PR1359 TB CRAZY F P SOUNDS11 (topbox rom?)*/ \
285302   ROM_LOAD( "95008349.bin", 0x100000, 0x100000, CRC(6f7716a0) SHA1(75f8fbee605b96e36e8596068dd4570928a5a02d) ) \
303   ROM_REGION( 0x400000, "others2", ROMREGION_ERASE00 ) /* PR1359 TB CRAZY F P SOUNDS11 (alt topbox rom?) */ \
304   ROM_LOAD( "95008363.bin", 0x000000, 0x100000, CRC(6d211d7b) SHA1(59dbb6201aa355a585253d17302e4f8ceed9a220) ) \
286305
287306#define sc_cknig_others \
288307   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
r14896r14897
335354
336355#define sc_cerup_others \
337356   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
357   ROM_LOAD( "cash erruption sounds", 0x000000, 0x100000, NO_DUMP ) \
338358
339359#define sc_cexpl_others \
340360   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
361   ROM_LOAD( "cash explosion sounds", 0x000000, 0x100000, NO_DUMP ) \
341362
342363#define sc_chand_others \
343364   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
r14896r14897
374395
375396#define sc_clucl_others \
376397   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
398   ROM_LOAD( "clucl sounds", 0x000000, 0x100000, NO_DUMP ) \
377399
378400#define sc_colos_others \
379401   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
r14896r14897
420442   ROM_LOAD( "95890308.bin", 0x0000, 0x5000, CRC(04de60b0) SHA1(cee280d9528f9e167be1c373e7a99f1f2f1bc1c0) ) \
421443
422444#define sc_cari_others \
423   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
424   ROM_LOAD( "97000070.bin", 0x0000, 0x0f8526, CRC(27ba6768) SHA1(708e836f3fc35fabd0a5c8dc9cd8e9327d7bcdc7) ) \
425   ROM_LOAD( "95008981.bin", 0x0000, 0x0ff245, CRC(3a888f98) SHA1(b113c17acda287200fdcd734a1b384879a5e7101) ) \
426   ROM_LOAD( "caribbeancashsnd1.bin", 0x0000, 0x080000, CRC(89da9fc4) SHA1(d56364e2e71d03d7d8888966b64ff1fab4bfc3e9) ) \
427   ROM_LOAD( "caribbeancashsnd2.bin", 0x0000, 0x080000, CRC(99d33f61) SHA1(7caf3b9540372900e90a7141f14383fe06936a2e) ) \
445   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) /* CARIBBEANSND */ \
446   ROM_LOAD( "97000070.bin", 0x000000, 0x0f8526, CRC(27ba6768) SHA1(708e836f3fc35fabd0a5c8dc9cd8e9327d7bcdc7) ) \
447   ROM_REGION( 0x400000, "others1", ROMREGION_ERASE00 ) /* CARIBBEANSND (same data?) */ \
448   ROM_LOAD( "caribbeancashsnd1.bin", 0x000000, 0x080000, CRC(89da9fc4) SHA1(d56364e2e71d03d7d8888966b64ff1fab4bfc3e9) ) \
449   ROM_LOAD( "caribbeancashsnd2.bin", 0x080000, 0x080000, CRC(99d33f61) SHA1(7caf3b9540372900e90a7141f14383fe06936a2e) ) \
450   ROM_REGION( 0x400000, "others2", ROMREGION_ERASE00 ) /* CABC SOUNDS */ \
451   ROM_LOAD( "95008981.bin", 0x000000, 0x0ff245, CRC(3a888f98) SHA1(b113c17acda287200fdcd734a1b384879a5e7101) ) \
428452   ROM_REGION( 0x5000, "pics", 0 ) \
429453   ROM_LOAD( "95890474.bin", 0x0000, 0x5000, CRC(bcb54114) SHA1(0236171b34f3e47db9aa253f9605ff6bd21b1460) ) \
430454   ROM_LOAD( "95890475.bin", 0x0000, 0x5000, CRC(c9230520) SHA1(5cf9c3d130f114dac633d696e0bf1bda94afb9ee) ) \
r14896r14897
445469
446470#define sc_clue_others \
447471   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
448   \
472   ROM_LOAD( "clue sounds", 0x0000, 0x100000, NO_DUMP ) \
449473   ROM_REGION( 0x5000, "pics", 0 ) \
450474   ROM_LOAD( "95890356.bin", 0x0000, 0x5000, CRC(fd78e03f) SHA1(029e2fd7e9cff3793d905d192c889873ad2a0d26) ) \
451475   ROM_LOAD( "95890357.bin", 0x0000, 0x5000, CRC(88eea40b) SHA1(5a730add3f9941dfcbfa5cd8f6a6142d19065482) ) \
r14896r14897
468492   ROM_LOAD( "95008681.bin", 0x0000, 0x100000, CRC(7a459110) SHA1(51f0a51af485a0f4e447ee0c22f488a924e45117) ) \
469493
470494#define sc_cfqps_others \
471   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
495   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) /* PR6813 CRAZY FRUITS SOUNDS11 */ \
472496   ROM_LOAD( "95004101.bin", 0x000000, 0x080000, CRC(31e5785a) SHA1(8da2bd3571640b0ae23e9fdcc2235dcf9d2de122) ) \
473497   ROM_LOAD( "95004102.bin", 0x080000, 0x080000, CRC(bf059b21) SHA1(89a96c593e5385e9b40f694768986691eed4b5c5) ) \
498   ROM_REGION( 0x400000, "others", ROMREGION_ERASE00 ) /* PR6813 CRAZY FRUITS SOUNDS11 (same data?) */ \
474499   ROM_LOAD( "95008339.bin", 0x000000, 0x100000, CRC(bae07fa8) SHA1(a86a5d9ff6ac802bd15275f46894374317627e23) ) \
475   \
476   ROM_REGION( 0x400000, "others", ROMREGION_ERASE00 )   \
477   ROM_LOAD( "95420324.bin", 0x0000, 0x100000, CRC(41729e8f) SHA1(adb15067f61eb2e4adf537137dd24876749da8a2) ) \
478500
479501#define sc_czfr_others \
480   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
481   /* 3 different sets of sound! */ \
502   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) /* PR6813 CRAZY FRUITS SOUNDS11 */ \
482503   ROM_LOAD( "crazy sound 1.bin", 0x000000, 0x080000, CRC(31e5785a) SHA1(8da2bd3571640b0ae23e9fdcc2235dcf9d2de122) ) \
483504   ROM_LOAD( "crazy sound 2.bin", 0x080000, 0x080000, CRC(bf059b21) SHA1(89a96c593e5385e9b40f694768986691eed4b5c5) ) \
484505   \
506   ROM_REGION( 0x400000, "others", ROMREGION_ERASE00 ) \
507   ROM_LOAD( "oki_sound_rom--ccfsnd.bin", 0x0000, 0x02196a, CRC(15e542c2) SHA1(9bd9218b7392c882f68e330619bea7996afd001e) ) /* oki sound rom, doubt it belongs here */ \
508
509#define SOUND_95004150_CRAZY_FRUITS_PR6982 \
485510   ROM_LOAD( "95004150.bin", 0x000000, 0x080000, CRC(7707ea0d) SHA1(efe187a4c64a3a5f8d10e21c269afbb603186ae7) ) \
486511   ROM_LOAD( "95004151.bin", 0x080000, 0x080000, CRC(54845756) SHA1(e53dfa8f836044232ee1a8006051ef586ac24d8c) ) \
487   \
512
513#define PR1152_CRAZY_FRUITS_SOUNDS11 \
514   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
488515   ROM_LOAD( "95004280.sn1", 0x000000, 0x080000, CRC(44d1b0d9) SHA1(2e361a1b65955acecbc26ba47000e4ef6316a22d) ) \
489516   ROM_LOAD( "95004281.sn2", 0x080000, 0x080000, CRC(31f057f3) SHA1(a6415eee8499ada43225901dee2d12c93d494658) ) \
490   \
491   ROM_REGION( 0x400000, "others", ROMREGION_ERASE00 ) \
492   ROM_LOAD( "ccfsnd.bin", 0x0000, 0x02196a, CRC(15e542c2) SHA1(9bd9218b7392c882f68e330619bea7996afd001e) ) /* oki sound rom, doubt it belongs here */ \
493517
518
494519#define sc_crnjw_others \
495520   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
496521   ROM_LOAD( "95008469.bin", 0x0000, 0x100000, CRC(07df5a41) SHA1(56dacba05e26258e50085f78dfe965196917addf) ) /* PR1608 CROWN JEWELS SOUNDS11 */ \
497   \
498   ROM_LOAD( "95009176.bin", 0x000000, 0x100000, CRC(d1db2564) SHA1(641f94108df9dffde599012018d944e3848f50ed) ) /* PR000055 CJEWELS */ \
522
523#define PR000055_CJEWELS \
524   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
525   ROM_LOAD( "95009176.bin", 0x000000, 0x100000, CRC(d1db2564) SHA1(641f94108df9dffde599012018d944e3848f50ed) ) \
499526   ROM_LOAD( "95009177.bin", 0x100000, 0x100000, CRC(e574cc1c) SHA1(760284d60d336571495da921ff666ac5725d7c19) ) \
500527
501528#define sc_cclim_others \
r14896r14897
617644   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
618645   ROM_LOAD( "95008293.bin", 0x0000, 0x100000, CRC(acbed8e1) SHA1(607dafa2215632d02c34e65b79bf1341b981f63b) ) \
619646
620#define sc_dnd_others \
647/* PR1954 */
648
649#define PR1954_CASINO_DOND_R_SOUNDS11 \
621650   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
622   /* Regular */ \
623   ROM_LOAD( "95008606.bin", 0x000000, 0x100000, CRC(c63c8663) SHA1(4718baf87340fe93ccfe642a1a0cdb9d9dcac57f) ) /* 0 (1907)  DOND SOUNDS 11 */ \
624   ROM_LOAD( "95008607.bin", 0x100000, 0x100000, CRC(a615514f) SHA1(d4ff7d4fe6f1dd1d7b00cc504f90b2921aa5e8fb) ) /* 1 */ \
625   \
626   ROM_REGION( 0x400000, "others", ROMREGION_ERASE00 ) \
627   /*  Casino */ \
628   ROM_LOAD( "95008631.bin", 0x000000, 0x100000, CRC(7208854a) SHA1(a02de60cfcbafe5da4f67596ab65237f5b5f41b7) ) /* 0 (1954) DOND SOUNDS 11 */ \
629   \
630   ROM_LOAD( "95008632.bin", 0x000000, 0x100000, CRC(fd81a317) SHA1(1e597fd58aab5a7a8321dc4daf138ee07b42c094) ) /* 0 (1945) DOND SOUNDS 11 */ \
631   ROM_LOAD( "95008633.bin", 0x100000, 0x100000, CRC(a7a445d4) SHA1(dbb1938c33ce654c2d4aa3b6af8c210f5aad2ae3) ) /* 1 */ \
632   \
633   /*  Casino */ \
634   ROM_LOAD( "95008661.bin", 0x000000, 0x100000, CRC(2d9ebcd5) SHA1(d824a227420cbe616aca6e2fd279af691ddfd87a) ) /* 0 (1945) DOND SOUNDS 12 */ \
635   \
636   ROM_LOAD( "95008680.bin", 0x000000, 0x100000, CRC(9bd439d1) SHA1(5e71d04e5697e92998bae28f7352ea7742cafe07) ) /* 0 (1964) DOND SOUNDS 11 */ \
637   \
638   ROM_LOAD( "95008698.bin", 0x000000, 0x100000, CRC(8eea7754) SHA1(7612c128d6c062bba3477d55aee3089e1255f61e) ) /* 0 (1964) DOND SOUNDS 12 */ \
651   ROM_LOAD( "95008631.bin", 0x000000, 0x100000, CRC(7208854a) SHA1(a02de60cfcbafe5da4f67596ab65237f5b5f41b7) ) \
639652
653/* PR1945 */
640654
655#define PR1945_CASINO_DOND_R_SOUNDS12 \
656   ROM_LOAD( "95008661.bin", 0x000000, 0x100000, CRC(2d9ebcd5) SHA1(d824a227420cbe616aca6e2fd279af691ddfd87a) ) \
657
658#define PR1945_CASINO_D_O_N_D_SOUNDS11 \
659   ROM_LOAD( "95008632.bin", 0x000000, 0x100000, CRC(fd81a317) SHA1(1e597fd58aab5a7a8321dc4daf138ee07b42c094) ) \
660   ROM_LOAD( "95008633.bin", 0x100000, 0x100000, CRC(a7a445d4) SHA1(dbb1938c33ce654c2d4aa3b6af8c210f5aad2ae3) ) \
661
662/* PR1964 */
663
664#define PR1964_CASINO_DOND_SOUNDS11 \
665   ROM_LOAD( "95008680.bin", 0x000000, 0x100000, CRC(9bd439d1) SHA1(5e71d04e5697e92998bae28f7352ea7742cafe07) ) \
666
667#define PR1964_CASINO_DOND_SOUNDS12 \
668   ROM_LOAD( "95008698.bin", 0x000000, 0x100000, CRC(8eea7754) SHA1(7612c128d6c062bba3477d55aee3089e1255f61e) ) \
669
670#define PR1964_DND \
671   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
672   PR1964_CASINO_DOND_SOUNDS11 \
673   PR1964_CASINO_DOND_SOUNDS12 \
674
675/* PR1907 */
676
677#define PR1907_DEAL_OR_NO_DEAL_SOUNDS11 \
678   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
679   ROM_LOAD( "95008606.bin", 0x000000, 0x100000, CRC(c63c8663) SHA1(4718baf87340fe93ccfe642a1a0cdb9d9dcac57f) ) \
680   ROM_LOAD( "95008607.bin", 0x100000, 0x100000, CRC(a615514f) SHA1(d4ff7d4fe6f1dd1d7b00cc504f90b2921aa5e8fb) ) \
681
682
683
641684#define sc_dndbb_others \
642685   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
643686   ROM_LOAD( "95008788.bin", 0x000000, 0x100000, CRC(51384d64) SHA1(3af87bcc7fb4881ae671d9cbb484fb6a2a534cce) ) \
r14896r14897
648691   ROM_LOAD( "95009158.bin", 0x000000, 0x100000, CRC(27f11b81) SHA1(f2690c2828ad09d73cb14c5c1cb53c2ad1fc7b53) ) \
649692   ROM_LOAD( "95009159.bin", 0x100000, 0x100000, CRC(95e278c8) SHA1(7d85b6dbe3ccacd6c5a5b4eb475598a3d5548ce0) ) \
650693
651#define   sc_dndbl_others \
652   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
653694
654695#define sc_dndbq_others \
655696   ROM_REGION( 0x5000, "pics", 0 ) \
r14896r14897
659700   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
660701   ROM_LOAD( "95008887.bin", 0x0000, 0x100000, CRC(53cb9dc5) SHA1(66cdf8624736ea5a4e239bdb81fc96366ec4623e) ) \
661702
703#define PR3068_BEAT_THE_BANKER_SOUNDS11 \
704   ROM_LOAD( "95008713.bin", 0x000000, 0x100000, CRC(7311db5e) SHA1(24a4b3f44fa6dbbe756b0acac2b513c6e92cdf26) ) \
705   ROM_LOAD( "95008714.bin", 0x100000, 0x100000, CRC(c6ebc845) SHA1(6a135f42940b8c44422736650e369fa12b51e0df) ) \
706
707
662708#define sc_dndcl_others \
663709   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
664   /* club dond */ \
665710   ROM_LOAD( "95008629.bin", 0x000000, 0x100000, CRC(6f7cf500) SHA1(bf3db728872251116b32aa2c44f72a87d29b13d2) ) \
666711   ROM_LOAD( "95008630.bin", 0x100000, 0x100000, CRC(5dfda41e) SHA1(6d61d0eedc6a1599777f47d3880689f954f326c9) ) \
667   ROM_REGION( 0x400000, "others", ROMREGION_ERASE00 ) \
668   /* beat the banker */ \
669   ROM_LOAD( "95008713.bin", 0x000000, 0x100000, CRC(7311db5e) SHA1(24a4b3f44fa6dbbe756b0acac2b513c6e92cdf26) ) /* R3068? */ \
670   ROM_LOAD( "95008714.bin", 0x100000, 0x100000, CRC(c6ebc845) SHA1(6a135f42940b8c44422736650e369fa12b51e0df) ) \
671712
672713#define sc_dndcr_others \
673714   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
r14896r14897
801842   ROM_REGION( 0x400000, "others2", ROMREGION_ERASE00 ) /* PR3071 (alt checksum, extra sound??) */ \
802843    ROM_LOAD( "95008766.bin", 0x000000, 0x100000, CRC(62accb81) SHA1(ed0456cefed2fbf9a1cfd911f871262e892a4ce8) ) /* wiyb */ \
803844   ROM_REGION( 0x400000, "others3", ROMREGION_ERASE00 ) /* PR3084 (wrong game?) */ \
804ROM_LOAD( "95008767.bin", 0x000000, 0x100000, CRC(0aa49d8a) SHA1(a2baffc495656f0b5426b720cac298a78774b7fa) ) /* super slam?? */  \
845   ROM_LOAD( "95008767.bin", 0x000000, 0x100000, CRC(0aa49d8a) SHA1(a2baffc495656f0b5426b720cac298a78774b7fa) ) /* super slam?? */  \
805846
806847#define sc_dndpg_others \
807848   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
r14896r14897
10521093
10531094#define sc_gd_others \
10541095   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1096   /* PR1016 GOLD DIG SOUNDS11 */ \
10551097   ROM_LOAD( "95008187.bin", 0x000000, 0x100000, CRC(1fbbc7cc) SHA1(6e19b582a3654bbbcf65b8f42bd556029f43e8cb) ) \
10561098   ROM_LOAD( "95008188.bin", 0x100000, 0x100000, CRC(a74b23a7) SHA1(f7948edfb5524eaf80039c07ca7a9f76883f5a6f) ) \
1099   /* PR3509 GOLD DIGGER SOUNDS11 */ \
10571100   ROM_LOAD( "95009061.bin", 0x000000, 0x100000, CRC(c4cad720) SHA1(ce67af8d9e0b2f4f79d38b7a01dfc5ff7323e162) ) \
10581101   ROM_LOAD( "95009062.bin", 0x100000, 0x100000, CRC(509761d3) SHA1(6a133cc33bac6a1696de98a4961572a86cefc1c8) ) \
10591102
r14896r14897
11021145
11031146#define sc_hapnt_others \
11041147   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1148   /* PR1306 HAPPY NOTES SOUNDS11 */ \
11051149   ROM_LOAD( "95008290.bin", 0x000000, 0x100000, CRC(427fc43d) SHA1(c63154c7f2bb3e7ec78e31268a8040d0eb131f2f) ) \
1150   /* PR1327 CAS_HAPPY_NOTES SOUNDS11 */ \
11061151   ROM_LOAD( "95008312.bin", 0x100000, 0x100000, CRC(cf33e14d) SHA1(33382be257a145784d9de7050b5c90f725241de4) ) \
11071152
11081153#define sc_hfcl_others \
r14896r14897
11361181
11371182#define sc_hotwd_others \
11381183   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1184   /* PR1311 HOT WAD SOUNDS11 */ \
11391185   ROM_LOAD( "95008309.bin", 0x000000, 0x100000, CRC(8cd75778) SHA1(5d75c10b32477faa24c73ad03de75914385787f6) ) \
1140   ROM_LOAD( "95008334.bin", 0x100000, 0x100000, CRC(0c334241) SHA1(3e5bde03330a5684a2a40fa94b33345039cd3755) ) \
1186   ROM_REGION( 0x400000, "others", ROMREGION_ERASE00 ) \
1187   /* PR1367 CRAZYSLOTS SOUNDS11 */ \
1188   ROM_LOAD( "95008334.bin", 0x000000, 0x100000, CRC(0c334241) SHA1(3e5bde03330a5684a2a40fa94b33345039cd3755) ) \
11411189
11421190#define sc_celeb_others \
11431191   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
r14896r14897
12881336
12891337#define sc_monsp_others \
12901338   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1339   /* 95004291 MONEYSPINNER PR1158 */ \
12911340   ROM_LOAD( "95004291.snd", 0x000000, 0x080000, CRC(0ea304f7) SHA1(3d524e108cd12e83956fec3997316a92a9e0898d) ) \
1341   /* PR1026 MONEY SPIN SOUNDS11 */ \
12921342   ROM_LOAD( "95008183.bin", 0x000000, 0x080000, CRC(ab29f841) SHA1(908603184c3f7ead278dabd224d60e5362cdafbe) ) \
12931343   ROM_LOAD( "95008184.bin", 0x080000, 0x080000, CRC(45ef95ea) SHA1(1e1126b542621e723eaf6e38918162fe701247e0) ) \
12941344
12951345#define sc_monop_others \
12961346   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1347   /* MONO SOUNDS */ \
12971348   ROM_LOAD( "95008391.bin", 0x0000, 0x0ec7b3, CRC(fad36ca8) SHA1(67918353945429183befba56ab891a1d138f2e8b) ) \
1349   /* MPDX SOUNDS */ \
12981350   ROM_LOAD( "95008514.bin", 0x0000, 0x0ed840, CRC(2608cbde) SHA1(4831570fbc825592781e6473173d6ec911a0054d) ) \
12991351
13001352#define sc_mmm_others \
r14896r14897
13481400
13491401#define sc_mcas_others \
13501402   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1403   /* MONO SOUNDS */ \
13511404   ROM_LOAD( "95008436.bin", 0x0000, 0x0e6369, CRC(32e8df77) SHA1(fa044287970d4e54af53ff492eabc50afa9a7a92) ) \
1405   /* MONO SOUNDS */ \
13521406   ROM_LOAD( "95008991.bin", 0x0000, 0x0ec7b3, CRC(fad36ca8) SHA1(67918353945429183befba56ab891a1d138f2e8b) ) \
13531407   ROM_REGION( 0x5000, "pics", 0 ) \
13541408   ROM_LOAD( "95890727.bin", 0x0000, 0x5000, CRC(10ec3f00) SHA1(986bfce992e113bab26eea8d1981905a54367b94) ) \
r14896r14897
13611415   ROM_LOAD( "95890713.bin", 0x0000, 0x5000, CRC(f0bb40b7) SHA1(33c19dab3086cdeae4f503fbf3f3cc5f0dad98c4) ) \
13621416   ROM_LOAD( "95890714.bin", 0x0000, 0x5000, CRC(33e16227) SHA1(87efc1a046ef6af0b72cc76a6ee393a4d1ddbce3) ) \
13631417   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1418   /* PR1706 WHEEL OF WEALTH SOUNDS11 */ \
13641419   ROM_LOAD( "95008550.bin", 0x000000, 0x100000, CRC(db6343bf) SHA1(e4d702020af67aa5be0560027706c1cbf34296fa) ) \
1420   /* 95008551 STEPITS5 PR1666 */ \
13651421   ROM_LOAD( "95008551.bin", 0x100000, 0x100000, CRC(2d89a52a) SHA1(244101df7f6beae545f9b823750f908f532ac1e4) ) \
1422   /* WOW SOUNDS */ \
13661423   ROM_LOAD( "95008850.bin", 0x000000, 0x0af41f, CRC(8ca16e09) SHA1(9b494ad6946c2c7bbfad6591e62fa699fd53b6dc) ) \
1424   /* WOWT SOUNDS */ \
13671425   ROM_LOAD( "95008869.bin", 0x000000, 0x0b9d9d, CRC(f3ef3bbb) SHA1(92f9835e96c4fc444a451e97b2b8a7b66e5794b7) ) \
13681426
13691427#define sc_nmare_others \
13701428   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1429   /* PR3002 ELM STREET SOUNDS11 */ \
13711430   ROM_LOAD( "95008664.bin", 0x000000, 0x100000, CRC(54d245d7) SHA1(503db10681bc1d6cf1cffb2a6f818c5d912a7f56) ) \
13721431   ROM_LOAD( "95008665.bin", 0x100000, 0x100000, CRC(79a00527) SHA1(b8207d3a81e97b2233fea1df883a4128388570e4) ) \
1432   /* PR3002 ELM STREET SOUNDS11 (alt checksum..) */ \
13731433   ROM_LOAD( "95008703.bin", 0x000000, 0x100000, CRC(5c095089) SHA1(ffba71efccf4679c2b29ab620e67f3fa45ff19d4) ) \
13741434   ROM_LOAD( "95008704.bin", 0x100000, 0x100000, CRC(61e5d6f4) SHA1(6d221e0b3dce7507253bb7f07d99d03025d813cb) ) \
13751435
r14896r14897
14171477
14181478#define sc_pp_others \
14191479   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1480   /* PINK PANTHER SOUNDS */ \
14201481   ROM_LOAD( "95008942.bin", 0x0000, 0x0ebc96, CRC(42765fbc) SHA1(ab5b9240a8e71695897fd55a1385b64f63ce52c8) ) \
1482   /* SD_PANTHER SNDS */ \
14211483   ROM_LOAD( "95008948.bin", 0x0000, 0x08b98b, CRC(35e995c5) SHA1(9d12a3002423e9434bcd76fe13f9fc0891354e40) ) \
1484   /* PINKP SOUNDS */ \
14221485   ROM_LOAD( "95008953.bin", 0x0000, 0x0fabc8, CRC(12d96e7a) SHA1(4f5179b5817e471b891f377f0bec81dcb4a2077c) ) \
14231486   \
14241487   ROM_REGION( 0x5000, "pics", 0 ) \
r14896r14897
14401503
14411504#define sc_ppdym_others \
14421505   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1506   /* DYMN SOUNDS */ \
14431507   ROM_LOAD( "95008984.bin", 0x0000, 0x0e6770, CRC(8257c559) SHA1(9088fd4d28ad9701767a2a255164e7201410c33a) ) \
1508   /* DYMT SOUNDS */ \
14441509   ROM_LOAD( "95008989.bin", 0x0000, 0x0e6770, CRC(fb60e407) SHA1(50f7ed9d2106db2f1e746081d7ca768177e7680c) ) \
14451510   ROM_REGION( 0x5000, "pics", 0 ) \
14461511   ROM_LOAD( "95890483.bin", 0x0000, 0x5000, CRC(0ee68077) SHA1(163a46b16da238123cd542a62119dbaa726fca1b) ) \
r14896r14897
15061571
15071572#define sc_rhx_others \
15081573   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1574   /* REDX SOUNDS */ \
15091575   ROM_LOAD( "95008331.bin", 0x000000, 0x100000, CRC(b41748dd) SHA1(458409a4d2f6444af564ebe28d80e110fdb845b6) ) \
1576   /* RHRL SOUNDS */ \
15101577   ROM_LOAD( "95008927.bin", 0x100000, 0x0f1c08, CRC(38fccc48) SHA1(9ef11b3fbe3bbd3c5b74cee2c35581f3e41cb372) ) \
15111578
15121579#define sc_rhxcl_others \
r14896r14897
17511818
17521819#define sc_wacky_others \
17531820   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1821   /* PR3330 WACKY RACES SOUNDS11 */ \
17541822   ROM_LOAD( "95008834.bin", 0x000000, 0x100000, CRC(def73602) SHA1(681aafa4c035fdbb0f03e92fa56d31c13e27ca59) ) \
17551823   ROM_LOAD( "95008835.bin", 0x100000, 0x100000, CRC(9a10ff4f) SHA1(903e43d9db726dc5ee92abaf23b61454611064b1) ) \
1824   /* PR3330 WACKY RACES SOUNDS12 */ \
17561825   ROM_LOAD( "95009128.bin", 0x000000, 0x100000, CRC(d9883f0c) SHA1(3cfeb470248a9d5d6b653175c16f88c54d51fceb) ) \
17571826   ROM_LOAD( "95009129.bin", 0x100000, 0x100000, CRC(969f418a) SHA1(ca65dfa23f9e6a516bc65baa8ddd80faa530af1f) ) \
17581827
r14896r14897
17901859
17911860#define sc_gball_pthers \
17921861   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1862   /* PR1034 GOLDEN BALLS SOUNDS11 */ \
17931863   ROM_LOAD( "95008161.bin", 0x000000, 0x080000, CRC(ecd13fd9) SHA1(51d11b9133d4e840ce9afd7cf716520ea0fc0343) ) \
17941864   ROM_LOAD( "95008162.bin", 0x080000, 0x080000, CRC(b4b4a5c5) SHA1(d0748decfaee7da52d2f6a4bc0877be4243ed6fb) ) \
1865   /* PR1604 GOLDEN BALLS SOUNDS12 */ \
17951866   ROM_LOAD( "95008465.bin", 0x000000, 0x100000, CRC(5d1fa2c9) SHA1(c12de2b89f0bcb8f1b35630fffd205fd9d5b9777) ) \
17961867   ROM_LOAD( "95008466.bin", 0x100000, 0x100000, CRC(418068ab) SHA1(342939e9bcc1d213bc2f52666cc3765442e18635) ) \
17971868
r14896r14897
18261897
18271898#define sc_hellb_others \
18281899   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) \
1900   /* 95004211 HELLS BELLS PR6945 */ \
18291901   ROM_LOAD( "95004211.bin", 0x0000, 0x080000, CRC(2e729642) SHA1(c8dcdce52f930b3fa894c46907691a28a5499a16) ) \
1902   /* PR1402 HELLS BELLS SOUNDS11 */ \
18301903   ROM_LOAD( "95008341.bin", 0x0000, 0x100000, CRC(486e5395) SHA1(0ad68f271f4839d50a790b7f4427e1f1f1933bd4) ) \
18311904
18321905#define sc_leg_others \
src/mame/includes/batman.h
r14896r14897
1515   UINT16         m_latch_data;
1616
1717   UINT8         m_alpha_tile_bank;
18   DECLARE_READ16_MEMBER(batman_atarivc_r);
19   DECLARE_WRITE16_MEMBER(batman_atarivc_w);
20   DECLARE_READ16_MEMBER(special_port2_r);
21   DECLARE_WRITE16_MEMBER(latch_w);
1822};
1923
2024
src/mame/includes/stv.h
r14896r14897
120120   legacy_cpu_device* m_audiocpu;
121121
122122   bitmap_rgb32 m_tmpbitmap;
123   DECLARE_READ8_MEMBER(stv_ioga_r);
124   DECLARE_WRITE8_MEMBER(stv_ioga_w);
125   DECLARE_READ8_MEMBER(critcrsh_ioga_r);
126   DECLARE_READ8_MEMBER(magzun_ioga_r);
127   DECLARE_WRITE8_MEMBER(magzun_ioga_w);
128   DECLARE_READ8_MEMBER(stvmp_ioga_r);
129   DECLARE_WRITE8_MEMBER(stvmp_ioga_w);
130   DECLARE_READ32_MEMBER(stv_ioga_r32);
131   DECLARE_WRITE32_MEMBER(stv_ioga_w32);
132   DECLARE_READ32_MEMBER(critcrsh_ioga_r32);
133   DECLARE_READ32_MEMBER(stvmp_ioga_r32);
134   DECLARE_WRITE32_MEMBER(stvmp_ioga_w32);
135   DECLARE_READ32_MEMBER(magzun_ioga_r32);
136   DECLARE_WRITE32_MEMBER(magzun_ioga_w32);
137   DECLARE_READ32_MEMBER(magzun_hef_hack_r);
138   DECLARE_READ32_MEMBER(magzun_rx_hack_r);
139   DECLARE_READ32_MEMBER(astrass_hack_r);
123140};
124141
125142#define MASTER_CLOCK_352 57272720
src/mame/includes/galaxia.h
r14896r14897
1414
1515   tilemap_t *m_bg_tilemap;
1616   bitmap_ind16 m_temp_bitmap;
17   DECLARE_WRITE8_MEMBER(galaxia_video_w);
18   DECLARE_WRITE8_MEMBER(galaxia_scroll_w);
19   DECLARE_WRITE8_MEMBER(galaxia_ctrlport_w);
20   DECLARE_WRITE8_MEMBER(galaxia_dataport_w);
21   DECLARE_READ8_MEMBER(galaxia_collision_r);
22   DECLARE_READ8_MEMBER(galaxia_collision_clear);
1723};
1824
1925
src/mame/includes/segag80v.h
r14896r14897
3535   DECLARE_WRITE8_MEMBER(coin_count_w);
3636   DECLARE_WRITE8_MEMBER(unknown_w);
3737   DECLARE_CUSTOM_INPUT_MEMBER(elim4_joint_coin_r);
38   DECLARE_WRITE8_MEMBER(elim1_sh_w);
39   DECLARE_WRITE8_MEMBER(elim2_sh_w);
40   DECLARE_WRITE8_MEMBER(zektor1_sh_w);
41   DECLARE_WRITE8_MEMBER(zektor2_sh_w);
42   DECLARE_WRITE8_MEMBER(spacfury1_sh_w);
43   DECLARE_WRITE8_MEMBER(spacfury2_sh_w);
3844};
3945
4046
4147/*----------- defined in audio/segag80v.c -----------*/
4248
43WRITE8_HANDLER( elim1_sh_w );
44WRITE8_HANDLER( elim2_sh_w );
45WRITE8_HANDLER( spacfury1_sh_w );
46WRITE8_HANDLER( spacfury2_sh_w );
47WRITE8_HANDLER( zektor1_sh_w );
48WRITE8_HANDLER( zektor2_sh_w );
4949
5050
5151/*----------- defined in video/segag80v.c -----------*/
src/mame/includes/galaga.h
r14896r14897
3737   DECLARE_WRITE8_MEMBER(bosco_latch_w);
3838   DECLARE_WRITE8_MEMBER(galaga_videoram_w);
3939   DECLARE_WRITE8_MEMBER(gatsbee_bank_w);
40   DECLARE_CUSTOM_INPUT_MEMBER(shifted_port_r);
4140};
4241
4342class xevious_state : public galaga_state
r14896r14897
9291   UINT8 m_tx_color_mode;
9392   UINT8 m_bg_disable;
9493   UINT8 m_bg_color_bank;
94   DECLARE_CUSTOM_INPUT_MEMBER(shifted_port_r);
9595};
9696
9797
src/mame/includes/8080bw.h
r14896r14897
3333
3434   device_t *m_speaker;
3535   DECLARE_CUSTOM_INPUT_MEMBER(sflush_80_r);
36   DECLARE_READ8_MEMBER(indianbt_r);
37   DECLARE_WRITE8_MEMBER(steelwkr_sh_port_3_w);
38   DECLARE_WRITE8_MEMBER(invadpt2_sh_port_1_w);
39   DECLARE_WRITE8_MEMBER(invadpt2_sh_port_2_w);
40   DECLARE_WRITE8_MEMBER(spcewars_sh_port_w);
41   DECLARE_WRITE8_MEMBER(lrescue_sh_port_1_w);
42   DECLARE_WRITE8_MEMBER(lrescue_sh_port_2_w);
43   DECLARE_WRITE8_MEMBER(cosmo_sh_port_2_w);
44   DECLARE_WRITE8_MEMBER(ballbomb_sh_port_1_w);
45   DECLARE_WRITE8_MEMBER(ballbomb_sh_port_2_w);
46   DECLARE_WRITE8_MEMBER(indianbt_sh_port_1_w);
47   DECLARE_WRITE8_MEMBER(indianbt_sh_port_2_w);
48   DECLARE_WRITE8_MEMBER(schaser_sh_port_1_w);
49   DECLARE_WRITE8_MEMBER(schaser_sh_port_2_w);
50   DECLARE_WRITE8_MEMBER(rollingc_sh_port_w);
51   DECLARE_WRITE8_MEMBER(invrvnge_sh_port_w);
52   DECLARE_WRITE8_MEMBER(lupin3_sh_port_1_w);
53   DECLARE_WRITE8_MEMBER(lupin3_sh_port_2_w);
54   DECLARE_WRITE8_MEMBER(schasercv_sh_port_1_w);
55   DECLARE_WRITE8_MEMBER(schasercv_sh_port_2_w);
56   DECLARE_WRITE8_MEMBER(yosakdon_sh_port_1_w);
57   DECLARE_WRITE8_MEMBER(yosakdon_sh_port_2_w);
58   DECLARE_WRITE8_MEMBER(shuttlei_sh_port_1_w);
59   DECLARE_WRITE8_MEMBER(shuttlei_sh_port_2_w);
3660};
3761
3862
r14896r14897
4064
4165MACHINE_START( extra_8080bw_sh );
4266
43WRITE8_HANDLER( invadpt2_sh_port_1_w );
44WRITE8_HANDLER( invadpt2_sh_port_2_w );
4567
46WRITE8_HANDLER( spcewars_sh_port_w );
4768
48WRITE8_HANDLER( lrescue_sh_port_1_w );
49WRITE8_HANDLER( lrescue_sh_port_2_w );
5069extern const samples_interface lrescue_samples_interface;
5170
52WRITE8_HANDLER( cosmo_sh_port_2_w );
5371
54WRITE8_HANDLER( ballbomb_sh_port_1_w );
55WRITE8_HANDLER( ballbomb_sh_port_2_w );
5672
57WRITE8_HANDLER( indianbt_sh_port_1_w );
58WRITE8_HANDLER( indianbt_sh_port_2_w );
5973WRITE8_DEVICE_HANDLER( indianbt_sh_port_3_w );
6074DISCRETE_SOUND_EXTERN( indianbt );
6175
r14896r14897
6680
6781MACHINE_RESET( schaser_sh );
6882MACHINE_START( schaser_sh );
69WRITE8_HANDLER( schaser_sh_port_1_w );
70WRITE8_HANDLER( schaser_sh_port_2_w );
7183extern const sn76477_interface schaser_sn76477_interface;
7284DISCRETE_SOUND_EXTERN( schaser );
7385
74WRITE8_HANDLER( rollingc_sh_port_w );
7586
76WRITE8_HANDLER( invrvnge_sh_port_w );
7787
78WRITE8_HANDLER( lupin3_sh_port_1_w );
79WRITE8_HANDLER( lupin3_sh_port_2_w );
8088
81WRITE8_HANDLER( schasercv_sh_port_1_w );
82WRITE8_HANDLER( schasercv_sh_port_2_w );
8389
84WRITE8_HANDLER( yosakdon_sh_port_1_w );
85WRITE8_HANDLER( yosakdon_sh_port_2_w );
8690
87WRITE8_HANDLER( shuttlei_sh_port_1_w );
88WRITE8_HANDLER( shuttlei_sh_port_2_w );
8991
9092
9193/*----------- defined in video/8080bw.c -----------*/
src/mame/includes/quasar.h
r14896r14897
1616   UINT8      m_effectcontrol;
1717   UINT8      m_page;
1818   UINT8      m_io_page;
19   DECLARE_WRITE8_MEMBER(video_page_select_w);
20   DECLARE_WRITE8_MEMBER(io_page_select_w);
21   DECLARE_WRITE8_MEMBER(quasar_video_w);
22   DECLARE_READ8_MEMBER(quasar_IO_r);
23   DECLARE_WRITE8_MEMBER(quasar_bullet_w);
24   DECLARE_WRITE8_MEMBER(quasar_sh_command_w);
25   DECLARE_READ8_MEMBER(quasar_sh_command_r);
26   DECLARE_READ8_MEMBER(audio_t1_r);
1927};
2028
2129
src/mame/includes/tx1.h
r14896r14897
140140   DECLARE_WRITE16_MEMBER(buggyboy_gas_w);
141141   DECLARE_WRITE16_MEMBER(buggyboy_sky_w);
142142   DECLARE_WRITE16_MEMBER(buggyboy_scolst_w);
143   DECLARE_WRITE16_MEMBER(z80_busreq_w);
144   DECLARE_WRITE16_MEMBER(resume_math_w);
145   DECLARE_WRITE16_MEMBER(halt_math_w);
146   DECLARE_WRITE8_MEMBER(z80_intreq_w);
147   DECLARE_READ16_MEMBER(z80_shared_r);
148   DECLARE_WRITE16_MEMBER(z80_shared_w);
149   DECLARE_READ16_MEMBER(dipswitches_r);
150   DECLARE_WRITE8_MEMBER(ts_w);
151   DECLARE_READ8_MEMBER(ts_r);
152   DECLARE_WRITE8_MEMBER(tx1_ppi_latch_w);
153   DECLARE_READ8_MEMBER(bb_analog_r);
154   DECLARE_READ8_MEMBER(bbjr_analog_r);
143155};
144156
145157
src/mame/includes/blstroid.h
r14896r14897
1313      : atarigen_state(mconfig, type, tag) { }
1414
1515   UINT16 *      m_priorityram;
16   DECLARE_WRITE16_MEMBER(blstroid_halt_until_hblank_0_w);
17   DECLARE_READ16_MEMBER(inputs_r);
1618};
1719
1820
src/mame/includes/gotya.h
r14896r14897
2525   DECLARE_WRITE8_MEMBER(gotya_videoram_w);
2626   DECLARE_WRITE8_MEMBER(gotya_colorram_w);
2727   DECLARE_WRITE8_MEMBER(gotya_video_control_w);
28   DECLARE_WRITE8_MEMBER(gotya_soundlatch_w);
2829};
2930
3031
3132/*----------- defined in audio/gotya.c -----------*/
3233
33WRITE8_HANDLER( gotya_soundlatch_w );
3434
3535
3636/*----------- defined in video/gotya.c -----------*/
src/mame/includes/aztarac.h
r14896r14897
1919   DECLARE_READ16_MEMBER(nvram_r);
2020   DECLARE_READ16_MEMBER(joystick_r);
2121   DECLARE_WRITE16_MEMBER(aztarac_ubr_w);
22   DECLARE_READ16_MEMBER(aztarac_sound_r);
23   DECLARE_WRITE16_MEMBER(aztarac_sound_w);
24   DECLARE_READ8_MEMBER(aztarac_snd_command_r);
25   DECLARE_READ8_MEMBER(aztarac_snd_status_r);
26   DECLARE_WRITE8_MEMBER(aztarac_snd_status_w);
2227};
2328
2429/*----------- defined in audio/aztarac.c -----------*/
2530
26READ16_HANDLER( aztarac_sound_r );
27WRITE16_HANDLER( aztarac_sound_w );
2831
29READ8_HANDLER( aztarac_snd_command_r );
30READ8_HANDLER( aztarac_snd_status_r );
31WRITE8_HANDLER( aztarac_snd_status_w );
3232
3333INTERRUPT_GEN( aztarac_snd_timed_irq );
3434
src/mame/includes/harddriv.h
r14896r14897
168168
169169   INT8               m_gfx_finescroll;
170170   UINT8               m_gfx_palettebank;
171   DECLARE_READ16_MEMBER(steeltal_dummy_r);
172   DECLARE_READ16_MEMBER(hd68k_snd_data_r);
173   DECLARE_READ16_MEMBER(hd68k_snd_status_r);
174   DECLARE_WRITE16_MEMBER(hd68k_snd_data_w);
175   DECLARE_WRITE16_MEMBER(hd68k_snd_reset_w);
176   DECLARE_READ16_MEMBER(hdsnd68k_data_r);
177   DECLARE_WRITE16_MEMBER(hdsnd68k_data_w);
178   DECLARE_READ16_MEMBER(hdsnd68k_switches_r);
179   DECLARE_READ16_MEMBER(hdsnd68k_320port_r);
180   DECLARE_READ16_MEMBER(hdsnd68k_status_r);
181   DECLARE_WRITE16_MEMBER(hdsnd68k_latches_w);
182   DECLARE_WRITE16_MEMBER(hdsnd68k_speech_w);
183   DECLARE_WRITE16_MEMBER(hdsnd68k_irqclr_w);
184   DECLARE_READ16_MEMBER(hdsnd68k_320ram_r);
185   DECLARE_WRITE16_MEMBER(hdsnd68k_320ram_w);
186   DECLARE_READ16_MEMBER(hdsnd68k_320ports_r);
187   DECLARE_WRITE16_MEMBER(hdsnd68k_320ports_w);
188   DECLARE_READ16_MEMBER(hdsnd68k_320com_r);
189   DECLARE_WRITE16_MEMBER(hdsnd68k_320com_w);
190   DECLARE_READ16_MEMBER(hdsnddsp_get_bio);
191   DECLARE_WRITE16_MEMBER(hdsnddsp_comport_w);
192   DECLARE_WRITE16_MEMBER(hdsnddsp_mute_w);
193   DECLARE_WRITE16_MEMBER(hdsnddsp_gen68kirq_w);
194   DECLARE_WRITE16_MEMBER(hdsnddsp_soundaddr_w);
195   DECLARE_READ16_MEMBER(hdsnddsp_rom_r);
196   DECLARE_READ16_MEMBER(hdsnddsp_comram_r);
197   DECLARE_READ16_MEMBER(hdsnddsp_compare_r);
171198};
172199
173200
r14896r14897
296323
297324void hdsnd_init(running_machine &machine);
298325
299READ16_HANDLER( hd68k_snd_data_r );
300READ16_HANDLER( hd68k_snd_status_r );
301WRITE16_HANDLER( hd68k_snd_data_w );
302WRITE16_HANDLER( hd68k_snd_reset_w );
303326
304READ16_HANDLER( hdsnd68k_data_r );
305WRITE16_HANDLER( hdsnd68k_data_w );
306327
307READ16_HANDLER( hdsnd68k_switches_r );
308READ16_HANDLER( hdsnd68k_320port_r );
309READ16_HANDLER( hdsnd68k_status_r );
310328
311WRITE16_HANDLER( hdsnd68k_latches_w );
312WRITE16_HANDLER( hdsnd68k_speech_w );
313WRITE16_HANDLER( hdsnd68k_irqclr_w );
314329
315READ16_HANDLER( hdsnd68k_320ram_r );
316WRITE16_HANDLER( hdsnd68k_320ram_w );
317READ16_HANDLER( hdsnd68k_320ports_r );
318WRITE16_HANDLER( hdsnd68k_320ports_w );
319READ16_HANDLER( hdsnd68k_320com_r );
320WRITE16_HANDLER( hdsnd68k_320com_w );
321330
322READ16_HANDLER( hdsnddsp_get_bio );
323331
324332WRITE16_DEVICE_HANDLER( hdsnddsp_dac_w );
325WRITE16_HANDLER( hdsnddsp_comport_w );
326WRITE16_HANDLER( hdsnddsp_mute_w );
327WRITE16_HANDLER( hdsnddsp_gen68kirq_w );
328WRITE16_HANDLER( hdsnddsp_soundaddr_w );
329333
330READ16_HANDLER( hdsnddsp_rom_r );
331READ16_HANDLER( hdsnddsp_comram_r );
332READ16_HANDLER( hdsnddsp_compare_r );
333334
334335
335336/*----------- defined in video/harddriv.c -----------*/
src/mame/includes/atarig1.h
r14896r14897
2929   UINT16         m_playfield_yscroll;
3030
3131   device_t *      m_rle;
32   DECLARE_WRITE16_MEMBER(mo_control_w);
33   DECLARE_WRITE16_MEMBER(mo_command_w);
34   DECLARE_READ16_MEMBER(special_port0_r);
35   DECLARE_WRITE16_MEMBER(a2d_select_w);
36   DECLARE_READ16_MEMBER(a2d_data_r);
37   DECLARE_READ16_MEMBER(pitfightb_cheap_slapstic_r);
38   void update_bank(int bank);
3239};
3340
3441
3542/*----------- defined in video/atarig1.c -----------*/
3643
37WRITE16_HANDLER( atarig1_mo_control_w );
3844
3945VIDEO_START( atarig1 );
4046SCREEN_VBLANK( atarig1 );
src/mame/includes/toobin.h
r14896r14897
1616
1717   double         m_brightness;
1818   bitmap_ind16 m_pfbitmap;
19   DECLARE_WRITE16_MEMBER(interrupt_scan_w);
20   DECLARE_READ16_MEMBER(special_port1_r);
1921};
2022
2123
src/mame/includes/mcr68.h
r14896r14897
1010   attotime      period;
1111};
1212
13class mcr68_state : public driver_device
13class mcr68_state : public mcr_state
1414{
1515public:
1616   mcr68_state(const machine_config &mconfig, device_type type, const char *tag)
17      : driver_device(mconfig, type, tag) { }
17      : mcr_state(mconfig, type, tag) { }
1818
1919   UINT16 *m_videoram;
2020   UINT16 m_control_word;
src/mame/includes/gsword.h
r14896r14897
2323   DECLARE_WRITE8_MEMBER(gsword_charbank_w);
2424   DECLARE_WRITE8_MEMBER(gsword_videoctrl_w);
2525   DECLARE_WRITE8_MEMBER(gsword_scroll_w);
26   DECLARE_READ8_MEMBER(gsword_hack_r);
27   DECLARE_WRITE8_MEMBER(adpcm_soundcommand_w);
2628};
2729
2830
src/mame/includes/mario.h
r14896r14897
6666   DECLARE_WRITE8_MEMBER(mario_palettebank_w);
6767   DECLARE_WRITE8_MEMBER(mario_scroll_w);
6868   DECLARE_WRITE8_MEMBER(mario_flip_w);
69   DECLARE_READ8_MEMBER(mario_sh_p1_r);
70   DECLARE_READ8_MEMBER(mario_sh_p2_r);
71   DECLARE_READ8_MEMBER(mario_sh_t0_r);
72   DECLARE_READ8_MEMBER(mario_sh_t1_r);
73   DECLARE_READ8_MEMBER(mario_sh_tune_r);
74   DECLARE_WRITE8_MEMBER(mario_sh_p1_w);
75   DECLARE_WRITE8_MEMBER(mario_sh_p2_w);
76   DECLARE_WRITE8_MEMBER(masao_sh_irqtrigger_w);
77   DECLARE_WRITE8_MEMBER(mario_sh_tuneselect_w);
78   DECLARE_WRITE8_MEMBER(mario_sh3_w);
6979};
7080
7181/*----------- defined in video/mario.c -----------*/
r14896r14897
8090
8191WRITE8_DEVICE_HANDLER( mario_sh1_w );
8292WRITE8_DEVICE_HANDLER( mario_sh2_w );
83WRITE8_HANDLER( mario_sh3_w );
8493
85WRITE8_HANDLER( mario_sh_tuneselect_w );
86WRITE8_HANDLER( masao_sh_irqtrigger_w );
8794
8895MACHINE_CONFIG_EXTERN( mario_audio );
8996MACHINE_CONFIG_EXTERN( masao_audio );
src/mame/includes/cd32.h
r14896r14897
2626   void (*m_input_hack)(running_machine &machine);
2727   int m_oldstate[2];
2828   DECLARE_CUSTOM_INPUT_MEMBER(cubo_input);
29   DECLARE_WRITE32_MEMBER(aga_overlay_w);
2930};
3031
3132/*----------- defined in machine/cd32.c -----------*/
src/mame/includes/micro3d.h
r14896r14897
100100   DECLARE_WRITE32_MEMBER(micro3d_alt_fifo_w);
101101   DECLARE_READ32_MEMBER(micro3d_pipe_r);
102102   DECLARE_CUSTOM_INPUT_MEMBER(botssa_hwchk_r);
103   DECLARE_WRITE8_MEMBER(micro3d_snd_dac_a);
104   DECLARE_WRITE8_MEMBER(micro3d_snd_dac_b);
105   DECLARE_WRITE8_MEMBER(micro3d_sound_io_w);
106   DECLARE_READ8_MEMBER(micro3d_sound_io_r);
103107};
104108
105109typedef struct _micro3d_vtx_
r14896r14897
129133/*----------- defined in audio/micro3d.c -----------*/
130134
131135WRITE8_DEVICE_HANDLER( micro3d_upd7759_w );
132WRITE8_HANDLER( micro3d_snd_dac_a );
133WRITE8_HANDLER( micro3d_snd_dac_b );
134READ8_HANDLER( micro3d_sound_io_r );
135WRITE8_HANDLER( micro3d_sound_io_w );
136136
137137void micro3d_noise_sh_w(running_machine &machine, UINT8 data);
138138
src/mame/includes/cyberbal.h
r14896r14897
2626   UINT8         m_sound_data_from_6502;
2727   UINT8         m_sound_data_from_68k_ready;
2828   UINT8         m_sound_data_from_6502_ready;
29   DECLARE_READ16_MEMBER(special_port0_r);
30   DECLARE_READ16_MEMBER(special_port2_r);
31   DECLARE_READ16_MEMBER(sound_state_r);
32   DECLARE_WRITE16_MEMBER(p2_reset_w);
33   DECLARE_READ8_MEMBER(cyberbal_special_port3_r);
34   DECLARE_READ8_MEMBER(cyberbal_sound_6502_stat_r);
35   DECLARE_WRITE8_MEMBER(cyberbal_sound_bank_select_w);
36   DECLARE_READ8_MEMBER(cyberbal_sound_68k_6502_r);
37   DECLARE_WRITE8_MEMBER(cyberbal_sound_68k_6502_w);
38   DECLARE_WRITE16_MEMBER(cyberbal_io_68k_irq_ack_w);
39   DECLARE_READ16_MEMBER(cyberbal_sound_68k_r);
40   DECLARE_WRITE16_MEMBER(cyberbal_sound_68k_w);
41   DECLARE_WRITE16_MEMBER(cyberbal_sound_68k_dac_w);
2942};
3043
3144
r14896r14897
3649
3750INTERRUPT_GEN( cyberbal_sound_68k_irq_gen );
3851
39READ8_HANDLER( cyberbal_special_port3_r );
40READ8_HANDLER( cyberbal_sound_6502_stat_r );
41READ8_HANDLER( cyberbal_sound_68k_6502_r );
42WRITE8_HANDLER( cyberbal_sound_bank_select_w );
43WRITE8_HANDLER( cyberbal_sound_68k_6502_w );
4452
45READ16_HANDLER( cyberbal_sound_68k_r );
46WRITE16_HANDLER( cyberbal_io_68k_irq_ack_w );
47WRITE16_HANDLER( cyberbal_sound_68k_w );
48WRITE16_HANDLER( cyberbal_sound_68k_dac_w );
4953
5054
5155/*----------- defined in video/cyberbal.c -----------*/
src/mame/includes/lockon.h
r14896r14897
8484   DECLARE_WRITE16_MEMBER(lockon_obj_4000_w);
8585   DECLARE_WRITE16_MEMBER(lockon_fb_clut_w);
8686   DECLARE_WRITE16_MEMBER(lockon_rotate_w);
87   DECLARE_WRITE16_MEMBER(adrst_w);
88   DECLARE_READ16_MEMBER(main_gnd_r);
89   DECLARE_WRITE16_MEMBER(main_gnd_w);
90   DECLARE_READ16_MEMBER(main_obj_r);
91   DECLARE_WRITE16_MEMBER(main_obj_w);
92   DECLARE_WRITE16_MEMBER(tst_w);
93   DECLARE_READ16_MEMBER(main_z80_r);
94   DECLARE_WRITE16_MEMBER(main_z80_w);
95   DECLARE_WRITE16_MEMBER(inten_w);
96   DECLARE_WRITE16_MEMBER(emres_w);
97   DECLARE_READ8_MEMBER(adc_r);
98   DECLARE_WRITE8_MEMBER(sound_vol);
8799};
88100
89101
src/mame/includes/segas32.h
r14896r14897
2727   UINT8 m_sound_dummy_value;
2828   UINT16 m_sound_bank;
2929   UINT8 m_misc_io_data[2][0x10];
30   read16_space_func m_custom_io_r[2];
31   write16_space_func m_custom_io_w[2];
30   read16_delegate m_custom_io_r[2];
31   write16_delegate m_custom_io_w[2];
3232   UINT8 m_analog_bank;
3333   UINT8 m_analog_value[4];
3434   UINT8 m_sonic_last[6];
r14896r14897
9696   DECLARE_WRITE16_MEMBER(system32_mixer_w);
9797   DECLARE_WRITE32_MEMBER(multi32_mixer_0_w);
9898   DECLARE_WRITE32_MEMBER(multi32_mixer_1_w);
99   DECLARE_READ16_MEMBER(interrupt_control_16_r);
100   DECLARE_WRITE16_MEMBER(interrupt_control_16_w);
101   DECLARE_READ32_MEMBER(interrupt_control_32_r);
102   DECLARE_WRITE32_MEMBER(interrupt_control_32_w);
103   DECLARE_READ16_MEMBER(io_chip_r);
104   DECLARE_WRITE16_MEMBER(io_chip_w);
105   DECLARE_READ32_MEMBER(io_chip_0_r);
106   DECLARE_WRITE32_MEMBER(io_chip_0_w);
107   DECLARE_READ32_MEMBER(io_chip_1_r);
108   DECLARE_WRITE32_MEMBER(io_chip_1_w);
109   DECLARE_READ16_MEMBER(io_expansion_r);
110   DECLARE_WRITE16_MEMBER(io_expansion_w);
111   DECLARE_READ32_MEMBER(io_expansion_0_r);
112   DECLARE_WRITE32_MEMBER(io_expansion_0_w);
113   DECLARE_READ32_MEMBER(io_expansion_1_r);
114   DECLARE_WRITE32_MEMBER(io_expansion_1_w);
115   DECLARE_READ16_MEMBER(analog_custom_io_r);
116   DECLARE_WRITE16_MEMBER(analog_custom_io_w);
117   DECLARE_READ16_MEMBER(extra_custom_io_r);
118   DECLARE_WRITE16_MEMBER(orunners_custom_io_w);
119   DECLARE_READ16_MEMBER(sonic_custom_io_r);
120   DECLARE_WRITE16_MEMBER(sonic_custom_io_w);
121   DECLARE_WRITE16_MEMBER(random_number_16_w);
122   DECLARE_READ16_MEMBER(random_number_16_r);
123   DECLARE_WRITE32_MEMBER(random_number_32_w);
124   DECLARE_READ32_MEMBER(random_number_32_r);
125   DECLARE_READ16_MEMBER(shared_ram_16_r);
126   DECLARE_WRITE16_MEMBER(shared_ram_16_w);
127   DECLARE_READ32_MEMBER(shared_ram_32_r);
128   DECLARE_WRITE32_MEMBER(shared_ram_32_w);
129   DECLARE_WRITE8_MEMBER(sound_int_control_lo_w);
130   DECLARE_WRITE8_MEMBER(sound_int_control_hi_w);
131   DECLARE_WRITE8_MEMBER(sound_bank_lo_w);
132   DECLARE_WRITE8_MEMBER(sound_bank_hi_w);
133   DECLARE_READ8_MEMBER(sound_dummy_r);
134   DECLARE_WRITE8_MEMBER(sound_dummy_w);
135   DECLARE_WRITE16_MEMBER(dual_pcb_comms_w);
136   DECLARE_READ16_MEMBER(dual_pcb_comms_r);
137   DECLARE_READ16_MEMBER(dual_pcb_masterslave);
138   DECLARE_READ16_MEMBER(arescue_handshake_r);
139   DECLARE_READ16_MEMBER(arescue_slavebusy_r);
140   DECLARE_WRITE16_MEMBER(f1en_comms_echo_w);
99141};
100142
101143
src/mame/includes/badlands.h
r14896r14897
1818   UINT8 *         m_bank_source_data;
1919
2020   UINT8         m_playfield_tile_bank;
21   DECLARE_READ16_MEMBER(sound_busy_r);
22   DECLARE_READ16_MEMBER(pedal_0_r);
23   DECLARE_READ16_MEMBER(pedal_1_r);
24   DECLARE_READ8_MEMBER(audio_io_r);
25   DECLARE_WRITE8_MEMBER(audio_io_w);
26   DECLARE_READ16_MEMBER(badlandsb_unk_r);
2127};
2228
2329
src/mame/includes/offtwall.h
r14896r14897
1818
1919   UINT16 *m_spritecache_count;
2020   UINT16 *m_unknown_verify_base;
21   DECLARE_READ16_MEMBER(offtwall_atarivc_r);
22   DECLARE_WRITE16_MEMBER(offtwall_atarivc_w);
23   DECLARE_READ16_MEMBER(special_port3_r);
24   DECLARE_WRITE16_MEMBER(io_latch_w);
25   DECLARE_READ16_MEMBER(bankswitch_r);
26   DECLARE_READ16_MEMBER(bankrom_r);
27   DECLARE_READ16_MEMBER(spritecache_count_r);
28   DECLARE_READ16_MEMBER(unknown_verify_r);
2129};
2230
2331
src/mame/includes/klax.h
r14896r14897
1111public:
1212   klax_state(const machine_config &mconfig, device_type type, const char *tag)
1313      : atarigen_state(mconfig, type, tag) { }
14   DECLARE_WRITE16_MEMBER(interrupt_ack_w);
1415};
1516
1617
src/mame/includes/thunderj.h
r14896r14897
1313      : atarigen_state(mconfig, type, tag) { }
1414
1515   UINT8         m_alpha_tile_bank;
16   DECLARE_READ16_MEMBER(special_port2_r);
17   DECLARE_WRITE16_MEMBER(latch_w);
18   DECLARE_READ16_MEMBER(thunderj_atarivc_r);
19   DECLARE_WRITE16_MEMBER(thunderj_atarivc_w);
1620};
1721
1822
src/mame/includes/ddragon.h
r14896r14897
6161   DECLARE_WRITE8_MEMBER(ddragon_bgvideoram_w);
6262   DECLARE_WRITE8_MEMBER(ddragon_fgvideoram_w);
6363   DECLARE_CUSTOM_INPUT_MEMBER(sub_cpu_busy);
64   DECLARE_WRITE8_MEMBER(ddragon_bankswitch_w);
65   DECLARE_WRITE8_MEMBER(toffy_bankswitch_w);
66   DECLARE_READ8_MEMBER(darktowr_mcu_bank_r);
67   DECLARE_WRITE8_MEMBER(darktowr_mcu_bank_w);
68   DECLARE_WRITE8_MEMBER(darktowr_bankswitch_w);
69   DECLARE_WRITE8_MEMBER(ddragon_interrupt_w);
70   DECLARE_WRITE8_MEMBER(ddragon2_sub_irq_ack_w);
71   DECLARE_WRITE8_MEMBER(ddragon2_sub_irq_w);
72   DECLARE_WRITE8_MEMBER(darktowr_mcu_w);
73   DECLARE_READ8_MEMBER(ddragon_hd63701_internal_registers_r);
74   DECLARE_WRITE8_MEMBER(ddragon_hd63701_internal_registers_w);
75   DECLARE_READ8_MEMBER(ddragon_spriteram_r);
76   DECLARE_WRITE8_MEMBER(ddragon_spriteram_w);
77   DECLARE_WRITE8_MEMBER(dd_adpcm_w);
78   DECLARE_READ8_MEMBER(dd_adpcm_status_r);
79   DECLARE_WRITE8_MEMBER(ddragonba_port_w);
6480};
6581
6682
src/mame/includes/gladiatr.h
r14896r14897
3333   DECLARE_WRITE8_MEMBER(gladiatr_spritebank_w);
3434   DECLARE_WRITE8_MEMBER(ppking_video_registers_w);
3535   DECLARE_WRITE8_MEMBER(gladiatr_video_registers_w);
36   DECLARE_WRITE8_MEMBER(gladiatr_bankswitch_w);
37   DECLARE_WRITE8_MEMBER(glad_cpu_sound_command_w);
38   DECLARE_READ8_MEMBER(glad_cpu_sound_command_r);
39   DECLARE_WRITE8_MEMBER(gladiatr_flipscreen_w);
40   DECLARE_WRITE8_MEMBER(gladiatr_irq_patch_w);
41   DECLARE_WRITE8_MEMBER(qx0_w);
42   DECLARE_WRITE8_MEMBER(qx1_w);
43   DECLARE_WRITE8_MEMBER(qx2_w);
44   DECLARE_WRITE8_MEMBER(qx3_w);
45   DECLARE_READ8_MEMBER(qx2_r);
46   DECLARE_READ8_MEMBER(qx3_r);
47   DECLARE_READ8_MEMBER(qx0_r);
48   DECLARE_READ8_MEMBER(qx1_r);
49   DECLARE_READ8_MEMBER(f6a3_r);
3650};
3751
3852/*----------- defined in video/gladiatr.c -----------*/
src/mame/includes/atarigx2.h
r14896r14897
2727   UINT16         m_last_write_offset;
2828
2929   device_t *      m_rle;
30   DECLARE_READ32_MEMBER(special_port2_r);
31   DECLARE_READ32_MEMBER(special_port3_r);
32   DECLARE_READ32_MEMBER(a2d_data_r);
33   DECLARE_WRITE32_MEMBER(latch_w);
34   DECLARE_WRITE32_MEMBER(mo_command_w);
35   DECLARE_WRITE32_MEMBER(atarigx2_protection_w);
36   DECLARE_READ32_MEMBER(atarigx2_protection_r);
37   DECLARE_READ32_MEMBER(rrreveng_prot_r);
3038};
3139
3240
src/mame/includes/circus.h
r14896r14897
2626   DECLARE_WRITE8_MEMBER(circus_videoram_w);
2727   DECLARE_WRITE8_MEMBER(circus_clown_x_w);
2828   DECLARE_WRITE8_MEMBER(circus_clown_y_w);
29   DECLARE_WRITE8_MEMBER(circus_clown_z_w);
2930};
3031
3132
3233
3334/*----------- defined in audio/circus.c -----------*/
3435
35extern WRITE8_HANDLER( circus_clown_z_w );
3636
3737DISCRETE_SOUND_EXTERN( circus );
3838DISCRETE_SOUND_EXTERN( robotbwl );
src/mame/includes/relief.h
r14896r14897
1515   UINT8         m_ym2413_volume;
1616   UINT8         m_overall_volume;
1717   UINT32         m_adpcm_bank_base;
18   DECLARE_READ16_MEMBER(relief_atarivc_r);
19   DECLARE_WRITE16_MEMBER(relief_atarivc_w);
20   DECLARE_READ16_MEMBER(special_port2_r);
21   DECLARE_WRITE16_MEMBER(audio_control_w);
22   DECLARE_WRITE16_MEMBER(audio_volume_w);
1823};
1924
2025
src/mame/includes/mcr.h
r14896r14897
3636   DECLARE_READ8_MEMBER(twotiger_videoram_r);
3737   DECLARE_WRITE8_MEMBER(twotiger_videoram_w);
3838   DECLARE_WRITE8_MEMBER(mcr_91490_videoram_w);
39   DECLARE_READ8_MEMBER(solarfox_ip0_r);
40   DECLARE_READ8_MEMBER(solarfox_ip1_r);
41   DECLARE_READ8_MEMBER(kick_ip1_r);
42   DECLARE_WRITE8_MEMBER(wacko_op4_w);
43   DECLARE_READ8_MEMBER(wacko_ip1_r);
44   DECLARE_READ8_MEMBER(wacko_ip2_r);
45   DECLARE_READ8_MEMBER(kroozr_ip1_r);
46   DECLARE_WRITE8_MEMBER(kroozr_op4_w);
47   DECLARE_WRITE8_MEMBER(journey_op4_w);
48   DECLARE_WRITE8_MEMBER(twotiger_op4_w);
49   DECLARE_WRITE8_MEMBER(dotron_op4_w);
50   DECLARE_READ8_MEMBER(nflfoot_ip2_r);
51   DECLARE_WRITE8_MEMBER(nflfoot_op4_w);
52   DECLARE_READ8_MEMBER(demoderb_ip1_r);
53   DECLARE_READ8_MEMBER(demoderb_ip2_r);
54   DECLARE_WRITE8_MEMBER(demoderb_op4_w);
55   DECLARE_READ8_MEMBER(ssio_irq_clear);
56   DECLARE_WRITE8_MEMBER(ssio_status_w);
57   DECLARE_READ8_MEMBER(ssio_data_r);
58   DECLARE_WRITE8_MEMBER(ssio_data_w);
59   DECLARE_READ8_MEMBER(ssio_status_r);
60   DECLARE_READ8_MEMBER(ssio_input_port_r);
61   DECLARE_WRITE8_MEMBER(ssio_output_port_w);
62   DECLARE_WRITE8_MEMBER(csdeluxe_data_w);
63   DECLARE_READ8_MEMBER(csdeluxe_status_r);
64   DECLARE_WRITE8_MEMBER(soundsgood_data_w);
65   DECLARE_READ8_MEMBER(soundsgood_status_r);
66   DECLARE_WRITE8_MEMBER(turbocs_data_w);
67   DECLARE_READ8_MEMBER(turbocs_status_r);
68   DECLARE_WRITE8_MEMBER(squawkntalk_dac_w);
69   DECLARE_WRITE8_MEMBER(squawkntalk_data_w);
3970};
4071
4172
src/mame/includes/atarigt.h
r14896r14897
4646   UINT8         m_protdata[0x800];
4747
4848   device_t *      m_rle;
49   DECLARE_READ32_MEMBER(special_port2_r);
50   DECLARE_READ32_MEMBER(special_port3_r);
51   DECLARE_READ32_MEMBER(analog_port0_r);
52   DECLARE_READ32_MEMBER(analog_port1_r);
53   DECLARE_WRITE32_MEMBER(latch_w);
54   DECLARE_WRITE32_MEMBER(mo_command_w);
55   DECLARE_WRITE32_MEMBER(led_w);
56   DECLARE_READ32_MEMBER(sound_data_r);
57   DECLARE_WRITE32_MEMBER(sound_data_w);
58   DECLARE_READ32_MEMBER(colorram_protection_r);
59   DECLARE_WRITE32_MEMBER(colorram_protection_w);
60   DECLARE_WRITE32_MEMBER(tmek_pf_w);
61   void atarigt_colorram_w(offs_t address, UINT16 data, UINT16 mem_mask);
62   UINT16 atarigt_colorram_r(offs_t address);
4963};
5064
5165
5266/*----------- defined in video/atarigt.c -----------*/
5367
54void atarigt_colorram_w(atarigt_state *state, offs_t address, UINT16 data, UINT16 mem_mask);
55UINT16 atarigt_colorram_r(atarigt_state *state, offs_t address);
5668
69
5770VIDEO_START( atarigt );
5871SCREEN_VBLANK( atarigt );
5972SCREEN_UPDATE_RGB32( atarigt );
src/mame/includes/starwars.h
r14896r14897
5151   DECLARE_READ8_MEMBER(starwars_div_rel_r);
5252   DECLARE_WRITE8_MEMBER(starwars_math_w);
5353   DECLARE_CUSTOM_INPUT_MEMBER(matrix_flag_r);
54   DECLARE_READ8_MEMBER(starwars_sin_r);
55   DECLARE_WRITE8_MEMBER(starwars_sout_w);
56   DECLARE_READ8_MEMBER(starwars_main_read_r);
57   DECLARE_READ8_MEMBER(starwars_main_ready_flag_r);
58   DECLARE_WRITE8_MEMBER(starwars_main_wr_w);
59   DECLARE_WRITE8_MEMBER(starwars_soundrst_w);
5460};
5561
5662
r14896r14897
6975
7076SOUND_START( starwars );
7177
72READ8_HANDLER( starwars_main_read_r );
73READ8_HANDLER( starwars_main_ready_flag_r );
74WRITE8_HANDLER( starwars_main_wr_w );
75WRITE8_HANDLER( starwars_soundrst_w );
7678
77READ8_HANDLER( starwars_sin_r );
78WRITE8_HANDLER( starwars_sout_w );
src/mame/mame.mak
r14896r14897
22072207$(VIDEO)/model3.o:   $(MAMESRC)/video/m3raster.c
22082208$(VIDEO)/n64.o:      $(MAMESRC)/video/rdpfiltr.c
22092209$(DRIVERS)/bfm_sc4.o: $(MAMESRC)/includes/bfm_sc45.h
2210$(DRIVERS)/bfm_sc5.o: $(MAMESRC)/includes/bfm_sc45.h
22102211
22112212
src/mame/video/nycaptor.c
r14896r14897
107107      return;
108108
109109   if (offset & 0x100)
110      paletteram_xxxxBBBBGGGGRRRR_split2_w(space, (offset & 0xff) + (m_palette_bank << 8), data);
110      paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w(space, (offset & 0xff) + (m_palette_bank << 8), data);
111111   else
112      paletteram_xxxxBBBBGGGGRRRR_split1_w(space, (offset & 0xff) + (m_palette_bank << 8), data);
112      paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w(space, (offset & 0xff) + (m_palette_bank << 8), data);
113113}
114114
115115READ8_MEMBER(nycaptor_state::nycaptor_palette_r)
src/mame/video/mitchell.c
r14896r14897
252252{
253253
254254   if (m_paletteram_bank)
255      paletteram_xxxxRRRRGGGGBBBB_le_w(space, offset + 0x800, data);
255      paletteram_xxxxRRRRGGGGBBBB_byte_le_w(space, offset + 0x800, data);
256256   else
257      paletteram_xxxxRRRRGGGGBBBB_le_w(space, offset, data);
257      paletteram_xxxxRRRRGGGGBBBB_byte_le_w(space, offset, data);
258258}
259259
260260READ8_MEMBER(mitchell_state::pang_paletteram_r)
r14896r14897
268268
269269WRITE8_MEMBER(mitchell_state::mgakuen_paletteram_w)
270270{
271   paletteram_xxxxRRRRGGGGBBBB_le_w(space, offset, data);
271   paletteram_xxxxRRRRGGGGBBBB_byte_le_w(space, offset, data);
272272}
273273
274274READ8_MEMBER(mitchell_state::mgakuen_paletteram_r)
src/mame/video/xevious.c
r14896r14897
188188   UINT8 color = ((attr & 0x03) << 4) | ((attr & 0x3c) >> 2);
189189   SET_TILE_INFO(
190190         0,
191         state->m_xevious_fg_videoram[tile_index] | (flip_screen_get(machine) ? 0x100 : 0),
191         state->m_xevious_fg_videoram[tile_index] | (state->flip_screen() ? 0x100 : 0),
192192         color,
193         TILE_FLIPYX((attr & 0xc0) >> 6) ^ (flip_screen_get(machine) ? TILE_FLIPX : 0));
193         TILE_FLIPYX((attr & 0xc0) >> 6) ^ (state->flip_screen() ? TILE_FLIPX : 0));
194194}
195195
196196static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
297297      state->m_fg_tilemap->set_scrolly(0,scroll);
298298      break;
299299   case 7:
300      flip_screen_set(space->machine(), scroll & 1);
300      state->flip_screen_set(scroll & 1);
301301      break;
302302   default:
303303         logerror("CRTC WRITE REG: %x  Data: %03x\n",reg, scroll);
r14896r14897
448448         sx = spriteram_2[offs + 1] - 40 + 0x100*(spriteram_3[offs + 1] & 1);
449449         sy = 28*8-spriteram_2[offs]-1;
450450
451         if (flip_screen_get(machine))
451         if (state->flip_screen())
452452         {
453453            flipx = !flipx;
454454            flipy = !flipy;
src/mame/video/blktiger.c
r14896r14897
158158   device_set_input_line(m_audiocpu, INPUT_LINE_RESET, (data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
159159
160160   /* bit 6 flips screen */
161   flip_screen_set(machine(), data & 0x40);
161   flip_screen_set(data & 0x40);
162162
163163   /* bit 7 enables characters? Just a guess */
164164   m_chon = ~data & 0x80;
r14896r14897
206206      int color = attr & 0x07;
207207      int flipx = attr & 0x08;
208208
209      if (flip_screen_get(machine))
209      if (state->flip_screen())
210210      {
211211         sx = 240 - sx;
212212         sy = 240 - sy;
r14896r14897
216216      drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
217217            code,
218218            color,
219            flipx,flip_screen_get(machine),
219            flipx,state->flip_screen(),
220220            sx,sy,15);
221221   }
222222}
src/mame/video/dynduke.c
r14896r14897
128128      if (data&0x4) m_txt_enable = 0; else m_txt_enable = 1;
129129      if (data&0x8) m_sprite_enable=0; else m_sprite_enable=1;
130130
131      flip_screen_set(machine(), data & 0x40);
131      flip_screen_set(data & 0x40);
132132   }
133133}
134134
r14896r14897
157157      sprite = buffered_spriteram16[offs+1];
158158      sprite &= 0x3fff;
159159
160      if (flip_screen_get(machine)) {
160      if (state->flip_screen()) {
161161         x=240-x;
162162         y=240-y;
163163         if (fx) fx=0; else fx=1;
src/mame/video/tryout.c
r14896r14897
144144
145145WRITE8_MEMBER(tryout_state::tryout_flipscreen_w)
146146{
147   flip_screen_set(machine(), data & 1);
147   flip_screen_set(data & 1);
148148}
149149
150150static TILEMAP_MAPPER( get_fg_memory_offset )
r14896r14897
198198      fy = 0;
199199      inc = 16;
200200
201      if (flip_screen_get(machine))
201      if (state->flip_screen())
202202      {
203203         x = 240 - x;
204204         fx = !fx;
r14896r14897
234234   tryout_state *state = screen.machine().driver_data<tryout_state>();
235235   int scrollx = 0;
236236
237   if (!flip_screen_get(screen.machine()))
237   if (!state->flip_screen())
238238      state->m_fg_tilemap->set_scrollx(0, 16); /* Assumed hard-wired */
239239   else
240240      state->m_fg_tilemap->set_scrollx(0, -8); /* Assumed hard-wired */
src/mame/video/madmotor.c
r14896r14897
2525SCREEN_UPDATE_IND16( madmotor )
2626{
2727   madmotor_state *state = screen.machine().driver_data<madmotor_state>();
28   flip_screen_set(screen.machine(), screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
28   state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
2929
3030//  screen.machine().tilemap().set_flip_all(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
3131
src/mame/video/skyfox.c
r14896r14897
6060   switch (offset)
6161   {
6262      case 0:   m_bg_ctrl = data;   break;
63      case 1:   soundlatch_w(space, 0, data);   break;
63      case 1:   soundlatch_byte_w(space, 0, data);   break;
6464      case 2:   break;
6565      case 3:   break;
6666      case 4:   break;
src/mame/video/bublbobl.c
r14896r14897
7373            x = sx + xc * 8;
7474            y = (sy + yc * 8) & 0xff;
7575
76            if (flip_screen_get(screen.machine()))
76            if (state->flip_screen())
7777            {
7878               x = 248 - x;
7979               y = 248 - y;
src/mame/video/rocnrope.c
r14896r14897
9696
9797WRITE8_MEMBER(rocnrope_state::rocnrope_flipscreen_w)
9898{
99   if (flip_screen_get(machine()) != (~data & 0x01))
99   if (flip_screen() != (~data & 0x01))
100100   {
101      flip_screen_set(machine(), ~data & 0x01);
101      flip_screen_set(~data & 0x01);
102102      machine().tilemap().mark_all_dirty();
103103   }
104104}
src/mame/video/docastle.c
r14896r14897
7676
7777READ8_MEMBER(docastle_state::docastle_flipscreen_off_r)
7878{
79   flip_screen_set(machine(), 0);
79   flip_screen_set(0);
8080   m_do_tilemap->mark_all_dirty();
8181   return 0;
8282}
8383
8484READ8_MEMBER(docastle_state::docastle_flipscreen_on_r)
8585{
86   flip_screen_set(machine(), 1);
86   flip_screen_set(1);
8787   m_do_tilemap->mark_all_dirty();
8888   return 1;
8989}
9090
9191WRITE8_MEMBER(docastle_state::docastle_flipscreen_off_w)
9292{
93   flip_screen_set(machine(), 0);
93   flip_screen_set(0);
9494   m_do_tilemap->mark_all_dirty();
9595}
9696
9797WRITE8_MEMBER(docastle_state::docastle_flipscreen_on_w)
9898{
99   flip_screen_set(machine(), 1);
99   flip_screen_set(1);
100100   m_do_tilemap->mark_all_dirty();
101101}
102102
r14896r14897
190190         flipy = state->m_spriteram[offs + 2] & 0x80;
191191      }
192192
193      if (flip_screen_get(machine))
193      if (state->flip_screen())
194194      {
195195         sx = 240 - sx;
196196         sy = 240 - sy;
src/mame/video/mainsnk.c
r14896r14897
8888   int bank;
8989   int total_elements = machine().gfx[0]->total_elements;
9090
91   flip_screen_set(machine(), ~data & 0x80);
91   flip_screen_set(~data & 0x80);
9292
9393   m_bg_tilemap->set_palette_offset((data & 0x07) << 4);
9494   m_tx_tilemap->set_palette_offset((data & 0x07) << 4);
r14896r14897
146146      sx = 288-16 - sx;
147147      sy += 8;
148148
149      if (flip_screen_get(machine))
149      if (state->flip_screen())
150150      {
151151         sx = 288-16 - sx;
152152         sy = 224-16 - sy;
src/mame/video/senjyo.c
r14896r14897
179179      bitmap.fill(0, cliprect);
180180   else
181181   {
182      int flip = flip_screen_get(machine);
182      int flip = state->flip_screen();
183183
184184      pen = 0;
185185      count = 0;
r14896r14897
220220            sx = (8 * (offs % 8) + x) + 256-64;
221221            sy = ((offs & 0x1ff) / 8) + 96;
222222
223            if (flip_screen_get(machine))
223            if (state->flip_screen())
224224            {
225225               sx = 255 - sx;
226226               sy = 255 - sy;
r14896r14897
255255         flipx = spriteram[offs+1] & 0x40;
256256         flipy = spriteram[offs+1] & 0x80;
257257
258         if (flip_screen_get(machine))
258         if (state->flip_screen())
259259         {
260260            flipx = !flipx;
261261            flipy = !flipy;
r14896r14897
293293   palette_set_color(screen.machine(),513,MAKE_RGB(0xff,0xff,0x00));   /* yellow for player */
294294
295295   {
296      int flip = flip_screen_get(screen.machine());
296      int flip = state->flip_screen();
297297      int scrollx,scrolly;
298298
299299      for (i = 0;i < 32;i++)
src/mame/video/yiear.c
r14896r14897
6868WRITE8_MEMBER(yiear_state::yiear_control_w)
6969{
7070   /* bit 0 flips screen */
71   if (flip_screen_get(machine()) != (data & 0x01))
71   if (flip_screen() != (data & 0x01))
7272   {
73      flip_screen_set(machine(), data & 0x01);
73      flip_screen_set(data & 0x01);
7474      machine().tilemap().mark_all_dirty();
7575   }
7676
r14896r14897
120120      int sy = 240 - spriteram[offs + 1];
121121      int sx = spriteram_2[offs];
122122
123      if (flip_screen_get(machine))
123      if (state->flip_screen())
124124      {
125125         sy = 240 - sy;
126126         flipy = !flipy;
src/mame/video/sonson.c
r14896r14897
116116
117117WRITE8_MEMBER(sonson_state::sonson_flipscreen_w)
118118{
119   flip_screen_set(machine(), ~data & 0x01);
119   flip_screen_set(~data & 0x01);
120120}
121121
122122static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
152152      int sx = spriteram[offs + 3];
153153      int sy = spriteram[offs + 0];
154154
155      if (flip_screen_get(machine))
155      if (state->flip_screen())
156156      {
157157         sx = 240 - sx;
158158         sy = 240 - sy;
src/mame/video/simpl156.c
r14896r14897
4040   deco16ic_tilemap_1_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 4);
4141
4242   //FIXME: flip_screen_x should not be written!
43   flip_screen_set_no_update(screen.machine(), 1);
43   state->flip_screen_set_no_update(1);
4444
4545   screen.machine().device<decospr_device>("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram, 0x1400/4); // 0x1400/4 seems right for charlien (doesn't initialize any more RAM, so will draw a garbage 0 with more)
4646   return 0;
src/mame/video/deadang.c
r14896r14897
113113      color = (spriteram16[offs+1]>>12)&0xf;
114114      sprite = spriteram16[offs+1]&0xfff;
115115
116      if (flip_screen_get(machine)) {
116      if (state->flip_screen()) {
117117         x=240-x;
118118         y=240-y;
119119         if (fx) fx=0; else fx=1;
r14896r14897
151151   state->m_pf3_layer->enable(!(state->m_scroll_ram[0x34]&1));
152152   state->m_pf1_layer->enable(!(state->m_scroll_ram[0x34]&2));
153153   state->m_pf2_layer->enable(!(state->m_scroll_ram[0x34]&4));
154   flip_screen_set(screen.machine(),  state->m_scroll_ram[0x34]&0x40 );
154   state->flip_screen_set(state->m_scroll_ram[0x34]&0x40 );
155155
156156   bitmap.fill(get_black_pen(screen.machine()), cliprect);
157157   screen.machine().priority_bitmap.fill(0, cliprect);
src/mame/video/bking.c
r14896r14897
124124
125125   coin_lockout_global_w(machine(), ~data & 0x01);
126126
127   flip_screen_set_no_update(machine(), data & 0x04);
127   flip_screen_set_no_update(data & 0x04);
128128
129   machine().tilemap().set_flip_all(flip_screen_get(machine()) ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
129   machine().tilemap().set_flip_all(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
130130
131131   m_controller = data & 0x02;
132132
r14896r14897
304304         latch = 0x0400;
305305      }
306306
307      state->m_bg_tilemap->set_scrollx(0, flip_screen_get(screen.machine()) ? -xld : xld);
308      state->m_bg_tilemap->set_scrolly(0, flip_screen_get(screen.machine()) ? -yld : yld);
307      state->m_bg_tilemap->set_scrollx(0, state->flip_screen() ? -xld : xld);
308      state->m_bg_tilemap->set_scrolly(0, state->flip_screen() ? -yld : yld);
309309
310310      state->m_bg_tilemap->draw(state->m_tmp_bitmap1, rect, 0, 0);
311311
r14896r14897
331331                  int col = (xld + x) / 8 + 1;
332332                  int row = (yld + y) / 8 + 0;
333333
334                  latch |= (flip_screen_get(screen.machine()) ? 31 - col : col) << 0;
335                  latch |= (flip_screen_get(screen.machine()) ? 31 - row : row) << 5;
334                  latch |= (state->flip_screen() ? 31 - col : col) << 0;
335                  latch |= (state->flip_screen() ? 31 - row : row) << 5;
336336
337337                  state->m_pc3259_output[0] = (latch >> 0x0) & 0xf;
338338                  state->m_pc3259_output[1] = (latch >> 0x4) & 0xf;
src/mame/video/ddragon3.c
r14896r14897
1717      case 2: COMBINE_DATA(&m_bg_scrollx);   break;   // Scroll X, BG0
1818      case 3: COMBINE_DATA(&m_bg_scrolly);   break;   // Scroll Y, BG0
1919      case 4:                              break;   // Unknown write
20      case 5: flip_screen_set(machine(), data & 0x01);      break;   // Flip Screen
20      case 5: flip_screen_set(data & 0x01);      break;   // Flip Screen
2121      case 6:
2222         COMBINE_DATA(&m_bg_tilebase);         // BG Tile Base
2323         m_bg_tilebase &= 0x1ff;
r14896r14897
3535      case 1: return m_fg_scrolly;
3636      case 2: return m_bg_scrollx;
3737      case 3: return m_bg_scrolly;
38      case 5: return flip_screen_get(machine());
38      case 5: return flip_screen();
3939      case 6: return m_bg_tilebase;
4040   }
4141
r14896r14897
138138         if (attr & 0x02) sy = 239 + (0x100 - sy); else sy = 240 - sy;
139139         if (sx > 0x17f) sx = 0 - (0x200 - sx);
140140
141         if (flip_screen_get(machine))
141         if (state->flip_screen())
142142         {
143143            sx = 304 - sx;
144144            sy = 224 - sy;
r14896r14897
150150         {
151151            drawgfx_transpen(bitmap, cliprect,
152152               machine.gfx[1], code + i, color, flipx, flipy,
153               sx, sy + (flip_screen_get(machine) ? (i * 16) : (-i * 16)), 0);
153               sx, sy + (state->flip_screen() ? (i * 16) : (-i * 16)), 0);
154154         }
155155      }
156156
src/mame/video/decbac06.c
r14896r14897
250250    doesn't affect any games.
251251    */
252252
253   if (flip_screen_get(machine))
253   if (machine.driver_data()->flip_screen())
254254      src_y = (src_bitmap.height() - 256) - scrolly;
255255   else
256256      src_y = scrolly;
r14896r14897
261261      else
262262         src_x=scrollx;
263263
264      if (flip_screen_get(machine))
264      if (machine.driver_data()->flip_screen())
265265         src_x=(src_bitmap.width() - 256) - src_x;
266266
267267      for (x=0; x<=cliprect.max_x; x++) {
src/mame/video/ambush.c
r14896r14897
7171
7272      code = state->m_videoram[offs] | ((col & 0x60) << 3);
7373
74      if (flip_screen_get(machine))
74      if (state->flip_screen())
7575      {
7676         sx = 31 - sx;
7777         sy = 31 - sy;
r14896r14897
8181      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
8282         code,
8383         (col & 0x0f) | ((*state->m_colorbank & 0x03) << 4),
84         flip_screen_get(machine), flip_screen_get(machine),
84         state->flip_screen(), state->flip_screen(),
8585         8 * sx, (8 * sy + scroll) & 0xff, transpen);
8686   }
8787}
r14896r14897
119119         /* 16x16 sprites */
120120         gfx = 1;
121121
122         if (!flip_screen_get(screen.machine()))
122         if (!state->flip_screen())
123123            sy = 240 - sy;
124124         else
125125            sx = 240 - sx;
r14896r14897
130130         gfx = 0;
131131         code <<= 2;
132132
133         if (!flip_screen_get(screen.machine()))
133         if (!state->flip_screen())
134134            sy = 248 - sy;
135135         else
136136            sx = 248 - sx;
r14896r14897
140140      flipx = state->m_spriteram[offs + 1] & 0x40;
141141      flipy = state->m_spriteram[offs + 1] & 0x80;
142142
143      if (flip_screen_get(screen.machine()))
143      if (state->flip_screen())
144144      {
145145         flipx = !flipx;
146146         flipy = !flipy;
src/mame/video/sauro.c
r14896r14897
7979
8080WRITE8_MEMBER(sauro_state::sauro_scroll_fg_w)
8181{
82   const int *map = (flip_screen_get(machine()) ? scroll2_map_flip : scroll2_map);
82   const int *map = (flip_screen() ? scroll2_map_flip : scroll2_map);
8383   int scroll = (data & 0xf8) | map[data & 7];
8484
8585   m_fg_tilemap->set_scrollx(0, scroll);
r14896r14897
104104   sauro_state *state = machine.driver_data<sauro_state>();
105105   UINT8 *spriteram = state->m_spriteram;
106106   int offs,code,sx,sy,color,flipx;
107   int flipy = flip_screen_get(machine);
107   int flipy = state->flip_screen();
108108
109109   for (offs = 3; offs < state->m_spriteram_size - 1; offs += 4)
110110   {
r14896r14897
172172   sauro_state *state = machine.driver_data<sauro_state>();
173173   UINT8 *spriteram = state->m_spriteram;
174174   int offs,code,sy,color,flipx,sx;
175   int flipy = flip_screen_get(machine);
175   int flipy = state->flip_screen();
176176
177177   /* Weird, sprites entries don't start on DWORD boundary */
178178   for (offs = 3; offs < state->m_spriteram_size - 1; offs += 4)
src/mame/video/gaplus.c
r14896r14897
279279         int duplicate = spriteram_3[offs] & 0x80;
280280         int x,y;
281281
282         if (flip_screen_get(machine))
282         if (state->flip_screen())
283283         {
284284            flipx ^= 1;
285285            flipy ^= 1;
r14896r14897
308308{
309309   gaplus_state *state = screen.machine().driver_data<gaplus_state>();
310310   /* flip screen control is embedded in RAM */
311   flip_screen_set(screen.machine(), state->m_spriteram[0x1f7f-0x800] & 1);
311   state->flip_screen_set(state->m_spriteram[0x1f7f-0x800] & 1);
312312
313313   bitmap.fill(0, cliprect);
314314
src/mame/video/system1.c
r14896r14897
175175   m_video_mode = data;
176176
177177   /* bit 7 is flip screen */
178   flip_screen_set(machine(), data & 0x80);
178   flip_screen_set(data & 0x80);
179179}
180180
181181
r14896r14897
366366   UINT32 gfxbanks = machine.region("sprites")->bytes() / 0x8000;
367367   const UINT8 *gfxbase = machine.region("sprites")->base();
368368   UINT8 *spriteram = state->m_spriteram;
369   int flipscreen = flip_screen_get(machine);
369   int flipscreen = state->flip_screen();
370370   int spritenum;
371371
372372   /* up to 32 sprites total */
r14896r14897
578578   yscroll = videoram[0xfbd];
579579
580580   /* adjust for flipping */
581   if (flip_screen_get(screen.machine()))
581   if (state->flip_screen())
582582   {
583583      xscroll = 640 - (xscroll & 0x1ff);
584584      yscroll = 764 - (yscroll & 0x1ff);
r14896r14897
614614   bitmap_ind16 &fgpixmap = state->m_tilemap_page[0]->pixmap();
615615
616616   /* get scroll offsets */
617   if (!flip_screen_get(screen.machine()))
617   if (!state->flip_screen())
618618   {
619619      xscroll = ((videoram[0x7c0] | (videoram[0x7c1] << 8)) & 0x1ff) - 512 + 10;
620620      yscroll = videoram[0x7ba];
r14896r14897
657657   bitmap_ind16 &fgpixmap = state->m_tilemap_page[0]->pixmap();
658658
659659   /* get scroll offsets */
660   if (!flip_screen_get(screen.machine()))
660   if (!state->flip_screen())
661661   {
662662      for (y = 0; y < 32; y++)
663663         rowscroll[y] = ((videoram[0x7c0 + y * 2] | (videoram[0x7c1 + y * 2] << 8)) & 0x1ff) - 512 + 10;
src/mame/video/powerins.c
r14896r14897
5050
5151WRITE16_MEMBER(powerins_state::powerins_flipscreen_w)
5252{
53   if (ACCESSING_BITS_0_7)   flip_screen_set(machine(),  data & 1 );
53   if (ACCESSING_BITS_0_7)   flip_screen_set(data & 1 );
5454}
5555
5656WRITE16_MEMBER(powerins_state::powerins_tilebank_w)
r14896r14897
293293
294294      /* Handle flip_screen. Apply a global offset of 32 pixels along x too */
295295
296      if (flip_screen_get(machine))
296      if (state->flip_screen())
297297      {
298298         sx = screen_w - sx - dimx*16 - 32;   flipx = !flipx;
299299         sy = screen_h - sy - dimy*16;      flipy = !flipy;
src/mame/video/seta2.c
r14896r14897
133133   switch( offset*2 )
134134   {
135135   case 0x1c:   // FLIP SCREEN (myangel)    <- this is actually zoom
136      flip_screen_set(machine(),  data & 1 );
136      flip_screen_set(data & 1 );
137137      if (data & ~1)   logerror("CPU #0 PC %06X: flip screen unknown bits %04X\n",cpu_get_pc(&space.device()),data);
138138      break;
139139   case 0x2a:   // FLIP X (pzlbowl)
140      flip_screen_x_set(machine(),  data & 1 );
140      flip_screen_x_set(data & 1 );
141141      if (data & ~1)   logerror("CPU #0 PC %06X: flipx unknown bits %04X\n",cpu_get_pc(&space.device()),data);
142142      break;
143143   case 0x2c:   // FLIP Y (pzlbowl)
144      flip_screen_y_set(machine(),  data & 1 );
144      flip_screen_y_set(data & 1 );
145145      if (data & ~1)   logerror("CPU #0 PC %06X: flipy unknown bits %04X\n",cpu_get_pc(&space.device()),data);
146146      break;
147147
src/mame/video/shootout.c
r14896r14897
121121            int flipx = (attributes & 0x04);
122122            int flipy = 0;
123123
124            if (flip_screen_get(machine)) {
124            if (state->flip_screen()) {
125125               flipx = !flipx;
126126               flipy = !flipy;
127127            }
r14896r14897
132132
133133               vx = sx;
134134               vy = sy;
135               if (flip_screen_get(machine)) {
135               if (state->flip_screen()) {
136136                  vx = 240 - vx;
137137                  vy = 240 - vy;
138138               }
r14896r14897
151151
152152            vx = sx;
153153            vy = sy;
154            if (flip_screen_get(machine)) {
154            if (state->flip_screen()) {
155155               vx = 240 - vx;
156156               vy = 240 - vy;
157157            }
src/mame/video/paradise.c
r14896r14897
3030
3131WRITE8_MEMBER(paradise_state::paradise_flipscreen_w)
3232{
33   flip_screen_set(machine(), data ? 0 : 1);
33   flip_screen_set(data ? 0 : 1);
3434}
3535
3636WRITE8_MEMBER(paradise_state::tgtball_flipscreen_w)
3737{
38   flip_screen_set(machine(), data ? 1 : 0);
38   flip_screen_set(data ? 1 : 0);
3939}
4040
4141/* Note: Penky updates pixel palette bank register BEFORE actually writing to the paletteram. */
r14896r14897
200200      int flipx = 0;   // ?
201201      int flipy = 0;
202202
203      if (flip_screen_get(machine))
203      if (state->flip_screen())
204204      {
205205         x = 0xf0 - x;   flipx = !flipx;
206206         y = 0xf0 - y;   flipy = !flipy;
r14896r14897
263263
264264   if (layers_ctrl & 1)   state->m_tilemap_0->draw(bitmap, cliprect, 0, 0);
265265   if (layers_ctrl & 2)   state->m_tilemap_1->draw(bitmap, cliprect, 0, 0);
266   if (layers_ctrl & 4)   copybitmap_trans(bitmap, state->m_tmpbitmap, flip_screen_get(screen.machine()), flip_screen_get(screen.machine()), 0, 0, cliprect, 0x80f);
266   if (layers_ctrl & 4)   copybitmap_trans(bitmap, state->m_tmpbitmap, state->flip_screen(), state->flip_screen(), 0, 0, cliprect, 0x80f);
267267
268268   if (state->m_priority & 2)
269269   {
src/mame/video/ashnojoe.c
r14896r14897
221221
222222   //state->m_tilemap_reg[0] & 0x10 // ?? on coin insertion
223223
224   flip_screen_set(screen.machine(), state->m_tilemap_reg[0] & 1);
224   state->flip_screen_set(state->m_tilemap_reg[0] & 1);
225225
226226   if(state->m_tilemap_reg[0] & 0x02)
227227      state->m_joetilemap7->draw(bitmap, cliprect, 0, 0);
src/mame/video/terracre.c
r14896r14897
7878         color += 16 * (spritepalettebank[(tile>>1)&0xff] & 0x0f);
7979      }
8080
81      if (flip_screen_get(machine))
81      if (state->flip_screen())
8282      {
8383            sx=240-sx;
8484            sy=240-sy;
r14896r14897
170170   {
171171      coin_counter_w( machine(), 0, data&0x01 );
172172      coin_counter_w( machine(), 1, (data&0x02)>>1 );
173      flip_screen_set(machine(), data&0x04);
173      flip_screen_set(data&0x04);
174174   }
175175}
176176
src/mame/video/mouser.c
r14896r14897
4646
4747WRITE8_MEMBER(mouser_state::mouser_flip_screen_x_w)
4848{
49   flip_screen_x_set(machine(), ~data & 1);
49   flip_screen_x_set(~data & 1);
5050}
5151
5252WRITE8_MEMBER(mouser_state::mouser_flip_screen_y_w)
5353{
54   flip_screen_y_set(machine(), ~data & 1);
54   flip_screen_y_set(~data & 1);
5555}
5656
5757SCREEN_UPDATE_IND16( mouser )
r14896r14897
7171      sx = offs % 32;
7272      sy = offs / 32;
7373
74      if (flip_screen_x_get(screen.machine()))
74      if (state->flip_screen_x())
7575      {
7676         sx = 31 - sx;
7777      }
7878
79      if (flip_screen_y_get(screen.machine()))
79      if (state->flip_screen_y())
8080      {
8181         sy = 31 - sy;
8282      }
r14896r14897
9393      drawgfx_opaque(bitmap,cliprect,screen.machine().gfx[0],
9494            state->m_videoram[offs] | (state->m_colorram[color_offs] >> 5) * 256 | ((state->m_colorram[color_offs] >> 4) & 1) * 512,
9595            state->m_colorram[color_offs]%16,
96            flip_screen_x_get(screen.machine()),flip_screen_y_get(screen.machine()),
96            state->flip_screen_x(),state->flip_screen_y(),
9797            8*sx,scrolled_y_position);
9898   }
9999
r14896r14897
108108      flipx = BIT(spriteram[offs], 6);
109109      flipy = BIT(spriteram[offs], 7);
110110
111      if (flip_screen_x_get(screen.machine()))
111      if (state->flip_screen_x())
112112      {
113113         flipx = !flipx;
114114         sx = 240 - sx;
115115      }
116116
117      if (flip_screen_y_get(screen.machine()))
117      if (state->flip_screen_y())
118118      {
119119         flipy = !flipy;
120120         sy = 238 - sy;
r14896r14897
137137      flipx = BIT(spriteram[offs], 6);
138138      flipy = BIT(spriteram[offs], 7);
139139
140      if (flip_screen_x_get(screen.machine()))
140      if (state->flip_screen_x())
141141      {
142142         flipx = !flipx;
143143         sx = 240 - sx;
144144      }
145145
146      if (flip_screen_y_get(screen.machine()))
146      if (state->flip_screen_y())
147147      {
148148         flipy = !flipy;
149149         sy = 238 - sy;
src/mame/video/deco32.c
r14896r14897
582582   state->m_deco_tilegen1 = screen.machine().device("tilegen1");
583583   state->m_deco_tilegen2 = screen.machine().device("tilegen2");
584584
585   screen.machine().tilemap().set_flip_all(flip_screen_get(screen.machine()) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
585   screen.machine().tilemap().set_flip_all(state->flip_screen() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
586586
587587   screen.machine().priority_bitmap.fill(0, cliprect);
588588   bitmap.fill(screen.machine().pens[0x000], cliprect); // Palette index not confirmed
src/mame/video/lkage.c
r14896r14897
138138         priority_mask = 0xf0;
139139      }
140140
141      if (flip_screen_x_get(machine))
141      if (state->flip_screen_x())
142142      {
143143         sx = 239 - sx - 24;
144144         flipx = !flipx;
145145      }
146      if (flip_screen_y_get(machine))
146      if (state->flip_screen_y())
147147      {
148148         sy = 254 - 16 * height - sy;
149149         flipy = !flipy;
r14896r14897
176176   lkage_state *state = screen.machine().driver_data<lkage_state>();
177177   int bank;
178178
179   flip_screen_x_set(screen.machine(), ~state->m_vreg[2] & 0x01);
180   flip_screen_y_set(screen.machine(), ~state->m_vreg[2] & 0x02);
179   state->flip_screen_x_set(~state->m_vreg[2] & 0x01);
180   state->flip_screen_y_set(~state->m_vreg[2] & 0x02);
181181
182182   bank = state->m_vreg[1] & 0x08;
183183
src/mame/video/zaxxon.c
r14896r14897
187187{
188188
189189   /* low bit controls flip; background and sprite flip are handled at render time */
190   flip_screen_set_no_update(machine(), ~data & 1);
191   m_fg_tilemap->set_flip(flip_screen_get(machine()) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
190   flip_screen_set_no_update(~data & 1);
191   m_fg_tilemap->set_flip(flip_screen() ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
192192}
193193
194194
r14896r14897
323323      int colorbase = state->m_bg_color + (state->m_congo_color_bank << 8);
324324      int xmask = pixmap.width() - 1;
325325      int ymask = pixmap.height() - 1;
326      int flipmask = flip_screen_get(machine) ? 0xff : 0x00;
327      int flipoffs = flip_screen_get(machine) ? 0x38 : 0x40;
326      int flipmask = state->flip_screen() ? 0xff : 0x00;
327      int flipoffs = state->flip_screen() ? 0x38 : 0x40;
328328      int x, y;
329329
330330      /* the starting X value is offset by 1 pixel (normal) or 7 pixels */
331331      /* (flipped) due to a delay in the loading */
332      if (!flip_screen_get(machine))
332      if (!state->flip_screen())
333333         flipoffs -= 1;
334334      else
335335         flipoffs += 7;
r14896r14897
435435   zaxxon_state *state = machine.driver_data<zaxxon_state>();
436436   UINT8 *spriteram = state->m_spriteram;
437437   const gfx_element *gfx = machine.gfx[2];
438   int flip = flip_screen_get(machine);
438   int flip = state->flip_screen();
439439   int flipmask = flip ? 0xff : 0x00;
440440   int offs;
441441
src/mame/video/gaiden.c
r14896r14897
170170WRITE16_MEMBER(gaiden_state::gaiden_flip_w)
171171{
172172   if (ACCESSING_BITS_0_7)
173      flip_screen_set(machine(), data & 1);
173      flip_screen_set(data & 1);
174174}
175175
176176WRITE16_MEMBER(gaiden_state::gaiden_txscrollx_w)
r14896r14897
396396         if (ypos >= 256)
397397            ypos -= 512;
398398
399         if (flip_screen_get(machine))
399         if (state->flip_screen())
400400         {
401401            flipx = !flipx;
402402            flipy = !flipy;
r14896r14897
518518         if (ypos >= 256)
519519            ypos -= 512;
520520
521         if (flip_screen_get(machine))
521         if (state->flip_screen())
522522         {
523523            flipx = !flipx;
524524            flipy = !flipy;
src/mame/video/trackfld.c
r14896r14897
103103
104104WRITE8_MEMBER(trackfld_state::trackfld_flipscreen_w)
105105{
106   if (flip_screen_get(machine()) != data)
106   if (flip_screen() != data)
107107   {
108      flip_screen_set(machine(), data);
108      flip_screen_set(data);
109109      machine().tilemap().mark_all_dirty();
110110   }
111111}
r14896r14897
208208      int sx = spriteram[offs] - 1;
209209      int sy = 240 - spriteram_2[offs + 1];
210210
211      if (flip_screen_get(machine))
211      if (state->flip_screen())
212212      {
213213         sy = 240 - sy;
214214         flipy = !flipy;
r14896r14897
253253   for (row = 0; row < 32; row++)
254254   {
255255      scrollx = state->m_scroll[row] + 256 * (state->m_scroll2[row] & 0x01);
256      if (flip_screen_get(screen.machine())) scrollx = -scrollx;
256      if (state->flip_screen()) scrollx = -scrollx;
257257      state->m_bg_tilemap->set_scrollx(row, scrollx);
258258   }
259259
src/mame/video/fastfred.c
r14896r14897
204204WRITE8_HANDLER( fastfred_flip_screen_x_w )
205205{
206206   fastfred_state *state = space->machine().driver_data<fastfred_state>();
207   if (flip_screen_x_get(space->machine()) != (data & 0x01))
207   if (state->flip_screen_x() != (data & 0x01))
208208   {
209      flip_screen_x_set(space->machine(), data & 0x01);
209      state->flip_screen_x_set(data & 0x01);
210210
211      state->m_bg_tilemap->set_flip((flip_screen_x_get(space->machine()) ? TILEMAP_FLIPX : 0) | (flip_screen_y_get(space->machine()) ? TILEMAP_FLIPY : 0));
211      state->m_bg_tilemap->set_flip((state->flip_screen_x() ? TILEMAP_FLIPX : 0) | (state->flip_screen_y() ? TILEMAP_FLIPY : 0));
212212   }
213213}
214214
215215WRITE8_HANDLER( fastfred_flip_screen_y_w )
216216{
217217   fastfred_state *state = space->machine().driver_data<fastfred_state>();
218   if (flip_screen_y_get(space->machine()) != (data & 0x01))
218   if (state->flip_screen_y() != (data & 0x01))
219219   {
220      flip_screen_y_set(space->machine(), data & 0x01);
220      state->flip_screen_y_set(data & 0x01);
221221
222      state->m_bg_tilemap->set_flip((flip_screen_x_get(space->machine()) ? TILEMAP_FLIPX : 0) | (flip_screen_y_get(space->machine()) ? TILEMAP_FLIPY : 0));
222      state->m_bg_tilemap->set_flip((state->flip_screen_x() ? TILEMAP_FLIPX : 0) | (state->flip_screen_y() ? TILEMAP_FLIPY : 0));
223223   }
224224}
225225
r14896r14897
276276      }
277277
278278
279      if (flip_screen_x_get(machine))
279      if (state->flip_screen_x())
280280      {
281281         sx = 240 - sx;
282282         flipx = !flipx;
283283      }
284      if (flip_screen_y_get(machine))
284      if (state->flip_screen_y())
285285      {
286286         sy = 240 - sy;
287287         flipy = !flipy;
288288      }
289289
290      drawgfx_transpen(bitmap,flip_screen_x_get(machine) ? spritevisibleareaflipx : spritevisiblearea,machine.gfx[1],
290      drawgfx_transpen(bitmap,state->flip_screen_x() ? spritevisibleareaflipx : spritevisiblearea,machine.gfx[1],
291291            code,
292292            state->m_colorbank | (state->m_spriteram[offs + 2] & 0x07),
293293            flipx,flipy,
src/mame/video/lwings.c
r14896r14897
199199         flipx = buffered_spriteram[offs + 1] & 0x02;
200200         flipy = buffered_spriteram[offs + 1] & 0x04;
201201
202         if (flip_screen_get(machine))
202         if (state->flip_screen())
203203         {
204204            sx = 240 - sx;
205205            sy = 240 - sy;
r14896r14897
248248            flipy = 1;
249249         }
250250
251         if (flip_screen_get(machine))
251         if (state->flip_screen())
252252         {
253253            sx = 240 - sx;
254254            sy = 240 - sy;
src/mame/video/tecmo.c
r14896r14897
153153
154154WRITE8_MEMBER(tecmo_state::tecmo_flipscreen_w)
155155{
156   flip_screen_set(machine(), data & 1);
156   flip_screen_set(data & 1);
157157}
158158
159159
r14896r14897
205205         flipx = bank & 1;
206206         flipy = bank & 2;
207207
208         if (flip_screen_get(machine))
208         if (state->flip_screen())
209209         {
210210            xpos = 256 - (8 * size) - xpos;
211211            ypos = 256 - (8 * size) - ypos;
src/mame/video/finalizr.c
r14896r14897
121121
122122         if (size >= 0x10)   /* 32x32 */
123123         {
124            if (flip_screen_get(screen.machine()))
124            if (state->flip_screen())
125125            {
126126               sx = 256 - sx;
127127               sy = 224 - sy;
r14896r14897
152152         }
153153         else
154154         {
155            if (flip_screen_get(screen.machine()))
155            if (state->flip_screen())
156156            {
157157               sx = ((size & 0x08) ? 280:272) - sx;
158158               sy = ((size & 0x04) ? 248:240) - sy;
src/mame/video/cloak.c
r14896r14897
150150
151151WRITE8_MEMBER(cloak_state::cloak_flipscreen_w)
152152{
153   flip_screen_set(machine(), data & 0x80);
153   flip_screen_set(data & 0x80);
154154}
155155
156156static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
212212      int sx = spriteram[offs + 192];
213213      int sy = 240 - spriteram[offs];
214214
215      if (flip_screen_get(machine))
215      if (state->flip_screen())
216216      {
217217         sx -= 9;
218218         sy = 240 - sy;
src/mame/video/foodf.c
r14896r14897
6060 *
6161 *************************************/
6262
63void foodf_set_flip(foodf_state *state, int flip)
63void foodf_state::foodf_set_flip(int flip)
6464{
65   if (flip != state->m_playfield_flip)
65   if (flip != m_playfield_flip)
6666   {
67      state->m_playfield_flip = flip;
68      state->m_playfield_tilemap->mark_all_dirty();
67      m_playfield_flip = flip;
68      m_playfield_tilemap->mark_all_dirty();
6969   }
7070}
7171
r14896r14897
7777 *
7878 *************************************/
7979
80WRITE16_HANDLER( foodf_paletteram_w )
80WRITE16_MEMBER(foodf_state::foodf_paletteram_w)
8181{
82   foodf_state *state = space->machine().driver_data<foodf_state>();
8382   int newword, r, g, b, bit0, bit1, bit2;
8483
85   COMBINE_DATA(&state->m_generic_paletteram_16[offset]);
86   newword = state->m_generic_paletteram_16[offset];
84   COMBINE_DATA(&m_generic_paletteram_16[offset]);
85   newword = m_generic_paletteram_16[offset];
8786
8887   /* only the bottom 8 bits are used */
8988   /* red component */
9089   bit0 = (newword >> 0) & 0x01;
9190   bit1 = (newword >> 1) & 0x01;
9291   bit2 = (newword >> 2) & 0x01;
93   r = combine_3_weights(state->m_rweights, bit0, bit1, bit2);
92   r = combine_3_weights(m_rweights, bit0, bit1, bit2);
9493
9594   /* green component */
9695   bit0 = (newword >> 3) & 0x01;
9796   bit1 = (newword >> 4) & 0x01;
9897   bit2 = (newword >> 5) & 0x01;
99   g = combine_3_weights(state->m_gweights, bit0, bit1, bit2);
98   g = combine_3_weights(m_gweights, bit0, bit1, bit2);
10099
101100   /* blue component */
102101   bit0 = (newword >> 6) & 0x01;
103102   bit1 = (newword >> 7) & 0x01;
104   b = combine_2_weights(state->m_bweights, bit0, bit1);
103   b = combine_2_weights(m_bweights, bit0, bit1);
105104
106   palette_set_color(space->machine(), offset, MAKE_RGB(r, g, b));
105   palette_set_color(machine(), offset, MAKE_RGB(r, g, b));
107106}
108107
109108
src/mame/video/armedf.c
r14896r14897
353353      int sx = buffered_spriteram[offs + 3];
354354      int sy = state->m_sprite_offy + 240 - (buffered_spriteram[offs + 0] & 0x1ff);
355355
356      if (flip_screen_get(machine))
356      if (state->flip_screen())
357357      {
358358         sx = 320 - sx + 176;   /* don't ask where 176 comes from, just tried it out */
359359         sy = 240 - sy + 1;   /* don't ask where 1 comes from, just tried it out */
src/mame/video/appoooh.c
r14896r14897
181181   m_nmi_mask = data & 1;
182182
183183   /* bit 1 flip screen */
184   flip_screen_set(machine(), data & 0x02);
184   flip_screen_set(data & 0x02);
185185
186186   /* bits 2-3 unknown */
187187
r14896r14897
203203
204204static void appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, const gfx_element *gfx, UINT8 *sprite )
205205{
206   appoooh_state *state = gfx->machine().driver_data<appoooh_state>();
206207   int offs;
207   int flipy = flip_screen_get(gfx->machine());
208   int flipy = state->flip_screen();
208209
209210   for (offs = 0x20 - 4; offs >= 0; offs -= 4)
210211   {
r14896r14897
234235
235236static void robowres_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, const gfx_element *gfx, UINT8 *sprite )
236237{
238   appoooh_state *state = gfx->machine().driver_data<appoooh_state>();
237239   int offs;
238   int flipy = flip_screen_get(gfx->machine());
240   int flipy = state->flip_screen();
239241
240242   for (offs = 0x20 - 4; offs >= 0; offs -= 4)
241243   {
src/mame/video/travrusa.c
r14896r14897
276276   /* screen flip is handled both by software and hardware */
277277   data ^= ~input_port_read(machine(), "DSW2") & 1;
278278
279   flip_screen_set(machine(), data & 1);
279   flip_screen_set(data & 1);
280280
281281   coin_counter_w(machine(), 0, data & 0x02);
282282   coin_counter_w(machine(), 1, data & 0x20);
r14896r14897
297297   const rectangle spritevisiblearea(1*8, 31*8-1, 0*8, 24*8-1);
298298   const rectangle spritevisibleareaflip(1*8, 31*8-1, 8*8, 32*8-1);
299299   rectangle clip = cliprect;
300   if (flip_screen_get(machine))
300   if (state->flip_screen())
301301      clip &= spritevisibleareaflip;
302302   else
303303      clip &= spritevisiblearea;
r14896r14897
312312      int flipx = attr & 0x40;
313313      int flipy = attr & 0x80;
314314
315      if (flip_screen_get(machine))
315      if (state->flip_screen())
316316      {
317317         sx = 240 - sx;
318318         sy = 240 - sy;
src/mame/video/metlclsh.c
r14896r14897
197197
198198      sy = 240 - spriteram[offs + 2];
199199
200      if (flip_screen_get(machine))
200      if (state->flip_screen())
201201      {
202202         sx = 240 - sx;   flipx = !flipx;
203203         sy = 240 - sy;   flipy = !flipy;      if (sizey)   sy += 16;
r14896r14897
249249   if (state->m_scrollx[0] & 0x08)               // background (if enabled)
250250   {
251251      /* The background seems to be always flipped along x */
252      state->m_bg_tilemap->set_flip((flip_screen_get(screen.machine()) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0) ^ TILEMAP_FLIPX);
252      state->m_bg_tilemap->set_flip((state->flip_screen() ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0) ^ TILEMAP_FLIPX);
253253      state->m_bg_tilemap->set_scrollx(0, state->m_scrollx[1] + ((state->m_scrollx[0] & 0x02) << 7) );
254254      state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
255255   }
src/mame/video/prehisle.c
r14896r14897
5353   case 0x23: m_invert_controls = data ? 0x00ff : 0x0000; break;
5454   case 0x28: coin_counter_w(machine(), 0, data & 1); break;
5555   case 0x29: coin_counter_w(machine(), 1, data & 1); break;
56   case 0x30: flip_screen_set(machine(), data & 0x01); break;
56   case 0x30: flip_screen_set(data & 0x01); break;
5757   }
5858}
5959
r14896r14897
145145      if (sx&0x100) sx=-0x100+(sx&0xff);
146146      if (sy&0x100) sy=-0x100+(sy&0xff);
147147
148      if (flip_screen_get(machine))
148      if (state->flip_screen())
149149      {
150150         sx = 240 - sx;
151151         sy = 240 - sy;
src/mame/video/simpsons.c
r14896r14897
9898   if (bank & 1)
9999   {
100100      space->install_read_bank(0x0000, 0x0fff, "bank5");
101      space->install_write_handler(0x0000, 0x0fff, write8_delegate(FUNC(simpsons_state::paletteram_xBBBBBGGGGGRRRRR_be_w), state));
101      space->install_write_handler(0x0000, 0x0fff, write8_delegate(FUNC(simpsons_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state));
102102      memory_set_bankptr(machine, "bank5", state->m_generic_paletteram_8);
103103   }
104104   else
src/mame/video/wwfsstar.c
r14896r14897
158158
159159         number &= ~(chain - 1);
160160
161         if (flip_screen_get(machine))
161         if (state->flip_screen())
162162         {
163163            flipy = !flipy;
164164            flipx = !flipx;
r14896r14897
168168
169169         for (count=0;count<chain;count++)
170170         {
171            if (flip_screen_get(machine))
171            if (state->flip_screen())
172172            {
173173               if (!flipy)
174174               {
src/mame/video/jackal.c
r14896r14897
119119
120120static void draw_sprites_region( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *sram, int length, int bank )
121121{
122   jackal_state *state = machine.driver_data<jackal_state>();
122123   int offs;
123124
124125   for (offs = 0; offs < length; offs += 5)
r14896r14897
137138      if (sy > 0xf0)
138139         sy = sy - 256;
139140
140      if (flip_screen_get(machine))
141      if (state->flip_screen())
141142      {
142143         sx = 240 - sx;
143144         sy = 240 - sy;
r14896r14897
150151         int spritenum = sn1 * 4 + ((sn2 & (8 + 4)) >> 2) + ((sn2 & (2 + 1)) << 10);
151152         int mod = -8;
152153
153         if (flip_screen_get(machine))
154         if (state->flip_screen())
154155         {
155156            sx += 8;
156157            sy -= 8;
r14896r14897
159160
160161         if ((attr & 0x0C) == 0x0C)
161162         {
162            if (flip_screen_get(machine)) sy += 16;
163            if (state->flip_screen()) sy += 16;
163164            DRAW_SPRITE(bank + 1, spritenum, sx, sy)
164165         }
165166
r14896r14897
182183
183184         if (attr & 0x10)
184185         {
185            if (flip_screen_get(machine))
186            if (state->flip_screen())
186187            {
187188               sx -= 16;
188189               sy -= 16;
src/mame/video/namcos86.c
r14896r14897
312312      sx += sprite_xoffs;
313313      sy -= sprite_yoffs;
314314
315      if (flip_screen_get(machine))
315      if (state->flip_screen())
316316      {
317317         sx = -sx - sizex;
318318         sy = -sy - sizey;
r14896r14897
344344
345345   scrollx = state->m_xscroll[layer] - xdisp[layer];
346346   scrolly = state->m_yscroll[layer] + 9;
347   if (flip_screen_get(machine))
347   if (state->flip_screen())
348348   {
349349      scrollx = -scrollx;
350350      scrolly = -scrolly;
r14896r14897
360360   int layer;
361361
362362   /* flip screen is embedded in the sprite control registers */
363   /* can't use flip_screen_set(screen.machine(), ) because the visible area is asymmetrical */
364   flip_screen_set_no_update(screen.machine(), state->m_spriteram[0x07f6] & 1);
365   screen.machine().tilemap().set_flip_all(flip_screen_get(screen.machine()) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
363   /* can't use state->flip_screen_set() because the visible area is asymmetrical */
364   state->flip_screen_set_no_update(state->m_spriteram[0x07f6] & 1);
365   screen.machine().tilemap().set_flip_all(state->flip_screen() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
366366   set_scroll(screen.machine(), 0);
367367   set_scroll(screen.machine(), 1);
368368   set_scroll(screen.machine(), 2);
src/mame/video/suna8.c
r14896r14897
313313            if (flipx)   tile_flipx = !tile_flipx;
314314            if (flipy)   tile_flipy = !tile_flipy;
315315
316            if (flip_screen_get(machine))
316            if (state->flip_screen())
317317            {
318318               sx = max_x - sx;   tile_flipx = !tile_flipx;
319319               sy = max_y - sy;   tile_flipy = !tile_flipy;
r14896r14897
381381            int sx      =    x + tx * 8;
382382            int sy      =   (y + real_ty * 8) & 0xff;
383383
384            if (flip_screen_get(machine))
384            if (state->flip_screen())
385385            {
386386               sx = max_x - sx;   flipx = !flipx;
387387               sy = max_y - sy;   flipy = !flipy;
src/mame/video/vaportra.c
r14896r14897
5656   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
5757   int pri = state->m_priority[0] & 0x03;
5858
59   flip_screen_set(screen.machine(), !BIT(flip, 7));
59   state->flip_screen_set(!BIT(flip, 7));
6060   deco16ic_pf_update(state->m_deco_tilegen1, 0, 0);
6161   deco16ic_pf_update(state->m_deco_tilegen2, 0, 0);
6262
src/mame/video/btime.c
r14896r14897
140140WRITE8_MEMBER(btime_state::btime_paletteram_w)
141141{
142142   /* RGB output is inverted */
143   paletteram_BBGGGRRR_w(space, offset, ~data);
143   paletteram_BBGGGRRR_byte_w(space, offset, ~data);
144144}
145145
146146WRITE8_MEMBER(btime_state::lnc_videoram_w)
r14896r14897
247247   // Bit 0   = Flip screen
248248   // Bit 1-7 = Unknown
249249
250   flip_screen_set(machine(), data & 0x01);
250   flip_screen_set(data & 0x01);
251251}
252252
253253WRITE8_MEMBER(btime_state::bnj_video_control_w)
r14896r14897
277277   m_btime_palette = (data & 0x30) >> 3;
278278
279279   if (input_port_read(machine(), "DSW1") & 0x40) /* cocktail mode */
280      flip_screen_set(machine(), data & 0x80);
280      flip_screen_set(data & 0x80);
281281}
282282
283283WRITE8_MEMBER(btime_state::disco_video_control_w)
r14896r14897
285285   m_btime_palette = (data >> 2) & 0x03;
286286
287287   if (!(input_port_read(machine(), "DSW1") & 0x40)) /* cocktail mode */
288      flip_screen_set(machine(), data & 0x01);
288      flip_screen_set(data & 0x01);
289289}
290290
291291
r14896r14897
305305      if ((priority != -1) && (priority != ((code >> 7) & 0x01)))
306306         continue;
307307
308      if (flip_screen_get(machine))
308      if (state->flip_screen())
309309      {
310310         x = 31 + 16 - x;
311311         y = 33 - y;
r14896r14897
314314      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
315315            code,
316316            color,
317            flip_screen_get(machine),flip_screen_get(machine),
317            state->flip_screen(),state->flip_screen(),
318318            8*x,8*y,
319319            transparency ? 0 : -1);
320320   }
r14896r14897
324324                   UINT8 sprite_y_adjust, UINT8 sprite_y_adjust_flip_screen,
325325                   UINT8 *sprite_ram, offs_t interleave )
326326{
327   btime_state *state = machine.driver_data<btime_state>();
327328   int i;
328329   offs_t offs;
329330
r14896r14897
341342      flipx = sprite_ram[offs + 0] & 0x04;
342343      flipy = sprite_ram[offs + 0] & 0x02;
343344
344      if (flip_screen_get(machine))
345      if (state->flip_screen())
345346      {
346347         x = 240 + 128 - x;
347348         y = 256 - y + sprite_y_adjust_flip_screen;
r14896r14897
358359            flipx,flipy,
359360            x, y,0);
360361
361      y = y + (flip_screen_get(machine) ? -256 : 256);
362      y = y + (state->flip_screen() ? -256 : 256);
362363
363364      // Wrap around
364365      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
r14896r14897
394395         int x = 240 - (16 * (offs / 16) + scroll) - 1;
395396         int y = 16 * (offs % 16);
396397
397         if (flip_screen_get(machine))
398         if (state->flip_screen())
398399         {
399400            x = 240 + 128 - x;
400401            y = 256 - y;
r14896r14897
403404         drawgfx_opaque(bitmap, cliprect,machine.gfx[2],
404405               gfx[tileoffset + offs],
405406               color,
406               flip_screen_get(machine),flip_screen_get(machine),
407               state->flip_screen(),state->flip_screen(),
407408               x,y);
408409      }
409410   }
r14896r14897
418419      int i, start;
419420
420421      // Generate tile map
421      if (flip_screen_get(screen.machine()))
422      if (state->flip_screen())
422423         start = 0;
423424      else
424425         start = 1;
r14896r14897
495496         sy = 16 * (((offs % 0x100) < 0x80) ? offs % 8 : (offs % 8) + 8);
496497         sx = 496 - sx;
497498
498         if (flip_screen_get(screen.machine()))
499         if (state->flip_screen())
499500         {
500501            sx = 496 - sx;
501502            sy = 256 - sy;
r14896r14897
504505         drawgfx_opaque(*state->m_background_bitmap, state->m_background_bitmap->cliprect(), screen.machine().gfx[2],
505506               (state->m_bnj_backgroundram[offs] >> 4) + ((offs & 0x80) >> 3) + 32,
506507               0,
507               flip_screen_get(screen.machine()), flip_screen_get(screen.machine()),
508               state->flip_screen(), state->flip_screen(),
508509               sx, sy);
509510      }
510511
511512      /* copy the background bitmap to the screen */
512513      scroll = (state->m_bnj_scroll1 & 0x02) * 128 + 511 - state->m_bnj_scroll2;
513      if (!flip_screen_get(screen.machine()))
514      if (!state->flip_screen())
514515         scroll = 767 - scroll;
515516      copyscrollbitmap(bitmap, *state->m_background_bitmap, 1, &scroll, 0, 0, cliprect);
516517
r14896r14897
542543      sx = 31 - (offs / 32);
543544      sy = offs % 32;
544545
545      if (flip_screen_get(screen.machine()))
546      if (state->flip_screen())
546547      {
547548         sx = 31 - sx;
548549         sy = 33 - sy;
r14896r14897
551552      drawgfx_opaque(bitmap, cliprect, screen.machine().gfx[2],
552553            state->m_bnj_backgroundram[offs],
553554            0,
554            flip_screen_get(screen.machine()), flip_screen_get(screen.machine()),
555            state->flip_screen(), state->flip_screen(),
555556            8*sx,8*sy);
556557   }
557558
src/mame/video/nova2001.c
r14896r14897
5151{
5252   int i;
5353
54   paletteram_BBGGRRII_w(space,offset,data);
54   paletteram_BBGGRRII_byte_w(space,offset,data);
5555
5656   // expand the sprite palette to full length
5757   if (offset < 16)
5858   {
59      paletteram_BBGGRRII_w(space, 0x200 + offset * 16 + 1, data);
59      paletteram_BBGGRRII_byte_w(space, 0x200 + offset * 16 + 1, data);
6060
6161      if (offset != 1)
6262      {
6363         for (i = 0; i < 16; i++)
6464         {
65            paletteram_BBGGRRII_w(space, 0x200 + offset + i * 16, data);
65            paletteram_BBGGRRII_byte_w(space, 0x200 + offset + i * 16, data);
6666         }
6767      }
6868   }
r14896r14897
248248WRITE8_MEMBER(nova2001_state::nova2001_flipscreen_w)
249249{
250250   // inverted
251   flip_screen_set(machine(), ~data & 1);
251   flip_screen_set(~data & 1);
252252}
253253
254254WRITE8_MEMBER(nova2001_state::pkunwar_flipscreen_w)
255255{
256   flip_screen_set(machine(), data & 1);
256   flip_screen_set(data & 1);
257257}
258258
259259
r14896r14897
286286         continue;
287287      }
288288
289      if (flip_screen_get(machine))
289      if (state->flip_screen())
290290      {
291291         sx = 240 - sx;
292292         sy = 240 - sy;
r14896r14897
324324         continue;
325325      }
326326
327      if (flip_screen_get(machine))
327      if (state->flip_screen())
328328      {
329329         sx = 240 - sx;
330330         sy = 240 - sy;
src/mame/video/cps1.c
r14896r14897
23122312
23132313#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY)               \
23142314{                                                   \
2315   if (flip_screen_get(machine))                                 \
2315   if (state->flip_screen())                                 \
23162316      pdrawgfx_transpen(bitmap,\
23172317            cliprect,machine.gfx[2],                     \
23182318            CODE,                                    \
r14896r14897
25502550
25512551#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY)                           \
25522552{                                                               \
2553   if (flip_screen_get(machine))                                             \
2553   if (state->flip_screen())                                             \
25542554      pdrawgfx_transpen(bitmap,\
25552555            cliprect,machine.gfx[2],                                 \
25562556            CODE,                                                \
r14896r14897
27182718            int sy = (offs % 256);
27192719            sx = (sx - state->m_stars2x + (col & 0x1f)) & 0x1ff;
27202720            sy = (sy - state->m_stars2y) & 0xff;
2721            if (flip_screen_get(screen.machine()))
2721            if (state->flip_screen())
27222722            {
27232723               sx = 511 - sx;
27242724               sy = 255 - sy;
r14896r14897
27432743            int sy = (offs % 256);
27442744            sx = (sx - state->m_stars1x + (col & 0x1f)) & 0x1ff;
27452745            sy = (sy - state->m_stars1y) & 0xff;
2746            if (flip_screen_get(screen.machine()))
2746            if (state->flip_screen())
27472747            {
27482748               sx = 511 - sx;
27492749               sy = 255 - sy;
r14896r14897
28052805   int layercontrol, l0, l1, l2, l3;
28062806   int videocontrol = state->m_cps_a_regs[CPS1_VIDEOCONTROL];
28072807
2808   flip_screen_set(screen.machine(), videocontrol & 0x8000);
2808   state->flip_screen_set(videocontrol & 0x8000);
28092809
28102810   layercontrol = state->m_cps_b_regs[state->m_game_config->layer_control / 2];
28112811
src/mame/video/yunsun16.c
r14896r14897
172172      x += state->m_sprites_scrolldx;
173173      y += state->m_sprites_scrolldy;
174174
175      if (flip_screen_get(machine))   // not used?
175      if (state->flip_screen())   // not used?
176176      {
177177         flipx = !flipx;      x = max_x - x - 16;
178178         flipy = !flipy;      y = max_y - y - 16;
src/mame/video/mermaid.c
r14896r14897
8383
8484WRITE8_MEMBER(mermaid_state::mermaid_flip_screen_x_w)
8585{
86   flip_screen_x_set(machine(), data & 0x01);
86   flip_screen_x_set(data & 0x01);
8787}
8888
8989WRITE8_MEMBER(mermaid_state::mermaid_flip_screen_y_w)
9090{
91   flip_screen_y_set(machine(), data & 0x01);
91   flip_screen_y_set(data & 0x01);
9292}
9393
9494WRITE8_MEMBER(mermaid_state::mermaid_bg_scroll_w)
r14896r14897
205205      code |= state->m_rougien_gfxbank1 * 0x2800;
206206      code |= state->m_rougien_gfxbank2 * 0x2400;
207207
208      if (flip_screen_x_get(machine))
208      if (state->flip_screen_x())
209209      {
210210         flipx = !flipx;
211211         sx = 240 - sx;
212212      }
213213
214      if (flip_screen_y_get(machine))
214      if (state->flip_screen_y())
215215      {
216216         flipy = !flipy;
217217         sy = 240 - sy;
218218      }
219219
220      drawgfx_transpen(bitmap, (flip_screen_x_get(machine) ? flip_spritevisiblearea : spritevisiblearea),
220      drawgfx_transpen(bitmap, (state->flip_screen_x() ? flip_spritevisiblearea : spritevisiblearea),
221221         machine.gfx[1], code, color, flipx, flipy, sx, sy, 0);
222222   }
223223}
r14896r14897
291291         code |= state->m_rougien_gfxbank1 * 0x2800;
292292         code |= state->m_rougien_gfxbank2 * 0x2400;
293293
294         if (flip_screen_x_get(screen.machine()))
294         if (state->flip_screen_x())
295295         {
296296            flipx = !flipx;
297297            sx = 240 - sx;
298298         }
299299
300         if (flip_screen_y_get(screen.machine()))
300         if (state->flip_screen_y())
301301         {
302302            flipy = !flipy;
303303            sy = 240 - sy;
r14896r14897
354354               code2 |= state->m_rougien_gfxbank1 * 0x2800;
355355               code2 |= state->m_rougien_gfxbank2 * 0x2400;
356356
357               if (flip_screen_x_get(screen.machine()))
357               if (state->flip_screen_x())
358358               {
359359                  flipx2 = !flipx2;
360360                  sx2 = 240 - sx2;
361361               }
362362
363               if (flip_screen_y_get(screen.machine()))
363               if (state->flip_screen_y())
364364               {
365365                  flipy2 = !flipy2;
366366                  sy2 = 240 - sy2;
r14896r14897
394394         code |= state->m_rougien_gfxbank1 * 0x2800;
395395         code |= state->m_rougien_gfxbank2 * 0x2400;
396396
397         if (flip_screen_x_get(screen.machine()))
397         if (state->flip_screen_x())
398398         {
399399            flipx = !flipx;
400400            sx = 240 - sx;
401401         }
402402
403         if (flip_screen_y_get(screen.machine()))
403         if (state->flip_screen_y())
404404         {
405405            flipy = !flipy;
406406            sy = 240 - sy;
r14896r14897
435435               code2 |= state->m_rougien_gfxbank1 * 0x2800;
436436               code2 |= state->m_rougien_gfxbank2 * 0x2400;
437437
438               if (flip_screen_x_get(screen.machine()))
438               if (state->flip_screen_x())
439439               {
440440                  flipx2 = !flipx2;
441441                  sx2 = 240 - sx2;
442442               }
443443
444               if (flip_screen_y_get(screen.machine()))
444               if (state->flip_screen_y())
445445               {
446446                  flipy2 = !flipy2;
447447                  sy2 = 240 - sy2;
r14896r14897
475475         code |= state->m_rougien_gfxbank1 * 0x2800;
476476         code |= state->m_rougien_gfxbank2 * 0x2400;
477477
478         if (flip_screen_x_get(screen.machine()))
478         if (state->flip_screen_x())
479479         {
480480            flipx = !flipx;
481481            sx = 240 - sx;
482482         }
483483
484         if (flip_screen_y_get(screen.machine()))
484         if (state->flip_screen_y())
485485         {
486486            flipy = !flipy;
487487            sy = 240 - sy;
r14896r14897
516516               code2 |= state->m_rougien_gfxbank1 * 0x2800;
517517               code2 |= state->m_rougien_gfxbank2 * 0x2400;
518518
519               if (flip_screen_x_get(screen.machine()))
519               if (state->flip_screen_x())
520520               {
521521                  flipx2 = !flipx2;
522522                  sx2 = 240 - sx2;
523523               }
524524
525               if (flip_screen_y_get(screen.machine()))
525               if (state->flip_screen_y())
526526               {
527527                  flipy2 = !flipy2;
528528                  sy2 = 240 - sy2;
src/mame/video/othldrby.c
r14896r14897
153153      sizex = (state->m_buf_spriteram[offs + 2] & 0x000f) + 1;
154154      sizey = (state->m_buf_spriteram[offs + 3] & 0x000f) + 1;
155155
156      if (flip_screen_get(machine))
156      if (state->flip_screen())
157157      {
158158         flipx = !flipx;
159159         flipy = !flipy;
r14896r14897
180180   othldrby_state *state = screen.machine().driver_data<othldrby_state>();
181181   int layer;
182182
183   flip_screen_set(screen.machine(), state->m_vreg[0x0f] & 0x80);
183   state->flip_screen_set(state->m_vreg[0x0f] & 0x80);
184184
185185   for (layer = 0; layer < 3; layer++)
186186   {
187      if (flip_screen_get(screen.machine()))
187      if (state->flip_screen())
188188      {
189189         state->m_bg_tilemap[layer]->set_scrollx(0, state->m_vreg[2 * layer] + 59);
190190         state->m_bg_tilemap[layer]->set_scrolly(0, state->m_vreg[2 * layer + 1] + 248);
src/mame/video/snk.c
r14896r14897
489489
490490WRITE8_MEMBER(snk_state::marvins_flipscreen_w)
491491{
492   flip_screen_set(machine(), data & 0x80);
492   flip_screen_set(data & 0x80);
493493
494494   // other bits unknown
495495}
r14896r14897
497497WRITE8_MEMBER(snk_state::sgladiat_flipscreen_w)
498498{
499499
500   flip_screen_set(machine(), data & 0x80);
500   flip_screen_set(data & 0x80);
501501
502502   m_bg_tilemap->set_palette_offset(((data & 0xf) ^ 8) << 4);
503503
r14896r14897
507507WRITE8_MEMBER(snk_state::hal21_flipscreen_w)
508508{
509509
510   flip_screen_set(machine(), data & 0x80);
510   flip_screen_set(data & 0x80);
511511
512512   m_bg_tilemap->set_palette_offset(((data & 0xf) ^ 8) << 4);
513513   if (m_bg_tile_offset != ((data & 0x20) << 3))
r14896r14897
558558    */
559559
560560
561   flip_screen_set(machine(), data & 0x20);
561   flip_screen_set(data & 0x20);
562562
563563   m_bg_scrolly =   (m_bg_scrolly   & 0xff) | ((data & 0x10) << 4);
564564   m_sp16_scrolly = (m_sp16_scrolly & 0xff) | ((data & 0x08) << 5);
r14896r14897
581581    */
582582
583583
584   flip_screen_set(machine(), data & 0x80);
584   flip_screen_set(data & 0x80);
585585
586586   if (m_tx_tile_offset != ((data & 0x40) << 2))
587587   {
r14896r14897
661661WRITE8_MEMBER(snk_state::gwar_videoattrs_w)
662662{
663663
664   flip_screen_set(machine(), data & 0x04);
664   flip_screen_set(data & 0x04);
665665
666666   m_sp32_scrollx = (m_sp32_scrollx & 0xff) | ((data & 0x80) << 1);
667667   m_sp16_scrollx = (m_sp16_scrollx & 0xff) | ((data & 0x40) << 2);
r14896r14897
674674WRITE8_MEMBER(snk_state::gwara_videoattrs_w)
675675{
676676
677   flip_screen_set(machine(), data & 0x10);
677   flip_screen_set(data & 0x10);
678678
679679   m_bg_scrollx =   (m_bg_scrollx   & 0xff) | ((data & 0x02) << 7);
680680   m_bg_scrolly =   (m_bg_scrolly   & 0xff) | ((data & 0x01) << 8);
r14896r14897
733733      int flipy = (attributes&0x20);
734734      int flipx = 0;
735735
736      if (flip_screen_get(machine))
736      if (state->flip_screen())
737737      {
738738         sx = 89 - 16 - sx;
739739         sy = 262 - 16 - sy;
r14896r14897
800800         yflip = attributes & 0x20;
801801      }
802802
803      if (flip_screen_get(machine))
803      if (state->flip_screen())
804804      {
805805         sx = 89 - size - sx;   // this causes slight misalignment in tnk3 but is correct for athena and fitegolf
806806         sy = 262 - size - sy;
r14896r14897
935935      if (hw_xflip)
936936         sx = 495 - size - sx;
937937
938      if (flip_screen_get(machine))
938      if (state->flip_screen())
939939      {
940940         sx = 495 - size - sx;
941941         sy = 258 - size - sy;
src/mame/video/hyprduel.c
r14896r14897
557557
558558         UINT32 gfxstart = (8 * 8 * 4 / 8) * (((attr & 0x000f) << 16) + code);
559559
560         if (flip_screen_get(machine))
560         if (state->flip_screen())
561561         {
562562            flipx = !flipx;      x = max_x - x - width;
563563            flipy = !flipy;      y = max_y - y - height;
r14896r14897
729729        ---- ---- ---- ---0     Flip  Screen    */
730730   if (screenctrl & 2)
731731      return 0;
732   flip_screen_set(screen.machine(), screenctrl & 1);
732   state->flip_screen_set(screenctrl & 1);
733733
734734#if 0
735735if (screen.machine().input().code_pressed(KEYCODE_Z))
src/mame/video/flstory.c
r14896r14897
102102WRITE8_MEMBER(flstory_state::flstory_palette_w)
103103{
104104   if (offset & 0x100)
105      paletteram_xxxxBBBBGGGGRRRR_split2_w(space, (offset & 0xff) + (m_palette_bank << 8),data);
105      paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w(space, (offset & 0xff) + (m_palette_bank << 8),data);
106106   else
107      paletteram_xxxxBBBBGGGGRRRR_split1_w(space, (offset & 0xff) + (m_palette_bank << 8),data);
107      paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w(space, (offset & 0xff) + (m_palette_bank << 8),data);
108108}
109109
110110READ8_MEMBER(flstory_state::flstory_palette_r)
r14896r14897
129129   }
130130   m_palette_bank = (data & 0x20) >> 5;
131131
132   flip_screen_set(machine(), m_flipscreen);
132   flip_screen_set(m_flipscreen);
133133
134134//popmessage("%04x: gfxctrl = %02x\n", cpu_get_pc(&space.device()), data);
135135
r14896r14897
151151   if (data & 0x04)
152152   {
153153      m_flipscreen = (data & 0x01);
154      flip_screen_set(machine(), m_flipscreen);
154      flip_screen_set(m_flipscreen);
155155   }
156156
157157//popmessage("%04x: gfxctrl = %02x\n", cpu_get_pc(&space.device()), data);
src/mame/video/strnskil.c
r14896r14897
5252{
5353   m_scrl_ctrl = data >> 5;
5454
55   if (flip_screen_get(machine()) != (data & 0x08))
55   if (flip_screen() != (data & 0x08))
5656   {
57      flip_screen_set(machine(), data & 0x08);
57      flip_screen_set(data & 0x08);
5858      machine().tilemap().mark_all_dirty();
5959   }
6060}
r14896r14897
8989   {
9090      int code = spriteram[offs + 1];
9191      int color = spriteram[offs + 2] & 0x3f;
92      int flipx = flip_screen_x_get(machine);
93      int flipy = flip_screen_y_get(machine);
92      int flipx = state->flip_screen_x();
93      int flipy = state->flip_screen_y();
9494
9595      int sx = spriteram[offs + 3];
9696      int sy = spriteram[offs];
9797      int px, py;
9898
99      if (flip_screen_get(machine))
99      if (state->flip_screen())
100100      {
101101         px = 240 - sx + 0; /* +2 or +0 ? */
102102         py = sy;
src/mame/video/cosmic.c
r14896r14897
268268      {
269269         if (data & 0x80)
270270         {
271            if (flip_screen_get(machine))
271            if (state->flip_screen())
272272               bitmap.pix16(255-y, 255-x) = pen;
273273            else
274274               bitmap.pix16(y, x) = pen;
r14896r14897
317317
318318static void cosmica_draw_starfield( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
319319{
320   cosmic_state *state = screen.machine().driver_data<cosmic_state>();
320321   UINT8 y = 0;
321322   UINT8 map = 0;
322323   UINT8 *PROM = screen.machine().region("user2")->base();
r14896r14897
333334         UINT8 x1;
334335         int hc, hb_;
335336
336         if (flip_screen_get(screen.machine()))
337         if (state->flip_screen())
337338            x1 = x - screen.frame_number();
338339         else
339340            x1 = x + screen.frame_number();
r14896r14897
366367
367368static void devzone_draw_grid( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
368369{
370   cosmic_state *state = machine.driver_data<cosmic_state>();
369371   UINT8 y;
370372   UINT8 *horz_PROM = machine.region("user2")->base();
371373   UINT8 *vert_PROM = machine.region("user3")->base();
r14896r14897
404406            if (!(vert_data & horz_data & 0x80))   /* NAND gate */
405407            {
406408               /* blue */
407               if (flip_screen_get(machine))
409               if (state->flip_screen())
408410                  bitmap.pix16(255-y, 255-x) = 4;
409411               else
410412                  bitmap.pix16(y, x) = 4;
r14896r14897
424426
425427static void nomnlnd_draw_background( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
426428{
429   cosmic_state *state = screen.machine().driver_data<cosmic_state>();
427430   UINT8 y = 0;
428431   UINT8 water = screen.frame_number();
429432   UINT8 *PROM = screen.machine().region("user2")->base();
r14896r14897
489492            if ((!hd_) & hc_ & (!hb_))
490493            {
491494               offs_t offs = ((x >> 3) & 0x03) | ((y & 0x1f) << 2) |
492                             (flip_screen_get(screen.machine()) ? 0x80 : 0);
495                             (state->flip_screen() ? 0x80 : 0);
493496
494497               UINT8 plane1 = PROM[offs         ] << (x & 0x07);
495498               UINT8 plane2 = PROM[offs | 0x0400] << (x & 0x07);
r14896r14897
523526
524527         if (color != 0)
525528         {
526            if (flip_screen_get(screen.machine()))
529            if (state->flip_screen())
527530               bitmap.pix16(255-y, 255-x) = color;
528531            else
529532               bitmap.pix16(y, x) = color;
src/mame/video/shaolins.c
r14896r14897
125125
126126   m_nmi_enable = data;
127127
128   if (flip_screen_get(machine()) != (data & 0x01))
128   if (flip_screen() != (data & 0x01))
129129   {
130      flip_screen_set(machine(), data & 0x01);
130      flip_screen_set(data & 0x01);
131131      machine().tilemap().mark_all_dirty();
132132   }
133133}
r14896r14897
170170         int sx = 240 - spriteram[offs + 6];
171171         int sy = 248 - spriteram[offs + 4];
172172
173         if (flip_screen_get(machine))
173         if (state->flip_screen())
174174         {
175175            sx = 240 - sx;
176176            sy = 248 - sy;
src/mame/video/sshangha.c
r14896r14897
3838   if (state->m_spriteram2 != NULL)
3939      screen.machine().device<decospr_device>("spritegen2")->draw_sprites(bitmap, cliprect, state->m_spriteram2, 0x800, true);
4040
41   screen.machine().tilemap().set_flip_all(flip_screen_x_get(screen.machine()) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
41   screen.machine().tilemap().set_flip_all(state->flip_screen_x() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
4242
4343   bitmap.fill(get_black_pen(screen.machine()), cliprect);
4444
src/mame/video/decospr.c
r14896r14897
213213
214214   int offs, end, incr;
215215
216   int flipscreen = flip_screen_get(machine());
216   int flipscreen = machine().driver_data()->flip_screen();
217217
218218   if (invert_flip)
219219      flipscreen = !flipscreen;
src/mame/video/popeye.c
r14896r14897
191191      sx = 8 * (offset % 128);
192192      sy = 8 * (offset / 128);
193193
194      if (flip_screen_get(machine()))
194      if (flip_screen())
195195         sy = 512-8 - sy;
196196
197197      colour = data & 0x0f;
r14896r14897
208208      sx = 8 * (offset % 64);
209209      sy = 4 * (offset / 64);
210210
211      if (flip_screen_get(machine()))
211      if (flip_screen())
212212         sy = 512-4 - sy;
213213
214214      colour = data & 0x0f;
r14896r14897
282282   int offs;
283283   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
284284
285   if (state->m_lastflip != flip_screen_get(machine))
285   if (state->m_lastflip != state->flip_screen())
286286   {
287287      for (offs = 0;offs < popeye_bitmapram_size;offs++)
288288         state->popeye_bitmap_w(*space,offs,state->m_bitmapram[offs]);
289289
290      state->m_lastflip = flip_screen_get(machine);
290      state->m_lastflip = state->flip_screen();
291291   }
292292
293293   set_background_palette(machine, (*state->m_palettebank & 0x08) >> 3);
r14896r14897
303303      if (state->m_bitmap_type == TYPE_SKYSKIPR)
304304         scrollx = 2*scrollx - 512;
305305
306      if (flip_screen_get(machine))
306      if (state->flip_screen())
307307      {
308308         if (state->m_bitmap_type == TYPE_POPEYE)
309309            scrollx = -scrollx;
r14896r14897
351351      sx = 2*(spriteram[offs])-8;
352352      sy = 2*(256-spriteram[offs + 1]);
353353
354      if (flip_screen_get(machine))
354      if (state->flip_screen())
355355      {
356356         flipx = !flipx;
357357         flipy = !flipy;
src/mame/video/pushman.c
r14896r14897
105105      flipx = spriteram[offs + 1] & 2;
106106      flipy = spriteram[offs + 1] & 1;   /* flip y untested */
107107
108      if (flip_screen_get(machine))
108      if (state->flip_screen())
109109      {
110110         x = 240 - x;
111111         y = 240 - y;
src/mame/video/hyperspt.c
r14896r14897
103103
104104WRITE8_MEMBER(hyperspt_state::hyperspt_flipscreen_w)
105105{
106   if (flip_screen_get(machine()) != (data & 0x01))
106   if (flip_screen() != (data & 0x01))
107107   {
108      flip_screen_set(machine(), data & 0x01);
108      flip_screen_set(data & 0x01);
109109      machine().tilemap().mark_all_dirty();
110110   }
111111}
r14896r14897
143143      int flipx = ~spriteram[offs] & 0x40;
144144      int flipy = spriteram[offs] & 0x80;
145145
146      if (flip_screen_get(machine))
146      if (state->flip_screen())
147147      {
148148         sy = 240 - sy;
149149         flipy = !flipy;
150150      }
151151
152      /* Note that this adjustment must be done AFTER handling flip_screen_get(machine), thus */
152      /* Note that this adjustment must be done AFTER handling state->flip_screen(), thus */
153153      /* proving that this is a hardware related "feature" */
154154
155155      sy += 1;
r14896r14897
180180   for (row = 0; row < 32; row++)
181181   {
182182      int scrollx = state->m_scroll[row * 2] + (state->m_scroll[(row * 2) + 1] & 0x01) * 256;
183      if (flip_screen_get(screen.machine())) scrollx = -scrollx;
183      if (state->flip_screen()) scrollx = -scrollx;
184184      state->m_bg_tilemap->set_scrollx(row, scrollx);
185185   }
186186
src/mame/video/toaplan1.c
r14896r14897
508508{
509509
510510   COMBINE_DATA(&m_colorram1[offset]);
511   paletteram16_xBBBBBGGGGGRRRRR_word_w(space, offset, data, mem_mask);
511   paletteram_xBBBBBGGGGGRRRRR_word_w(space, offset, data, mem_mask);
512512}
513513
514514/* sprite palette */
r14896r14897
522522{
523523
524524   COMBINE_DATA(&m_colorram2[offset]);
525   paletteram16_xBBBBBGGGGGRRRRR_word_w(space, offset+(m_colorram1_size/2), data, mem_mask);
525   paletteram_xBBBBBGGGGGRRRRR_word_w(space, offset+(m_colorram1_size/2), data, mem_mask);
526526}
527527
528528READ16_MEMBER(toaplan1_state::toaplan1_spriteram16_r)
src/mame/video/zodiack.c
r14896r14897
3939
4040WRITE8_MEMBER( zodiack_state::flipscreen_w )
4141{
42   if (flip_screen_get(machine()) != (~data & 0x01))
42   if (flip_screen() != (~data & 0x01))
4343   {
44      flip_screen_set(machine(), ~data & 0x01);
44      flip_screen_set(~data & 0x01);
4545      machine().tilemap().mark_all_dirty();
4646   }
4747}
r14896r14897
127127   m_fg_tilemap->set_scroll_cols(32);
128128
129129   /* FIXME: flip_screen_x should not be written. */
130   flip_screen_set_no_update(machine(), 0);
130   flip_screen_set_no_update(0);
131131}
132132
133133void zodiack_state::draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect )
r14896r14897
139139      x = m_bulletsram[offs + 3] + 7;
140140      y = 255 - m_bulletsram[offs + 1];
141141
142      if (flip_screen_get(machine()) && m_percuss_hardware)
142      if (flip_screen() && m_percuss_hardware)
143143      {
144144         y = 255 - y;
145145      }
r14896r14897
166166      flipy = m_spriteram[offs + 1] & 0x80;
167167      spritecode = m_spriteram[offs + 1] & 0x3f;
168168
169      if (flip_screen_get(machine()) && m_percuss_hardware)
169      if (flip_screen() && m_percuss_hardware)
170170      {
171171         sy = 240 - sy;
172172         flipy = !flipy;
src/mame/video/pitnrun.c
r14896r14897
190190      flipy = (spriteram[offs+1]&0x80)>>7;
191191      flipx = (spriteram[offs+1]&0x40)>>6;
192192
193      if (flip_screen_x_get(machine))
193      if (state->flip_screen_x())
194194      {
195195         sx = 256 - sx;
196196         flipx = !flipx;
197197      }
198      if (flip_screen_y_get(machine))
198      if (state->flip_screen_y())
199199      {
200200         sy = 240 - sy;
201201         flipy = !flipy;
r14896r14897
245245      dx=128-state->m_h_heed+((state->m_ha&8)<<5)+3;
246246      dy=128-state->m_v_heed+((state->m_ha&0x10)<<4);
247247
248      if (flip_screen_x_get(screen.machine()))
248      if (state->flip_screen_x())
249249         dx=128-dx+16;
250250
251      if (flip_screen_y_get(screen.machine()))
251      if (state->flip_screen_y())
252252         dy=128-dy;
253253
254254      myclip.set(dx, dx+127, dy, dy+127);
r14896r14897
260260   draw_sprites(screen.machine(),bitmap,myclip);
261261
262262   if(state->m_ha&4)
263      copybitmap_trans(bitmap,*state->m_tmp_bitmap[state->m_ha&3],flip_screen_x_get(screen.machine()),flip_screen_y_get(screen.machine()),dx,dy,myclip, 1);
263      copybitmap_trans(bitmap,*state->m_tmp_bitmap[state->m_ha&3],state->flip_screen_x(),state->flip_screen_y(),dx,dy,myclip, 1);
264264   state->m_fg->draw(bitmap, cliprect, 0,0);
265265   return 0;
266266}
src/mame/video/liberatr.c
r14896r14897
209209
210210***************************************************************************/
211211
212void liberatr_state::video_start()
212void liberatr_state::video_start_liberatr()
213213{
214214   // for each planet in the planet ROMs
215215   init_planet(m_planets[0], &machine().region("gfx1")->base()[0x2000]);
src/mame/video/tehkanwc.c
r14896r14897
4545
4646WRITE8_MEMBER(tehkanwc_state::tehkanwc_flipscreen_x_w)
4747{
48   flip_screen_x_set(machine(), data & 0x40);
48   flip_screen_x_set(data & 0x40);
4949}
5050
5151WRITE8_MEMBER(tehkanwc_state::tehkanwc_flipscreen_y_w)
5252{
53   flip_screen_y_set(machine(), data & 0x40);
53   flip_screen_y_set(data & 0x40);
5454}
5555
5656WRITE8_MEMBER(tehkanwc_state::gridiron_led0_w)
r14896r14897
140140      int sx = spriteram[offs + 2] + ((attr & 0x20) << 3) - 128;
141141      int sy = spriteram[offs + 3];
142142
143      if (flip_screen_x_get(machine))
143      if (state->flip_screen_x())
144144      {
145145         sx = 240 - sx;
146146         flipx = !flipx;
147147      }
148148
149      if (flip_screen_y_get(machine))
149      if (state->flip_screen_y())
150150      {
151151         sy = 240 - sy;
152152         flipy = !flipy;
src/mame/video/bionicc.c
r14896r14897
183183
184184   if (ACCESSING_BITS_8_15)
185185   {
186      flip_screen_set(machine(), data & 0x0100);
186      flip_screen_set(data & 0x0100);
187187
188188      m_bg_tilemap->enable(data & 0x2000);   /* guess */
189189      m_fg_tilemap->enable(data & 0x1000);   /* guess */
r14896r14897
223223         if (sy > 512 - 16)
224224            sy -= 512;
225225
226         if (flip_screen_get(machine))
226         if (state->flip_screen())
227227         {
228228            sx = 240 - sx;
229229            sy = 240 - sy;
src/mame/video/deckarn.c
r14896r14897
7171      y = (y + 16) % 0x200;
7272      x = 256 - x;
7373      y = 256 - y;
74      if (flip_screen_get(machine))
74      if (machine.driver_data()->flip_screen())
7575      {
7676         y = 240 - y;
7777         x = 240 - x;
src/mame/video/citycon.c
r14896r14897
9595
9696   /* bit 0 flips screen */
9797   /* it is also used to multiplex player 1 and player 2 controls */
98   flip_screen_set(machine(), data & 0x01);
98   flip_screen_set(data & 0x01);
9999
100100   /* bits 1-3 are unknown */
101101//  if ((data & 0x0e) != 0) logerror("background register = %02x\n", data);
r14896r14897
115115      sx = state->m_spriteram[offs + 3];
116116      sy = 239 - state->m_spriteram[offs];
117117      flipx = ~state->m_spriteram[offs + 2] & 0x10;
118      if (flip_screen_get(machine))
118      if (state->flip_screen())
119119      {
120120         sx = 240 - sx;
121121         sy = 238 - sy;
r14896r14897
125125      drawgfx_transpen(bitmap, cliprect, machine.gfx[state->m_spriteram[offs + 1] & 0x80 ? 2 : 1],
126126            state->m_spriteram[offs + 1] & 0x7f,
127127            state->m_spriteram[offs + 2] & 0x0f,
128            flipx,flip_screen_get(machine),
128            flipx,state->flip_screen(),
129129            sx, sy, 0);
130130   }
131131}
src/mame/video/psikyo.c
r14896r14897
332332      zoomx = 32 - zoomx;
333333      zoomy = 32 - zoomy;
334334
335      if (flip_screen_get(machine))
335      if (state->flip_screen())
336336      {
337337         x = width  - x - (nx * zoomx) / 2;
338338         y = height - y - (ny * zoomy) / 2;
r14896r14897
453453      zoomy = 32 - zoomy;
454454
455455
456      if (flip_screen_get(machine))
456      if (state->flip_screen())
457457      {
458458         x = width  - x - (nx * zoomx) / 2;
459459         y = height - y - (ny * zoomy) / 2;
r14896r14897
533533
534534   tilemap_t *tmptilemap0, *tmptilemap1;
535535
536   flip_screen_set(screen.machine(), ~input_port_read(screen.machine(), "DSW") & 0x00010000);      // hardwired to a DSW bit
536   state->flip_screen_set(~input_port_read(screen.machine(), "DSW") & 0x00010000);      // hardwired to a DSW bit
537537
538538   /* Layers enable (not quite right) */
539539
r14896r14897
707707
708708   tilemap_t *tmptilemap0, *tmptilemap1;
709709
710   flip_screen_set(screen.machine(), ~input_port_read(screen.machine(), "DSW") & 0x00010000);      // hardwired to a DSW bit
710   state->flip_screen_set(~input_port_read(screen.machine(), "DSW") & 0x00010000);      // hardwired to a DSW bit
711711
712712   /* Layers enable (not quite right) */
713713
src/mame/video/esd16.c
r14896r14897
114114   m_tilemap0_color = data & 3;
115115   m_tilemap_0->mark_all_dirty();
116116
117   flip_screen_set(machine(), data & 0x80);
117   flip_screen_set(data & 0x80);
118118}
119119
120120
src/mame/video/st0016.c
r14896r14897
425425   state_save_register_global(machine, st0016_spr2_bank);
426426   state_save_register_global(machine, st0016_pal_bank);
427427   state_save_register_global(machine, st0016_char_bank);
428   state_save_register_global(machine, st0016_rom_bank);
428   //state_save_register_global(machine, st0016_rom_bank);
429429   state_save_register_global_array(machine, st0016_vregs);
430430   state_save_register_global_pointer(machine, st0016_charram, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE);
431431   state_save_register_global_pointer(machine, st0016_paletteram, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE);
src/mame/video/sbasketb.c
r14896r14897
108108
109109WRITE8_MEMBER(sbasketb_state::sbasketb_flipscreen_w)
110110{
111   if (flip_screen_get(machine()) != data)
111   if (flip_screen() != data)
112112   {
113      flip_screen_set(machine(), data);
113      flip_screen_set(data);
114114      machine().tilemap().mark_all_dirty();
115115   }
116116}
r14896r14897
152152         int flipx =  spriteram[offs + 1] & 0x40;
153153         int flipy =  spriteram[offs + 1] & 0x80;
154154
155         if (flip_screen_get(machine))
155         if (state->flip_screen())
156156         {
157157            sx = 240 - sx;
158158            sy = 240 - sy;
src/mame/video/funkyjet.c
r14896r14897
1616   funkyjet_state *state = screen.machine().driver_data<funkyjet_state>();
1717   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
1818
19   flip_screen_set(screen.machine(), BIT(flip, 7));
19   state->flip_screen_set(BIT(flip, 7));
2020   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
2121
2222   bitmap.fill(768, cliprect);
src/mame/video/ksayakyu.c
r14896r14897
2222   m_video_ctrl = data;
2323
2424   m_flipscreen = data & 4;
25   flip_screen_set(machine(), m_flipscreen);
25   flip_screen_set(m_flipscreen);
2626   m_tilemap->set_scrolly(0, (data & 0xe0) << 3);
2727   if(m_flipscreen)
2828      m_tilemap->set_flip((data & 2) ? TILEMAP_FLIPY : TILEMAP_FLIPX | TILEMAP_FLIPY);
src/mame/video/himesiki.c
r14896r14897
4141WRITE8_MEMBER(himesiki_state::himesiki_flip_w)
4242{
4343   m_flipscreen = data & 0xc0;
44   flip_screen_set(machine(), m_flipscreen);
44   flip_screen_set(m_flipscreen);
4545
4646   if (data & 0x3f)
4747      logerror("p08_w %02x\n",data);
src/mame/video/battlex.c
r14896r14897
3737{
3838   m_starfield_enabled = data & 0x10;
3939
40   if (flip_screen_get(machine()) != (data >> 7))
40   if (flip_screen() != (data >> 7))
4141   {
42      flip_screen_set(machine(), data & 0x80);
42      flip_screen_set(data & 0x80);
4343      machine().tilemap().mark_all_dirty();
4444   }
4545}
r14896r14897
7676      int flipy = source[1] & 0x80;
7777      int flipx = source[1] & 0x40;
7878
79      if (flip_screen_get(machine))
79      if (state->flip_screen())
8080      {
8181         sx = 240 - sx;
8282         sy = 240 - sy;
src/mame/video/ironhors.c
r14896r14897
122122
123123WRITE8_MEMBER(ironhors_state::ironhors_flipscreen_w)
124124{
125   if (flip_screen_get(machine()) != (~data & 0x08))
125   if (flip_screen() != (~data & 0x08))
126126   {
127      flip_screen_set(machine(), ~data & 0x08);
127      flip_screen_set(~data & 0x08);
128128      machine().tilemap().mark_all_dirty();
129129   }
130130
r14896r14897
170170      int flipy = sr[offs + 4] & 0x40;
171171      int code = (sr[offs] << 2) + ((sr[offs + 1] & 0x03) << 10) + ((sr[offs + 1] & 0x0c) >> 2);
172172      int color = ((sr[offs + 1] & 0xf0) >> 4) + 16 * state->m_palettebank;
173   //  int mod = flip_screen_get(machine) ? -8 : 8;
173   //  int mod = state->flip_screen() ? -8 : 8;
174174
175      if (flip_screen_get(machine))
175      if (state->flip_screen())
176176      {
177177         sx = 240 - sx;
178178         sy = 240 - sy;
r14896r14897
192192
193193         case 0x04:   /* 16x8 */
194194            {
195               if (flip_screen_get(machine)) sy += 8; // this fixes the train wheels' position
195               if (state->flip_screen()) sy += 8; // this fixes the train wheels' position
196196
197197               drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
198198                     code & ~1,
r14896r14897
283283      int code = (sr[offs] << 2) + ((sr2[offs] & 0x03) << 10) + ((sr2[offs] & 0x0c) >> 2);
284284      int color = ((sr2[offs] & 0xf0) >> 4) + 16 * state->m_palettebank;
285285
286   //  int mod = flip_screen_get() ? -8 : 8;
286   //  int mod = flip_screen() ? -8 : 8;
287287
288//      if (flip_screen_get())
288//      if (flip_screen())
289289      {
290290      //  sx = 240 - sx;
291291         sy = 240 - sy;
r14896r14897
305305
306306         case 0x04:   /* 16x8 */
307307            {
308               if (flip_screen_get(machine)) sy += 8; // this fixes the train wheels' position
308               if (state->flip_screen()) sy += 8; // this fixes the train wheels' position
309309
310310               drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
311311                     code & ~1,
src/mame/video/mjkjidai.c
r14896r14897
5757   m_nmi_mask = data & 1;
5858
5959   /* bit 1 = flip screen */
60   flip_screen_set(machine(), data & 0x02);
60   flip_screen_set(data & 0x02);
6161
6262   /* bit 2 =display enable */
6363   m_display_enable = data & 0x04;
r14896r14897
106106
107107      sx += (spriteram_2[offs] & 0x20) >> 5;   // not sure about this
108108
109      if (flip_screen_get(machine))
109      if (state->flip_screen())
110110      {
111111         sx = 496 - sx;
112112         sy = 240 - sy;
src/mame/video/jailbrek.c
r14896r14897
7979      int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
8080      int sy = spriteram[i + 3];
8181
82      if (flip_screen_get(machine))
82      if (state->flip_screen())
8383      {
8484         sx = 240 - sx;
8585         sy = 240 - sy;
src/mame/video/bankp.c
r14896r14897
126126   m_nmi_mask = (data & 0x10) >> 4;
127127
128128   /* bit 5 controls screen flip */
129   flip_screen_set(machine(), data & 0x20);
129   flip_screen_set(data & 0x20);
130130
131131   /* bits 6-7 unknown */
132132}
r14896r14897
171171{
172172   bankp_state *state = screen.machine().driver_data<bankp_state>();
173173
174   if (flip_screen_get(screen.machine()))
174   if (state->flip_screen())
175175   {
176176      state->m_fg_tilemap->set_scrollx(0, -state->m_scroll_x);
177177      state->m_bg_tilemap->set_scrollx(0, 0);
src/mame/video/crbaloon.c
r14896r14897
104104   UINT8 *gfx = machine.region("gfx2")->base() + (code << 7);
105105
106106
107   if (flip_screen_get(machine))
107   if (state->flip_screen())
108108      sy += 32;
109109
110110   /* assume no collision */
src/mame/video/bosco.c
r14896r14897
204204      int flipy = spriteram[offs] & 2;
205205      int color = spriteram_2[offs + 1] & 0x3f;
206206
207      if (flip_screen_get(machine))
207      if (state->flip_screen())
208208      {
209209         sx += 128-2;
210210         sy += 8;
r14896r14897
230230      int x = state->m_bosco_radarx[offs] + ((~state->m_bosco_radarattr[offs] & 0x01) << 8);
231231      int y = 253 - state->m_bosco_radary[offs];
232232
233      if (flip_screen_get(machine))
233      if (state->flip_screen())
234234      {
235235         x += 96-2;
236236         y += 8;
r14896r14897
289289       the screen, and clip it to only the position where it is supposed to be shown */
290290   rectangle fg_clip = cliprect;
291291   rectangle bg_clip = cliprect;
292   if (flip_screen_get(screen.machine()))
292   if (state->flip_screen())
293293   {
294294      bg_clip.min_x = 20*8;
295295      fg_clip.max_x = 20*8-1;
r14896r14897
301301   }
302302
303303   bitmap.fill(get_black_pen(screen.machine()), cliprect);
304   draw_stars(screen.machine(),bitmap,cliprect,flip_screen_get(screen.machine()));
304   draw_stars(screen.machine(),bitmap,cliprect,state->flip_screen());
305305
306306   state->m_bg_tilemap->draw(bitmap, bg_clip, 0,0);
307307   state->m_fg_tilemap->draw(bitmap, fg_clip, 0,0);
src/mame/video/funkybee.c
r14896r14897
6262
6363WRITE8_MEMBER(funkybee_state::funkybee_scroll_w)
6464{
65   m_bg_tilemap->set_scrollx(0, flip_screen_get(machine()) ? -data : data);
65   m_bg_tilemap->set_scrollx(0, flip_screen() ? -data : data);
6666}
6767
6868WRITE8_MEMBER(funkybee_state::funkybee_flipscreen_w)
6969{
70   flip_screen_set(machine(), data & 0x01);
70   flip_screen_set(data & 0x01);
7171}
7272
7373static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
107107      int sx = state->m_videoram[offs2 + 0x10];
108108      int sy = 224 - state->m_colorram[offs2];
109109
110      if (flip_screen_get(machine))
110      if (state->flip_screen())
111111      {
112112         sy += 32;
113113         flipx = !flipx;
r14896r14897
127127
128128   for (offs = 0x1f; offs >= 0; offs--)
129129   {
130      int const flip = flip_screen_get(machine);
130      int const flip = state->flip_screen();
131131      int code = state->m_videoram[0x1c00 + offs];
132132      int color = state->m_colorram[0x1f10] & 0x03;
133133      int sx = flip ? state->m_videoram[0x1f1f] : state->m_videoram[0x1f10];
src/mame/video/lastduel.c
r14896r14897
128128{
129129   if (ACCESSING_BITS_0_7)
130130   {
131      flip_screen_set(machine(), data & 0x01);
131      flip_screen_set(data & 0x01);
132132
133133      coin_lockout_w(machine(), 0, ~data & 0x10);
134134      coin_lockout_w(machine(), 1, ~data & 0x20);
r14896r14897
245245      flipy = attr & state->m_sprite_flipy_mask;   /* 0x40 for lastduel, 0x80 for madgear */
246246      color = attr & 0x0f;
247247
248      if (flip_screen_get(machine))
248      if (state->flip_screen())
249249      {
250250         sx = 496 - sx;
251251         sy = 240 - sy;
src/mame/video/freekick.c
r14896r14897
4343      int flipy = 0;
4444      int color = state->m_spriteram[offs + 1] & 0x1f;
4545
46      if (flip_screen_x_get(machine))
46      if (state->flip_screen_x())
4747      {
4848         xpos = 240 - xpos;
4949         flipx = !flipx;
5050      }
51      if (flip_screen_y_get(machine))
51      if (state->flip_screen_y())
5252      {
5353         ypos = 256 - ypos;
5454         flipy = !flipy;
r14896r14897
7878      int flipy = 0;//state->m_spriteram[offs + 0] & 0x40;
7979      int color = state->m_spriteram[offs + 1] & 0x0f;
8080
81      if (flip_screen_x_get(machine))
81      if (state->flip_screen_x())
8282      {
8383         xpos = 240 - xpos;
8484         flipx = !flipx;
8585      }
86      if (flip_screen_y_get(machine))
86      if (state->flip_screen_y())
8787      {
8888         ypos = 256 - ypos;
8989         flipy = !flipy;
r14896r14897
114114      int flipy = state->m_spriteram[offs + 2] & 0x40;
115115      int color = state->m_spriteram[offs + 2] & 0x1f;
116116
117      if (flip_screen_x_get(machine))
117      if (state->flip_screen_x())
118118      {
119119         xpos = 240 - xpos;
120120         flipx = !flipx;
121121      }
122      if (flip_screen_y_get(machine))
122      if (state->flip_screen_y())
123123      {
124124         ypos = 256 - ypos;
125125         flipy = !flipy;
src/mame/video/cischeat.c
r14896r14897
410410         }
411411
412412      case 0x2200/2 : return input_port_read(machine(), "IN5");   // DSW 3 (4 bits)
413      case 0x2300/2 : return soundlatch2_r(space,0);   // From sound cpu
413      case 0x2300/2 : return soundlatch2_byte_r(space,0);   // From sound cpu
414414
415415      default:   SHOW_READ_ERROR("vreg %04X read!",offset*2);
416416               return m_vregs[offset];
r14896r14897
496496
497497      case 0x0006/2 :   return input_port_read(machine(), "IN3");   // ? Read at boot only
498498
499      case 0x0008/2 :   return soundlatch2_r(space,0);      // From sound cpu
499      case 0x0008/2 :   return soundlatch2_byte_r(space,0);      // From sound cpu
500500
501501      case 0x000c/2 :   return input_port_read(machine(), "IN4");   // DSW 3
502502
r14896r14897
538538
539539      case 0x0004/2 :   return input_port_read(machine(), "IN1"); // Buttons
540540
541      case 0x0008/2 :   return soundlatch2_r(space,0); // From sound cpu
541      case 0x0008/2 :   return soundlatch2_byte_r(space,0); // From sound cpu
542542
543543      case 0x0010/2 :   // X, Y
544544         return input_port_read(machine(), "IN2") | (input_port_read(machine(), "IN3")<<8);
src/mame/video/redclash.c
r14896r14897
120120
121121WRITE8_HANDLER( redclash_flipscreen_w )
122122{
123   flip_screen_set(space->machine(), data & 0x01);
123   ladybug_state *state = space->machine().driver_data<ladybug_state>();
124   state->flip_screen_set(data & 0x01);
124125}
125126
126127void redclash_set_stars_enable( running_machine &machine, UINT8 on ); //temp
r14896r14897
278279      int sx = 8 * offs + (state->m_videoram[offs] & 0x07);   /* ?? */
279280      int sy = 0xff - state->m_videoram[offs + 0x20];
280281
281      if (flip_screen_get(machine))
282      if (state->flip_screen())
282283      {
283284         sx = 240 - sx;
284285      }
src/mame/video/galaxold.c
r14896r14897
11591159
11601160static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
11611161{
1162   galaxold_state *state = machine.driver_data<galaxold_state>();
11621163   int i, color;
11631164
1164   if (flip_screen_x_get(machine))  x++;
1165   if (state->flip_screen_x())  x++;
11651166
11661167   x = x - 6;
11671168
r14896r14897
13391340   int col1 = base + state->m_dambustr_bg_color_1;
13401341   int col2 = base + state->m_dambustr_bg_color_2;
13411342
1342   if (flip_screen_x_get(machine))
1343   if (state->flip_screen_x())
13431344   {
13441345      bitmap.plot_box(  0, 0, 256-state->m_dambustr_bg_split_line, 256, col2);
13451346      bitmap.plot_box(256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col1);
r14896r14897
13561357{
13571358   galaxold_state *state = machine.driver_data<galaxold_state>();
13581359
1359   if (flip_screen_x_get(machine))
1360   if (state->flip_screen_x())
13601361   {
13611362      rectangle clip(254 - state->m_dambustr_bg_split_line, state->m_dambustr_bg_split_line, 0, 255);
13621363      copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip);
src/mame/video/welltris.c
r14896r14897
165165         m_char_tilemap->mark_all_dirty();
166166      }
167167
168      flip_screen_set(machine(), data & 0x80);
168      flip_screen_set(data & 0x80);
169169
170170      m_spritepalettebank = (data & 0x20) >> 5;
171171      m_pixelpalettebank = (data & 0x08) >> 3;
src/mame/video/dec0.c
r14896r14897
4949{
5050   dec0_state *state = screen.machine().driver_data<dec0_state>();
5151
52   flip_screen_set(screen.machine(), screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
52   state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
5353
5454   screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
5555   screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, 0x08, 0x0f);
r14896r14897
6767SCREEN_UPDATE_IND16( baddudes )
6868{
6969   dec0_state *state = screen.machine().driver_data<dec0_state>();
70   flip_screen_set(screen.machine(), screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
70   state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
7171
7272   /* WARNING: inverted wrt Midnight Resistance */
7373   if ((state->m_pri & 0x01) == 0)
r14896r14897
108108   dec0_state *state = screen.machine().driver_data<dec0_state>();
109109   int trans;
110110
111   flip_screen_set(screen.machine(), screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
111   state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
112112
113113   if (state->m_pri & 0x04)
114114      trans = 0x08;
r14896r14897
153153{
154154   dec0_state *state = screen.machine().driver_data<dec0_state>();
155155
156   flip_screen_set(screen.machine(), screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
156   state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
157157
158158   /* This game doesn't have the extra playfield chip on the game board, but
159159    the palette does show through. */
r14896r14897
169169SCREEN_UPDATE_IND16( hippodrm )
170170{
171171   dec0_state *state = screen.machine().driver_data<dec0_state>();
172   flip_screen_set(screen.machine(), screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
172   state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
173173
174174   if (state->m_pri & 0x01)
175175   {
r14896r14897
192192SCREEN_UPDATE_IND16( slyspy )
193193{
194194   dec0_state *state = screen.machine().driver_data<dec0_state>();
195   flip_screen_set(screen.machine(), screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
195   state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
196196
197197   screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
198198   screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
r14896r14897
214214   dec0_state *state = screen.machine().driver_data<dec0_state>();
215215   int trans;
216216
217   flip_screen_set(screen.machine(), screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
217   state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
218218
219219   if (state->m_pri & 0x04)
220220      trans = 0x00;
src/mame/video/cop01.c
r14896r14897
151151   {
152152      coin_counter_w(machine(), 0, data & 1);
153153      coin_counter_w(machine(), 1, data & 2);
154      flip_screen_set(machine(), data & 4);
154      flip_screen_set(data & 4);
155155   }
156156}
157157
r14896r14897
183183      sx = (state->m_spriteram[offs + 3] - 0x80) + 256 * (attr & 0x01);
184184      sy = 240 - state->m_spriteram[offs];
185185
186      if (flip_screen_get(machine))
186      if (state->flip_screen())
187187      {
188188         sx = 240 - sx;
189189         sy = 240 - sy;
src/mame/video/hanaawas.c
r14896r14897
7474
7575   /* dirty both current and next offsets */
7676   m_bg_tilemap->mark_tile_dirty(offset);
77   m_bg_tilemap->mark_tile_dirty((offset + (flip_screen_get(machine()) ? -1 : 1)) & 0x03ff);
77   m_bg_tilemap->mark_tile_dirty((offset + (flip_screen() ? -1 : 1)) & 0x03ff);
7878}
7979
8080WRITE8_DEVICE_HANDLER( hanaawas_portB_w )
8181{
8282   /* bit 7 is flip screen */
83   if (flip_screen_get(device->machine()) != (~data & 0x80))
83   hanaawas_state *state = device->machine().driver_data<hanaawas_state>();
84   if (state->flip_screen() != (~data & 0x80))
8485   {
85      flip_screen_set(device->machine(), ~data & 0x80);
86      state->flip_screen_set(~data & 0x80);
8687      device->machine().tilemap().mark_all_dirty();
8788   }
8889}
r14896r14897
9192{
9293   hanaawas_state *state = machine.driver_data<hanaawas_state>();
9394   /* the color is determined by the current color byte, but the bank is via the previous one!!! */
94   int offset = (tile_index + (flip_screen_get(machine) ? 1 : -1)) & 0x3ff;
95   int offset = (tile_index + (state->flip_screen() ? 1 : -1)) & 0x3ff;
9596   int attr = state->m_colorram[offset];
9697   int gfxbank = (attr & 0x40) >> 6;
9798   int code = state->m_videoram[tile_index] + ((attr & 0x20) << 3);
src/mame/video/metro.c
r14896r14897
752752   if (screenctrl & 2)
753753      return 0;
754754
755   //flip_screen_set(screen.machine(), screenctrl & 1);
755   //state->flip_screen_set(screenctrl & 1);
756756   state->m_flip_screen = screenctrl & 1;
757757
758758   /* If the game supports 16x16 tiles, make sure that the
src/mame/video/circusc.c
r14896r14897
148148
149149WRITE8_MEMBER(circusc_state::circusc_flipscreen_w)
150150{
151   flip_screen_set(machine(), data & 1);
151   flip_screen_set(data & 1);
152152}
153153
154154
r14896r14897
179179      int flipx = sr[offs + 1] & 0x40;
180180      int flipy = sr[offs + 1] & 0x80;
181181
182      if (flip_screen_get(machine))
182      if (state->flip_screen())
183183      {
184184         sx = 240 - sx;
185185         sy = 240 - sy;
src/mame/video/mikie.c
r14896r14897
113113
114114WRITE8_MEMBER(mikie_state::mikie_flipscreen_w)
115115{
116   if (flip_screen_get(machine()) != (data & 0x01))
116   if (flip_screen() != (data & 0x01))
117117   {
118      flip_screen_set(machine(), data & 0x01);
118      flip_screen_set(data & 0x01);
119119      machine().tilemap().mark_all_dirty();
120120   }
121121}
r14896r14897
158158      int flipx = ~spriteram[offs] & 0x10;
159159      int flipy = spriteram[offs] & 0x20;
160160
161      if (flip_screen_get(machine))
161      if (state->flip_screen())
162162      {
163163         sy = 242 - sy;
164164         flipy = !flipy;
src/mame/video/zaccaria.c
r14896r14897
173173
174174WRITE8_MEMBER(zaccaria_state::zaccaria_flip_screen_x_w)
175175{
176   flip_screen_x_set(machine(), data & 1);
176   flip_screen_x_set(data & 1);
177177}
178178
179179WRITE8_MEMBER(zaccaria_state::zaccaria_flip_screen_y_w)
180180{
181   flip_screen_y_set(machine(), data & 1);
181   flip_screen_y_set(data & 1);
182182}
183183
184184
r14896r14897
206206*/
207207static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section)
208208{
209   zaccaria_state *state = machine.driver_data<zaccaria_state>();
209210   int offs,o1 = 1,o2 = 2;
210211
211212   if (section)
r14896r14897
223224
224225      if (sx == 1) continue;
225226
226      if (flip_screen_x_get(machine))
227      if (state->flip_screen_x())
227228      {
228229         sx = 240 - sx;
229230         flipx = !flipx;
230231      }
231      if (flip_screen_y_get(machine))
232      if (state->flip_screen_y())
232233      {
233234         sy = 240 - sy;
234235         flipy = !flipy;
src/mame/video/suna16.c
r14896r14897
6464{
6565   if (ACCESSING_BITS_0_7)
6666   {
67      flip_screen_set(machine(),  data & 1 );
67      flip_screen_set(data & 1 );
6868      m_color_bank = ( data & 4 ) >> 2;
6969   }
7070   if (data & ~(1|4))   logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", cpu_get_pc(&space.device()), data);
r14896r14897
7474{
7575   if (ACCESSING_BITS_0_7)
7676   {
77      flip_screen_set(machine(),  data & 0x10 );
77      flip_screen_set(data & 0x10 );
7878      //m_color_bank = ( data & 0x07 );
7979   }
8080   if (data & ~(0x10))   logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", cpu_get_pc(&space.device()), data);
r14896r14897
185185
186186            if (flipx)   tile_flipx = !tile_flipx;
187187
188            if (flip_screen_get(machine))
188            if (state->flip_screen())
189189            {
190190               sx = max_x - sx;
191191               sy = max_y - sy;
src/mame/video/speedbal.c
r14896r14897
104104
105105      flipx = flipy = 0;
106106
107      if(flip_screen_get(machine))
107      if(state->flip_screen())
108108      {
109109         x = 246 - x;
110110         y = 238 - y;
src/mame/video/tagteam.c
r14896r14897
115115WRITE8_MEMBER(tagteam_state::tagteam_flipscreen_w)
116116{
117117   // d0: flip screen
118   if (flip_screen_get(machine()) != (data &0x01))
118   if (flip_screen() != (data &0x01))
119119   {
120      flip_screen_set(machine(), data & 0x01);
120      flip_screen_set(data & 0x01);
121121      machine().tilemap().mark_all_dirty();
122122   }
123123
r14896r14897
159159
160160      if (!(state->m_videoram[offs] & 0x01)) continue;
161161
162      if (flip_screen_get(machine))
162      if (state->flip_screen())
163163      {
164164         sx = 240 - sx;
165165         sy = 240 - sy;
r14896r14897
177177
178178      code = state->m_videoram[offs + 0x20] + 256 * spritebank;
179179      color = state->m_palettebank;
180      sy += (flip_screen_get(machine) ? -256 : 256);
180      sy += (state->flip_screen() ? -256 : 256);
181181
182182      drawgfx_transpen(bitmap, cliprect,
183183         machine.gfx[1],
src/mame/video/bagman.c
r14896r14897
8181
8282WRITE8_MEMBER(bagman_state::bagman_flipscreen_w)
8383{
84   if ((flip_screen_get(machine()) ^ data) & 1)
84   if ((flip_screen() ^ data) & 1)
8585   {
86      flip_screen_set(machine(), data & 0x01);
86      flip_screen_set(data & 0x01);
8787      m_bg_tilemap->mark_all_dirty();
8888   }
8989}
r14896r14897
122122      sy = 255 - spriteram[offs + 2] - 16;
123123      flipx = spriteram[offs] & 0x40;
124124      flipy = spriteram[offs] & 0x80;
125      if (flip_screen_x_get(machine))
125      if (state->flip_screen_x())
126126      {
127127         sx = bitmap.width() - sx - 15;
128128         flipx = !flipx;
129129      }
130      if (flip_screen_y_get(machine))
130      if (state->flip_screen_y())
131131      {
132132         sy = bitmap.height() - sy - 15;
133133         flipy = !flipy;
src/mame/video/commando.c
r14896r14897
6363   device_set_input_line(m_audiocpu, INPUT_LINE_RESET, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
6464
6565   // bit 7 flips screen
66   flip_screen_set(machine(), data & 0x80);
66   flip_screen_set(data & 0x80);
6767}
6868
6969static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
116116      int sx = buffered_spriteram[offs + 3] - ((attr & 0x01) << 8);
117117      int sy = buffered_spriteram[offs + 2];
118118
119      if (flip_screen_get(machine))
119      if (state->flip_screen())
120120      {
121121         sx = 240 - sx;
122122         sy = 240 - sy;
src/mame/video/ninjakd2.c
r14896r14897
376376         // Ninja Kid II doesn't use the 'big' feature so it might not be available on the board
377377         int const big = (sprptr[2] & 0x04) >> 2;
378378
379         if (flip_screen_get(machine))
379         if (state->flip_screen())
380380         {
381381            sx = 240 - 16*big - sx;
382382            sy = 240 - 16*big - sy;
src/mame/video/warpwarp.c
r14896r14897
226226   {
227227      int x,y,i,j;
228228
229      if (flip_screen_get(machine) & 1) {
229      if (state->flip_screen() & 1) {
230230         x = 376 - state->m_ball_h;
231231         y = 280 - state->m_ball_v;
232232      }
src/mame/video/m52.c
r14896r14897
275275WRITE8_MEMBER(m52_state::m52_flipscreen_w)
276276{
277277   /* screen flip is handled both by software and hardware */
278   flip_screen_set(machine(), (data & 0x01) ^ (~input_port_read(machine(), "DSW2") & 0x01));
278   flip_screen_set((data & 0x01) ^ (~input_port_read(machine(), "DSW2") & 0x01));
279279
280280   coin_counter_w(machine(), 0, data & 0x02);
281281   coin_counter_w(machine(), 1, data & 0x20);
r14896r14897
283283
284284WRITE8_MEMBER(m52_state::alpha1v_flipscreen_w)
285285{
286   flip_screen_set(machine(), data & 0x01);
286   flip_screen_set(data & 0x01);
287287}
288288
289289
r14896r14897
299299   rectangle rect;
300300   const rectangle &visarea = machine.primary_screen->visible_area();
301301
302   if (flip_screen_get(machine))
302   m52_state *state = machine.driver_data<m52_state>();
303   if (state->flip_screen())
303304   {
304305      xpos = 255 - xpos;
305306      ypos = 255 - ypos - BGHEIGHT;
r14896r14897
313314   drawgfx_transpen(bitmap, cliprect,
314315      machine.gfx[image],
315316      0, 0,
316      flip_screen_get(machine),
317      flip_screen_get(machine),
317      state->flip_screen(),
318      state->flip_screen(),
318319      xpos,
319320      ypos, 0);
320321
321322   drawgfx_transpen(bitmap, cliprect,
322323      machine.gfx[image],
323324      0, 0,
324      flip_screen_get(machine),
325      flip_screen_get(machine),
325      state->flip_screen(),
326      state->flip_screen(),
326327      xpos - 256,
327328      ypos, 0);
328329
329330   rect.min_x = visarea.min_x;
330331   rect.max_x = visarea.max_x;
331332
332   if (flip_screen_get(machine))
333   if (state->flip_screen())
333334   {
334335      rect.min_y = ypos - BGHEIGHT;
335336      rect.max_y = ypos - 1;
r14896r14897
370371         draw_background(screen.machine(), bitmap, cliprect, state->m_bg1xpos, state->m_bg1ypos, 4); /* cityscape */
371372   }
372373
373   state->m_bg_tilemap->set_flip(flip_screen_get(screen.machine()) ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
374   state->m_bg_tilemap->set_flip(state->flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
374375
375376   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
376377
r14896r14897
394395         clip.min_y = 128, clip.max_y = 255;
395396
396397      /* adjust for flipping */
397      if (flip_screen_get(screen.machine()))
398      if (state->flip_screen())
398399      {
399400         int temp = clip.min_y;
400401         clip.min_y = 255 - clip.max_y;
src/mame/video/cbuster.c
r14896r14897
5353   cbuster_state *state = screen.machine().driver_data<cbuster_state>();
5454   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
5555
56   flip_screen_set(screen.machine(), !BIT(flip, 7));
56   state->flip_screen_set(!BIT(flip, 7));
5757
5858   screen.machine().device<decospr_device>("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram16_buffer, 0x400);
5959
src/mame/video/gng.c
r14896r14897
9393
9494WRITE8_MEMBER(gng_state::gng_flipscreen_w)
9595{
96   flip_screen_set(machine(), ~data & 1);
96   flip_screen_set(~data & 1);
9797}
9898
9999
r14896r14897
120120      int flipx = attributes & 0x04;
121121      int flipy = attributes & 0x08;
122122
123      if (flip_screen_get(machine))
123      if (state->flip_screen())
124124      {
125125         sx = 240 - sx;
126126         sy = 240 - sy;
src/mame/video/n8080.c
r14896r14897
1313
1414   m_sheriff_color_mode = (data >> 3) & 3;
1515   m_sheriff_color_data = (data >> 0) & 7;
16   flip_screen_set_no_update(machine(), data & 0x20);
16   flip_screen_set_no_update(data & 0x20);
1717}
1818
1919
r14896r14897
7575   }
7676   else
7777   {
78      if (flip_screen_get(machine))
78      if (state->flip_screen())
7979         state->m_helifire_mv %= 255;
8080      else
8181         state->m_helifire_mv %= 257;
r14896r14897
9494
9595   state->m_cannon_timer = machine.scheduler().timer_alloc(FUNC(spacefev_stop_red_cannon));
9696
97   flip_screen_set_no_update(machine, 0);
97   state->flip_screen_set_no_update(0);
9898
9999   state->save_item(NAME(state->m_spacefev_red_screen));
100100   state->save_item(NAME(state->m_spacefev_red_cannon));
r14896r14897
105105{
106106   n8080_state *state = machine.driver_data<n8080_state>();
107107
108   flip_screen_set_no_update(machine, 0);
108   state->flip_screen_set_no_update(0);
109109
110110   state->save_item(NAME(state->m_sheriff_color_mode));
111111   state->save_item(NAME(state->m_sheriff_color_data));
r14896r14897
134134      state->m_helifire_LSFR[i] = data;
135135   }
136136
137   flip_screen_set_no_update(machine, 0);
137   state->flip_screen_set_no_update(0);
138138}
139139
140140
141141SCREEN_UPDATE_IND16( spacefev )
142142{
143143   n8080_state *state = screen.machine().driver_data<n8080_state>();
144   UINT8 mask = flip_screen_get(screen.machine()) ? 0xff : 0x00;
144   UINT8 mask = state->flip_screen() ? 0xff : 0x00;
145145
146146   int x;
147147   int y;
r14896r14897
211211SCREEN_UPDATE_IND16( sheriff )
212212{
213213   n8080_state *state = screen.machine().driver_data<n8080_state>();
214   UINT8 mask = flip_screen_get(screen.machine()) ? 0xff : 0x00;
214   UINT8 mask = state->flip_screen() ? 0xff : 0x00;
215215
216216   const UINT8* pPROM = screen.machine().region("proms")->base();
217217
r14896r14897
323323
324324         for (n = 0; n < 8; n++)
325325         {
326            if (flip_screen_get(screen.machine()))
326            if (state->flip_screen())
327327            {
328328               if ((state->m_videoram[offset ^ 0x1fff] << n) & 0x80)
329329               {
src/mame/video/nbmj8891.c
r14896r14897
376376
377377         color = GFX[gfxaddr++];
378378
379         // for hanamomo
380         if ((nb1413m3_type == NB1413M3_HANAMOMO) && ((gfxaddr >= 0x20000) && (gfxaddr < 0x28000)))
381         {
382            color |= ((color & 0x0f) << 4);
383         }
384
385379         dx1 = (2 * x + 0) & 0x1ff;
386380         dx2 = (2 * x + 1) & 0x1ff;
387381
src/mame/video/holeland.c
r14896r14897
9999WRITE8_MEMBER(holeland_state::holeland_flipscreen_w)
100100{
101101   if (offset)
102      flip_screen_y_set(machine(), data);
102      flip_screen_y_set(data);
103103   else
104      flip_screen_x_set(machine(), data);
104      flip_screen_x_set(data);
105105}
106106
107107
r14896r14897
125125      flipx = spriteram[offs + 3] & 0x04;
126126      flipy = spriteram[offs + 3] & 0x08;
127127
128      if (flip_screen_x_get(machine))
128      if (state->flip_screen_x())
129129      {
130130         flipx = !flipx;
131131         sx = 240 - sx;
132132      }
133133
134      if (flip_screen_y_get(machine))
134      if (state->flip_screen_y())
135135      {
136136         flipy = !flipy;
137137         sy = 240 - sy;
r14896r14897
164164      flipx = spriteram[offs + 3] & 0x04;
165165      flipy = spriteram[offs + 3] & 0x08;
166166
167      if (flip_screen_x_get(machine))
167      if (state->flip_screen_x())
168168      {
169169         flipx = !flipx;
170170         sx = 240 - sx;
171171      }
172172
173      if (flip_screen_y_get(machine))
173      if (state->flip_screen_y())
174174      {
175175         flipy = !flipy;
176176         sy = 240 - sy;
src/mame/video/spdodgeb.c
r14896r14897
110110   UINT8 *rom = machine().region("maincpu")->base();
111111
112112   /* bit 0 = flip screen */
113   flip_screen_set(machine(), data & 0x01);
113   flip_screen_set(data & 0x01);
114114
115115   /* bit 1 = ROM bank switch */
116116   memory_set_bankptr(machine(), "bank1",rom + 0x10000 + 0x4000 * ((~data & 0x02) >> 1));
r14896r14897
173173      int dy = -16;
174174      int cy;
175175
176      if (flip_screen_get(machine))
176      if (state->flip_screen())
177177      {
178178         sx = 240 - sx;
179179         sy = 240 - sy;
r14896r14897
192192         break;
193193
194194         case 1: /* double y */
195         if (flip_screen_get(machine)) { if (sy > 240) sy -= 256; } else { if (sy < 0) sy += 256; }
195         if (state->flip_screen()) { if (sy > 240) sy -= 256; } else { if (sy < 0) sy += 256; }
196196         cy = sy + dy;
197197         which &= ~1;
198198         DRAW_SPRITE(0,sx,cy);
src/mame/video/liberate.c
r14896r14897
117117            m_back_tilemap->mark_all_dirty();
118118         }
119119         m_background_disable = data & 0x4;
120         flip_screen_set(machine(), data & 0x01);
120         flip_screen_set(data & 0x01);
121121         break;
122122      case 7: /* Background palette resistors? */
123123         /* Todo */
r14896r14897
126126         device_set_input_line(m_maincpu, DECO16_IRQ_LINE, CLEAR_LINE);
127127         break;
128128      case 9: /* Sound */
129         soundlatch_w(space, 0, data);
129         soundlatch_byte_w(space, 0, data);
130130         device_set_input_line(m_audiocpu, M6502_IRQ_LINE, HOLD_LINE);
131131         break;
132132   }
r14896r14897
154154         device_set_input_line(m_maincpu, DECO16_IRQ_LINE, CLEAR_LINE);
155155         break;
156156      case 9: /* Sound */
157         soundlatch_w(space, 0, data);
157         soundlatch_byte_w(space, 0, data);
158158         device_set_input_line(m_audiocpu, M6502_IRQ_LINE, HOLD_LINE);
159159         break;
160160   }
r14896r14897
169169   {
170170      case 0:
171171         //background_disable = ~data & 0x80;
172         flip_screen_set(machine(), data & 0x80);
172         flip_screen_set(data & 0x80);
173173         m_back_tilemap->mark_all_dirty();
174174         break;
175175      case 2: /* Sound */
176         soundlatch_w(space, 0, data);
176         soundlatch_byte_w(space, 0, data);
177177         device_set_input_line(m_audiocpu, M6502_IRQ_LINE, HOLD_LINE);
178178         break;
179179      case 4: /* Irq ack */
r14896r14897
319319      if (multi && fy == 0)
320320         sy -= 16;
321321
322      if (flip_screen_get(machine))
322      if (state->flip_screen())
323323      {
324324         sy = 240 - sy;
325325         sx = 240 - sx;
r14896r14897
390390//      if (multi) sy -= 16;
391391      if ((fy && multi) || (fx && multi)) { code2 = code; code++; }
392392
393      if (flip_screen_get(machine))
393      if (state->flip_screen())
394394      {
395395         sy = 240 - sy;
396396         sx = 240 - sx;
r14896r14897
451451//      if (multi) sy -= 16;
452452      if (fy && multi) { code2 = code; code++; }
453453
454      if (flip_screen_get(machine))
454      if (state->flip_screen())
455455      {
456456         sy = 240 - sy;
457457         sx = 240 - sx;
src/mame/video/gunsmoke.c
r14896r14897
8383   /* bit 5 resets the sound CPU? - we ignore it */
8484
8585   /* bit 6 flips screen */
86   flip_screen_set(machine(), data & 0x40);
86   flip_screen_set(data & 0x40);
8787
8888   /* bit 7 enables characters? */
8989   m_chon = data & 0x80;
r14896r14897
158158
159159      code += 256 * bank;
160160
161      if (flip_screen_get(machine))
161      if (state->flip_screen())
162162      {
163163         sx = 240 - sx;
164164         sy = 240 - sy;
src/mame/video/cvs.c
r14896r14897
331331
332332      if ((y & 1) ^ ((x >> 4) & 1))
333333      {
334         if (flip_screen_x_get(machine))
334         if (state->flip_screen_x())
335335            x = ~x;
336336
337         if (flip_screen_y_get(machine))
337         if (state->flip_screen_y())
338338            y = ~y;
339339
340340         if ((y >= cliprect.min_y) && (y <= cliprect.max_y) &&
src/mame/video/vball.c
r14896r14897
133133      int flipy = 0;
134134      int dy = -16;
135135
136      if (flip_screen_get(machine))
136      if (state->flip_screen())
137137      {
138138         sx = 240 - sx;
139139         sy = 240 - sy;
src/mame/video/rohga.c
r14896r14897
6868   UINT16 priority = decocomn_priority_r(state->m_decocomn, 0, 0xffff);
6969
7070   /* Update playfields */
71   flip_screen_set(screen.machine(), BIT(flip, 7));
71   state->flip_screen_set(BIT(flip, 7));
7272   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
7373   deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll);
7474
r14896r14897
175175   screen.machine().device<decospr_device>("spritegen1")->draw_sprites(bitmap, cliprect, state->m_spriteram->buffer(), 0x400, true);
176176
177177   /* Update playfields */
178   flip_screen_set(screen.machine(), BIT(flip, 7));
178   state->flip_screen_set(BIT(flip, 7));
179179   deco16ic_pf_update(state->m_deco_tilegen1, 0, 0);
180180   deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll);
181181
r14896r14897
212212   screen.machine().device<decospr_device>("spritegen1")->draw_sprites(bitmap, cliprect, state->m_spriteram->buffer(), 0x400, false);
213213
214214   /* Update playfields */
215   flip_screen_set(screen.machine(), BIT(flip, 7));
215   state->flip_screen_set(BIT(flip, 7));
216216   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
217217   deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll);
218218
src/mame/video/higemaru.c
r14896r14897
8181   coin_counter_w(machine(), 1,data & 1);
8282
8383   /* bit 7 flips screen */
84   if (flip_screen_get(machine()) != (data & 0x80))
84   if (flip_screen() != (data & 0x80))
8585   {
86      flip_screen_set(machine(), data & 0x80);
86      flip_screen_set(data & 0x80);
8787      m_bg_tilemap->mark_all_dirty();
8888   }
8989}
r14896r14897
119119      sy = spriteram[offs + 8];
120120      flipx = spriteram[offs + 4] & 0x10;
121121      flipy = spriteram[offs + 4] & 0x20;
122      if (flip_screen_get(machine))
122      if (state->flip_screen())
123123      {
124124         sx = 240 - sx;
125125         sy = 240 - sy;
src/mame/video/1942.c
r14896r14897
183183
184184   device_set_input_line(m_audiocpu, INPUT_LINE_RESET, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
185185
186   flip_screen_set(machine(), data & 0x80);
186   flip_screen_set(data & 0x80);
187187}
188188
189189
r14896r14897
209209      sy = state->m_spriteram[offs + 2];
210210      dir = 1;
211211
212      if (flip_screen_get(machine))
212      if (state->flip_screen())
213213      {
214214         sx = 240 - sx;
215215         sy = 240 - sy;
r14896r14897
225225      {
226226         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
227227               code + i,col,
228               flip_screen_get(machine),flip_screen_get(machine),
228               state->flip_screen(),state->flip_screen(),
229229               sx,sy + 16 * i * dir,15);
230230
231231         i--;
src/mame/video/bombjack.c
r14896r14897
3333
3434WRITE8_MEMBER(bombjack_state::bombjack_flipscreen_w)
3535{
36   if (flip_screen_get(machine()) != (data & 0x01))
36   if (flip_screen() != (data & 0x01))
3737   {
38      flip_screen_set(machine(), data & 0x01);
38      flip_screen_set(data & 0x01);
3939      machine().tilemap().mark_all_dirty();
4040   }
4141}
r14896r14897
106106      flipx = state->m_spriteram[offs + 1] & 0x40;
107107      flipy = state->m_spriteram[offs + 1] & 0x80;
108108
109      if (flip_screen_get(machine))
109      if (state->flip_screen())
110110      {
111111         if (state->m_spriteram[offs + 1] & 0x20)
112112         {
src/mame/video/rallyx.c
r14896r14897
447447   if (!cliprect.contains(x, y))
448448      return;
449449
450   if (flip_screen_x_get(machine))
450   rallyx_state *state = machine.driver_data<rallyx_state>();
451   if (state->flip_screen_x())
451452      x = 255 - x;
452453
453   if (flip_screen_y_get(machine))
454   if (state->flip_screen_y())
454455      y = 255 - y;
455456
456457   if (colortable_entry_get_value(machine.colortable, bitmap.pix16(y, x) % 0x144) == 0)
r14896r14897
487488      int color = spriteram_2[offs + 1] & 0x3f;
488489      int flipx = spriteram[offs] & 1;
489490      int flipy = spriteram[offs] & 2;
490      if (flip_screen_get(machine))
491      if (state->flip_screen())
491492         sx -= 2 * displacement;
492493
493494      pdrawgfx_transmask(bitmap,cliprect,machine.gfx[1],
r14896r14897
535536
536537      x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x01) << 8);
537538      y = 253 - state->m_radary[offs];
538      if (flip_screen_get(machine))
539      if (state->flip_screen())
539540         x -= 3;
540541
541542      if (transpen)
r14896r14897
630631   rectangle fg_clip = cliprect;
631632   rectangle bg_clip = cliprect;
632633
633   if (flip_screen_get(screen.machine()))
634   if (state->flip_screen())
634635   {
635636      bg_clip.min_x = 8 * 8;
636637      fg_clip.max_x = 8 * 8 - 1;
r14896r14897
664665   rectangle fg_clip = cliprect;
665666   rectangle bg_clip = cliprect;
666667
667   if (flip_screen_get(screen.machine()))
668   if (state->flip_screen())
668669   {
669670      bg_clip.min_x = 8 * 8;
670671      fg_clip.max_x = 8 * 8 - 1;
r14896r14897
702703   rectangle fg_clip = cliprect;
703704   rectangle bg_clip = cliprect;
704705
705   if (flip_screen_get(screen.machine()))
706   if (state->flip_screen())
706707   {
707708      /* handle reduced visible area in some games */
708709      if (screen.visible_area().max_x == 32 * 8 - 1)
src/mame/video/realbrk.c
r14896r14897
3030      coin_counter_w(machine(), 0,   data & 0x0001);
3131      coin_counter_w(machine(), 1,   data & 0x0004);
3232
33      flip_screen_set(machine(),   data & 0x0080);
33      flip_screen_set(   data & 0x0080);
3434   }
3535
3636   if (ACCESSING_BITS_8_15)
r14896r14897
256256      xdim   =      ((zoom & 0x00ff) >> 0) << (16-6+4);
257257      ydim   =      ((zoom & 0xff00) >> 8) << (16-6+4);
258258
259      if (flip_screen_x_get(machine))   {   flipx = !flipx;      sx = (max_x << 16) - sx - xnum * xdim;   }
260      if (flip_screen_y_get(machine))   {   flipy = !flipy;      sy = (max_y << 16) - sy - ynum * ydim;   }
259      if (state->flip_screen_x())   {   flipx = !flipx;      sx = (max_x << 16) - sx - xnum * xdim;   }
260      if (state->flip_screen_y())   {   flipy = !flipy;      sy = (max_y << 16) - sy - ynum * ydim;   }
261261
262262      if (flipx)   { xstart = xnum-1;  xend = -1;    xinc = -1; }
263263      else      { xstart = 0;       xend = xnum;  xinc = +1; }
r14896r14897
418418      xdim   =      ((zoom & 0x00ff) >> 0) << (16-6+4);
419419      ydim   =      ((zoom & 0xff00) >> 8) << (16-6+4);
420420
421      if (flip_screen_x_get(machine))   {   flipx = !flipx;      sx = (max_x << 16) - sx - xnum * xdim;   }
422      if (flip_screen_y_get(machine))   {   flipy = !flipy;      sy = (max_y << 16) - sy - ynum * ydim;   }
421      if (state->flip_screen_x())   {   flipx = !flipx;      sx = (max_x << 16) - sx - xnum * xdim;   }
422      if (state->flip_screen_y())   {   flipy = !flipy;      sy = (max_y << 16) - sy - ynum * ydim;   }
423423
424424      if (flipx)   { xstart = xnum-1;  xend = -1;    xinc = -1; }
425425      else      { xstart = 0;       xend = xnum;  xinc = +1; }
src/mame/video/flower.c
r14896r14897
7878      code |= ((source[2] & 0x01) << 6);
7979      code |= ((source[2] & 0x08) << 4);
8080
81      if(flip_screen_get(machine))
81      if(state->flip_screen())
8282      {
8383         flipx = !flipx;
8484         flipy = !flipy;
r14896r14897
176176
177177   draw_sprites(screen.machine(),bitmap,cliprect);
178178
179   if(flip_screen_get(screen.machine()))
179   if(state->flip_screen())
180180   {
181181      myclip.min_x = cliprect.min_x;
182182      myclip.max_x = cliprect.min_x + 15;
r14896r14897
213213
214214WRITE8_MEMBER(flower_state::flower_flipscreen_w)
215215{
216   flip_screen_set(machine(), data);
216   flip_screen_set(data);
217217}
src/mame/video/xain.c
r14896r14897
155155
156156WRITE8_MEMBER(xain_state::xain_flipscreen_w)
157157{
158   flip_screen_set(machine(), data & 1);
158   flip_screen_set(data & 1);
159159}
160160
161161
r14896r14897
184184      if (sy <= -7) sy += 256;
185185      flipx = attr & 0x40;
186186      flipy = 0;
187      if (flip_screen_get(machine))
187      if (state->flip_screen())
188188      {
189189         sx = 238 - sx;
190190         sy = 240 - sy;
src/mame/video/namcos1.c
r14896r14897
334334      sx += sprite_xoffs;
335335      sy -= sprite_yoffs;
336336
337      if (flip_screen_get(machine))
337      if (state->flip_screen())
338338      {
339339         sx = -sx - sizex;
340340         sy = -sy - sizey;
r14896r14897
377377   rectangle new_clip = cliprect;
378378
379379   /* flip screen is embedded in the sprite control registers */
380   /* can't use flip_screen_set(screen.machine(), ) because the visible area is asymmetrical */
381   flip_screen_set_no_update(screen.machine(), state->m_spriteram[0x0ff6] & 1);
382   screen.machine().tilemap().set_flip_all(flip_screen_get(screen.machine()) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
380   /* can't use state->flip_screen_set() because the visible area is asymmetrical */
381   state->flip_screen_set_no_update(state->m_spriteram[0x0ff6] & 1);
382   screen.machine().tilemap().set_flip_all(state->flip_screen() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
383383
384384
385385   /* background color */
r14896r14897
411411      scrollx = ( state->m_playfield_control[j+1] + (state->m_playfield_control[j+0]<<8) ) - disp_x[i];
412412      scrolly = ( state->m_playfield_control[j+3] + (state->m_playfield_control[j+2]<<8) ) + 8;
413413
414      if (flip_screen_get(screen.machine()))
414      if (state->flip_screen())
415415      {
416416         scrollx = -scrollx;
417417         scrolly = -scrolly;
src/mame/video/toki.c
r14896r14897
194194         flipy   = 0;
195195         tile    = (sprite_word[1] & 0xfff) + ((sprite_word[2] & 0x8000) >> 3);
196196
197         if (flip_screen_get(machine)) {
197         if (state->flip_screen()) {
198198            x=240-x;
199199            y=240-y;
200200            if (flipx) flipx=0; else flipx=1;
r14896r14897
276276   state->m_foreground_layer->set_scrollx(0, foreground_x_scroll );
277277   state->m_foreground_layer->set_scrolly(0, foreground_y_scroll );
278278
279   flip_screen_set(screen.machine(), (state->m_scrollram16[0x28]&0x8000)==0);
279   state->flip_screen_set((state->m_scrollram16[0x28]&0x8000)==0);
280280
281281   if (state->m_scrollram16[0x28]&0x100) {
282282      state->m_background_layer->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
src/mame/video/40love.c
r14896r14897
160160   if (m_flipscreen != f)
161161   {
162162      m_flipscreen = f;
163      flip_screen_set(machine(), m_flipscreen);
163      flip_screen_set(m_flipscreen);
164164      m_pix_redraw = 1;
165165
166166      for (offs = 0; offs < 32; offs++)
src/mame/video/renegade.c
r14896r14897
2525
2626WRITE8_MEMBER(renegade_state::renegade_flipscreen_w)
2727{
28   flip_screen_set(machine(), ~data & 0x01);
28   flip_screen_set(~data & 0x01);
2929}
3030
3131WRITE8_MEMBER(renegade_state::renegade_scroll0_w)
r14896r14897
9797         if (sx > 248)
9898            sx -= 256;
9999
100         if (flip_screen_get(machine))
100         if (state->flip_screen())
101101         {
102102            sx = 240 - sx;
103103            sy = 240 - sy;
r14896r14897
110110            drawgfx_transpen(bitmap, cliprect, machine.gfx[sprite_bank],
111111               sprite_number + 1,
112112               color,
113               xflip, flip_screen_get(machine),
114               sx, sy + (flip_screen_get(machine) ? -16 : 16), 0);
113               xflip, state->flip_screen(),
114               sx, sy + (state->flip_screen() ? -16 : 16), 0);
115115         }
116116         else
117117         {
118            sy += (flip_screen_get(machine) ? -16 : 16);
118            sy += (state->flip_screen() ? -16 : 16);
119119         }
120120         drawgfx_transpen(bitmap, cliprect, machine.gfx[sprite_bank],
121121            sprite_number,
122122            color,
123            xflip, flip_screen_get(machine),
123            xflip, state->flip_screen(),
124124            sx, sy, 0);
125125      }
126126      source += 4;
src/mame/video/galaga.c
r14896r14897
416416    int color = state->m_videoram[tile_index + 0x400] & 0x3f;
417417   SET_TILE_INFO(
418418         0,
419         (state->m_videoram[tile_index] & 0x7f) | (flip_screen_get(machine) ? 0x80 : 0) | (state->m_galaga_gfxbank << 8),
419         (state->m_videoram[tile_index] & 0x7f) | (state->flip_screen() ? 0x80 : 0) | (state->m_galaga_gfxbank << 8),
420420         color,
421         flip_screen_get(machine) ? TILE_FLIPX : 0);
421         state->flip_screen() ? TILE_FLIPX : 0);
422422   tileinfo.group = color;
423423}
424424
r14896r14897
504504      sy -= 16 * sizey;
505505      sy = (sy & 0xff) - 32;   // fix wraparound
506506
507      if (flip_screen_get(machine))
507      if (state->flip_screen())
508508      {
509509         flipx ^= 1;
510510         flipy ^= 1;
r14896r14897
537537   if ( (state->m_galaga_starcontrol[5] & 1) == 1 )
538538   {
539539      int y_align = 112; /* 112 is a tweak to get alignment about perfect */
540      int x_align = flip_screen_get(machine) ? 112 : 16;
540      int x_align = state->flip_screen() ? 112 : 16;
541541
542542      int star_cntr;
543543      int set_a, set_b;
src/mame/video/lasso.c
r14896r14897
217217WRITE8_MEMBER(lasso_state::lasso_flip_screen_w)
218218{
219219   /* don't know which is which, but they are always set together */
220   flip_screen_x_set(machine(), data & 0x01);
221   flip_screen_y_set(machine(), data & 0x02);
220   flip_screen_x_set(data & 0x01);
221   flip_screen_y_set(data & 0x02);
222222
223   machine().tilemap().set_flip_all((flip_screen_x_get(machine()) ? TILEMAP_FLIPX : 0) | (flip_screen_y_get(machine()) ? TILEMAP_FLIPY : 0));
223   machine().tilemap().set_flip_all((flip_screen_x() ? TILEMAP_FLIPX : 0) | (flip_screen_y() ? TILEMAP_FLIPY : 0));
224224}
225225
226226
r14896r14897
296296      flipx = source[1] & 0x40;
297297      flipy = source[1] & 0x80;
298298
299      if (flip_screen_x_get(machine))
299      if (state->flip_screen_x())
300300      {
301301         sx = 240 - sx;
302302         flipx = !flipx;
303303      }
304304
305      if (flip_screen_y_get(machine))
305      if (state->flip_screen_y())
306306         flipy = !flipy;
307307      else
308308         sy = 240 - sy;
r14896r14897
334334      UINT8 x;
335335      UINT8 y = offs >> 5;
336336
337      if (flip_screen_y_get(machine))
337      if (state->flip_screen_y())
338338         y = ~y;
339339
340340      if ((y < cliprect.min_y) || (y > cliprect.max_y))
r14896r14897
343343      x = (offs & 0x1f) << 3;
344344      data = state->m_bitmap_ram[offs];
345345
346      if (flip_screen_x_get(machine))
346      if (state->flip_screen_x())
347347         x = ~x;
348348
349349      for (bit = 0; bit < 8; bit++)
r14896r14897
351351         if ((data & 0x80) && (x >= cliprect.min_x) && (x <= cliprect.max_x))
352352            bitmap.pix16(y, x) = pen;
353353
354         if (flip_screen_x_get(machine))
354         if (state->flip_screen_x())
355355            x = x - 1;
356356         else
357357            x = x + 1;
src/mame/video/psychic5.c
r14896r14897
325325      if (attr & 0x01) sx -= 256;
326326      if (attr & 0x04) sy -= 256;
327327
328      if (flip_screen_get(machine))
328      if (state->flip_screen())
329329      {
330330         sx = 224 - sx;
331331         sy = 224 - sy;
r14896r14897
350350      }
351351      else
352352      {
353         if (flip_screen_get(machine))
353         if (state->flip_screen())
354354            DRAW_SPRITE(code, sx + 16, sy + 16)
355355         else
356356            DRAW_SPRITE(code, sx, sy)
r14896r14897
408408      case 11: case 13: clip.max_x = state->m_sx1; break;
409409      }
410410
411      if (flip_screen_get(machine))
411      if (state->flip_screen())
412412         clip.set(255 - clip.max_x, 255 - clip.min_x, 255 - clip.max_y, 255 - clip.min_y);
413413   }
414414
src/mame/video/ginganin.c
r14896r14897
176176      machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
177177      break;
178178   case 7:
179      soundlatch_w(space, 0, data);
179      soundlatch_byte_w(space, 0, data);
180180      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
181181      break;
182182   default:
src/mame/video/mrjong.c
r14896r14897
8282
8383WRITE8_MEMBER(mrjong_state::mrjong_flipscreen_w)
8484{
85   if (flip_screen_get(machine()) != BIT(data, 2))
85   if (flip_screen() != BIT(data, 2))
8686   {
87      flip_screen_set(machine(), BIT(data, 2));
87      flip_screen_set(BIT(data, 2));
8888      machine().tilemap().mark_all_dirty();
8989   }
9090}
r14896r14897
127127
128128      sx = 224 - state->m_videoram[offs + 2];
129129      sy = state->m_videoram[offs + 0];
130      if (flip_screen_get(machine))
130      if (state->flip_screen())
131131      {
132132         sx = 208 - sx;
133133         sy = 240 - sy;
src/mame/video/1943.c
r14896r14897
145145   /* bit 5 resets the sound CPU - we ignore it */
146146
147147   /* bit 6 flips screen */
148   flip_screen_set(machine(), data & 0x40);
148   flip_screen_set(data & 0x40);
149149
150150   /* bit 7 enables characters */
151151   m_char_on = data & 0x80;
r14896r14897
230230      int sx = state->m_spriteram[offs + 3] - ((attr & 0x10) << 4);
231231      int sy = state->m_spriteram[offs + 2];
232232
233      if (flip_screen_get(machine))
233      if (state->flip_screen())
234234      {
235235         sx = 240 - sx;
236236         sy = 240 - sy;
r14896r14897
240240      if (priority)
241241      {
242242         if (color != 0x0a && color != 0x0b)
243            drawgfx_transpen(bitmap, cliprect, machine.gfx[3], code, color, flip_screen_get(machine), flip_screen_get(machine), sx, sy, 0);
243            drawgfx_transpen(bitmap, cliprect, machine.gfx[3], code, color, state->flip_screen(), state->flip_screen(), sx, sy, 0);
244244      }
245245      else
246246      {
247247         if (color == 0x0a || color == 0x0b)
248            drawgfx_transpen(bitmap, cliprect, machine.gfx[3], code, color, flip_screen_get(machine), flip_screen_get(machine), sx, sy, 0);
248            drawgfx_transpen(bitmap, cliprect, machine.gfx[3], code, color, state->flip_screen(), state->flip_screen(), sx, sy, 0);
249249      }
250250   }
251251}
src/mame/video/cninja.c
r14896r14897
9898         inc = 1;
9999      }
100100
101      if (flip_screen_get(machine))
101      if (state->flip_screen())
102102      {
103103         y = 240 - y;
104104         x = 240 - x;
r14896r14897
130130   cninja_state *state = screen.machine().driver_data<cninja_state>();
131131   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
132132
133   flip_screen_set(screen.machine(), BIT(flip, 7));
133   state->flip_screen_set(BIT(flip, 7));
134134   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
135135   deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll);
136136
r14896r14897
155155   deco16ic_set_enable(state->m_deco_tilegen2, 0, 1 );
156156   deco16ic_set_enable(state->m_deco_tilegen2, 1, 1 );
157157
158   flip_screen_set(screen.machine(), BIT(flip, 7));
158   state->flip_screen_set(BIT(flip, 7));
159159   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
160160   deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll);
161161
r14896r14897
176176   cninja_state *state = screen.machine().driver_data<cninja_state>();
177177   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
178178
179   flip_screen_set(screen.machine(), BIT(flip, 7));
179   state->flip_screen_set(BIT(flip, 7));
180180   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
181181   deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll);
182182
r14896r14897
211211   }
212212
213213   /* Update playfields */
214   flip_screen_set(screen.machine(), BIT(flip, 7));
214   state->flip_screen_set(BIT(flip, 7));
215215   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
216216   deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll);
217217
r14896r14897
254254   UINT16 priority = decocomn_priority_r(state->m_decocomn, 0, 0xffff);
255255
256256
257   flip_screen_set(screen.machine(), BIT(flip, 7));
257   state->flip_screen_set(BIT(flip, 7));
258258   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
259259   deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll);
260260
src/mame/video/pacland.c
r14896r14897
303303      sprite &= ~sizex;
304304      sprite &= ~(sizey << 1);
305305
306      if (flip_screen_get(machine))
306      if (state->flip_screen())
307307      {
308308         flipx ^= 1;
309309         flipy ^= 1;
r14896r14897
374374   int row;
375375
376376   for (row = 5; row < 29; row++)
377      state->m_fg_tilemap->set_scrollx(row, flip_screen_get(screen.machine()) ? state->m_scroll0-7 : state->m_scroll0);
378   state->m_bg_tilemap->set_scrollx(0, flip_screen_get(screen.machine()) ? state->m_scroll1-4 : state->m_scroll1-3);
377      state->m_fg_tilemap->set_scrollx(row, state->flip_screen() ? state->m_scroll0-7 : state->m_scroll0);
378   state->m_bg_tilemap->set_scrollx(0, state->flip_screen() ? state->m_scroll1-4 : state->m_scroll1-3);
379379
380380   /* draw high priority sprite pixels, setting priority bitmap to non-zero
381381       wherever there is a high-priority pixel; note that we draw to the bitmap
src/mame/video/sidearms.c
r14896r14897
6363   if (m_flipon != (data & 0x80))
6464   {
6565      m_flipon = data & 0x80;
66      flip_screen_set(machine(), m_flipon);
66      flip_screen_set(m_flipon);
6767      machine().tilemap().mark_all_dirty();
6868   }
6969}
src/mame/video/ladyfrog.c
r14896r14897
4646{
4747
4848   if (offset & 0x100)
49      paletteram_xxxxBBBBGGGGRRRR_split2_w(space, (offset & 0xff) + (m_palette_bank << 8), data);
49      paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w(space, (offset & 0xff) + (m_palette_bank << 8), data);
5050   else
51      paletteram_xxxxBBBBGGGGRRRR_split1_w(space, (offset & 0xff) + (m_palette_bank << 8), data);
51      paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w(space, (offset & 0xff) + (m_palette_bank << 8), data);
5252}
5353
5454READ8_MEMBER(ladyfrog_state::ladyfrog_palette_r)
src/mame/video/tumblep.c
r14896r14897
2424   tumblep_state *state = screen.machine().driver_data<tumblep_state>();
2525   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
2626
27   flip_screen_set(screen.machine(), BIT(flip, 7));
27   state->flip_screen_set(BIT(flip, 7));
2828   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
2929
3030   bitmap.fill(256, cliprect); /* not verified */
src/mame/video/jack.c
r14896r14897
2525WRITE8_MEMBER(jack_state::jack_paletteram_w)
2626{
2727   /* RGB output is inverted */
28   paletteram_BBGGGRRR_w(space, offset, ~data);
28   paletteram_BBGGGRRR_byte_w(space, offset, ~data);
2929}
3030
3131READ8_MEMBER(jack_state::jack_flipscreen_r)
3232{
33   flip_screen_set(machine(), offset);
33   flip_screen_set(offset);
3434   return 0;
3535}
3636
3737WRITE8_MEMBER(jack_state::jack_flipscreen_w)
3838{
39   flip_screen_set(machine(), offset);
39   flip_screen_set(offset);
4040}
4141
4242static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
7979      flipx = (spriteram[offs + 3] & 0x80);
8080      flipy = (spriteram[offs + 3] & 0x40);
8181
82      if (flip_screen_get(machine))
82      if (state->flip_screen())
8383      {
8484         sx = 248 - sx;
8585         sy = 248 - sy;
r14896r14897
164164      flipx = (spriteram[offs + 3] & 0x80);
165165      flipy = (spriteram[offs + 3] & 0x40);
166166
167      if (flip_screen_get(machine))
167      if (state->flip_screen())
168168      {
169169         sx = 248 - sx;
170170         sy = 248 - sy;
src/mame/video/dogfgt.c
r14896r14897
119119      for (i = 0; i < 3; i++)
120120         color |= ((m_bitmapram[offset + BITMAPRAM_SIZE / 3 * i] >> subx) & 1) << i;
121121
122      if (flip_screen_get(machine()))
122      if (flip_screen())
123123         m_pixbitmap.pix16(y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color;
124124      else
125125         m_pixbitmap.pix16(y, x + subx) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color;
r14896r14897
164164   coin_counter_w(machine(), 1, data & 0x20);
165165
166166   /* bit 7 is screen flip */
167   flip_screen_set(machine(), data & 0x80);
167   flip_screen_set(data & 0x80);
168168
169169   /* other bits unused? */
170170   logerror("PC %04x: 1800 = %02x\n", cpu_get_pc(&space.device()), data);
r14896r14897
192192         sy = (240 - state->m_spriteram[offs + 2]) & 0xff;
193193         flipx = state->m_spriteram[offs] & 0x04;
194194         flipy = state->m_spriteram[offs] & 0x02;
195         if (flip_screen_get(machine))
195         if (state->flip_screen())
196196         {
197197            sx = 240 - sx;
198198            sy = 240 - sy;
r14896r14897
215215   dogfgt_state *state = screen.machine().driver_data<dogfgt_state>();
216216   int offs;
217217
218   if (state->m_lastflip != flip_screen_get(screen.machine()) || state->m_lastpixcolor != state->m_pixcolor)
218   if (state->m_lastflip != state->flip_screen() || state->m_lastpixcolor != state->m_pixcolor)
219219   {
220220      address_space *space = screen.machine().device("maincpu")->memory().space(AS_PROGRAM);
221221
222      state->m_lastflip = flip_screen_get(screen.machine());
222      state->m_lastflip = state->flip_screen();
223223      state->m_lastpixcolor = state->m_pixcolor;
224224
225225      for (offs = 0; offs < BITMAPRAM_SIZE; offs++)
src/mame/video/dietgo.c
r14896r14897
88   dietgo_state *state = screen.machine().driver_data<dietgo_state>();
99   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
1010
11   flip_screen_set(screen.machine(), BIT(flip, 7));
11   state->flip_screen_set(BIT(flip, 7));
1212   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
1313
1414   bitmap.fill(256, cliprect); /* not verified */
src/mame/video/kingobox.c
r14896r14897
165165      m_bg_tilemap->mark_all_dirty();
166166   }
167167
168   if (flip_screen_get(machine()) != (data & 0x80))
168   if (flip_screen() != (data & 0x80))
169169   {
170      flip_screen_set(machine(), data & 0x80);
170      flip_screen_set(data & 0x80);
171171      machine().tilemap().mark_all_dirty();
172172   }
173173}
r14896r14897
226226      sx = spriteram[roffs + 1];
227227      sy = spriteram[roffs];
228228
229      if (flip_screen_get(machine))
229      if (state->flip_screen())
230230      {
231231         sx = 240 - sx;
232232         sy = 240 - sy;
r14896r14897
288288      int sx = spriteram[offs + 2];
289289      int sy = spriteram[offs];
290290
291      if (flip_screen_get(machine))
291      if (state->flip_screen())
292292      {
293293         sx = 240 - sx;
294294         sy = 240 - sy;
src/mame/video/tsamurai.c
r14896r14897
168168      /* So I'm using this specific check. -kal 11 jul 2002 */
169169//      if(sprite_type == 1) sy=sy+2;
170170
171      if( flip_screen_get(machine) )
171      if( state->flip_screen() )
172172      {
173173         drawgfx_transpen( bitmap,cliprect,gfx,
174174            sprite_number&0x7f,
src/mame/video/snk6502.c
r14896r14897
135135
136136   /* bit 7 flips screen */
137137
138   if (flip_screen_get(machine()) != (data & 0x80))
138   if (flip_screen() != (data & 0x80))
139139   {
140      flip_screen_set(machine(), data & 0x80);
140      flip_screen_set(data & 0x80);
141141      machine().tilemap().mark_all_dirty();
142142   }
143143}
r14896r14897
263263{
264264   /* bit 0 flips screen */
265265
266   if (flip_screen_get(machine()) != (data & 0x01))
266   if (flip_screen() != (data & 0x01))
267267   {
268      flip_screen_set(machine(), data & 0x01);
268      flip_screen_set(data & 0x01);
269269      machine().tilemap().mark_all_dirty();
270270   }
271271
src/mame/video/kan_panb.c
r14896r14897
3333      x = dx;
3434      y = dy;
3535
36      if (flip_screen_get(screen.machine()))
36      if (state->flip_screen())
3737      {
3838         sx = 240 - x;
3939         sy = 240 - y;
r14896r14897
6464      x = dx;
6565      y = dy;
6666
67      if (flip_screen_get(screen.machine()))
67      if (state->flip_screen())
6868      {
6969         sx = 240 - x;
7070         sy = 240 - y;
r14896r14897
120120      x = dx;
121121      y = dy;
122122
123      if (flip_screen_get(screen.machine()))
123      if (state->flip_screen())
124124      {
125125         sx = 240 - x;
126126         sy = 240 - y;
r14896r14897
169169
170170      if (wrapr == 8) xpos -= 256;
171171
172      if (flip_screen_get(screen.machine()))
172      if (state->flip_screen())
173173      {
174174         xpos = 240 - xpos;
175175         ypos = 240 - ypos;
r14896r14897
249249      if (x > 511) x &= 0x1ff;
250250      if (y > 511) y &= 0x1ff;
251251
252      if (flip_screen_get(screen.machine()))
252      if (state->flip_screen())
253253      {
254254         sx = 240 - x;
255255         sy = 240 - y;
src/mame/video/exzisus.c
r14896r14897
131131            x = (sx + (xc << 3)) & 0xff;
132132            y = (sy + (yc << 3)) & 0xff;
133133
134            if (flip_screen_get(screen.machine()))
134            if (state->flip_screen())
135135            {
136136               x = 248 - x;
137137               y = 248 - y;
r14896r14897
140140            drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[0],
141141                  code & 0x3fff,
142142                  color,
143                  flip_screen_get(screen.machine()), flip_screen_get(screen.machine()),
143                  state->flip_screen(), state->flip_screen(),
144144                  x, y, 15);
145145            goffs += 2;
146146         }
r14896r14897
200200            x = (sx + (xc << 3)) & 0xff;
201201            y = (sy + (yc << 3)) & 0xff;
202202
203            if (flip_screen_get(screen.machine()))
203            if (state->flip_screen())
204204            {
205205               x = 248 - x;
206206               y = 248 - y;
r14896r14897
209209            drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[1],
210210                  code & 0x3fff,
211211                  color,
212                  flip_screen_get(screen.machine()), flip_screen_get(screen.machine()),
212                  state->flip_screen(), state->flip_screen(),
213213                  x, y, 15);
214214            goffs += 2;
215215         }
src/mame/video/dassault.c
r14896r14897
8686   bitmap_ind16* sprite_bitmap2 = &screen.machine().device<decospr_device>("spritegen2")->get_sprite_temp_bitmap();
8787
8888   /* Update tilemaps */
89   flip_screen_set(screen.machine(), BIT(flip, 7));
89   state->flip_screen_set(BIT(flip, 7));
9090   deco16ic_pf_update(state->m_deco_tilegen1, 0, state->m_pf2_rowscroll);
9191   deco16ic_pf_update(state->m_deco_tilegen2, 0, state->m_pf4_rowscroll);
9292
src/mame/video/gotya.c
r14896r14897
8282
8383   m_scroll_bit_8 = data & 0x01;
8484
85   if (flip_screen_get(machine()) != (data & 0x02))
85   if (flip_screen() != (data & 0x02))
8686   {
87      flip_screen_set(machine(), data & 0x02);
87      flip_screen_set(data & 0x02);
8888      machine().tilemap().mark_all_dirty();
8989   }
9090}
r14896r14897
117117   gotya_state *state = machine.driver_data<gotya_state>();
118118   int row;
119119
120   if (flip_screen_get(machine))
120   if (state->flip_screen())
121121   {
122122      sx = 35 - sx;
123123   }
r14896r14897
126126   {
127127      int sy;
128128
129      if (flip_screen_get(machine))
129      if (state->flip_screen())
130130         sy = row;
131131      else
132132         sy = 31 - row;
r14896r14897
135135         machine.gfx[0],
136136         state->m_videoram2[row * 32 + col],
137137         state->m_videoram2[row * 32 + col + 0x10] & 0x0f,
138         flip_screen_x_get(machine), flip_screen_y_get(machine),
138         state->flip_screen_x(), state->flip_screen_y(),
139139         8 * sx, 8 * sy);
140140   }
141141}
r14896r14897
153153      int sx = 256 - spriteram[offs + 0x10] + (spriteram[offs + 0x01] & 0x01) * 256;
154154      int sy = spriteram[offs + 0x00];
155155
156      if (flip_screen_get(machine))
156      if (state->flip_screen())
157157         sy = 240 - sy;
158158
159159      drawgfx_transpen(bitmap,cliprect,
160160         machine.gfx[1],
161161         code, color,
162         flip_screen_x_get(machine), flip_screen_y_get(machine),
162         state->flip_screen_x(), state->flip_screen_y(),
163163         sx, sy, 0);
164164   }
165165}
src/mame/video/supbtime.c
r14896r14897
2626   supbtime_state *state = screen.machine().driver_data<supbtime_state>();
2727   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
2828
29   flip_screen_set(screen.machine(), BIT(flip, 7));
29   state->flip_screen_set(BIT(flip, 7));
3030   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
3131
3232   bitmap.fill(768, cliprect);
src/mame/video/retofinv.c
r14896r14897
137137   switch (offset)
138138   {
139139      case 0:
140         flip_screen_set(machine(), data & 1);
140         flip_screen_set(data & 1);
141141         break;
142142
143143      case 1:
r14896r14897
196196      sprite &= ~sizex;
197197      sprite &= ~(sizey << 1);
198198
199      if (flip_screen_get(machine))
199      if (state->flip_screen())
200200      {
201201         flipx ^= 1;
202202         flipy ^= 1;
src/mame/video/bogeyman.c
r14896r14897
6666WRITE8_MEMBER(bogeyman_state::bogeyman_paletteram_w)
6767{
6868   /* RGB output is inverted */
69   paletteram_BBGGGRRR_w(space, offset, ~data);
69   paletteram_BBGGGRRR_byte_w(space, offset, ~data);
7070}
7171
7272static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
121121
122122         if (multi) sy -= 16;
123123
124         if (flip_screen_get(machine))
124         if (state->flip_screen())
125125         {
126126            sx = 240 - sx;
127127            sy = 240 - sy;
r14896r14897
141141               machine.gfx[2],
142142               code + 1, color,
143143               flipx, flipy,
144               sx, sy + (flip_screen_get(machine) ? -16 : 16), 0);
144               sx, sy + (state->flip_screen() ? -16 : 16), 0);
145145         }
146146      }
147147   }
src/mame/video/m72.c
r14896r14897
365365      coin_counter_w(machine(), 1,data & 0x02);
366366
367367      /* bit 2 is flip screen (handled both by software and hardware) */
368      flip_screen_set(machine(), ((data & 0x04) >> 2) ^ ((~input_port_read(machine(), "DSW") >> 8) & 1));
368      flip_screen_set(((data & 0x04) >> 2) ^ ((~input_port_read(machine(), "DSW") >> 8) & 1));
369369
370370      /* bit 3 is display disable */
371371      m_video_off = data & 0x08;
r14896r14897
391391      coin_counter_w(machine(), 1,data & 0x02);
392392
393393      /* bit 2 is flip screen (handled both by software and hardware) */
394      flip_screen_set(machine(), ((data & 0x04) >> 2) ^ ((~input_port_read(machine(), "DSW") >> 8) & 1));
394      flip_screen_set(((data & 0x04) >> 2) ^ ((~input_port_read(machine(), "DSW") >> 8) & 1));
395395
396396      /* bit 3 is display disable */
397397      m_video_off = data & 0x08;
r14896r14897
442442      h = 1 << ((spriteram[offs+2] & 0x3000) >> 12);
443443      sy -= 16 * h;
444444
445      if (flip_screen_get(machine))
445      if (state->flip_screen())
446446      {
447447         sx = 512 - 16*w - sx;
448448         sy = 284 - 16*h - sy;
r14896r14897
495495      h = 1 << ((spriteram16_2[offs+2] & 0x3000) >> 12);
496496      sy -= 16 * h;
497497
498      if (flip_screen_get(machine))
498      if (state->flip_screen())
499499      {
500500         sx = 512 - 16*w - sx;
501501         sy = 256 - 16*h - sy;
src/mame/video/pokechmp.c
r14896r14897
1313
1414WRITE8_MEMBER(pokechmp_state::pokechmp_flipscreen_w)
1515{
16   if (flip_screen_get(machine()) != (data & 0x80))
16   if (flip_screen() != (data & 0x80))
1717   {
18      flip_screen_set(machine(), data & 0x80);
18      flip_screen_set(data & 0x80);
1919      machine().tilemap().mark_all_dirty();
2020   }
2121}
r14896r14897
5555
5656         flipx = spriteram[offs+1] & 0x04;
5757         flipy = spriteram[offs+1] & 0x02;
58         if (flip_screen_get(machine)) {
58         if (state->flip_screen()) {
5959            sx=240-sx;
6060            sy=240-sy;
6161            if (flipx) flipx=0; else flipx=1;
src/mame/video/aeroboto.c
r14896r14897
8181
8282READ8_MEMBER(aeroboto_state::aeroboto_in0_r)
8383{
84   return input_port_read(machine(), flip_screen_get(machine()) ? "P2" : "P1");
84   return input_port_read(machine(), flip_screen() ? "P2" : "P1");
8585}
8686
8787WRITE8_MEMBER(aeroboto_state::aeroboto_3000_w)
8888{
8989
9090   /* bit 0 selects both flip screen and player1/player2 controls */
91   flip_screen_set(machine(), data & 0x01);
91   flip_screen_set(data & 0x01);
9292
9393   /* bit 1 = char bank select */
9494   if (m_charbank != ((data & 0x02) >> 1))
r14896r14897
136136      int x = state->m_spriteram[offs + 3];
137137      int y = 240 - state->m_spriteram[offs];
138138
139      if (flip_screen_get(machine))
139      if (state->flip_screen())
140140      {
141141         x = 248 - x;
142142         y = 240 - y;
r14896r14897
145145      drawgfx_transpen(bitmap, cliprect, machine.gfx[1],
146146            state->m_spriteram[offs + 1],
147147            state->m_spriteram[offs + 2] & 0x07,
148            flip_screen_get(machine), flip_screen_get(machine),
148            state->flip_screen(), state->flip_screen(),
149149            ((x + 8) & 0xff) - 8, y, 0);
150150   }
151151}
src/mame/video/firetrap.c
r14896r14897
211211      color = ((state->m_spriteram[offs + 1] & 0x08) >> 2) | (state->m_spriteram[offs + 1] & 0x01);
212212      flipx = state->m_spriteram[offs + 1] & 0x04;
213213      flipy = state->m_spriteram[offs + 1] & 0x02;
214      if (flip_screen_get(machine))
214      if (state->flip_screen())
215215      {
216216         sx = 240 - sx;
217217         sy = 240 - sy;
r14896r14897
221221
222222      if (state->m_spriteram[offs + 1] & 0x10)   /* double width */
223223      {
224         if (flip_screen_get(machine)) sy -= 16;
224         if (state->flip_screen()) sy -= 16;
225225
226226         drawgfx_transpen(bitmap,cliprect,machine.gfx[3],
227227               code & ~1,
src/mame/video/thedeep.c
r14896r14897
171171      if (color & 1)   sx -= 256;
172172      if (attr  & 1)   sy -= 256;
173173
174      if (flip_screen_get(machine))
174      if (state->flip_screen())
175175      {
176176         flipx = !flipx;
177177         flipy = !flipy;
src/mame/video/amspdwy.c
r14896r14897
1919WRITE8_MEMBER(amspdwy_state::amspdwy_paletteram_w)
2020{
2121   data ^= 0xff;
22   paletteram_BBGGGRRR_w(space, offset, data);
23//  paletteram_RRRGGGBB_w(offset, data);
22   paletteram_BBGGGRRR_byte_w(space, offset, data);
23//  paletteram_RRRGGGBB_byte_w(offset, data);
2424}
2525
2626WRITE8_MEMBER(amspdwy_state::amspdwy_flipscreen_w)
2727{
2828   m_flipscreen ^= 1;
29   flip_screen_set(machine(), m_flipscreen);
29   flip_screen_set(m_flipscreen);
3030}
3131
3232/***************************************************************************
r14896r14897
117117      int flipx = attr & 0x80;
118118      int flipy = attr & 0x40;
119119
120      if (flip_screen_get(machine))
120      if (state->flip_screen())
121121      {
122122         x = max_x - x - 8;
123123         y = max_y - y - 8;
src/mame/video/srumbler.c
r14896r14897
8383WRITE8_MEMBER(srumbler_state::srumbler_4009_w)
8484{
8585   /* bit 0 flips screen */
86   flip_screen_set(machine(), data & 1);
86   flip_screen_set(data & 1);
8787
8888   /* bits 4-5 used during attract mode, unknown */
8989
r14896r14897
142142      sx = buffered_spriteram[offs + 3] + 0x100 * ( attr & 0x01);
143143      flipy = attr & 0x02;
144144
145      if (flip_screen_get(machine))
145      if (state->flip_screen())
146146      {
147147         sx = 496 - sx;
148148         sy = 240 - sy;
r14896r14897
152152      drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
153153            code,
154154            colour,
155            flip_screen_get(machine),flipy,
155            state->flip_screen(),flipy,
156156            sx, sy,15);
157157   }
158158}
src/mame/video/pbaction.c
r14896r14897
3636WRITE8_MEMBER(pbaction_state::pbaction_scroll_w)
3737{
3838   m_scroll = data - 3;
39   if (flip_screen_get(machine()))
39   if (flip_screen())
4040      m_scroll = -m_scroll;
4141
4242   m_bg_tilemap->set_scrollx(0, m_scroll);
r14896r14897
4545
4646WRITE8_MEMBER(pbaction_state::pbaction_flipscreen_w)
4747{
48   flip_screen_set(machine(), data & 0x01);
48   flip_screen_set(data & 0x01);
4949}
5050
5151static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
103103      flipx = spriteram[offs + 1] & 0x40;
104104      flipy = spriteram[offs + 1] & 0x80;
105105
106      if (flip_screen_get(machine))
106      if (state->flip_screen())
107107      {
108108         if (spriteram[offs] & 0x80)
109109         {
r14896r14897
123123            spriteram[offs],
124124            spriteram[offs + 1] & 0x0f,
125125            flipx,flipy,
126            sx + (flip_screen_get(machine) ? state->m_scroll : -state->m_scroll), sy,0);
126            sx + (state->flip_screen() ? state->m_scroll : -state->m_scroll), sy,0);
127127   }
128128}
129129
src/mame/video/mcr68.c
r14896r14897
55***************************************************************************/
66
77#include "emu.h"
8#include "includes/mcr.h"
89#include "includes/mcr68.h"
910
1011
src/mame/video/spcforce.c
r14896r14897
1212
1313WRITE8_MEMBER(spcforce_state::spcforce_flip_screen_w)
1414{
15   flip_screen_set(machine(), ~data & 0x01);
15   flip_screen_set(~data & 0x01);
1616}
1717
1818
r14896r14897
2020{
2121   spcforce_state *state = screen.machine().driver_data<spcforce_state>();
2222   int offs;
23   int flip = flip_screen_get(screen.machine());
23   int flip = state->flip_screen();
2424
2525   /* draw the characters as sprites because they could be overlapping */
2626   bitmap.fill(0, cliprect);
src/mame/video/exprraid.c
r14896r14897
1616
1717WRITE8_MEMBER(exprraid_state::exprraid_flipscreen_w)
1818{
19   if (flip_screen_get(machine()) != (data & 0x01))
19   if (flip_screen() != (data & 0x01))
2020   {
21      flip_screen_set(machine(), data & 0x01);
21      flip_screen_set(data & 0x01);
2222      machine().tilemap().mark_all_dirty();
2323   }
2424}
r14896r14897
106106      int sx = ((248 - state->m_spriteram[offs + 2]) & 0xff) - 8;
107107      int sy = state->m_spriteram[offs];
108108
109      if (flip_screen_get(machine))
109      if (state->flip_screen())
110110      {
111111         sx = 240 - sx;
112112         sy = 240 - sy;
r14896r14897
126126         drawgfx_transpen(bitmap,cliprect, machine.gfx[1],
127127            code + 1, color,
128128            flipx, flipy,
129            sx, sy + (flip_screen_get(machine) ? -16 : 16), 0);
129            sx, sy + (state->flip_screen() ? -16 : 16), 0);
130130      }
131131   }
132132}
src/mame/video/tecmo16.c
r14896r14897
161161WRITE16_MEMBER(tecmo16_state::tecmo16_flipscreen_w)
162162{
163163   m_flipscreen = data & 0x01;
164   flip_screen_set(machine(), m_flipscreen);
164   flip_screen_set(m_flipscreen);
165165}
166166
167167/******************************************************************************/
src/mame/video/toypop.c
r14896r14897
216216
217217void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base)
218218{
219   toypop_state *state = machine.driver_data<toypop_state>();
219220   UINT8 *spriteram = spriteram_base + 0x780;
220221   UINT8 *spriteram_2 = spriteram + 0x800;
221222   UINT8 *spriteram_3 = spriteram_2 + 0x800;
r14896r14897
246247         sy -= 16 * sizey;
247248         sy = (sy & 0xff) - 32;   // fix wraparound
248249
249         if (flip_screen_get(machine))
250         if (state->flip_screen())
250251         {
251252            flipx ^= 1;
252253            flipy ^= 1;
src/mame/video/kchamp.c
r14896r14897
3838
3939WRITE8_MEMBER(kchamp_state::kchamp_flipscreen_w)
4040{
41   flip_screen_set(machine(), data & 0x01);
41   flip_screen_set(data & 0x01);
4242}
4343
4444static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
8383      int sx = spriteram[offs + 3] - 8;
8484      int sy = 247 - spriteram[offs];
8585
86      if (flip_screen_get(machine))
86      if (state->flip_screen())
8787      {
8888         sx = 240 - sx;
8989         sy = 240 - sy;
r14896r14897
112112      int sx = spriteram[offs + 3];
113113      int sy = 240 - spriteram[offs];
114114
115      if (flip_screen_get(machine))
115      if (state->flip_screen())
116116      {
117117         sx = 240 - sx;
118118         sy = 240 - sy;
src/mame/video/digdug.c
r14896r14897
129129       characters when screen is flipped, we have to flip them back. */
130130   SET_TILE_INFO(
131131         0,
132         (code & 0x7f) | (flip_screen_get(machine) ? 0x80 : 0),
132         (code & 0x7f) | (state->flip_screen() ? 0x80 : 0),
133133         color,
134         flip_screen_get(machine) ? TILE_FLIPX : 0);
134         state->flip_screen() ? TILE_FLIPX : 0);
135135}
136136
137137
r14896r14897
227227         break;
228228
229229      case 7:   /* FLIP */
230         flip_screen_set(space->machine(), data & 1);
230         state->flip_screen_set(data & 1);
231231         break;
232232   }
233233}
r14896r14897
252252   rectangle visarea = cliprect;
253253   visarea.min_x = 2*8;
254254   visarea.max_x = 34*8-1;
255   if (flip_screen_get(machine))
255   if (state->flip_screen())
256256   {
257257      visarea.min_x += 12*8;
258258      visarea.max_x += 12*8;
r14896r14897
280280      sy -= 16 * size;
281281      sy = (sy & 0xff) - 32;   // fix wraparound
282282
283      if (flip_screen_get(machine))
283      if (state->flip_screen())
284284      {
285285         flipx ^= 1;
286286         flipy ^= 1;
src/mame/video/decmxc06.c
r14896r14897
8686      sy = 240 - sy;
8787
8888
89      if (flip_screen_get(machine))
89      if (machine.driver_data()->flip_screen())
9090      {
9191         sy = 240 - sy;
9292         sx = 240 - sx;
src/mame/video/scotrsht.c
r14896r14897
111111      int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
112112      int sy = spriteram[i + 3];
113113
114      if (flip_screen_get(machine))
114      if (state->flip_screen())
115115      {
116116         sx = 240 - sx;
117117         sy = 240 - sy;
src/mame/video/markham.c
r14896r14897
4747
4848WRITE8_MEMBER(markham_state::markham_flipscreen_w)
4949{
50   if (flip_screen_get(machine()) != (data & 0x01))
50   if (flip_screen() != (data & 0x01))
5151   {
52      flip_screen_set(machine(), data & 0x01);
52      flip_screen_set(data & 0x01);
5353      machine().tilemap().mark_all_dirty();
5454   }
5555}
r14896r14897
8383      int chr = spriteram[offs + 1];
8484      int col = spriteram[offs + 2];
8585
86      int fx = flip_screen_get(machine);
87      int fy = flip_screen_get(machine);
86      int fx = state->flip_screen();
87      int fy = state->flip_screen();
8888
8989      int x = spriteram[offs + 3];
9090      int y = spriteram[offs + 0];
9191      int px, py;
9292      col &= 0x3f ;
9393
94      if (flip_screen_get(machine) == 0)
94      if (state->flip_screen() == 0)
9595      {
9696         px = x - 2;
9797         py = 240 - y;
src/mame/video/superqix.c
r14896r14897
130130   memory_set_bank(machine(), "bank1", (data & 0x08) >> 3);
131131
132132   m_nmi_mask = data & 0x10;
133   flip_screen_set(machine(), data & 0x20);
133   flip_screen_set(data & 0x20);
134134}
135135
136136WRITE8_MEMBER(superqix_state::superqix_0410_w)
r14896r14897
174174      int sx = spriteram[offs + 1] + 256 * (spriteram[offs] & 0x01);
175175      int sy = spriteram[offs + 2];
176176
177      if (flip_screen_get(machine))
177      if (state->flip_screen())
178178      {
179179         sx = 240 - sx;
180180         sy = 240 - sy;
r14896r14897
183183      drawgfx_transpen(bitmap,cliprect, machine.gfx[1],
184184            code,
185185            color,
186            flip_screen_get(machine), flip_screen_get(machine),
186            state->flip_screen(), state->flip_screen(),
187187            sx, sy, 0);
188188   }
189189}
r14896r14897
204204      int sx = spriteram[offs + 1];
205205      int sy = spriteram[offs + 2];
206206
207      if (flip_screen_get(machine))
207      if (state->flip_screen())
208208      {
209209         sx = 240 - sx;
210210         sy = 240 - sy;
r14896r14897
233233{
234234   superqix_state *state = screen.machine().driver_data<superqix_state>();
235235   state->m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
236   copybitmap_trans(bitmap,*state->m_fg_bitmap[state->m_show_bitmap],flip_screen_get(screen.machine()),flip_screen_get(screen.machine()),0,0,cliprect,0);
236   copybitmap_trans(bitmap,*state->m_fg_bitmap[state->m_show_bitmap],state->flip_screen(),state->flip_screen(),0,0,cliprect,0);
237237   superqix_draw_sprites(screen.machine(), bitmap,cliprect);
238238   state->m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
239239   return 0;
src/mame/video/mappy.c
r14896r14897
373373
374374WRITE8_MEMBER(mappy_state::superpac_flipscreen_w)
375375{
376   flip_screen_set(machine(), data & 1);
376   flip_screen_set(data & 1);
377377}
378378
379379READ8_MEMBER(mappy_state::superpac_flipscreen_r)
380380{
381   flip_screen_set(machine(), 1);
381   flip_screen_set(1);
382382   return 0xff;
383383}
384384
r14896r14897
398398
399399static void mappy_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base)
400400{
401   mappy_state *state = machine.driver_data<mappy_state>();
401402   UINT8 *spriteram = spriteram_base + 0x780;
402403   UINT8 *spriteram_2 = spriteram + 0x800;
403404   UINT8 *spriteram_3 = spriteram_2 + 0x800;
r14896r14897
430431         sy -= 16 * sizey;
431432         sy = (sy & 0xff) - 32;   // fix wraparound
432433
433         if (flip_screen_get(machine))
434         if (state->flip_screen())
434435         {
435436            flipx ^= 1;
436437            flipy ^= 1;
r14896r14897
478479
479480static void phozon_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base)
480481{
482   mappy_state *state = machine.driver_data<mappy_state>();
481483   UINT8 *spriteram = spriteram_base + 0x780;
482484   UINT8 *spriteram_2 = spriteram + 0x800;
483485   UINT8 *spriteram_3 = spriteram_2 + 0x800;
r14896r14897
509511         sy -= 8 * sizey;
510512         sy = (sy & 0xff) - 32;   // fix wraparound
511513
512         if (flip_screen_get(machine))
514         if (state->flip_screen())
513515         {
514516            flipx ^= 1;
515517            flipy ^= 1;
r14896r14897
568570   mappy_state *state = screen.machine().driver_data<mappy_state>();
569571
570572   /* flip screen control is embedded in RAM */
571   flip_screen_set(screen.machine(), state->m_spriteram[0x1f7f-0x800] & 1);
573   state->flip_screen_set(state->m_spriteram[0x1f7f-0x800] & 1);
572574
573575   state->m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0);
574576
src/mame/video/tigeroad.c
r14896r14897
1919
2020      /* bit 1 flips screen */
2121
22      if (flip_screen_get(machine()) != (data & 0x02))
22      if (flip_screen() != (data & 0x02))
2323      {
24         flip_screen_set(machine(), data & 0x02);
24         flip_screen_set(data & 0x02);
2525         machine().tilemap().mark_all_dirty();
2626      }
2727
r14896r14897
8989         if (sx > 0x100) sx -= 0x200;
9090         if (sy > 0x100) sy -= 0x200;
9191
92         if (flip_screen_get(machine))
92         if (state->flip_screen())
9393         {
9494            sx = 240 - sx;
9595            sy = 240 - sy;
src/mame/video/quizdna.c
r14896r14897
112112
113113   m_flipscreen = tmp;
114114
115   flip_screen_set(machine(), tmp);
115   flip_screen_set(tmp);
116116   m_fg_tilemap->set_scrolldx(64, -64 +16);
117117}
118118
src/mame/video/kan_pand.c
r14896r14897
162162         y = dy;
163163      }
164164
165      if (flip_screen_get(device->machine()))
165      if (device->machine().driver_data()->flip_screen())
166166      {
167167         sx = 240 - x;
168168         sy = 240 - y;
src/mame/video/boogwing.c
r14896r14897
187187   screen.machine().device<decospr_device>("spritegen2")->draw_sprites(bitmap, cliprect, state->m_spriteram2->buffer(), 0x400, true);
188188   screen.machine().device<decospr_device>("spritegen1")->draw_sprites(bitmap, cliprect, state->m_spriteram->buffer(), 0x400, true);
189189
190   flip_screen_set(screen.machine(), BIT(flip, 7));
190   state->flip_screen_set(BIT(flip, 7));
191191   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
192192   deco16ic_pf_update(state->m_deco_tilegen2, state->m_pf3_rowscroll, state->m_pf4_rowscroll);
193193
src/mame/video/equites.c
r14896r14897
208208
209209WRITE16_MEMBER(equites_state::equites_flip0_w)
210210{
211   flip_screen_set(machine(), 0);
211   flip_screen_set(0);
212212}
213213
214214WRITE16_MEMBER(equites_state::equites_flip1_w)
215215{
216   flip_screen_set(machine(), 1);
216   flip_screen_set(1);
217217}
218218
219219WRITE16_MEMBER(equites_state::splndrbt_flip0_w)
220220{
221221   if (ACCESSING_BITS_0_7)
222      flip_screen_set(machine(), 0);
222      flip_screen_set(0);
223223
224224   if (ACCESSING_BITS_8_15)
225225      m_bgcolor = data >> 8;
r14896r14897
228228WRITE16_MEMBER(equites_state::splndrbt_flip1_w)
229229{
230230   if (ACCESSING_BITS_0_7)
231      flip_screen_set(machine(), 1);
231      flip_screen_set(1);
232232}
233233
234234WRITE16_MEMBER(equites_state::splndrbt_bg_scrollx_w)
r14896r14897
266266         int sy = (state->m_spriteram[offs] & 0x00ff);
267267         int transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[2], color, 0);
268268
269         if (flip_screen_get(machine))
269         if (state->flip_screen())
270270         {
271271            sx = 240 - sx;
272272            sy = 240 - sy;
r14896r14897
354354
355355      sy += 16;
356356
357      if (flip_screen_get(machine))
357      if (state->flip_screen())
358358      {
359359         // sx NOT inverted
360360         fx = fx ^ 1;
r14896r14897
407407   const UINT8 * const yrom = xrom + 0x2000;
408408   int scroll_x = state->m_splndrbt_bg_scrollx;
409409   int scroll_y = state->m_splndrbt_bg_scrolly;
410   int const dinvert = flip_screen_get(machine) ? 0xff : 0x00;
410   int const dinvert = state->flip_screen() ? 0xff : 0x00;
411411   int src_y = 0;
412412   int dst_y;
413413
414   if (flip_screen_get(machine))
414   if (state->flip_screen())
415415   {
416416      scroll_x = -scroll_x - 8;
417417      scroll_y = -scroll_y;
src/mame/video/decocass.c
r14896r14897
395395                  int sprite_y_adjust, int sprite_y_adjust_flip_screen,
396396                  UINT8 *sprite_ram, int interleave)
397397{
398   decocass_state *state = machine.driver_data<decocass_state>();
398399   int i,offs;
399400
400401   /* Draw the sprites */
r14896r14897
411412      flipx = sprite_ram[offs + 0] & 0x04;
412413      flipy = sprite_ram[offs + 0] & 0x02;
413414
414      if (flip_screen_get(machine))
415      if (state->flip_screen())
415416      {
416417         sx = 240 - sx;
417418         sy = 240 - sy + sprite_y_adjust_flip_screen;
r14896r14897
428429            flipx,flipy,
429430            sx,sy, 0);
430431
431      sy += (flip_screen_get(machine) ? -256 : 256);
432      sy += (state->flip_screen() ? -256 : 256);
432433
433434      // Wrap around
434435      drawgfx_transpen(bitmap,cliprect, machine.gfx[1],
r14896r14897
455456
456457      sy = 255 - missile_ram[offs + 0 * interleave];
457458      sx = 255 - missile_ram[offs + 2 * interleave];
458      if (flip_screen_get(machine))
459      if (state->flip_screen())
459460      {
460461         sx = 240 - sx;
461462         sy = 240 - sy + missile_y_adjust_flip_screen;
r14896r14897
471472
472473      sy = 255 - missile_ram[offs + 1 * interleave];
473474      sx = 255 - missile_ram[offs + 3 * interleave];
474      if (flip_screen_get(machine))
475      if (state->flip_screen())
475476      {
476477         sx = 240 - sx;
477478         sy = 240 - sy + missile_y_adjust_flip_screen;
src/mame/video/skykid.c
r14896r14897
8383       characters when screen is flipped, we have to flip them back. */
8484   SET_TILE_INFO(
8585         0,
86         code | (flip_screen_get(machine) ? 0x100 : 0),
86         code | (state->flip_screen() ? 0x100 : 0),
8787         attr & 0x3f,
88         flip_screen_get(machine) ? (TILE_FLIPY | TILE_FLIPX) : 0);
88         state->flip_screen() ? (TILE_FLIPY | TILE_FLIPX) : 0);
8989}
9090
9191
r14896r14897
166166WRITE8_MEMBER(skykid_state::skykid_flipscreen_priority_w)
167167{
168168   m_priority = data;
169   flip_screen_set(machine(), offset & 1);
169   flip_screen_set(offset & 1);
170170}
171171
172172
r14896r14897
206206      sprite &= ~sizex;
207207      sprite &= ~(sizey << 1);
208208
209      if (flip_screen_get(machine))
209      if (state->flip_screen())
210210      {
211211         flipx ^= 1;
212212         flipy ^= 1;
r14896r14897
234234SCREEN_UPDATE_IND16( skykid )
235235{
236236   skykid_state *state = screen.machine().driver_data<skykid_state>();
237   if (flip_screen_get(screen.machine()))
237   if (state->flip_screen())
238238   {
239239      state->m_bg_tilemap->set_scrollx(0, 189 - (state->m_scroll_x ^ 1));
240240      state->m_bg_tilemap->set_scrolly(0, 7 - state->m_scroll_y);
src/mame/video/mustache.c
r14896r14897
5252
5353WRITE8_MEMBER(mustache_state::mustache_video_control_w)
5454{
55   if (flip_screen_get(machine()) != (data & 0x01))
55   if (flip_screen() != (data & 0x01))
5656   {
57      flip_screen_set(machine(), data & 0x01);
57      flip_screen_set(data & 0x01);
5858      machine().tilemap().mark_all_dirty();
5959   }
6060
r14896r14897
121121      if ((state->m_control_byte & 0xa))
122122         clip.max_y = visarea.max_y;
123123      else
124         if (flip_screen_get(machine))
124         if (state->flip_screen())
125125            clip.min_y = visarea.min_y + 56;
126126         else
127127            clip.max_y = visarea.max_y - 56;
128128
129      if (flip_screen_get(machine))
129      if (state->flip_screen())
130130      {
131131         sx = 240 - sx;
132132         sy = 240 - sy;
r14896r14897
135135      drawgfx_transpen(bitmap,clip,gfx,
136136            code,
137137            color,
138            flip_screen_get(machine),flip_screen_get(machine),
138            state->flip_screen(),state->flip_screen(),
139139            sx,sy,0);
140140   }
141141}
src/mame/video/ladybug.c
r14896r14897
149149
150150WRITE8_MEMBER(ladybug_state::ladybug_flipscreen_w)
151151{
152   if (flip_screen_get(machine()) != (data & 0x01))
152   if (flip_screen() != (data & 0x01))
153153   {
154      flip_screen_set(machine(), data & 0x01);
154      flip_screen_set(data & 0x01);
155155      machine().tilemap().mark_all_dirty();
156156   }
157157}
r14896r14897
166166   // bit3 = enable stars
167167   // bit210 = stars speed/dir
168168
169   if (flip_screen_get(machine()) != (data & 0x80))
169   if (flip_screen() != (data & 0x80))
170170   {
171      flip_screen_set(machine(), data & 0x80);
171      flip_screen_set(data & 0x80);
172172      machine().tilemap().mark_all_dirty();
173173   }
174174
r14896r14897
292292      int sx = offs % 4;
293293      int sy = offs / 4;
294294
295      if (flip_screen_get(screen.machine()))
295      if (state->flip_screen())
296296         state->m_bg_tilemap->set_scrollx(offs, -state->m_videoram[32 * sx + sy]);
297297      else
298298         state->m_bg_tilemap->set_scrollx(offs, state->m_videoram[32 * sx + sy]);
r14896r14897
325325      int sx = offs % 4;
326326      int sy = offs / 4;
327327
328      if (flip_screen_get(screen.machine()))
328      if (state->flip_screen())
329329         state->m_bg_tilemap->set_scrollx(offs, -state->m_videoram[32 * sx + sy]);
330330      else
331331         state->m_bg_tilemap->set_scrollx(offs, state->m_videoram[32 * sx + sy]);
r14896r14897
335335   bitmap.fill(0, cliprect);
336336
337337   // draw the stars
338   if (flip_screen_get(screen.machine()))
338   if (state->flip_screen())
339339      redclash_draw_stars(screen.machine(), bitmap, cliprect, 0x60, 1, 0x27, 0xff);
340340   else
341341      redclash_draw_stars(screen.machine(), bitmap, cliprect, 0x60, 1, 0x00, 0xd8);
r14896r14897
344344   colortable_palette_set_color(screen.machine().colortable, 0x40, MAKE_RGB(state->m_grid_color & 0x40 ? 0xff : 0,
345345                                                             state->m_grid_color & 0x20 ? 0xff : 0,
346346                                                             state->m_grid_color & 0x10 ? 0xff : 0));
347   state->m_grid_tilemap->draw(bitmap, cliprect, 0, flip_screen_get(screen.machine()));
347   state->m_grid_tilemap->draw(bitmap, cliprect, 0, state->flip_screen());
348348
349349   for (i = 0; i < 0x100; i++)
350350   {
r14896r14897
353353         UINT8 x = i;
354354         int height = cliprect.max_y - cliprect.min_y + 1;
355355
356         if (flip_screen_get(screen.machine()))
356         if (state->flip_screen())
357357            x = ~x;
358358
359359         bitmap.plot_box(x, cliprect.min_y, 1, height, 0x81);
r14896r14897
361361   }
362362
363363   // now the chars
364   state->m_bg_tilemap->draw(bitmap, cliprect, 0, flip_screen_get(screen.machine()));
364   state->m_bg_tilemap->draw(bitmap, cliprect, 0, state->flip_screen());
365365
366366   // now the sprites
367367   draw_sprites(screen.machine(), bitmap, cliprect);
src/mame/video/blueprnt.c
r14896r14897
6363WRITE8_MEMBER(blueprnt_state::blueprnt_flipscreen_w)
6464{
6565
66   flip_screen_set(machine(), ~data & 0x02);
66   flip_screen_set(~data & 0x02);
6767
6868   if (m_gfx_bank != ((data & 0x04) >> 2))
6969   {
r14896r14897
108108      int flipx = state->m_spriteram[offs + 2] & 0x40;
109109      int flipy = state->m_spriteram[offs + 2 - 4] & 0x80;   // -4? Awkward, isn't it?
110110
111      if (flip_screen_get(machine))
111      if (state->flip_screen())
112112      {
113113         sx = 248 - sx;
114114         sy = 240 - sy;
r14896r14897
126126   blueprnt_state *state = screen.machine().driver_data<blueprnt_state>();
127127   int i;
128128
129   if (flip_screen_get(screen.machine()))
129   if (state->flip_screen())
130130      for (i = 0; i < 32; i++)
131131         state->m_bg_tilemap->set_scrolly(i, state->m_scrollram[32 - i]);
132132   else
src/mame/video/buggychl.c
r14896r14897
5656    bit0 = VINV
5757*/
5858
59   flip_screen_y_set(machine(), data & 0x01);
60   flip_screen_x_set(machine(), data & 0x02);
59   flip_screen_y_set(data & 0x01);
60   flip_screen_x_set(data & 0x02);
6161
6262   m_bg_on = data & 0x04;
6363   m_sky_on = data & 0x08;
r14896r14897
9292
9393   /* prevent wraparound */
9494   rectangle clip = cliprect;
95   if (flip_screen_x_get(machine)) clip.min_x += 8*8;
95   if (state->flip_screen_x()) clip.min_x += 8*8;
9696   else clip.max_x -= 8*8;
9797
9898   for (offs = 0; offs < 0x400; offs++)
r14896r14897
102102      int sx = offs % 32;
103103      int sy = offs / 32;
104104
105      if (flip_screen_x_get(machine))
105      if (state->flip_screen_x())
106106         sx = 31 - sx;
107      if (flip_screen_y_get(machine))
107      if (state->flip_screen_y())
108108         sy = 31 - sy;
109109
110110      drawgfx_opaque(state->m_tmp_bitmap1, state->m_tmp_bitmap1.cliprect(), machine.gfx[0],
111111            code,
112112            2,
113            flip_screen_x_get(machine),flip_screen_y_get(machine),
113            state->flip_screen_x(),state->flip_screen_y(),
114114            8*sx,8*sy);
115115   }
116116
r14896r14897
137137   {
138138      int sx = offs % 32;
139139      int sy = offs / 32;
140      int flipx = flip_screen_x_get(machine);
141      int flipy = flip_screen_y_get(machine);
140      int flipx = state->flip_screen_x();
141      int flipy = state->flip_screen_y();
142142
143143      int code = state->m_videoram[offs];
144144
r14896r14897
184184
185185      for (y = 0; y < 64; y++)
186186      {
187         int dy = flip_screen_y_get(machine) ? (255 - sy - y) : (sy + y);
187         int dy = state->flip_screen_y() ? (255 - sy - y) : (sy + y);
188188
189189         if ((dy & ~0xff) == 0)
190190         {
r14896r14897
212212                  int col = pendata[x];
213213                  if (col)
214214                  {
215                     int dx = flip_screen_x_get(machine) ? (255 - sx - px) : (sx + px);
215                     int dx = state->flip_screen_x() ? (255 - sx - px) : (sx + px);
216216                     if ((dx & ~0xff) == 0)
217217                        bitmap.pix16(dy, dx) = state->m_sprite_color_base + col;
218218                  }
src/mame/video/gberet.c
r14896r14897
150150         int flipx = attr & 0x10;
151151         int flipy = attr & 0x20;
152152
153         if (flip_screen_get(machine))
153         if (state->flip_screen())
154154         {
155155            sx = 240 - sx;
156156            sy = 240 - sy;
r14896r14897
205205         int flipx = attr & 0x10;
206206         int flipy = attr & 0x20;
207207
208         if (flip_screen_get(machine))
208         if (state->flip_screen())
209209         {
210210            sx = 240 - sx;
211211            sy = 240 - sy;
src/mame/video/stfight.c
r14896r14897
230230         /* 0x40 = sprites */
231231         m_bg_tilemap->enable(data & 0x20);
232232         m_fg_tilemap->enable(data & 0x10);
233         flip_screen_set(machine(), data & 0x01);
233         flip_screen_set(data & 0x01);
234234         break;
235235   }
236236}
r14896r14897
268268                sx -= 0x100;
269269         }
270270
271         if (flip_screen_get(machine))
271         if (state->flip_screen())
272272         {
273273            sx = 240 - sx;
274274            sy = 240 - sy;
r14896r14897
280280         pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
281281                 code,
282282                color,
283                flipx,flip_screen_get(machine),
283                flipx,state->flip_screen(),
284284                sx,sy,
285285                 machine.priority_bitmap,
286286                pri ? 0x02 : 0,0x0f);
src/mame/video/gottlieb.c
r14896r14897
5151   m_background_priority = data & 0x01;
5252
5353   /* bit 1 controls horizonal flip screen */
54   if (flip_screen_x_get(machine()) != (data & 0x02))
54   if (flip_screen_x() != (data & 0x02))
5555   {
56      flip_screen_x_set(machine(), data & 0x02);
56      flip_screen_x_set(data & 0x02);
5757      machine().tilemap().mark_all_dirty();
5858   }
5959
6060   /* bit 2 controls horizonal flip screen */
61   if (flip_screen_y_get(machine()) != (data & 0x04))
61   if (flip_screen_y() != (data & 0x04))
6262   {
63      flip_screen_y_set(machine(), data & 0x04);
63      flip_screen_y_set(data & 0x04);
6464      machine().tilemap().mark_all_dirty();
6565   }
6666
r14896r14897
225225      int sy = (spriteram[offs]) - 13;
226226      int code = (255 ^ spriteram[offs + 2]) + 256 * state->m_spritebank;
227227
228      if (flip_screen_x_get(machine)) sx = 233 - sx;
229      if (flip_screen_y_get(machine)) sy = 244 - sy;
228      if (state->flip_screen_x()) sx = 233 - sx;
229      if (state->flip_screen_y()) sy = 244 - sy;
230230
231231      drawgfx_transpen(bitmap, clip,
232232         machine.gfx[2],
233233         code, 0,
234         flip_screen_x_get(machine), flip_screen_y_get(machine),
234         state->flip_screen_x(), state->flip_screen_y(),
235235         sx,sy, 0);
236236   }
237237}
src/mame/video/ddragon.c
r14896r14897
196196            which = src[i + 3] + ((src[i + 2] & 0x0f) << 8);
197197         }
198198
199         if (flip_screen_get(machine))
199         if (state->flip_screen())
200200         {
201201            sx = 240 - sx;
202202            sy = 256 - sy;
src/mame/video/xxmissio.c
r14896r14897
4545
4646WRITE8_MEMBER(xxmissio_state::xxmissio_paletteram_w)
4747{
48   paletteram_BBGGRRII_w(space,offset,data);
48   paletteram_BBGGRRII_byte_w(space,offset,data);
4949}
5050
5151/****************************************************************************/
src/mame/video/pcktgal.c
r14896r14897
4848
4949         flipx = spriteram[offs+1] & 0x04;
5050         flipy = spriteram[offs+1] & 0x02;
51         if (flip_screen_get(machine)) {
51         if (state->flip_screen()) {
5252            sx=240-sx;
5353            sy=240-sy;
5454            if (flipx) flipx=0; else flipx=1;
r14896r14897
6666
6767SCREEN_UPDATE_IND16( pcktgal )
6868{
69//  flip_screen_set(screen.machine(), screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
69//  state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state());
7070   screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
7171   draw_sprites(screen.machine(), bitmap, cliprect);
7272   return 0;
src/mame/video/solomon.c
r14896r14897
3131
3232WRITE8_MEMBER(solomon_state::solomon_flipscreen_w)
3333{
34   if (flip_screen_get(machine()) != (data & 0x01))
34   if (flip_screen() != (data & 0x01))
3535   {
36      flip_screen_set(machine(), data & 0x01);
36      flip_screen_set(data & 0x01);
3737      machine().tilemap().mark_all_dirty();
3838   }
3939}
r14896r14897
8787      int sx = spriteram[offs + 3];
8888      int sy = 241 - spriteram[offs + 2];
8989
90      if (flip_screen_get(machine))
90      if (state->flip_screen())
9191      {
9292         sx = 240 - sx;
9393         sy = 242 - sy;
src/mame/video/gladiatr.c
r14896r14897
217217      int color = src[1] & 0x1f;
218218      int x,y;
219219
220      if (flip_screen_get(machine))
220      if (state->flip_screen())
221221      {
222222         xflip = !xflip;
223223         yflip = !yflip;
r14896r14897
287287      int scroll;
288288
289289      scroll = state->m_bg_scrollx + ((state->m_video_attributes & 0x04) << 6);
290      state->m_bg_tilemap->set_scrollx(0, scroll ^ (flip_screen_get(screen.machine()) ? 0x0f : 0));
290      state->m_bg_tilemap->set_scrollx(0, scroll ^ (state->flip_screen() ? 0x0f : 0));
291291      scroll = state->m_fg_scrollx + ((state->m_video_attributes & 0x08) << 5);
292      state->m_fg_tilemap->set_scrollx(0, scroll ^ (flip_screen_get(screen.machine()) ? 0x0f : 0));
292      state->m_fg_tilemap->set_scrollx(0, scroll ^ (state->flip_screen() ? 0x0f : 0));
293293
294294      // always 0 anyway
295295      state->m_bg_tilemap->set_scrolly(0, state->m_bg_scrolly);
src/mame/video/goindol.c
r14896r14897
9393      sx = sprite_ram[offs];
9494      sy = 240 - sprite_ram[offs + 1];
9595
96      if (flip_screen_get(machine))
96      if (state->flip_screen())
9797      {
9898         sx = 248 - sx;
9999         sy = 248 - sy;
r14896r14897
109109                  machine.gfx[gfxbank],
110110                  tile,
111111                  palette,
112                  flip_screen_get(machine),flip_screen_get(machine),
112                  state->flip_screen(),state->flip_screen(),
113113                  sx,sy, 0);
114114         drawgfx_transpen(bitmap,cliprect,
115115                  machine.gfx[gfxbank],
116116                  tile+1,
117117                  palette,
118                  flip_screen_get(machine),flip_screen_get(machine),
119                  sx,sy + (flip_screen_get(machine) ? -8 : 8), 0);
118                  state->flip_screen(),state->flip_screen(),
119                  sx,sy + (state->flip_screen() ? -8 : 8), 0);
120120      }
121121   }
122122}
src/mame/video/cabal.c
r14896r14897
6464      m_background_layer->set_flip(flip);
6565      m_text_layer->set_flip(flip);
6666
67      flip_screen_set(machine(), data & 0x20);
67      flip_screen_set(data & 0x20);
6868   }
6969}
7070
r14896r14897
125125
126126         if ( sx>256 )   sx -= 512;
127127
128         if (flip_screen_get(machine))
128         if (state->flip_screen())
129129         {
130130            sx = 240 - sx;
131131            sy = 240 - sy;
src/mame/video/suprloco.c
r14896r14897
118118
119119WRITE8_MEMBER(suprloco_state::suprloco_scrollram_w)
120120{
121   int adj = flip_screen_get(machine()) ? -8 : 8;
121   int adj = flip_screen() ? -8 : 8;
122122
123123   m_scrollram[offset] = data;
124124   m_bg_tilemap->set_scrollx(offset, data - adj);
r14896r14897
144144   coin_counter_w(machine(), 0, data & 0x01);
145145   coin_counter_w(machine(), 1, data & 0x02);
146146
147   flip_screen_set(machine(), data & 0x80);
147   flip_screen_set(data & 0x80);
148148
149149   m_control = data;
150150}
r14896r14897
173173static void draw_sprite(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int spr_number)
174174{
175175   suprloco_state *state = machine.driver_data<suprloco_state>();
176   int flip = flip_screen_get(machine);
176   int flip = state->flip_screen();
177177   int sx,sy,col,row,height,src,adjy,dy;
178178   UINT8 *spr_reg;
179179   UINT8 *gfx2;
r14896r14897
191191   sx = spr_reg[SPR_X];
192192   sy = spr_reg[SPR_Y_TOP] + 1;
193193
194   if (!flip_screen_get(machine))
194   if (!state->flip_screen())
195195   {
196196      adjy = sy;
197197      dy = 1;
src/mame/video/m92.c
r14896r14897
131131
132132WRITE16_MEMBER(m92_state::m92_paletteram_w)
133133{
134   paletteram16_xBBBBBGGGGGRRRRR_word_w(space, offset + 0x400 * m_palette_bank, data, mem_mask);
134   paletteram_xBBBBBGGGGGRRRRR_word_w(space, offset + 0x400 * m_palette_bank, data, mem_mask);
135135}
136136
137137/*****************************************************************************/
r14896r14897
349349
350350            for (row = 0; row < numrows; row++)
351351            {
352               if (flip_screen_get(machine))
352               if (state->flip_screen())
353353               {
354354                  pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
355355                        code + s_ptr, color, !flipx, !flipy,
r14896r14897
424424
425425            for (row = 0; row < numrows; row++)
426426            {
427               if (flip_screen_get(machine))
427               if (state->flip_screen())
428428               {
429429                  pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
430430                        code + s_ptr, color, !flipx, !flipy,
r14896r14897
544544   draw_sprites(screen.machine(), bitmap, cliprect);
545545
546546   /* Flipscreen appears hardwired to the dipswitch - strange */
547   m92_state *state = screen.machine().driver_data<m92_state>();
547548   if (input_port_read(screen.machine(), "DSW") & 0x100)
548      flip_screen_set(screen.machine(), 0);
549      state->flip_screen_set(0);
549550   else
550      flip_screen_set(screen.machine(), 1);
551      state->flip_screen_set(1);
551552   return 0;
552553}
553554
r14896r14897
561562   ppan_draw_sprites(screen.machine(), bitmap, cliprect);
562563
563564   /* Flipscreen appears hardwired to the dipswitch - strange */
565   m92_state *state = screen.machine().driver_data<m92_state>();
564566   if (input_port_read(screen.machine(), "DSW") & 0x100)
565      flip_screen_set(screen.machine(), 0);
567      state->flip_screen_set(0);
566568   else
567      flip_screen_set(screen.machine(), 1);
569      state->flip_screen_set(1);
568570   return 0;
569571}
src/mame/video/m58.c
r14896r14897
200200WRITE8_MEMBER(m58_state::yard_flipscreen_w)
201201{
202202   /* screen flip is handled both by software and hardware */
203   flip_screen_set(machine(), (data & 0x01) ^ (~input_port_read(machine(), "DSW2") & 0x01));
203   flip_screen_set((data & 0x01) ^ (~input_port_read(machine(), "DSW2") & 0x01));
204204
205205   coin_counter_w(machine(), 0, data & 0x02);
206206   coin_counter_w(machine(), 1, data & 0x20);
r14896r14897
245245         code2 = code1 + 0x40;
246246      }
247247
248      if (flip_screen_get(machine))
248      if (state->flip_screen())
249249      {
250250         sx = 240 - sx;
251251         sy2 = 192 - sy1;
r14896r14897
279279   {
280280      const rectangle clippanel(26*8, 32*8-1,   1*8, 31*8-1);
281281      const rectangle clippanelflip(0*8, 6*8-1, 1*8, 31*8-1);
282      rectangle clip = flip_screen_get(machine) ? clippanelflip : clippanel;
282      rectangle clip = state->flip_screen() ? clippanelflip : clippanel;
283283      const rectangle &visarea = machine.primary_screen->visible_area();
284      int sx = flip_screen_get(machine) ? cliprect.min_x - 8 : cliprect.max_x + 1 - SCROLL_PANEL_WIDTH;
285      int yoffs = flip_screen_get(machine) ? -40 : -16;
284      int sx = state->flip_screen() ? cliprect.min_x - 8 : cliprect.max_x + 1 - SCROLL_PANEL_WIDTH;
285      int yoffs = state->flip_screen() ? -40 : -16;
286286
287287      clip.min_y += visarea.min_y + yoffs;
288288      clip.max_y += visarea.max_y + yoffs;
289289      clip &= cliprect;
290290
291      copybitmap(bitmap, *state->m_scroll_panel_bitmap, flip_screen_get(machine), flip_screen_get(machine),
291      copybitmap(bitmap, *state->m_scroll_panel_bitmap, state->flip_screen(), state->flip_screen(),
292292               sx, visarea.min_y + yoffs, clip);
293293   }
294294}
src/mame/video/wwfwfest.c
r14896r14897
189189         number = (source[2] & 0x00ff) | (source[3] & 0x00ff) << 8;
190190         colourbank = (source[4] & 0x000f);
191191
192         if (flip_screen_get(machine)) {
192         if (state->flip_screen()) {
193193            if (flipy) flipy=0; else flipy=1;
194194            if (flipx) flipx=0; else flipx=1;
195195            ypos=240-ypos-state->m_sprite_xoff;
r14896r14897
197197         }
198198
199199         for (count=0;count<chain;count++) {
200            if (flip_screen_get(machine)) {
200            if (state->flip_screen()) {
201201               if (!flipy) {
202202                  drawgfx_transpen(bitmap,cliprect,gfx,number+count,colourbank,flipx,flipy,xpos,ypos+(16*(chain-1))-(16*count),0);
203203               } else {
src/mame/video/pktgaldx.c
r14896r14897
1010   pktgaldx_state *state = screen.machine().driver_data<pktgaldx_state>();
1111   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
1212
13   flip_screen_set(screen.machine(), BIT(flip, 7));
13   state->flip_screen_set(BIT(flip, 7));
1414   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
1515
1616   bitmap.fill(0, cliprect); /* not Confirmed */
src/mame/video/timeplt.c
r14896r14897
157157
158158WRITE8_MEMBER(timeplt_state::timeplt_flipscreen_w)
159159{
160   flip_screen_set(machine(), ~data & 1);
160   flip_screen_set(~data & 1);
161161}
162162
163163
src/mame/video/fuukifg2.c
r14896r14897
182182      sx = (sx & 0x1ff) - (sx & 0x200);
183183      sy = (sy & 0x1ff) - (sy & 0x200);
184184
185      if (flip_screen_get(screen.machine()))
185      if (state->flip_screen())
186186      {
187187         flipx = !flipx;      sx = max_x - sx - xnum * 16;
188188         flipy = !flipy;      sy = max_y - sy - ynum * 16;
r14896r14897
306306   int tm_middle = pri_table[state->m_priority[0] & 0x0f][1];
307307   int tm_back   = pri_table[state->m_priority[0] & 0x0f][2];
308308
309   flip_screen_set(screen.machine(), state->m_vregs[0x1e / 2] & 1);
309   state->flip_screen_set(state->m_vregs[0x1e / 2] & 1);
310310
311311   /* Layers scrolling */
312312
313   scrolly_offs = state->m_vregs[0xc / 2] - (flip_screen_get(screen.machine()) ? 0x103 : 0x1f3);
314   scrollx_offs = state->m_vregs[0xe / 2] - (flip_screen_get(screen.machine()) ? 0x2a7 : 0x3f6);
313   scrolly_offs = state->m_vregs[0xc / 2] - (state->flip_screen() ? 0x103 : 0x1f3);
314   scrollx_offs = state->m_vregs[0xe / 2] - (state->flip_screen() ? 0x2a7 : 0x3f6);
315315
316316   layer0_scrolly = state->m_vregs[0x0 / 2] + scrolly_offs;
317317   layer0_scrollx = state->m_vregs[0x2 / 2] + scrollx_offs;
src/mame/video/vulgus.c
r14896r14897
148148   coin_counter_w(machine(), 1, data & 0x02);
149149
150150   /* bit 7 flips screen */
151   flip_screen_set(machine(), data & 0x80);
151   flip_screen_set(data & 0x80);
152152}
153153
154154
r14896r14897
185185      sx = spriteram[offs + 3];
186186      sy = spriteram[offs + 2];
187187      dir = 1;
188      if (flip_screen_get(machine))
188      if (state->flip_screen())
189189      {
190190         sx = 240 - sx;
191191         sy = 240 - sy;
r14896r14897
200200         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
201201               code + i,
202202               col,
203               flip_screen_get(machine),flip_screen_get(machine),
203               state->flip_screen(),state->flip_screen(),
204204               sx, sy + 16 * i * dir,15);
205205
206206         /* draw again with wraparound */
207207         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
208208               code + i,
209209               col,
210               flip_screen_get(machine),flip_screen_get(machine),
210               state->flip_screen(),state->flip_screen(),
211211               sx, sy + 16 * i * dir -  dir * 256,15);
212212         i--;
213213      } while (i >= 0);
src/mame/video/shangha3.c
r14896r14897
9090   if (ACCESSING_BITS_0_7)
9191   {
9292      /* bit 7 flips screen, the rest seems to always be set to 0x7e */
93      flip_screen_set(machine(), data & 0x80);
93      flip_screen_set(data & 0x80);
9494
9595      if ((data & 0x7f) != 0x7e) popmessage("flipscreen_w %02x",data);
9696   }
r14896r14897
131131      zoomx = shangha3_ram[offs+10];
132132      zoomy = shangha3_ram[offs+13];
133133
134      if (flip_screen_get(machine()))
134      if (flip_screen())
135135      {
136136         sx = 383 - sx - sizex;
137137         sy = 255 - sy - sizey;
src/mame/video/vastar.c
r14896r14897
154154      flipx = spriteram_3[offs] & 0x02;
155155      flipy = spriteram_3[offs] & 0x01;
156156
157      if (flip_screen_get(machine))
157      if (state->flip_screen())
158158      {
159159         flipx = !flipx;
160160         flipy = !flipy;
r14896r14897
162162
163163      if (spriteram_2[offs] & 0x08)   /* double width */
164164      {
165         if (!flip_screen_get(machine))
165         if (!state->flip_screen())
166166            sy = 224 - sy;
167167
168168         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
r14896r14897
179179      }
180180      else
181181      {
182         if (!flip_screen_get(machine))
182         if (!state->flip_screen())
183183            sy = 240 - sy;
184184
185185         drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
src/mame/video/gaelco2.c
r14896r14897
193193
194194/***************************************************************************
195195
196    Palette (paletteram16_xRRRRRGGGGGBBBBB_word_w)
196    Palette (paletteram_xRRRRRGGGGGBBBBB_word_w)
197197
198198    The game's palette uses colors 0-4095, but we need 15 aditional palettes
199199    to handle shadows and highlights properly. After a color write to the
src/mame/video/champbas.c
r14896r14897
185185
186186WRITE8_MEMBER(champbas_state::champbas_flipscreen_w)
187187{
188   flip_screen_set(machine(), ~data & 1);
188   flip_screen_set(~data & 1);
189189}
190190
191191
src/mame/video/baraduke.c
r14896r14897
260260
261261         sy -= 16 * sizey;
262262
263         if (flip_screen_get(machine))
263         if (state->flip_screen())
264264         {
265265            sx = 496+3 - 16 * sizex - sx;
266266            sy = 240 - 16 * sizey - sy;
r14896r14897
295295
296296   scrollx = state->m_xscroll[layer] + xdisp[layer];
297297   scrolly = state->m_yscroll[layer] + 9;
298   if (flip_screen_get(machine))
298   if (state->flip_screen())
299299   {
300300      scrollx = -scrollx + 3;
301301      scrolly = -scrolly;
r14896r14897
313313   int back;
314314
315315   /* flip screen is embedded in the sprite control registers */
316   /* can't use flip_screen_set(screen.machine(), ) because the visible area is asymmetrical */
317   flip_screen_set_no_update(screen.machine(), spriteram[0x07f6] & 0x01);
318   screen.machine().tilemap().set_flip_all(flip_screen_get(screen.machine()) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
316   /* can't use state->flip_screen_set() because the visible area is asymmetrical */
317   state->flip_screen_set_no_update(spriteram[0x07f6] & 0x01);
318   screen.machine().tilemap().set_flip_all(state->flip_screen() ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
319319   set_scroll(screen.machine(), 0);
320320   set_scroll(screen.machine(), 1);
321321
src/mame/video/ssozumo.c
r14896r14897
109109
110110WRITE8_MEMBER(ssozumo_state::ssozumo_flipscreen_w)
111111{
112   flip_screen_set(machine(), data & 0x80);
112   flip_screen_set(data & 0x80);
113113}
114114
115115static TILE_GET_INFO( get_bg_tile_info )
r14896r14897
161161         int sx = 239 - spriteram[offs + 3];
162162         int sy = (240 - spriteram[offs + 2]) & 0xff;
163163
164         if (flip_screen_get(machine))
164         if (state->flip_screen())
165165         {
166166            sx = 240 - sx;
167167            sy = 240 - sy;
src/mame/video/arkanoid.c
r14896r14897
2121   int bank;
2222
2323   /* bits 0 and 1 flip X and Y, I don't know which is which */
24   if (flip_screen_x_get(machine()) != (data & 0x01))
24   if (flip_screen_x() != (data & 0x01))
2525   {
26      flip_screen_x_set(machine(), data & 0x01);
26      flip_screen_x_set(data & 0x01);
2727      m_bg_tilemap->mark_all_dirty();
2828   }
2929
30   if (flip_screen_y_get(machine()) != (data & 0x02))
30   if (flip_screen_y() != (data & 0x02))
3131   {
32      flip_screen_y_set(machine(), data & 0x02);
32      flip_screen_y_set(data & 0x02);
3333      m_bg_tilemap->mark_all_dirty();
3434   }
3535
r14896r14897
7676   int bank;
7777
7878   /* bits 0 and 1 flip X and Y, I don't know which is which */
79   if (flip_screen_x_get(machine()) != (data & 0x01))
79   if (flip_screen_x() != (data & 0x01))
8080   {
81      flip_screen_x_set(machine(), data & 0x01);
81      flip_screen_x_set(data & 0x01);
8282      m_bg_tilemap->mark_all_dirty();
8383   }
8484
85   if (flip_screen_y_get(machine()) != (data & 0x02))
85   if (flip_screen_y() != (data & 0x02))
8686   {
87      flip_screen_y_set(machine(), data & 0x02);
87      flip_screen_y_set(data & 0x02);
8888      m_bg_tilemap->mark_all_dirty();
8989   }
9090
r14896r14897
121121{
122122
123123   /* bit 0 = flipx (or y?) */
124   if (flip_screen_x_get(machine()) != (data & 0x01))
124   if (flip_screen_x() != (data & 0x01))
125125   {
126      flip_screen_x_set(machine(), data & 0x01);
126      flip_screen_x_set(data & 0x01);
127127      m_bg_tilemap->mark_all_dirty();
128128   }
129129
130130   /* bit 1 = flipy (or x?) */
131   if (flip_screen_y_get(machine()) != (data & 0x02))
131   if (flip_screen_y() != (data & 0x02))
132132   {
133      flip_screen_y_set(machine(), data & 0x02);
133      flip_screen_y_set(data & 0x02);
134134      m_bg_tilemap->mark_all_dirty();
135135   }
136136
r14896r14897
177177
178178      sx = state->m_spriteram[offs];
179179      sy = 248 - state->m_spriteram[offs + 1];
180      if (flip_screen_x_get(machine))
180      if (state->flip_screen_x())
181181         sx = 248 - sx;
182      if (flip_screen_y_get(machine))
182      if (state->flip_screen_y())
183183         sy = 248 - sy;
184184
185185      code = state->m_spriteram[offs + 3] + ((state->m_spriteram[offs + 2] & 0x03) << 8) + 1024 * state->m_gfxbank;
r14896r14897
187187      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
188188            2 * code,
189189            ((state->m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * state->m_palettebank,
190            flip_screen_x_get(machine),flip_screen_y_get(machine),
191            sx,sy + (flip_screen_y_get(machine) ? 8 : -8),0);
190            state->flip_screen_x(),state->flip_screen_y(),
191            sx,sy + (state->flip_screen_y() ? 8 : -8),0);
192192      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
193193            2 * code + 1,
194194            ((state->m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * state->m_palettebank,
195            flip_screen_x_get(machine),flip_screen_y_get(machine),
195            state->flip_screen_x(),state->flip_screen_y(),
196196            sx,sy,0);
197197   }
198198}
src/mame/video/twin16.c
r14896r14897
6767      case 0:
6868         COMBINE_DATA( &m_video_register );
6969
70         flip_screen_x_set(machine(), m_video_register & TWIN16_SCREEN_FLIPX);
71         flip_screen_y_set(machine(), m_video_register & TWIN16_SCREEN_FLIPY);
70         flip_screen_x_set(m_video_register & TWIN16_SCREEN_FLIPX);
71         flip_screen_y_set(m_video_register & TWIN16_SCREEN_FLIPY);
7272
7373         break;
7474
src/mame/video/clshroad.c
r14896r14897
3636
3737WRITE8_MEMBER(clshroad_state::clshroad_flipscreen_w)
3838{
39   flip_screen_set(machine(),  data & 1 );
39   flip_screen_set(data & 1 );
4040}
4141
4242
r14896r14897
301301      int flipy   =   0;
302302
303303      x -= 0x4a/2;
304      if (flip_screen_get(machine))
304      if (state->flip_screen())
305305      {
306306         y = 240 - y;
307307         flipx = !flipx;
src/mame/video/sf.c
r14896r14897
104104   if (ACCESSING_BITS_0_7)
105105   {
106106      m_sf_active = data & 0xff;
107      flip_screen_set(machine(), data & 0x04);
107      flip_screen_set(data & 0x04);
108108      m_tx_tilemap->enable(data & 0x08);
109109      m_bg_tilemap->enable(data & 0x20);
110110      m_fg_tilemap->enable(data & 0x40);
r14896r14897
144144      {
145145         int c1, c2, c3, c4, t;
146146
147         if (flip_screen_get(machine))
147         if (state->flip_screen())
148148         {
149149            sx = 480 - sx;
150150            sy = 224 - sy;
r14896r14897
195195      }
196196      else
197197      {
198         if (flip_screen_get(machine))
198         if (state->flip_screen())
199199         {
200200            sx = 496 - sx;
201201            sy = 240 - sy;
src/mame/video/lsasquad.c
r14896r14897
1515
1616      base = 64 * scrollram[offs + 1];
1717      sx = 8 * (offs / 4) + scrollx;
18      if (flip_screen_get(machine))
18      if (state->flip_screen())
1919         sx = 248 - sx;
2020
2121      sx &= 0xff;
r14896r14897
2525         int attr;
2626
2727         sy = 8 * y + scrolly;
28         if (flip_screen_get(machine))
28         if (state->flip_screen())
2929            sy = 248 - sy;
3030         sy &= 0xff;
3131
r14896r14897
3636         drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
3737               code,
3838               color,
39               flip_screen_get(machine),flip_screen_get(machine),
39               state->flip_screen(),state->flip_screen(),
4040               sx,sy,15);
4141         if (sx > 248)   /* wraparound */
4242            drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
4343                  code,
4444                  color,
45                  flip_screen_get(machine),flip_screen_get(machine),
45                  state->flip_screen(),state->flip_screen(),
4646                  sx-256,sy,15);
4747      }
4848   }
r14896r14897
102102      base = 64 * state->m_scrollram[offs + 1];
103103      sx = scrollx + stepx;
104104
105      if (flip_screen_get(machine))
105      if (state->flip_screen())
106106         sx = 248 - sx;
107107      sx &= 0xff;
108108
r14896r14897
111111         int attr;
112112
113113         sy = 8 * y + scrolly;
114         if (flip_screen_get(machine))
114         if (state->flip_screen())
115115            sy = 248 - sy;
116116         sy &= 0xff;
117117
r14896r14897
124124            drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
125125               code,
126126               color,
127               flip_screen_get(machine),flip_screen_get(machine),
127               state->flip_screen(),state->flip_screen(),
128128               sx,sy,15);
129129            if (sx > 248)   /* wraparound */
130130               drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
131131                  code,
132132                  color,
133                  flip_screen_get(machine),flip_screen_get(machine),
133                  state->flip_screen(),state->flip_screen(),
134134                  sx-256,sy,15);
135135         }
136136      }
r14896r14897
176176      flipx = attr & 0x40;
177177      flipy = attr & 0x80;
178178
179      if (flip_screen_get(machine))
179      if (state->flip_screen())
180180      {
181181         sx = 240 - sx;
182182         sy = 240 - sy;
src/mame/video/dooyong.c
r14896r14897
118118   m_sprites_disabled = data & 0x10;
119119
120120   /* bit 6 is flip screen */
121   flip_screen_set(machine(), data & 0x40);
121   flip_screen_set(data & 0x40);
122122}
123123
124124WRITE8_MEMBER(dooyong_state::pollux_ctrl_w)
125125{
126126   /* bit 0 is flip screen */
127   flip_screen_set(machine(), data & 0x01);
127   flip_screen_set(data & 0x01);
128128
129129   /* bits 6 and 7 are coin counters */
130130   coin_counter_w(machine(), 0, data & 0x80);
r14896r14897
145145   m_tx_pri = data & 0x08;
146146
147147   /* bit 4 flips screen */
148   flip_screen_set(machine(), data & 0x10);
148   flip_screen_set(data & 0x10);
149149
150150   /* bit 5 used but unknown */
151151
r14896r14897
166166WRITE8_MEMBER(dooyong_state::flytiger_ctrl_w)
167167{
168168   /* bit 0 is flip screen */
169   flip_screen_set(machine(), data & 0x01);
169   flip_screen_set(data & 0x01);
170170
171171   /* bits 1, 2 used but unknown */
172172
r14896r14897
183183   if (ACCESSING_BITS_0_7)
184184   {
185185      /* bit 0 flips screen */
186      flip_screen_set(machine(), data & 0x0001);
186      flip_screen_set(data & 0x0001);
187187
188188      /* bit 4 changes tilemaps priority */
189189      m_rshark_pri = data & 0x0010;
r14896r14897
410410         }
411411      }
412412
413      if (flip_screen_get(machine))
413      if (state->flip_screen())
414414      {
415415         sx = 498 - sx;
416416         sy = 240 - (16 * height) - sy;
r14896r14897
475475         width = buffered_spriteram16[offs+1] & 0x000f;
476476         height = (buffered_spriteram16[offs+1] & 0x00f0) >> 4;
477477
478         if (flip_screen_get(machine))
478         if (state->flip_screen())
479479         {
480480            sx = 498 - (16 * width) - sx;
481481            sy = 240 - (16 * height) - sy;
src/mame/video/dec8.c
r14896r14897
237237      fx = buffered_spriteram[offs + 1] & 0x04;
238238      multi = buffered_spriteram[offs + 1] & 0x10;
239239
240      if (flip_screen_get(machine))
240      if (state->flip_screen())
241241      {
242242         sy = 240 - sy;
243243         sx = 240 - sx;
r14896r14897
249249      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
250250                 code,
251251            color,
252            fx,flip_screen_get(machine),
252            fx,state->flip_screen(),
253253            sx,sy,0);
254254        if (multi)
255255          drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
256256            code+1,
257257            color,
258            fx,flip_screen_get(machine),
258            fx,state->flip_screen(),
259259            sx,sy2,0);
260260   }
261261}
r14896r14897
266266{
267267   dec8_state *state = screen.machine().driver_data<dec8_state>();
268268
269   flip_screen_set(screen.machine(), state->m_bg_control[0] >> 7);
269   state->flip_screen_set(state->m_bg_control[0] >> 7);
270270
271271   screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
272272   screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram16, 0x04, 0x00, 0x03);
r14896r14897
346346SCREEN_UPDATE_IND16( oscar )
347347{
348348   dec8_state *state = screen.machine().driver_data<dec8_state>();
349   flip_screen_set(screen.machine(), state->m_bg_control[1] >> 7);
349   state->flip_screen_set(state->m_bg_control[1] >> 7);
350350
351351   // we mimic the priority scheme in dec0.c, this was originally a bit different, so this could be wrong
352352   screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
src/mame/video/fuukifg3.c
r14896r14897
198198      sx = (sx & 0x1ff) - (sx & 0x200);
199199      sy = (sy & 0x1ff) - (sy & 0x200);
200200
201      if (flip_screen_get(screen.machine()))
201      if (state->flip_screen())
202202      {
203203         flipx = !flipx;      sx = max_x - sx - xnum * 16;
204204         flipy = !flipy;      sy = max_y - sy - ynum * 16;
r14896r14897
330330   int tm_middle = pri_table[(state->m_priority[0] >> 16) & 0x0f][1];
331331   int tm_back   = pri_table[(state->m_priority[0] >> 16) & 0x0f][2];
332332
333   flip_screen_set(screen.machine(), (state->m_vregs[0x1e / 4] & 0x0000ffff) & 1);
333   state->flip_screen_set((state->m_vregs[0x1e / 4] & 0x0000ffff) & 1);
334334
335335   /* Layers scrolling */
336336
337   scrolly_offs = ((state->m_vregs[0xc / 4] & 0xffff0000) >> 16) - (flip_screen_get(screen.machine()) ? 0x103 : 0x1f3);
338   scrollx_offs =  (state->m_vregs[0xc / 4] & 0x0000ffff) - (flip_screen_get(screen.machine()) ? 0x2c7 : 0x3f6);
337   scrolly_offs = ((state->m_vregs[0xc / 4] & 0xffff0000) >> 16) - (state->flip_screen() ? 0x103 : 0x1f3);
338   scrollx_offs =  (state->m_vregs[0xc / 4] & 0x0000ffff) - (state->flip_screen() ? 0x2c7 : 0x3f6);
339339
340340   layer0_scrolly = ((state->m_vregs[0x0 / 4] & 0xffff0000) >> 16) + scrolly_offs;
341341   layer0_scrollx = ((state->m_vregs[0x0 / 4] & 0x0000ffff)) + scrollx_offs;
src/mame/video/battlane.c
r14896r14897
175175         flipx = attr & 0x04;
176176         flipy = attr & 0x02;
177177
178         if (!flip_screen_get(machine))
178         if (!state->flip_screen())
179179            {
180180            sx = 240 - sx;
181181            sy = 240 - sy;
r14896r14897
218218
219219         if (data)
220220         {
221            if (flip_screen_get(machine))
221            if (state->flip_screen())
222222               bitmap.pix16(255 - y, 255 - x) = data;
223223            else
224224               bitmap.pix16(y, x) = data;
src/mame/video/atarigt.c
r14896r14897
127127 *
128128 *************************************/
129129
130void atarigt_colorram_w(atarigt_state *state, offs_t address, UINT16 data, UINT16 mem_mask)
130void atarigt_state::atarigt_colorram_w(offs_t address, UINT16 data, UINT16 mem_mask)
131131{
132132   UINT16 olddata;
133133
134134   /* update the raw data */
135135   address = (address & 0x7ffff) / 2;
136   olddata = state->m_colorram[address];
137   COMBINE_DATA(&state->m_colorram[address]);
136   olddata = m_colorram[address];
137   COMBINE_DATA(&m_colorram[address]);
138138
139139   /* update the TRAM checksum */
140140   if (address >= 0x10000 && address < 0x14000)
141      state->m_tram_checksum += state->m_colorram[address] - olddata;
141      m_tram_checksum += m_colorram[address] - olddata;
142142
143143   /* update expanded MRAM */
144144   else if (address >= 0x20000 && address < 0x28000)
145145   {
146      state->m_expanded_mram[0 * MRAM_ENTRIES + (address & 0x7fff)] = (state->m_colorram[address] >> 8) << RSHIFT;
147      state->m_expanded_mram[1 * MRAM_ENTRIES + (address & 0x7fff)] = (state->m_colorram[address] & 0xff) << GSHIFT;
146      m_expanded_mram[0 * MRAM_ENTRIES + (address & 0x7fff)] = (m_colorram[address] >> 8) << RSHIFT;
147      m_expanded_mram[1 * MRAM_ENTRIES + (address & 0x7fff)] = (m_colorram[address] & 0xff) << GSHIFT;
148148   }
149149   else if (address >= 0x30000 && address < 0x38000)
150      state->m_expanded_mram[2 * MRAM_ENTRIES + (address & 0x7fff)] = (state->m_colorram[address] & 0xff) << BSHIFT;
150      m_expanded_mram[2 * MRAM_ENTRIES + (address & 0x7fff)] = (m_colorram[address] & 0xff) << BSHIFT;
151151}
152152
153153
154UINT16 atarigt_colorram_r(atarigt_state *state, offs_t address)
154UINT16 atarigt_state::atarigt_colorram_r(offs_t address)
155155{
156156   address &= 0x7ffff;
157   return state->m_colorram[address / 2];
157   return m_colorram[address / 2];
158158}
159159
160160
src/mame/video/pooyan.c
r14896r14897
144144
145145WRITE8_MEMBER(pooyan_state::pooyan_flipscreen_w)
146146{
147   flip_screen_set(machine(), ~data & 0x01);
147   flip_screen_set(~data & 0x01);
148148}
149149
150150
src/mame/video/wrally.c
r14896r14897
125125
126126      if (high_priority != priority) continue;
127127
128      if (flip_screen_get(machine)) {
128      if (state->flip_screen()) {
129129         sy = sy + 248;
130130      }
131131
r14896r14897
180180{
181181   wrally_state *state = screen.machine().driver_data<wrally_state>();
182182   /* set scroll registers */
183   if (!flip_screen_get(screen.machine())) {
183   if (!state->flip_screen()) {
184184      state->m_pant[0]->set_scrolly(0, state->m_vregs[0]);
185185      state->m_pant[0]->set_scrollx(0, state->m_vregs[1]+4);
186186      state->m_pant[1]->set_scrolly(0, state->m_vregs[2]);
src/mame/video/shisen.c
r14896r14897
6666   // on Irem boards, screen flip is handled in both hardware and software.
6767   // this game doesn't have cocktail mode so if there's software control we don't
6868   // know where it is mapped.
69   flip_screen_set(screen.machine(), ~input_port_read(screen.machine(), "DSW2") & 1);
69   state->flip_screen_set(~input_port_read(screen.machine(), "DSW2") & 1);
7070
7171
7272   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
src/mame/video/nmk16.c
r14896r14897
366366WRITE16_MEMBER(nmk16_state::nmk_flipscreen_w)
367367{
368368   if (ACCESSING_BITS_0_7)
369      flip_screen_set(machine(), data & 0x01);
369      flip_screen_set(data & 0x01);
370370}
371371
372372WRITE16_MEMBER(nmk16_state::nmk_tilebank_w)
r14896r14897
426426    if(pri != priority)
427427      return;
428428
429    if (flip_screen_get(machine))
429    if (state->flip_screen())
430430    {
431431      sx = 368 - sx;
432432      sy = 240 - sy;
r14896r14897
443443        drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
444444            code,
445445            color,
446            flip_screen_get(machine), flip_screen_get(machine),
446            state->flip_screen(), state->flip_screen(),
447447            ((x + 16) & 0x1FF) - 16,sy & 0x1FF,15);
448448        code++;
449449        x += delta;
r14896r14897
474474    if(pri != priority)
475475      return;
476476
477    flipx ^= flip_screen_get(machine);
478    flipy ^= flip_screen_get(machine);
477    flipx ^= state->flip_screen();
478    flipy ^= state->flip_screen();
479479
480    if (flip_screen_get(machine))
480    if (state->flip_screen())
481481    {
482482      sx = 368 - sx;
483483      sy = 240 - sy;
r14896r14897
979979   if (dsw_flipscreen)
980980   {
981981
982      flip_screen_x_set(machine, ~input_port_read(machine, "DSW1") & 0x0100);
983      flip_screen_y_set(machine, ~input_port_read(machine, "DSW1") & 0x0200);
982      state->flip_screen_x_set(~input_port_read(machine, "DSW1") & 0x0100);
983      state->flip_screen_y_set(~input_port_read(machine, "DSW1") & 0x0200);
984984   }
985985
986986
src/mame/drivers/bfcobra.c
r14896r14897
14031403      if (changed & (1 << i))
14041404      {
14051405         MechMtr_update(i, data & (1 << i) );
1406         generic_pulse_irq_line(&space.device(), M6809_FIRQ_LINE, 1);
1406         generic_pulse_irq_line(space.device().execute(), M6809_FIRQ_LINE, 1);
14071407      }
14081408   }
14091409}
src/mame/drivers/nycaptor.c
r14896r14897
282282
283283WRITE8_MEMBER(nycaptor_state::sound_command_w)
284284{
285   soundlatch_w(space, 0, data);
285   soundlatch_byte_w(space, 0, data);
286286   machine().scheduler().synchronize(FUNC(nmi_callback), data);
287287}
288288
r14896r14897
388388   AM_RANGE(0xca00, 0xca00) AM_WRITENOP
389389   AM_RANGE(0xcb00, 0xcb00) AM_WRITENOP
390390   AM_RANGE(0xcc00, 0xcc00) AM_WRITENOP
391   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r) AM_WRITE(to_main_w)
391   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r) AM_WRITE(to_main_w)
392392   AM_RANGE(0xd200, 0xd200) AM_READNOP AM_WRITE(nmi_enable_w)
393393   AM_RANGE(0xd400, 0xd400) AM_WRITE(nmi_disable_w)
394394   AM_RANGE(0xd600, 0xd600) AM_WRITENOP
src/mame/drivers/mitchell.c
r14896r14897
386386   AM_RANGE(0x8000, 0x87ff) AM_RAM
387387   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("oki", oki_banking_w)
388388   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
389   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
389   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
390390ADDRESS_MAP_END
391391
392392WRITE8_MEMBER(mitchell_state::mstworld_sound_w)
393393{
394   soundlatch_w(space, 0, data);
394   soundlatch_byte_w(space, 0, data);
395395   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
396396}
397397
src/mame/drivers/blktiger.c
r14896r14897
7272   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
7373   AM_RANGE(0xc000, 0xcfff) AM_READWRITE(blktiger_bgvideoram_r, blktiger_bgvideoram_w)
7474   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(blktiger_txvideoram_w) AM_BASE(m_txvideoram)
75   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split1_w) AM_SHARE("paletteram")
76   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split2_w) AM_SHARE("paletteram2")
75   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_lo_w) AM_SHARE("paletteram")
76   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_hi_w) AM_SHARE("paletteram2")
7777   AM_RANGE(0xe000, 0xfdff) AM_RAM
7878   AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("spriteram")
7979ADDRESS_MAP_END
8080
8181static ADDRESS_MAP_START( blktiger_io_map, AS_IO, 8, blktiger_state )
8282   ADDRESS_MAP_GLOBAL_MASK(0xff)
83   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")   AM_WRITE(soundlatch_w)
83   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")   AM_WRITE(soundlatch_byte_w)
8484   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")   AM_WRITE(blktiger_bankswitch_w)
8585   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2")
8686   AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW0")   AM_WRITE(blktiger_coinlockout_w)
r14896r14897
9797
9898static ADDRESS_MAP_START( blktigerbl_io_map, AS_IO, 8, blktiger_state )
9999   ADDRESS_MAP_GLOBAL_MASK(0xff)
100   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")   AM_WRITE(soundlatch_w)
100   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")   AM_WRITE(soundlatch_byte_w)
101101   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")   AM_WRITE(blktiger_bankswitch_w)
102102   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2")
103103   AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW0")   AM_WRITE(blktiger_coinlockout_w)
r14896r14897
115115static ADDRESS_MAP_START( blktiger_sound_map, AS_PROGRAM, 8, blktiger_state )
116116   AM_RANGE(0x0000, 0x7fff) AM_ROM
117117   AM_RANGE(0xc000, 0xc7ff) AM_RAM
118   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
118   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r)
119119   AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
120120   AM_RANGE(0xe002, 0xe003) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r, ym2203_w)
121121ADDRESS_MAP_END
src/mame/drivers/mgolf.c
r14896r14897
1111{
1212public:
1313   mgolf_state(const machine_config &mconfig, device_type type, const char *tag)
14      : driver_device(mconfig, type, tag) { }
14      : driver_device(mconfig, type, tag) ,
15      m_video_ram(*this, "video_ram"){ }
1516
1617   /* memory pointers */
17   UINT8*  m_video_ram;
18   required_shared_ptr<UINT8> m_video_ram;
1819
1920   /* video-related */
2021   tilemap_t* m_bg_tilemap;
r14896r14897
3839static TILE_GET_INFO( get_tile_info )
3940{
4041   mgolf_state *state = machine.driver_data<mgolf_state>();
41   UINT8 code = state->m_video_ram[tile_index];
42   UINT8 code = state->m_video_ram.target()[tile_index];
4243
4344   SET_TILE_INFO(0, code, code >> 7, 0);
4445}
r14896r14897
4647
4748WRITE8_MEMBER(mgolf_state::mgolf_vram_w)
4849{
49   m_video_ram[offset] = data;
50   m_video_ram.target()[offset] = data;
5051   m_bg_tilemap->mark_tile_dirty(offset);
5152}
5253
r14896r14897
7071   for (i = 0; i < 2; i++)
7172   {
7273      drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[1],
73         state->m_video_ram[0x399 + 4 * i],
74         state->m_video_ram.target()[0x399 + 4 * i],
7475         i,
7576         0, 0,
76         state->m_video_ram[0x390 + 2 * i] - 7,
77         state->m_video_ram[0x398 + 4 * i] - 16, 0);
77         state->m_video_ram.target()[0x390 + 2 * i] - 7,
78         state->m_video_ram.target()[0x398 + 4 * i] - 16, 0);
7879
7980      drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[1],
80         state->m_video_ram[0x39b + 4 * i],
81         state->m_video_ram.target()[0x39b + 4 * i],
8182         i,
8283         0, 0,
83         state->m_video_ram[0x390 + 2 * i] - 15,
84         state->m_video_ram[0x39a + 4 * i] - 16, 0);
84         state->m_video_ram.target()[0x390 + 2 * i] - 15,
85         state->m_video_ram.target()[0x39a + 4 * i] - 16, 0);
8586   }
8687   return 0;
8788}
r14896r14897
136137
137138READ8_MEMBER(mgolf_state::mgolf_wram_r)
138139{
139   return m_video_ram[0x380 + offset];
140   return m_video_ram.target()[0x380 + offset];
140141}
141142
142143
r14896r14897
178179
179180WRITE8_MEMBER(mgolf_state::mgolf_wram_w)
180181{
181   m_video_ram[0x380 + offset] = data;
182   m_video_ram.target()[0x380 + offset] = data;
182183}
183184
184185
r14896r14897
207208   AM_RANGE(0x006d, 0x006d) AM_WRITENOP
208209   AM_RANGE(0x0080, 0x00ff) AM_WRITE(mgolf_wram_w)
209210   AM_RANGE(0x0180, 0x01ff) AM_WRITE(mgolf_wram_w)
210   AM_RANGE(0x0800, 0x0bff) AM_WRITE(mgolf_vram_w) AM_BASE(m_video_ram)
211   AM_RANGE(0x0800, 0x0bff) AM_WRITE(mgolf_vram_w) AM_SHARE("video_ram")
211212
212213   AM_RANGE(0x2000, 0x3fff) AM_ROM
213214ADDRESS_MAP_END
src/mame/drivers/pasha2.c
r14896r14897
8080{
8181public:
8282   pasha2_state(const machine_config &mconfig, device_type type, const char *tag)
83      : driver_device(mconfig, type, tag) { }
83      : driver_device(mconfig, type, tag) ,
84      m_wram(*this, "wram"),
85      m_paletteram(*this, "paletteram"){ }
8486
8587   /* memory pointers */
86   UINT16 *     m_paletteram;
87   UINT16 *     m_wram;
88   required_shared_ptr<UINT16> m_wram;
89   required_shared_ptr<UINT16> m_paletteram;
8890
8991   /* video-related */
9092   int m_vbuffer;
r14896r14897
136138{
137139   int color;
138140
139   COMBINE_DATA(&m_paletteram[offset]);
141   COMBINE_DATA(&m_paletteram.target()[offset]);
140142
141143   offset &= 0xff;
142144
143   color = (m_paletteram[offset] >> 8) | (m_paletteram[offset + 0x100] & 0xff00);
145   color = (m_paletteram.target()[offset] >> 8) | (m_paletteram.target()[offset + 0x100] & 0xff00);
144146   palette_set_color_rgb(machine(), offset * 2 + 0, pal5bit(color), pal5bit(color >> 5), pal5bit(color >> 10));
145147
146   color = (m_paletteram[offset] & 0xff) | ((m_paletteram[offset + 0x100] & 0xff) << 8);
148   color = (m_paletteram.target()[offset] & 0xff) | ((m_paletteram.target()[offset + 0x100] & 0xff) << 8);
147149   palette_set_color_rgb(machine(), offset * 2 + 1, pal5bit(color), pal5bit(color >> 5), pal5bit(color >> 10));
148150}
149151
r14896r14897
209211}
210212
211213static ADDRESS_MAP_START( pasha2_map, AS_PROGRAM, 16, pasha2_state )
212   AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE(m_wram)
214   AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("wram")
213215   AM_RANGE(0x40000000, 0x4001ffff) AM_RAM_WRITE(bitmap_0_w)
214216   AM_RANGE(0x40020000, 0x4003ffff) AM_RAM_WRITE(bitmap_1_w)
215217   AM_RANGE(0x40060000, 0x40060001) AM_WRITENOP
r14896r14897
220222   AM_RANGE(0x40074000, 0x40074001) AM_WRITE(vbuffer_set_w)
221223   AM_RANGE(0x40078000, 0x40078001) AM_WRITENOP //once at startup -> to disable the eeprom?
222224   AM_RANGE(0x80000000, 0x803fffff) AM_ROMBANK("bank1")
223   AM_RANGE(0xe0000000, 0xe00003ff) AM_RAM_WRITE(pasha2_palette_w) AM_BASE(m_paletteram) //tilemap? palette?
225   AM_RANGE(0xe0000000, 0xe00003ff) AM_RAM_WRITE(pasha2_palette_w) AM_SHARE("paletteram") //tilemap? palette?
224226   AM_RANGE(0xfff80000, 0xffffffff) AM_ROM AM_REGION("user1",0)
225227ADDRESS_MAP_END
226228
r14896r14897
466468   if(cpu_get_pc(&space.device()) == 0x8302)
467469      device_spin_until_interrupt(&space.device());
468470
469   return m_wram[(0x95744 / 2) + offset];
471   return m_wram.target()[(0x95744 / 2) + offset];
470472}
471473
472474static DRIVER_INIT( pasha2 )
src/mame/drivers/bublbobl.c
r14896r14897
290290   AM_RANGE(0xc000, 0xdcff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
291291   AM_RANGE(0xdd00, 0xdfff) AM_RAM AM_BASE_SIZE(m_objectram, m_objectram_size)
292292   AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE("share1")
293   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
293   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
294294   AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(bublbobl_sound_status_r, bublbobl_sound_command_w)
295295   AM_RANGE(0xfa03, 0xfa03) AM_WRITE(bublbobl_soundcpu_reset_w)
296296   AM_RANGE(0xfa80, 0xfa80) AM_WRITE(watchdog_reset_w)
r14896r14897
308308   AM_RANGE(0x8000, 0x8fff) AM_RAM
309309   AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
310310   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ym2", ym3526_r, ym3526_w)
311   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_r) AM_WRITE(bublbobl_sound_status_w)
311   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_byte_r) AM_WRITE(bublbobl_sound_status_w)
312312   AM_RANGE(0xb001, 0xb001) AM_WRITE(bublbobl_sh_nmi_enable_w) AM_READNOP
313313   AM_RANGE(0xb002, 0xb002) AM_WRITE(bublbobl_sh_nmi_disable_w)
314314   AM_RANGE(0xe000, 0xffff) AM_ROM   // space for diagnostic ROM?
r14896r14897
346346   AM_RANGE(0xc000, 0xdcff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
347347   AM_RANGE(0xdd00, 0xdfff) AM_RAM AM_BASE_SIZE(m_objectram, m_objectram_size)
348348   AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE("share1")
349   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
349   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
350350   AM_RANGE(0xfa00, 0xfa00) AM_READWRITE(bublbobl_sound_status_r, bublbobl_sound_command_w)
351351   AM_RANGE(0xfa03, 0xfa03) AM_WRITE(bublbobl_soundcpu_reset_w)
352352   AM_RANGE(0xfa80, 0xfa80) AM_WRITENOP // ???
r14896r14897
370370   AM_RANGE(0xc000, 0xdcff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
371371   AM_RANGE(0xdd00, 0xdfff) AM_RAM AM_BASE_SIZE(m_objectram, m_objectram_size)
372372   AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE("share1")
373   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
373   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
374374   AM_RANGE(0xfa00, 0xfa00) AM_WRITE(watchdog_reset_w)
375375   AM_RANGE(0xfa03, 0xfa03) AM_READ_PORT("DSW0")
376376   AM_RANGE(0xfa04, 0xfa04) AM_READ_PORT("DSW1")
r14896r14897
392392static ADDRESS_MAP_START( tokio_sound_map, AS_PROGRAM, 8, bublbobl_state )
393393   AM_RANGE(0x0000, 0x7fff) AM_ROM
394394   AM_RANGE(0x8000, 0x8fff) AM_RAM
395   AM_RANGE(0x9000, 0x9000) AM_READ(soundlatch_r) AM_WRITE(bublbobl_sound_status_w)
395   AM_RANGE(0x9000, 0x9000) AM_READ(soundlatch_byte_r) AM_WRITE(bublbobl_sound_status_w)
396396   AM_RANGE(0x9800, 0x9800) AM_READNOP   // ???
397397   AM_RANGE(0xa000, 0xa000) AM_WRITE(bublbobl_sh_nmi_disable_w)
398398   AM_RANGE(0xa800, 0xa800) AM_WRITE(bublbobl_sh_nmi_enable_w)
src/mame/drivers/skyfox.c
r14896r14897
7070   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r,ym2203_w)   // YM2203 #1
7171//  AM_RANGE(0xb000, 0xb001) AM_WRITENOP                        // ??
7272   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r,ym2203_w)   // YM2203 #2
73   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_r)            // From Main CPU
73   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_byte_r)            // From Main CPU
7474ADDRESS_MAP_END
7575
7676
src/mame/drivers/coinmstr.c
r14896r14897
3333{
3434public:
3535   coinmstr_state(const machine_config &mconfig, device_type type, const char *tag)
36      : driver_device(mconfig, type, tag) { }
36      : driver_device(mconfig, type, tag) ,
37      m_videoram(*this, "videoram"),
38      m_attr_ram1(*this, "attr_ram1"),
39      m_attr_ram2(*this, "attr_ram2"),
40      m_attr_ram3(*this, "attr_ram3"){ }
3741
38   UINT8 *m_videoram;
39   UINT8 *m_attr_ram1;
40   UINT8 *m_attr_ram2;
41   UINT8 *m_attr_ram3;
42   required_shared_ptr<UINT8> m_videoram;
43   required_shared_ptr<UINT8> m_attr_ram1;
44   required_shared_ptr<UINT8> m_attr_ram2;
45   required_shared_ptr<UINT8> m_attr_ram3;
4246   tilemap_t *m_bg_tilemap;
4347   UINT8 m_question_adr[4];
4448   DECLARE_WRITE8_MEMBER(quizmstr_bg_w);
r14896r14897
5357
5458WRITE8_MEMBER(coinmstr_state::quizmstr_bg_w)
5559{
56   UINT8 *videoram = m_videoram;
60   UINT8 *videoram = m_videoram.target();
5761   videoram[offset] = data;
5862
5963   if(offset >= 0x0240)
r14896r14897
96100
97101WRITE8_MEMBER(coinmstr_state::quizmstr_attr1_w)
98102{
99   m_attr_ram1[offset] = data;
103   m_attr_ram1.target()[offset] = data;
100104
101105   if(offset >= 0x0240)
102106   {
103107      // the later games also use attr3 for something..
104      UINT32   paldata = (m_attr_ram1[offset] & 0x7f) | ((m_attr_ram2[offset] & 0x7f) << 7);
108      UINT32   paldata = (m_attr_ram1.target()[offset] & 0x7f) | ((m_attr_ram2.target()[offset] & 0x7f) << 7);
105109      m_bg_tilemap->mark_tile_dirty(offset - 0x0240);
106110
107111      coinmstr_set_pal(machine(), paldata, offset - 0x240);
r14896r14897
111115
112116WRITE8_MEMBER(coinmstr_state::quizmstr_attr2_w)
113117{
114   m_attr_ram2[offset] = data;
118   m_attr_ram2.target()[offset] = data;
115119
116120   if(offset >= 0x0240)
117121   {
118122      // the later games also use attr3 for something..
119      UINT32   paldata = (m_attr_ram1[offset] & 0x7f) | ((m_attr_ram2[offset] & 0x7f) << 7);
123      UINT32   paldata = (m_attr_ram1.target()[offset] & 0x7f) | ((m_attr_ram2.target()[offset] & 0x7f) << 7);
120124      m_bg_tilemap->mark_tile_dirty(offset - 0x0240);
121125
122126      coinmstr_set_pal(machine(), paldata, offset - 0x240);
r14896r14897
126130
127131WRITE8_MEMBER(coinmstr_state::quizmstr_attr3_w)
128132{
129   m_attr_ram3[offset] = data;
133   m_attr_ram3.target()[offset] = data;
130134
131135   if(offset >= 0x0240)
132136      m_bg_tilemap->mark_tile_dirty(offset - 0x0240);
r14896r14897
202206static ADDRESS_MAP_START( coinmstr_map, AS_PROGRAM, 8, coinmstr_state )
203207   AM_RANGE(0x0000, 0xbfff) AM_ROM
204208   AM_RANGE(0xc000, 0xdfff) AM_RAM
205   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(quizmstr_bg_w) AM_BASE(m_videoram)
206   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(quizmstr_attr1_w) AM_BASE(m_attr_ram1)
207   AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(quizmstr_attr2_w) AM_BASE(m_attr_ram2)
208   AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(quizmstr_attr3_w) AM_BASE(m_attr_ram3)
209   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(quizmstr_bg_w) AM_SHARE("videoram")
210   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(quizmstr_attr1_w) AM_SHARE("attr_ram1")
211   AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(quizmstr_attr2_w) AM_SHARE("attr_ram2")
212   AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(quizmstr_attr3_w) AM_SHARE("attr_ram3")
209213ADDRESS_MAP_END
210214
211215// Different I/O mappping for every game
r14896r14897
897901static TILE_GET_INFO( get_bg_tile_info )
898902{
899903   coinmstr_state *state = machine.driver_data<coinmstr_state>();
900   UINT8 *videoram = state->m_videoram;
904   UINT8 *videoram = state->m_videoram.target();
901905   int tile = videoram[tile_index + 0x0240];
902906   int color = tile_index;
903907
904   tile |= (state->m_attr_ram1[tile_index + 0x0240] & 0x80) << 1;
905   tile |= (state->m_attr_ram2[tile_index + 0x0240] & 0x80) << 2;
908   tile |= (state->m_attr_ram1.target()[tile_index + 0x0240] & 0x80) << 1;
909   tile |= (state->m_attr_ram2.target()[tile_index + 0x0240] & 0x80) << 2;
906910
907   tile |= (state->m_attr_ram3[tile_index + 0x0240] & 0x03) << (6+4);
911   tile |= (state->m_attr_ram3.target()[tile_index + 0x0240] & 0x03) << (6+4);
908912
909913   SET_TILE_INFO(0, tile, color, 0);
910914}
src/mame/drivers/mainsnk.c
r14896r14897
116116{
117117
118118   m_sound_cpu_busy = 1;
119   soundlatch_w(space, 0, data);
119   soundlatch_byte_w(space, 0, data);
120120   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
121121}
122122
123123READ8_MEMBER(mainsnk_state::sound_command_r)
124124{
125   return soundlatch_r(space, 0);
125   return soundlatch_byte_r(space, 0);
126126}
127127
128128READ8_MEMBER(mainsnk_state::sound_ack_r)
src/mame/drivers/rampart.c
r14896r14897
8585 *
8686 *************************************/
8787
88static WRITE16_HANDLER( latch_w )
88WRITE16_MEMBER(rampart_state::latch_w)
8989{
9090   /* bit layout in this register:
9191
r14896r14897
108108   {
109109      if (data & 0x1000)
110110         logerror("Color bank set to 1!\n");
111      coin_counter_w(space->machine(), 0, (data >> 9) & 1);
112      coin_counter_w(space->machine(), 1, (data >> 8) & 1);
111      coin_counter_w(machine(), 0, (data >> 9) & 1);
112      coin_counter_w(machine(), 1, (data >> 8) & 1);
113113   }
114114
115115   /* lower byte being modified? */
116116   if (ACCESSING_BITS_0_7)
117117   {
118      atarigen_set_oki6295_vol(space->machine(), (data & 0x0020) ? 100 : 0);
118      atarigen_set_oki6295_vol(machine(), (data & 0x0020) ? 100 : 0);
119119      if (!(data & 0x0010))
120         devtag_reset(space->machine(), "oki");
121      atarigen_set_ym2413_vol(space->machine(), ((data >> 1) & 7) * 100 / 7);
120         devtag_reset(machine(), "oki");
121      atarigen_set_ym2413_vol(machine(), ((data >> 1) & 7) * 100 / 7);
122122      if (!(data & 0x0001))
123         devtag_reset(space->machine(), "ymsnd");
123         devtag_reset(machine(), "ymsnd");
124124   }
125125}
126126
r14896r14897
148148   AM_RANGE(0x480000, 0x480003) AM_MIRROR(0x019ffc) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0xff00)
149149   AM_RANGE(0x500000, 0x500fff) AM_MIRROR(0x019000) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
150150   AM_RANGE(0x5a6000, 0x5a6001) AM_MIRROR(0x019ffe) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
151   AM_RANGE(0x640000, 0x640001) AM_MIRROR(0x019ffe) AM_WRITE_LEGACY(latch_w)
151   AM_RANGE(0x640000, 0x640001) AM_MIRROR(0x019ffe) AM_WRITE(latch_w)
152152   AM_RANGE(0x640000, 0x640001) AM_MIRROR(0x019ffc) AM_READ_PORT("IN0")
153153   AM_RANGE(0x640002, 0x640003) AM_MIRROR(0x019ffc) AM_READ_PORT("IN1")
154154   AM_RANGE(0x6c0000, 0x6c0001) AM_MIRROR(0x019ff8) AM_READ_PORT("TRACK0")
src/mame/drivers/magicard.c
r14896r14897
171171{
172172public:
173173   magicard_state(const machine_config &mconfig, device_type type, const char *tag)
174      : driver_device(mconfig, type, tag) { }
174      : driver_device(mconfig, type, tag) ,
175      m_magicram(*this, "magicram"),
176      m_pcab_vregs(*this, "pcab_vregs"),
177      m_scc68070_ext_irqc_regs(*this, "scc68070_ext_irqc_regs"),
178      m_scc68070_iic_regs(*this, "scc68070_iic_regs"),
179      m_scc68070_uart_regs(*this, "scc68070_uart_regs"),
180      m_scc68070_timer_regs(*this, "scc68070_timer_regs"),
181      m_scc68070_int_irqc_regs(*this, "scc68070_int_irqc_regs"),
182      m_scc68070_dma_ch1_regs(*this, "scc68070_dma_ch1_regs"),
183      m_scc68070_dma_ch2_regs(*this, "scc68070_dma_ch2_regs"),
184      m_scc68070_mmu_regs(*this, "scc68070_mmu_regs"){ }
175185
176   UINT16 *m_magicram;
177   UINT16 *m_pcab_vregs;
178   UINT16 *m_scc68070_ext_irqc_regs;
179   UINT16 *m_scc68070_iic_regs;
180   UINT16 *m_scc68070_uart_regs;
181   UINT16 *m_scc68070_timer_regs;
182   UINT16 *m_scc68070_int_irqc_regs;
183   UINT16 *m_scc68070_dma_ch1_regs;
184   UINT16 *m_scc68070_dma_ch2_regs;
185   UINT16 *m_scc68070_mmu_regs;
186   required_shared_ptr<UINT16> m_magicram;
187   required_shared_ptr<UINT16> m_pcab_vregs;
188   required_shared_ptr<UINT16> m_scc68070_ext_irqc_regs;
189   required_shared_ptr<UINT16> m_scc68070_iic_regs;
190   required_shared_ptr<UINT16> m_scc68070_uart_regs;
191   required_shared_ptr<UINT16> m_scc68070_timer_regs;
192   required_shared_ptr<UINT16> m_scc68070_int_irqc_regs;
193   required_shared_ptr<UINT16> m_scc68070_dma_ch1_regs;
194   required_shared_ptr<UINT16> m_scc68070_dma_ch2_regs;
195   required_shared_ptr<UINT16> m_scc68070_mmu_regs;
186196   struct { int r,g,b,offs,offs_internal; } m_pal;
187197   DECLARE_READ16_MEMBER(test_r);
188198   DECLARE_WRITE16_MEMBER(paletteram_io_w);
r14896r14897
238248*/
239249
240250/*63 at post test,6d all the time.*/
241#define SCC_CSR_VREG    (state->m_pcab_vregs[0x00/2] & 0xffff)
251#define SCC_CSR_VREG    (state->m_pcab_vregs.target()[0x00/2] & 0xffff)
242252#define SCC_CG_VREG      ((SCC_CSR_VREG & 0x10)>>4)
243253
244254/*
r14896r14897
264274    w ........ ....aaaa  VSR:H = video start address (MSB's)
265275*/
266276
267#define SCC_DCR_VREG    (state->m_pcab_vregs[0x02/2] & 0xffff)
277#define SCC_DCR_VREG    (state->m_pcab_vregs.target()[0x02/2] & 0xffff)
268278#define SCC_DE_VREG      ((SCC_DCR_VREG & 0x8000)>>15)
269279#define SCC_FG_VREG      ((SCC_DCR_VREG & 0x0080)>>7)
270280#define SCC_VSR_VREG_H  ((SCC_DCR_VREG & 0xf)>>0)
r14896r14897
274284    w aaaaaaaa aaaaaaaa  VSR:L = video start address (LSB's)
275285*/
276286
277#define SCC_VSR_VREG_L  (state->m_pcab_vregs[0x04/2] & 0xffff)
287#define SCC_VSR_VREG_L  (state->m_pcab_vregs.target()[0x04/2] & 0xffff)
278288#define SCC_VSR_VREG    ((SCC_VSR_VREG_H)<<16) | (SCC_VSR_VREG_L)
279289
280290/*
r14896r14897
293303    w ........ xxxx....  not used
294304    w ........ ....aaaa  "data" (dunno the purpose...)
295305*/
296#define SCC_DCR2_VREG  (state->m_pcab_vregs[0x08/2] & 0xffff)
306#define SCC_DCR2_VREG  (state->m_pcab_vregs.target()[0x08/2] & 0xffff)
297307
298308/*
299309(Note: not present on the original vreg listing)
r14896r14897
3143241ffff0  a = source register a
315325    w nnnnnnnn nnnnnnnn  source
316326*/
317#define SCC_SRCA_VREG  (state->m_pcab_vregs[0x10/2] & 0xffff)
327#define SCC_SRCA_VREG  (state->m_pcab_vregs.target()[0x10/2] & 0xffff)
318328
319329/*
3203301ffff2  b = destination register b
321331   rw nnnnnnnn nnnnnnnn  destination
322332*/
323333
324#define SCC_DSTB_VREG  (state->m_pcab_vregs[0x12/2] & 0xffff)
334#define SCC_DSTB_VREG  (state->m_pcab_vregs.target()[0x12/2] & 0xffff)
325335
326336/*
3273371ffff4  pcr = pixac command register
r14896r14897
368378    w ........ .......0
369379*/
370380
371#define SCC_PCR_VREG  (state->m_pcab_vregs[0x14/2] & 0xffff)
381#define SCC_PCR_VREG  (state->m_pcab_vregs.target()[0x14/2] & 0xffff)
372382
373383/*
3743841ffff6  mask = mask register
r14896r14897
420430         {
421431            UINT32 color;
422432
423            color = ((state->m_magicram[count]) & 0x000f)>>0;
433            color = ((state->m_magicram.target()[count]) & 0x000f)>>0;
424434
425435            if(cliprect.contains((x*4)+3, y))
426436               bitmap.pix32(y, (x*4)+3) = screen.machine().pens[color];
427437
428            color = ((state->m_magicram[count]) & 0x00f0)>>4;
438            color = ((state->m_magicram.target()[count]) & 0x00f0)>>4;
429439
430440            if(cliprect.contains((x*4)+2, y))
431441               bitmap.pix32(y, (x*4)+2) = screen.machine().pens[color];
432442
433            color = ((state->m_magicram[count]) & 0x0f00)>>8;
443            color = ((state->m_magicram.target()[count]) & 0x0f00)>>8;
434444
435445            if(cliprect.contains((x*4)+1, y))
436446               bitmap.pix32(y, (x*4)+1) = screen.machine().pens[color];
437447
438            color = ((state->m_magicram[count]) & 0xf000)>>12;
448            color = ((state->m_magicram.target()[count]) & 0xf000)>>12;
439449
440450            if(cliprect.contains((x*4)+0, y))
441451               bitmap.pix32(y, (x*4)+0) = screen.machine().pens[color];
r14896r14897
452462         {
453463            UINT32 color;
454464
455            color = ((state->m_magicram[count]) & 0x00ff)>>0;
465            color = ((state->m_magicram.target()[count]) & 0x00ff)>>0;
456466
457467            if(cliprect.contains((x*2)+1, y))
458468               bitmap.pix32(y, (x*2)+1) = screen.machine().pens[color];
459469
460            color = ((state->m_magicram[count]) & 0xff00)>>8;
470            color = ((state->m_magicram.target()[count]) & 0xff00)>>8;
461471
462472            if(cliprect.contains((x*2)+0, y))
463473               bitmap.pix32(y, (x*2)+0) = screen.machine().pens[color];
r14896r14897
524534   //printf("[%04x]\n",offset*2);
525535
526536
527   return m_pcab_vregs[offset];
537   return m_pcab_vregs.target()[offset];
528538}
529539
530540WRITE16_MEMBER(magicard_state::philips_66470_w)
531541{
532   COMBINE_DATA(&m_pcab_vregs[offset]);
542   COMBINE_DATA(&m_pcab_vregs.target()[offset]);
533543
534544//  if(offset == 0x10/2)
535545//  {
536      //printf("%04x %04x %04x\n",data,m_pcab_vregs[0x12/2],m_pcab_vregs[0x14/2]);
537      //m_pcab_vregs[0x12/2] = m_pcab_vregs[0x10/2];
546      //printf("%04x %04x %04x\n",data,m_pcab_vregs.target()[0x12/2],m_pcab_vregs.target()[0x14/2]);
547      //m_pcab_vregs.target()[0x12/2] = m_pcab_vregs.target()[0x10/2];
538548//  }
539549}
540550
r14896r14897
542552
543553READ16_MEMBER(magicard_state::scc68070_ext_irqc_r)
544554{
545   return m_scc68070_ext_irqc_regs[offset];
555   return m_scc68070_ext_irqc_regs.target()[offset];
546556}
547557
548558WRITE16_MEMBER(magicard_state::scc68070_ext_irqc_w)
549559{
550   m_scc68070_ext_irqc_regs[offset] = data;
560   m_scc68070_ext_irqc_regs.target()[offset] = data;
551561}
552562
553563READ16_MEMBER(magicard_state::scc68070_iic_r)
r14896r14897
556566
557567   switch(offset)
558568   {
559      case 0x04/2: return m_scc68070_iic_regs[offset] & 0xef; //iic status register, bit 4 = pending irq
569      case 0x04/2: return m_scc68070_iic_regs.target()[offset] & 0xef; //iic status register, bit 4 = pending irq
560570   }
561571
562   return m_scc68070_iic_regs[offset];
572   return m_scc68070_iic_regs.target()[offset];
563573}
564574
565575WRITE16_MEMBER(magicard_state::scc68070_iic_w)
566576{
567   m_scc68070_iic_regs[offset] = data;
577   m_scc68070_iic_regs.target()[offset] = data;
568578}
569579
570580READ16_MEMBER(magicard_state::scc68070_uart_r)
r14896r14897
576586      case 0x02/2: return machine().rand(); //uart mode register
577587   }
578588
579   return m_scc68070_uart_regs[offset];
589   return m_scc68070_uart_regs.target()[offset];
580590}
581591
582592WRITE16_MEMBER(magicard_state::scc68070_uart_w)
583593{
584   m_scc68070_uart_regs[offset] = data;
594   m_scc68070_uart_regs.target()[offset] = data;
585595}
586596
587597READ16_MEMBER(magicard_state::scc68070_timer_r)
588598{
589   return m_scc68070_timer_regs[offset];
599   return m_scc68070_timer_regs.target()[offset];
590600}
591601
592602WRITE16_MEMBER(magicard_state::scc68070_timer_w)
593603{
594   m_scc68070_timer_regs[offset] = data;
604   m_scc68070_timer_regs.target()[offset] = data;
595605}
596606
597607READ16_MEMBER(magicard_state::scc68070_int_irqc_r)
598608{
599   return m_scc68070_int_irqc_regs[offset];
609   return m_scc68070_int_irqc_regs.target()[offset];
600610}
601611
602612WRITE16_MEMBER(magicard_state::scc68070_int_irqc_w)
603613{
604   m_scc68070_int_irqc_regs[offset] = data;
614   m_scc68070_int_irqc_regs.target()[offset] = data;
605615}
606616
607617READ16_MEMBER(magicard_state::scc68070_dma_ch1_r)
608618{
609   return m_scc68070_dma_ch1_regs[offset];
619   return m_scc68070_dma_ch1_regs.target()[offset];
610620}
611621
612622WRITE16_MEMBER(magicard_state::scc68070_dma_ch1_w)
613623{
614   m_scc68070_dma_ch1_regs[offset] = data;
624   m_scc68070_dma_ch1_regs.target()[offset] = data;
615625}
616626
617627READ16_MEMBER(magicard_state::scc68070_dma_ch2_r)
618628{
619   return m_scc68070_dma_ch2_regs[offset];
629   return m_scc68070_dma_ch2_regs.target()[offset];
620630}
621631
622632WRITE16_MEMBER(magicard_state::scc68070_dma_ch2_w)
623633{
624   m_scc68070_dma_ch2_regs[offset] = data;
634   m_scc68070_dma_ch2_regs.target()[offset] = data;
625635}
626636
627637READ16_MEMBER(magicard_state::scc68070_mmu_r)
628638{
629   return m_scc68070_mmu_regs[offset];
639   return m_scc68070_mmu_regs.target()[offset];
630640}
631641
632642WRITE16_MEMBER(magicard_state::scc68070_mmu_w)
633643{
634   m_scc68070_mmu_regs[offset] = data;
644   m_scc68070_mmu_regs.target()[offset] = data;
635645
636646   switch(offset)
637647   {
r14896r14897
649659
650660static ADDRESS_MAP_START( magicard_mem, AS_PROGRAM, 16, magicard_state )
651661//  ADDRESS_MAP_GLOBAL_MASK(0x1fffff)
652   AM_RANGE(0x00000000, 0x0017ffff) AM_MIRROR(0x7fe00000) AM_RAM AM_BASE(m_magicram) /*only 0-7ffff accessed in Magic Card*/
662   AM_RANGE(0x00000000, 0x0017ffff) AM_MIRROR(0x7fe00000) AM_RAM AM_SHARE("magicram") /*only 0-7ffff accessed in Magic Card*/
653663   AM_RANGE(0x00180000, 0x001ffbff) AM_MIRROR(0x7fe00000) AM_RAM AM_REGION("maincpu", 0)
654664   /* 001ffc00-001ffdff System I/O */
655665   AM_RANGE(0x001ffc00, 0x001ffc01) AM_MIRROR(0x7fe00000) AM_READ(test_r)
r14896r14897
660670   AM_RANGE(0x001ffd80, 0x001ffd81) AM_MIRROR(0x7fe00000) AM_READ(test_r)
661671   AM_RANGE(0x001ffd80, 0x001ffd81) AM_MIRROR(0x7fe00000) AM_WRITENOP //?
662672   AM_RANGE(0x001fff80, 0x001fffbf) AM_MIRROR(0x7fe00000) AM_RAM //DRAM I/O, not accessed by this game, CD buffer?
663   AM_RANGE(0x001fffe0, 0x001fffff) AM_MIRROR(0x7fe00000) AM_READWRITE(philips_66470_r,philips_66470_w) AM_BASE(m_pcab_vregs) //video registers
664   AM_RANGE(0x80001000, 0x8000100f) AM_READWRITE(scc68070_ext_irqc_r,scc68070_ext_irqc_w) AM_BASE(m_scc68070_ext_irqc_regs) //lir
665   AM_RANGE(0x80002000, 0x8000200f) AM_READWRITE(scc68070_iic_r,scc68070_iic_w) AM_BASE(m_scc68070_iic_regs) //i2c
666   AM_RANGE(0x80002010, 0x8000201f) AM_READWRITE(scc68070_uart_r,scc68070_uart_w) AM_BASE(m_scc68070_uart_regs)
667   AM_RANGE(0x80002020, 0x8000202f) AM_READWRITE(scc68070_timer_r,scc68070_timer_w) AM_BASE(m_scc68070_timer_regs)
668   AM_RANGE(0x80002040, 0x8000204f) AM_READWRITE(scc68070_int_irqc_r,scc68070_int_irqc_w) AM_BASE(m_scc68070_int_irqc_regs)
669   AM_RANGE(0x80004000, 0x8000403f) AM_READWRITE(scc68070_dma_ch1_r,scc68070_dma_ch1_w) AM_BASE(m_scc68070_dma_ch1_regs)
670   AM_RANGE(0x80004040, 0x8000407f) AM_READWRITE(scc68070_dma_ch2_r,scc68070_dma_ch2_w) AM_BASE(m_scc68070_dma_ch2_regs)
671   AM_RANGE(0x80008000, 0x8000807f) AM_READWRITE(scc68070_mmu_r,scc68070_mmu_w) AM_BASE(m_scc68070_mmu_regs)
673   AM_RANGE(0x001fffe0, 0x001fffff) AM_MIRROR(0x7fe00000) AM_READWRITE(philips_66470_r,philips_66470_w) AM_SHARE("pcab_vregs") //video registers
674   AM_RANGE(0x80001000, 0x8000100f) AM_READWRITE(scc68070_ext_irqc_r,scc68070_ext_irqc_w) AM_SHARE("scc68070_ext_irqc_regs") //lir
675   AM_RANGE(0x80002000, 0x8000200f) AM_READWRITE(scc68070_iic_r,scc68070_iic_w) AM_SHARE("scc68070_iic_regs") //i2c
676   AM_RANGE(0x80002010, 0x8000201f) AM_READWRITE(scc68070_uart_r,scc68070_uart_w) AM_SHARE("scc68070_uart_regs")
677   AM_RANGE(0x80002020, 0x8000202f) AM_READWRITE(scc68070_timer_r,scc68070_timer_w) AM_SHARE("scc68070_timer_regs")
678   AM_RANGE(0x80002040, 0x8000204f) AM_READWRITE(scc68070_int_irqc_r,scc68070_int_irqc_w) AM_SHARE("scc68070_int_irqc_regs")
679   AM_RANGE(0x80004000, 0x8000403f) AM_READWRITE(scc68070_dma_ch1_r,scc68070_dma_ch1_w) AM_SHARE("scc68070_dma_ch1_regs")
680   AM_RANGE(0x80004040, 0x8000407f) AM_READWRITE(scc68070_dma_ch2_r,scc68070_dma_ch2_w) AM_SHARE("scc68070_dma_ch2_regs")
681   AM_RANGE(0x80008000, 0x8000807f) AM_READWRITE(scc68070_mmu_r,scc68070_mmu_w) AM_SHARE("scc68070_mmu_regs")
672682ADDRESS_MAP_END
673683
674684
r14896r14897
684694{
685695   magicard_state *state = machine.driver_data<magicard_state>();
686696   UINT16 *src    = (UINT16*)machine.region("maincpu" )->base();
687   UINT16 *dst    = state->m_magicram;
697   UINT16 *dst    = state->m_magicram.target();
688698   memcpy (dst, src, 0x80000);
689699   machine.device("maincpu")->reset();
690700}
src/mame/drivers/bfm_sc1.c
r14896r14897
303303         if ( changed & (1 << i) )
304304         {
305305            MechMtr_update(i, data & (1 << i) );
306            generic_pulse_irq_line(machine().device("maincpu"), M6809_FIRQ_LINE, 1);
306            generic_pulse_irq_line(machine().device("maincpu")->execute(), M6809_FIRQ_LINE, 1);
307307         }
308308      }
309309   }
r14896r14897
695695
696696   AM_RANGE(0x2E00, 0x2E00) AM_READ(irqlatch_r)         // irq latch
697697
698   AM_RANGE(0x3001, 0x3001) AM_READ(soundlatch_r)
698   AM_RANGE(0x3001, 0x3001) AM_READ(soundlatch_byte_r)
699699   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
700700   AM_RANGE(0x3101, 0x3201) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
701701
src/mame/drivers/murogem.c
r14896r14897
114114{
115115public:
116116   murogem_state(const machine_config &mconfig, device_type type, const char *tag)
117      : driver_device(mconfig, type, tag) { }
117      : driver_device(mconfig, type, tag) ,
118      m_videoram(*this, "videoram"){ }
118119
119   UINT8 *m_videoram;
120   required_shared_ptr<UINT8> m_videoram;
120121   DECLARE_WRITE8_MEMBER(outport_w);
121122};
122123
r14896r14897
141142   AM_RANGE(0x5000, 0x5000) AM_READ_PORT("IN0")
142143   AM_RANGE(0x5800, 0x5800) AM_READ_PORT("IN1")
143144   AM_RANGE(0x7000, 0x7000) AM_WRITE(outport_w)   /* output port */
144   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(m_videoram)
145   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("videoram")
145146   AM_RANGE(0xf000, 0xffff) AM_ROM
146147ADDRESS_MAP_END
147148
r14896r14897
212213   {
213214      for(xx=0;xx<32;xx++)
214215      {
215         int tileno = state->m_videoram[count]&0x3f;
216         int attr = state->m_videoram[count+0x400]&0x0f;
216         int tileno = state->m_videoram.target()[count]&0x3f;
217         int attr = state->m_videoram.target()[count+0x400]&0x0f;
217218
218219         drawgfx_transpen(bitmap,cliprect,screen.machine().gfx[0],tileno,attr,0,0,xx*8,yy*8,0);
219220
src/mame/drivers/snowbros.c
r14896r14897
7878WRITE16_MEMBER(snowbros_state::snowbros_flipscreen_w)
7979{
8080   if (ACCESSING_BITS_8_15)
81      flip_screen_set(machine(), ~data & 0x8000);
81      flip_screen_set(~data & 0x8000);
8282}
8383
8484
r14896r14897
175175
176176READ16_MEMBER(snowbros_state::snowbros_68000_sound_r)
177177{
178   return soundlatch_r(space,offset);
178   return soundlatch_byte_r(space,offset);
179179}
180180
181181
r14896r14897
183183{
184184   if (ACCESSING_BITS_0_7)
185185   {
186      soundlatch_w(space, offset, data & 0xff);
186      soundlatch_byte_w(space, offset, data & 0xff);
187187      cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
188188   }
189189}
190190
191191WRITE16_MEMBER(snowbros_state::semicom_soundcmd_w)
192192{
193   if (ACCESSING_BITS_0_7) soundlatch_w(space,0,data & 0xff);
193   if (ACCESSING_BITS_0_7) soundlatch_byte_w(space,0,data & 0xff);
194194}
195195
196196/* Snow Bros Memory Map */
r14896r14897
204204   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW1")
205205   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
206206   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
207   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
207   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
208208   AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
209209   AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)   /* IRQ 4 acknowledge */
210210   AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)   /* IRQ 3 acknowledge */
r14896r14897
219219static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, snowbros_state )
220220   ADDRESS_MAP_GLOBAL_MASK(0xff)
221221   AM_RANGE(0x02, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)
222   AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_r, soundlatch_w)   /* goes back to the main CPU, checked during boot */
222   AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_byte_r, soundlatch_byte_w)   /* goes back to the main CPU, checked during boot */
223223ADDRESS_MAP_END
224224
225225
r14896r14897
286286   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW1")
287287   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
288288   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
289   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
289   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
290290   AM_RANGE(0x700000, 0x701fff) AM_RAM AM_BASE_SIZE(m_bootleg_spriteram16, m_spriteram_size)
291291   AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)   /* IRQ 4 acknowledge */
292292   AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)   /* IRQ 3 acknowledge */
r14896r14897
307307   AM_RANGE(0x900000, 0x900001) AM_READ_PORT("DSW1")
308308   AM_RANGE(0x900002, 0x900003) AM_READ_PORT("DSW2")
309309   AM_RANGE(0x900004, 0x900005) AM_READ_PORT("SYSTEM")
310   AM_RANGE(0xa00000, 0xa007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
310   AM_RANGE(0xa00000, 0xa007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
311311   AM_RANGE(0xb00000, 0xb01fff) AM_RAM AM_BASE_SIZE(m_bootleg_spriteram16, m_spriteram_size)
312312ADDRESS_MAP_END
313313
r14896r14897
320320static ADDRESS_MAP_START( honeydol_sound_io_map, AS_IO, 8, snowbros_state )
321321   ADDRESS_MAP_GLOBAL_MASK(0xff)
322322   AM_RANGE(0x02, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)                        // not connected?
323   AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_r, soundlatch_w)   /* goes back to the main CPU, checked during boot */
323   AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_byte_r, soundlatch_byte_w)   /* goes back to the main CPU, checked during boot */
324324ADDRESS_MAP_END
325325
326326/* Twin Adventure */
r14896r14897
329329{
330330   if (ACCESSING_BITS_0_7)
331331   {
332      soundlatch_w(space, offset, data & 0xff);
332      soundlatch_byte_w(space, offset, data & 0xff);
333333      cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
334334   }
335335}
r14896r14897
344344   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW1")
345345   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
346346   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
347   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
347   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
348348   AM_RANGE(0x700000, 0x701fff) AM_RAM AM_BASE_SIZE(m_bootleg_spriteram16, m_spriteram_size)
349349   AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)   /* IRQ 4 acknowledge */
350350   AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)   /* IRQ 3 acknowledge */
r14896r14897
362362
363363static ADDRESS_MAP_START( twinadv_sound_io_map, AS_IO, 8, snowbros_state )
364364   ADDRESS_MAP_GLOBAL_MASK(0xff)
365   AM_RANGE(0x02, 0x02) AM_READWRITE(soundlatch_r, soundlatch_w) // back to 68k?
365   AM_RANGE(0x02, 0x02) AM_READWRITE(soundlatch_byte_r, soundlatch_byte_w) // back to 68k?
366366   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("oki", twinadv_oki_bank_w) // oki bank?
367367   AM_RANGE(0x06, 0x06) AM_DEVREADWRITE("oki", okim6295_device, read, write)
368368ADDRESS_MAP_END
r14896r14897
384384   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
385385   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
386386
387   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
387   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
388388   AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r,pandora_spriteram_LSB_w)
389389   AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)   /* IRQ 4 acknowledge */
390390   AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)   /* IRQ 3 acknowledge */
r14896r14897
396396   AM_RANGE(0xd000, 0xd7ff) AM_RAM
397397   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)
398398   AM_RANGE(0xf002, 0xf002) AM_DEVREADWRITE("oki", okim6295_device, read, write)
399   AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_r)
399   AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_byte_r)
400400ADDRESS_MAP_END
401401
402402/* Same volume used for all samples at the Moment, could be right, we have no
r14896r14897
519519   AM_RANGE( 0x500000, 0x500001) AM_READ_PORT("DSW1")
520520   AM_RANGE( 0x500002, 0x500003) AM_READ_PORT("DSW2")
521521   AM_RANGE( 0x500004, 0x500005) AM_READ_PORT("SYSTEM")
522   AM_RANGE( 0x600000, 0x6003ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
522   AM_RANGE( 0x600000, 0x6003ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
523523   AM_RANGE( 0x700000, 0x7021ff) AM_RAM AM_BASE_SIZE(m_bootleg_spriteram16, m_spriteram_size)
524524   AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)   /* IRQ 4 acknowledge */
525525   AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)   /* IRQ 3 acknowledge */
r14896r14897
538538   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
539539   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
540540
541   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
541   AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
542542   AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
543543   AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)   /* IRQ 4 acknowledge */
544544   AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)   /* IRQ 3 acknowledge */
src/mame/drivers/segaxbd.c
r14896r14897
379379   segas1x_state *state = machine.driver_data<segas1x_state>();
380380   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
381381
382   state->soundlatch_w(*space, 0, param);
382   state->soundlatch_byte_w(*space, 0, param);
383383   device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, ASSERT_LINE);
384384}
385385
r14896r14897
403403   segas1x_state *state = space->machine().driver_data<segas1x_state>();
404404
405405   device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, CLEAR_LINE);
406   return state->soundlatch_r(*space, offset);
406   return state->soundlatch_byte_r(*space, offset);
407407}
408408
409409
src/mame/drivers/nbmj9195.c
r14896r14897
4747
4848READ8_MEMBER(nbmj9195_state::nbmj9195_sound_r)
4949{
50   return soundlatch_r(space, 0);
50   return soundlatch_byte_r(space, 0);
5151}
5252
5353WRITE8_MEMBER(nbmj9195_state::nbmj9195_sound_w)
5454{
55   soundlatch_w(space, 0, data);
55   soundlatch_byte_w(space, 0, data);
5656}
5757
5858WRITE8_MEMBER(nbmj9195_state::nbmj9195_soundclr_w)
5959{
60   soundlatch_clear_w(space, 0, 0);
60   soundlatch_clear_byte_w(space, 0, 0);
6161}
6262
6363static void nbmj9195_outcoin_flag_w(address_space *space, int data)
src/mame/drivers/sslam.c
r14896r14897
373373
374374WRITE16_MEMBER(sslam_state::powerbls_sound_w)
375375{
376   soundlatch_w(space, 0, data & 0xff);
376   soundlatch_byte_w(space, 0, data & 0xff);
377377   cputag_set_input_line(machine(), "audiocpu", MCS51_INT1_LINE, HOLD_LINE);
378378}
379379
r14896r14897
432432   UINT8 data = 0;
433433
434434   if ((m_oki_control & 0x38) == 0x30) {
435      data = soundlatch_r(space,0);
435      data = soundlatch_byte_r(space,0);
436436   }
437437   else if ((m_oki_control & 0x38) == 0x28) {
438438      data = (machine().device<okim6295_device>("oki")->read(space,0) & 0x0f);
src/mame/drivers/sonson.c
r14896r14897
8989   AM_RANGE(0x3005, 0x3005) AM_READ_PORT("DSW1")
9090   AM_RANGE(0x3006, 0x3006) AM_READ_PORT("DSW2")
9191   AM_RANGE(0x3008, 0x3008) AM_WRITENOP   // might be Y scroll, but the game always sets it to 0
92   AM_RANGE(0x3010, 0x3010) AM_WRITE(soundlatch_w)
92   AM_RANGE(0x3010, 0x3010) AM_WRITE(soundlatch_byte_w)
9393   AM_RANGE(0x3018, 0x3018) AM_WRITE(sonson_flipscreen_w)
9494   AM_RANGE(0x3019, 0x3019) AM_WRITE(sonson_sh_irqtrigger_w)
9595   AM_RANGE(0x301e, 0x301e) AM_WRITE(sonson_coin2_counter_w)
r14896r14897
101101   AM_RANGE(0x0000, 0x07ff) AM_RAM
102102   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
103103   AM_RANGE(0x4000, 0x4001) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
104   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
104   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
105105   AM_RANGE(0xe000, 0xffff) AM_ROM
106106ADDRESS_MAP_END
107107
src/mame/drivers/hcastle.c
r14896r14897
4141   AM_RANGE(0x0200, 0x0207) AM_WRITE(hcastle_pf2_control_w)
4242   AM_RANGE(0x0220, 0x023f) AM_RAM /* rowscroll? */
4343   AM_RANGE(0x0400, 0x0400) AM_WRITE(hcastle_bankswitch_w)
44   AM_RANGE(0x0404, 0x0404) AM_WRITE(soundlatch_w)
44   AM_RANGE(0x0404, 0x0404) AM_WRITE(soundlatch_byte_w)
4545   AM_RANGE(0x0408, 0x0408) AM_WRITE(hcastle_soundirq_w)
4646   AM_RANGE(0x040c, 0x040c) AM_WRITE(watchdog_reset_w)
4747   AM_RANGE(0x0410, 0x0410) AM_READ_PORT("SYSTEM") AM_WRITE(hcastle_coin_w)
r14896r14897
8181   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)
8282   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("konami1", k007232_r, k007232_w)
8383   AM_RANGE(0xc000, 0xc000) AM_DEVWRITE_LEGACY("konami1", sound_bank_w) /* 7232 bankswitch */
84   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
84   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r)
8585ADDRESS_MAP_END
8686
8787/*****************************************************************************/
src/mame/drivers/copsnrob.c
r14896r14897
103103static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, copsnrob_state )
104104   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
105105   AM_RANGE(0x0000, 0x01ff) AM_RAM
106   AM_RANGE(0x0500, 0x0507) AM_WRITE_LEGACY(copsnrob_misc_w)
106   AM_RANGE(0x0500, 0x0507) AM_WRITE(copsnrob_misc_w)
107107   AM_RANGE(0x0600, 0x0600) AM_WRITEONLY AM_BASE(m_trucky)
108108   AM_RANGE(0x0700, 0x07ff) AM_WRITEONLY AM_BASE(m_truckram)
109109   AM_RANGE(0x0800, 0x08ff) AM_RAM AM_BASE(m_bulletsram)
src/mame/drivers/cntsteer.c
r14896r14897
3333{
3434public:
3535   cntsteer_state(const machine_config &mconfig, device_type type, const char *tag)
36      : driver_device(mconfig, type, tag) { }
36      : driver_device(mconfig, type, tag) ,
37      m_spriteram(*this, "spriteram"),
38      m_videoram(*this, "videoram"),
39      m_colorram(*this, "colorram"),
40      m_videoram2(*this, "videoram2"){ }
3741
3842   /* memory pointers */
39   UINT8 *  m_videoram;
40   UINT8 *  m_videoram2;
41   UINT8 *  m_colorram;
42   UINT8 *  m_spriteram;
43   required_shared_ptr<UINT8> m_spriteram;
44   required_shared_ptr<UINT8> m_videoram;
45   required_shared_ptr<UINT8> m_colorram;
46   required_shared_ptr<UINT8> m_videoram2;
4347
4448   /* video-related */
4549   tilemap_t  *m_bg_tilemap;
r14896r14897
108112static TILE_GET_INFO( get_bg_tile_info )
109113{
110114   cntsteer_state *state = machine.driver_data<cntsteer_state>();
111   int code = state->m_videoram2[tile_index];
115   int code = state->m_videoram2.target()[tile_index];
112116
113117   SET_TILE_INFO(2, code + state->m_bg_bank, state->m_bg_color_bank, 0);
114118}
r14896r14897
116120static TILE_GET_INFO( get_fg_tile_info )
117121{
118122   cntsteer_state *state = machine.driver_data<cntsteer_state>();
119   int code = state->m_videoram[tile_index];
120   int attr = state->m_colorram[tile_index];
123   int code = state->m_videoram.target()[tile_index];
124   int attr = state->m_colorram.target()[tile_index];
121125
122126   code |= (attr & 0x01) << 8;
123127
r14896r14897
168172   {
169173      int multi, fx, fy, sx, sy, code, color;
170174
171      if ((state->m_spriteram[offs + 1] & 1) == 1)
175      if ((state->m_spriteram.target()[offs + 1] & 1) == 1)
172176         continue;
173177
174      code = state->m_spriteram[offs + 3] + ((state->m_spriteram[offs + 1] & 0xc0) << 2);
175      sx = (state->m_spriteram[offs + 2]);
176      sy = 0xf0 - state->m_spriteram[offs];
177      color = 0x10 + ((state->m_spriteram[offs + 1] & 0x20) >> 4) + ((state->m_spriteram[offs + 1] & 0x8)>>3);
178      code = state->m_spriteram.target()[offs + 3] + ((state->m_spriteram.target()[offs + 1] & 0xc0) << 2);
179      sx = (state->m_spriteram.target()[offs + 2]);
180      sy = 0xf0 - state->m_spriteram.target()[offs];
181      color = 0x10 + ((state->m_spriteram.target()[offs + 1] & 0x20) >> 4) + ((state->m_spriteram.target()[offs + 1] & 0x8)>>3);
178182
179      fx = !(state->m_spriteram[offs + 1] & 0x04);
180      fy = (state->m_spriteram[offs + 1] & 0x02);
183      fx = !(state->m_spriteram.target()[offs + 1] & 0x04);
184      fy = (state->m_spriteram.target()[offs + 1] & 0x02);
181185
182      multi = state->m_spriteram[offs + 1] & 0x10;
186      multi = state->m_spriteram.target()[offs + 1] & 0x10;
183187
184188      if (state->m_flipscreen)
185189      {
r14896r14897
226230   {
227231      int multi, fx, fy, sx, sy, code, color;
228232
229      if ((state->m_spriteram[offs + 0] & 1) == 0)
233      if ((state->m_spriteram.target()[offs + 0] & 1) == 0)
230234         continue;
231235
232      code = state->m_spriteram[offs + 1] + ((state->m_spriteram[offs + 0x80] & 0x03) << 8);
233      sx = 0x100 - state->m_spriteram[offs + 3];
234      sy = 0x100 - state->m_spriteram[offs + 2];
235      color = 0x10 + ((state->m_spriteram[offs + 0x80] & 0x70) >> 4);
236      code = state->m_spriteram.target()[offs + 1] + ((state->m_spriteram.target()[offs + 0x80] & 0x03) << 8);
237      sx = 0x100 - state->m_spriteram.target()[offs + 3];
238      sy = 0x100 - state->m_spriteram.target()[offs + 2];
239      color = 0x10 + ((state->m_spriteram.target()[offs + 0x80] & 0x70) >> 4);
236240
237      fx = (state->m_spriteram[offs + 0] & 0x04);
238      fy = (state->m_spriteram[offs + 0] & 0x02);
241      fx = (state->m_spriteram.target()[offs + 0] & 0x04);
242      fy = (state->m_spriteram.target()[offs + 0] & 0x02);
239243
240      multi = state->m_spriteram[offs + 0] & 0x10;
244      multi = state->m_spriteram.target()[offs + 0] & 0x10;
241245
242246      if (state->m_flipscreen)
243247      {
r14896r14897
395399            m_bg_tilemap->mark_all_dirty();
396400            break;
397401      case 3:   m_rotation_sign = (data & 1);
398            flip_screen_set(machine(), !(data & 4));
402            flip_screen_set(!(data & 4));
399403            m_scrolly_hi = (data & 0x30) << 4;
400404            m_scrollx_hi = (data & 0xc0) << 2;
401405            break;
r14896r14897
429433
430434WRITE8_MEMBER(cntsteer_state::cntsteer_foreground_vram_w)
431435{
432   m_videoram[offset] = data;
436   m_videoram.target()[offset] = data;
433437   m_fg_tilemap->mark_tile_dirty(offset);
434438}
435439
436440WRITE8_MEMBER(cntsteer_state::cntsteer_foreground_attr_w)
437441{
438   m_colorram[offset] = data;
442   m_colorram.target()[offset] = data;
439443   m_fg_tilemap->mark_tile_dirty(offset);
440444}
441445
442446WRITE8_MEMBER(cntsteer_state::cntsteer_background_w)
443447{
444   m_videoram2[offset] = data;
448   m_videoram2.target()[offset] = data;
445449   m_bg_tilemap->mark_tile_dirty(offset);
446450}
447451
r14896r14897
458462
459463WRITE8_MEMBER(cntsteer_state::cntsteer_sound_w)
460464{
461   soundlatch_w(space, 0, data);
465   soundlatch_byte_w(space, 0, data);
462466   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
463467}
464468
r14896r14897
529533
530534static ADDRESS_MAP_START( gekitsui_cpu1_map, AS_PROGRAM, 8, cntsteer_state )
531535   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
532   AM_RANGE(0x1000, 0x11ff) AM_RAM AM_BASE(m_spriteram)
536   AM_RANGE(0x1000, 0x11ff) AM_RAM AM_SHARE("spriteram")
533537   AM_RANGE(0x1200, 0x1fff) AM_RAM
534   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(cntsteer_foreground_vram_w) AM_BASE(m_videoram)
535   AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(cntsteer_foreground_attr_w) AM_BASE(m_colorram)
538   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(cntsteer_foreground_vram_w) AM_SHARE("videoram")
539   AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(cntsteer_foreground_attr_w) AM_SHARE("colorram")
536540   AM_RANGE(0x3000, 0x3003) AM_WRITE(zerotrgt_ctrl_w)
537541   AM_RANGE(0x8000, 0xffff) AM_ROM
538542ADDRESS_MAP_END
539543
540544static ADDRESS_MAP_START( gekitsui_cpu2_map, AS_PROGRAM, 8, cntsteer_state )
541545   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
542   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(cntsteer_background_w) AM_BASE(m_videoram2)
546   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(cntsteer_background_w) AM_SHARE("videoram2")
543547   AM_RANGE(0x3000, 0x3000) AM_READ_PORT("DSW0")
544548   AM_RANGE(0x3001, 0x3001) AM_READ_PORT("P2")
545549   AM_RANGE(0x3002, 0x3002) AM_READ_PORT("P1")
r14896r14897
552556
553557static ADDRESS_MAP_START( cntsteer_cpu1_map, AS_PROGRAM, 8, cntsteer_state )
554558   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
555   AM_RANGE(0x1000, 0x11ff) AM_RAM AM_BASE(m_spriteram)
556   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(cntsteer_foreground_vram_w) AM_BASE(m_videoram)
557   AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(cntsteer_foreground_attr_w) AM_BASE(m_colorram)
559   AM_RANGE(0x1000, 0x11ff) AM_RAM AM_SHARE("spriteram")
560   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(cntsteer_foreground_vram_w) AM_SHARE("videoram")
561   AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(cntsteer_foreground_attr_w) AM_SHARE("colorram")
558562   AM_RANGE(0x3000, 0x3000) AM_WRITE(cntsteer_sub_nmi_w)
559563   AM_RANGE(0x3001, 0x3001) AM_WRITE(cntsteer_sub_irq_w)
560564   AM_RANGE(0x8000, 0xffff) AM_ROM
r14896r14897
562566
563567static ADDRESS_MAP_START( cntsteer_cpu2_map, AS_PROGRAM, 8, cntsteer_state )
564568   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
565   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(cntsteer_background_w) AM_BASE(m_videoram2) AM_SHARE("share3")
569   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(cntsteer_background_w) AM_SHARE("videoram2") AM_SHARE("share3")
566570   AM_RANGE(0x2000, 0x2fff) AM_RAM_WRITE(cntsteer_background_w) AM_SHARE("share3")
567571   AM_RANGE(0x3000, 0x3000) AM_READ_PORT("DSW0")
568572   AM_RANGE(0x3001, 0x3001) AM_READ(cntsteer_adx_r)
r14896r14897
597601   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE_LEGACY("ay1", ay8910_address_w)
598602   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_LEGACY("ay2", ay8910_data_w)
599603   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE_LEGACY("ay2", ay8910_address_w)
600   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
604   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
601605   AM_RANGE(0xd000, 0xd000) AM_WRITE(nmimask_w)
602606   AM_RANGE(0xe000, 0xffff) AM_ROM
603607ADDRESS_MAP_END
src/mame/drivers/csplayh5.c
r14896r14897
109109
110110WRITE16_MEMBER(csplayh5_state::csplayh5_sound_w)
111111{
112   soundlatch_w(space, 0, ((data >> 8) & 0xff));
112   soundlatch_byte_w(space, 0, ((data >> 8) & 0xff));
113113}
114114
115115
r14896r14897
174174
175175READ8_MEMBER(csplayh5_state::csplayh5_sound_r)
176176{
177   return soundlatch_r(space, 0);
177   return soundlatch_byte_r(space, 0);
178178}
179179
180180WRITE8_MEMBER(csplayh5_state::csplayh5_soundclr_w)
181181{
182   soundlatch_clear_w(space, 0, 0);
182   soundlatch_clear_byte_w(space, 0, 0);
183183}
184184
185185READ8_MEMBER(csplayh5_state::tmpz84c011_pio_r)
src/mame/drivers/nexus3d.c
r14896r14897
2323{
2424public:
2525   nexus3d_state(const machine_config &mconfig, device_type type, const char *tag)
26      : driver_device(mconfig, type, tag) { }
26      : driver_device(mconfig, type, tag) ,
27      m_mainram(*this, "mainram"){ }
2728
28   UINT32* m_mainram;
29   required_shared_ptr<UINT32> m_mainram;
2930
3031   //
3132   UINT8 m_last_flash_cmd;
r14896r14897
4344//  DECLARE_READ32_MEMBER(nexus3d_unk3_r);
4445//  DECLARE_WRITE32_MEMBER(nexus3d_unk2_w);
4546//  DECLARE_WRITE32_MEMBER(nexus3d_unk3_w);
47   DECLARE_READ8_MEMBER(n3d_flash_r);
48   DECLARE_WRITE8_MEMBER(n3d_flash_cmd_w);
49   DECLARE_WRITE8_MEMBER(n3d_flash_addr_w);
4650};
4751
4852
r14896r14897
6367   state->m_flash_page_addr = 0;
6468}
6569
66READ8_HANDLER( n3d_flash_r )
70READ8_MEMBER(nexus3d_state::n3d_flash_r)
6771{
68   nexus3d_state *state = space->machine().driver_data<nexus3d_state>();
6972
70   if (state->m_last_flash_cmd==0x70) return 0xe0;
73   if (m_last_flash_cmd==0x70) return 0xe0;
7174
72   if (state->m_last_flash_cmd==0x00)
75   if (m_last_flash_cmd==0x00)
7376   {
74      UINT8 retdat = state->flash_page_data[state->m_flash_page_addr];
77      UINT8 retdat = flash_page_data[m_flash_page_addr];
7578
76      //logerror("n3d_flash_r %02x %04x\n", offset, state->m_flash_page_addr);
79      //logerror("n3d_flash_r %02x %04x\n", offset, m_flash_page_addr);
7780
78      state->m_flash_page_addr++;
81      m_flash_page_addr++;
7982      return retdat;
8083   }
8184
r14896r14897
8689}
8790
8891
89WRITE8_HANDLER( n3d_flash_cmd_w )
92WRITE8_MEMBER(nexus3d_state::n3d_flash_cmd_w)
9093{
91   nexus3d_state *state = space->machine().driver_data<nexus3d_state>();
9294   logerror("n3d_flash_cmd_w %02x %02x\n", offset, data);
93   state->m_last_flash_cmd = data;
95   m_last_flash_cmd = data;
9496
9597   if (data==0x00)
9698   {
97      memcpy(state->flash_page_data, state->m_flash_region + state->m_flash_addr * FLASH_PAGE_SIZE, FLASH_PAGE_SIZE);
99      memcpy(flash_page_data, m_flash_region + m_flash_addr * FLASH_PAGE_SIZE, FLASH_PAGE_SIZE);
98100
99101   }
100102
101103}
102104
103WRITE8_HANDLER( n3d_flash_addr_w )
105WRITE8_MEMBER(nexus3d_state::n3d_flash_addr_w)
104106{
105   nexus3d_state *state = space->machine().driver_data<nexus3d_state>();
106107//  logerror("n3d_flash_addr_w %02x %02x\n", offset, data);
107108
108   state->m_flash_addr_seq++;
109   m_flash_addr_seq++;
109110
110   if (state->m_flash_addr_seq==3)
111      state->m_flash_addr = (state->m_flash_addr & 0xffff00) | data;
111   if (m_flash_addr_seq==3)
112      m_flash_addr = (m_flash_addr & 0xffff00) | data;
112113
113   if (state->m_flash_addr_seq==4)
114      state->m_flash_addr = (state->m_flash_addr & 0xff00ff) | data << 8;
114   if (m_flash_addr_seq==4)
115      m_flash_addr = (m_flash_addr & 0xff00ff) | data << 8;
115116
116   if (state->m_flash_addr_seq==5)
117      state->m_flash_addr = (state->m_flash_addr & 0x00ffff) | data << 16;
117   if (m_flash_addr_seq==5)
118      m_flash_addr = (m_flash_addr & 0x00ffff) | data << 16;
118119
119   if (state->m_flash_addr_seq==5)
120   if (m_flash_addr_seq==5)
120121   {
121      state->m_flash_addr_seq = 0;
122      state->m_flash_page_addr = 0;
123      logerror("set flash block to %08x\n", state->m_flash_addr);
122      m_flash_addr_seq = 0;
123      m_flash_page_addr = 0;
124      logerror("set flash block to %08x\n", m_flash_addr);
124125   }
125126
126127}
r14896r14897
151152//}
152153
153154static ADDRESS_MAP_START( nexus3d_map, AS_PROGRAM, 32, nexus3d_state )
154   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(m_mainram)
155   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("mainram")
155156
156157   AM_RANGE(0x00400000, 0x01ffffff) AM_RAM // ?? uploads various data, + pointers to data in the 0x01ffxxxx range, might be video system related
157158
158159   // flash
159   AM_RANGE(0x9C000000, 0x9C000003) AM_WRITE8_LEGACY(n3d_flash_r, 0xffffffff)
160   AM_RANGE(0x9C000010, 0x9C000013) AM_WRITE8_LEGACY(n3d_flash_cmd_w, 0xffffffff)
161   AM_RANGE(0x9C000018, 0x9C00001b) AM_WRITE8_LEGACY(n3d_flash_addr_w, 0xffffffff)
160   AM_RANGE(0x9C000000, 0x9C000003) AM_READ8(n3d_flash_r, 0xffffffff)
161   AM_RANGE(0x9C000010, 0x9C000013) AM_WRITE8(n3d_flash_cmd_w, 0xffffffff)
162   AM_RANGE(0x9C000018, 0x9C00001b) AM_WRITE8(n3d_flash_addr_w, 0xffffffff)
162163
163164   // lots of accesses in this range
164165//  AM_RANGE(0xC0000F44, 0xC0000F47) AM_READWRITE(nexus3d_unk2_r, nexus3d_unk2_w ) // often
src/mame/drivers/bking.c
r14896r14897
4242      if (data & (1 << i))
4343         code |= 0x80 >> i;
4444
45   soundlatch_w(space, offset, code);
45   soundlatch_byte_w(space, offset, code);
4646   if (m_sound_nmi_enable)
4747      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
4848}
r14896r14897
133133   AM_RANGE(0x4401, 0x4401) AM_DEVREAD_LEGACY("ay1", ay8910_r)
134134   AM_RANGE(0x4402, 0x4403) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
135135   AM_RANGE(0x4403, 0x4403) AM_DEVREAD_LEGACY("ay2", ay8910_r)
136   AM_RANGE(0x4800, 0x4800) AM_READ(soundlatch_r)
136   AM_RANGE(0x4800, 0x4800) AM_READ(soundlatch_byte_r)
137137   AM_RANGE(0x4802, 0x4802) AM_READWRITE(bking_sndnmi_disable_r, bking_sndnmi_enable_w)
138138   AM_RANGE(0xe000, 0xefff) AM_ROM   /* Space for diagnostic ROM */
139139ADDRESS_MAP_END
src/mame/drivers/skeetsht.c
r14896r14897
2121{
2222public:
2323   skeetsht_state(const machine_config &mconfig, device_type type, const char *tag)
24      : driver_device(mconfig, type, tag) { }
24      : driver_device(mconfig, type, tag) ,
25      m_tms_vram(*this, "tms_vram"){ }
2526
26   UINT16 *m_tms_vram;
27   required_shared_ptr<UINT16> m_tms_vram;
2728   UINT8 m_porta_latch;
2829   UINT8 m_ay_sel;
2930   UINT8 m_lastdataw;
r14896r14897
6970{
7071   skeetsht_state *state = screen.machine().driver_data<skeetsht_state>();
7172   const rgb_t *const pens = tlc34076_get_pens(screen.machine().device("tlc34076"));
72   UINT16 *vram = &state->m_tms_vram[(params->rowaddr << 8) & 0x3ff00];
73   UINT16 *vram = &state->m_tms_vram.target()[(params->rowaddr << 8) & 0x3ff00];
7374   UINT32 *dest = &bitmap.pix32(scanline);
7475   int coladdr = params->coladdr;
7576   int x;
r14896r14897
191192
192193static ADDRESS_MAP_START( tms_program_map, AS_PROGRAM, 16, skeetsht_state )
193194   AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE_LEGACY(tms34010_io_register_r, tms34010_io_register_w)
194   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(m_tms_vram)
195   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("tms_vram")
195196   AM_RANGE(0x00440000, 0x004fffff) AM_READWRITE(ramdac_r, ramdac_w)
196197   AM_RANGE(0xff800000, 0xffbfffff) AM_ROM AM_MIRROR(0x00400000) AM_REGION("tms", 0)
197198ADDRESS_MAP_END
src/mame/drivers/dblewing.c
r14896r14897
3030{
3131public:
3232   dblewing_state(const machine_config &mconfig, device_type type, const char *tag)
33      : driver_device(mconfig, type, tag) { }
33      : driver_device(mconfig, type, tag) ,
34      m_pf1_rowscroll(*this, "pf1_rowscroll"),
35      m_pf2_rowscroll(*this, "pf2_rowscroll"),
36      m_spriteram(*this, "spriteram"){ }
3437
3538   /* memory pointers */
36   UINT16 *  m_pf1_rowscroll;
37   UINT16 *  m_pf2_rowscroll;
38   UINT16 *  m_spriteram;
39   size_t    m_spriteram_size;
39   required_shared_ptr<UINT16> m_pf1_rowscroll;
40   required_shared_ptr<UINT16> m_pf2_rowscroll;
41   required_shared_ptr<UINT16> m_spriteram;
4042
4143   /* protection */
4244   UINT16 m_008_data;
r14896r14897
101103   dblewing_state *state = screen.machine().driver_data<dblewing_state>();
102104   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
103105
104   flip_screen_set(screen.machine(), BIT(flip, 7));
105   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
106   state->flip_screen_set(BIT(flip, 7));
107   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll.target());
106108
107109   bitmap.fill(0, cliprect); /* not Confirmed */
108110   screen.machine().priority_bitmap.fill(0);
r14896r14897
240242         //printf("%04x\n",m_280_data);
241243         return;
242244      case 0x380: // sound write
243         soundlatch_w(space, 0, data & 0xff);
245         soundlatch_byte_w(space, 0, data & 0xff);
244246         m_sound_irq |= 0x02;
245247         device_set_input_line(m_audiocpu, 0, (m_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
246248         return;
r14896r14897
310312
311313   AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE_LEGACY("tilegen1", deco16ic_pf1_data_r, deco16ic_pf1_data_w)
312314   AM_RANGE(0x102000, 0x102fff) AM_DEVREADWRITE_LEGACY("tilegen1", deco16ic_pf2_data_r, deco16ic_pf2_data_w)
313   AM_RANGE(0x104000, 0x104fff) AM_RAM AM_BASE(m_pf1_rowscroll)
314   AM_RANGE(0x106000, 0x106fff) AM_RAM AM_BASE(m_pf2_rowscroll)
315   AM_RANGE(0x104000, 0x104fff) AM_RAM AM_SHARE("pf1_rowscroll")
316   AM_RANGE(0x106000, 0x106fff) AM_RAM AM_SHARE("pf2_rowscroll")
315317
316318   /* protection */
317319//  AM_RANGE(0x280104, 0x280105) AM_WRITENOP              // ??
r14896r14897
328330   AM_RANGE(0x284000, 0x284001) AM_RAM
329331   AM_RANGE(0x288000, 0x288001) AM_RAM
330332   AM_RANGE(0x28c000, 0x28c00f) AM_RAM_DEVWRITE_LEGACY("tilegen1", deco16ic_pf_control_w)
331   AM_RANGE(0x300000, 0x3007ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
332   AM_RANGE(0x320000, 0x3207ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
333   AM_RANGE(0x300000, 0x3007ff) AM_RAM AM_SHARE("spriteram")
334   AM_RANGE(0x320000, 0x3207ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
333335   AM_RANGE(0xff0000, 0xff3fff) AM_MIRROR(0xc000) AM_RAM
334336ADDRESS_MAP_END
335337
r14896r14897
347349   AM_RANGE(0x8000, 0x87ff) AM_RAM
348350   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_status_port_r,ym2151_w)
349351   AM_RANGE(0xb000, 0xb000) AM_DEVREADWRITE("oki", okim6295_device, read, write)
350   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r)
352   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r)
351353   AM_RANGE(0xd000, 0xd000) AM_READ(irq_latch_r) //timing? sound latch?
352354   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("oki", okim6295_device, read, write)
353355ADDRESS_MAP_END
src/mame/drivers/taito_o.c
r14896r14897
6666   AM_RANGE(0x200000, 0x20000f) AM_READWRITE(io_r, io_w) /* TC0220IOC ? */
6767   AM_RANGE(0x300000, 0x300003) AM_DEVREADWRITE8_LEGACY("ymsnd", ym2203_r, ym2203_w, 0x00ff)
6868   AM_RANGE(0x400000, 0x420fff) AM_DEVREADWRITE_LEGACY("tc0080vco", tc0080vco_word_r, tc0080vco_word_w)
69   AM_RANGE(0x500800, 0x500fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
69   AM_RANGE(0x500800, 0x500fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
7070ADDRESS_MAP_END
7171
7272static INPUT_PORTS_START( parentj )
src/mame/drivers/shougi.c
r14896r14897
9191{
9292public:
9393   shougi_state(const machine_config &mconfig, device_type type, const char *tag)
94      : driver_device(mconfig, type, tag) { }
94      : driver_device(mconfig, type, tag) ,
95      m_videoram(*this, "videoram"){ }
9596
96   UINT8 *m_videoram;
97   required_shared_ptr<UINT8> m_videoram;
9798   int m_nmi_enabled;
9899   //UINT8 *m_cpu_sharedram;
99100   //UINT8 m_cpu_sharedram_control_val;
r14896r14897
185186      //if (flipscreen[0]) sx = 31 - sx;
186187      //if (flipscreen[1]) sy = 31 - sy;
187188
188      data1 = state->m_videoram[offs];            /* color */
189      data2 = state->m_videoram[0x4000 + offs];   /* pixel data */
189      data1 = state->m_videoram.target()[offs];            /* color */
190      data2 = state->m_videoram.target()[0x4000 + offs];   /* pixel data */
190191
191192      for (x=0; x<4; x++) /*4 pixels per byte (2 bitplanes in 2 nibbles: 1st=bits 7-4, 2nd=bits 3-0)*/
192193      {
r14896r14897
308309   AM_RANGE(0x7000, 0x73ff) AM_RAM AM_SHARE("share1") /* 2114 x 2 (0x400 x 4bit each) */
309310   AM_RANGE(0x7800, 0x7bff) AM_RAM AM_SHARE("share2") /* 2114 x 2 (0x400 x 4bit each) */
310311
311   AM_RANGE(0x8000, 0xffff) AM_RAM AM_BASE(m_videoram)   /* 4116 x 16 (32K) */
312   AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("videoram")   /* 4116 x 16 (32K) */
312313ADDRESS_MAP_END
313314
314315/* sub */
src/mame/drivers/pipedrm.c
r14896r14897
268268   AM_RANGE(0x0000, 0x7fff) AM_ROM
269269   AM_RANGE(0x8000, 0x9fff) AM_RAM
270270   AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank1")
271   AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
271   AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
272272   AM_RANGE(0xd000, 0xffff) AM_READWRITE(fromance_videoram_r, fromance_videoram_w) AM_BASE_SIZE(m_videoram, m_videoram_size)
273273ADDRESS_MAP_END
274274
src/mame/drivers/ddragon3.c
r14896r14897
171171         m_vreg = m_io_reg[0];
172172         break;
173173
174      case 1: /* soundlatch_w */
175         soundlatch_w(space, 1, m_io_reg[1] & 0xff);
174      case 1: /* soundlatch_byte_w */
175         soundlatch_byte_w(space, 1, m_io_reg[1] & 0xff);
176176         device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE );
177177      break;
178178
r14896r14897
216216   AM_RANGE(0x100004, 0x100005) AM_READ_PORT("DSW")
217217   AM_RANGE(0x100006, 0x100007) AM_READ_PORT("P3")
218218   AM_RANGE(0x100000, 0x10000f) AM_WRITE(ddragon3_io_w)
219   AM_RANGE(0x140000, 0x1405ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") /* Palette RAM */
219   AM_RANGE(0x140000, 0x1405ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") /* Palette RAM */
220220   AM_RANGE(0x180000, 0x180fff) AM_RAM AM_BASE(m_spriteram)
221221   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM /* working RAM */
222222ADDRESS_MAP_END
r14896r14897
227227   AM_RANGE(0x081000, 0x081fff) AM_RAM AM_BASE(m_spriteram)
228228   AM_RANGE(0x082000, 0x0827ff) AM_RAM_WRITE(ddragon3_bg_videoram_w) AM_BASE(m_bg_videoram) /* Background (32x32 Tiles - 2 by per tile) */
229229   AM_RANGE(0x0c0000, 0x0c000f) AM_WRITE(ddragon3_scroll_w)
230   AM_RANGE(0x100000, 0x1005ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") /* Palette RAM */
230   AM_RANGE(0x100000, 0x1005ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") /* Palette RAM */
231231   AM_RANGE(0x140000, 0x14000f) AM_WRITE(ddragon3_io_w)
232232   AM_RANGE(0x180000, 0x180001) AM_READ_PORT("IN0")
233233   AM_RANGE(0x180002, 0x180003) AM_READ_PORT("IN1")
r14896r14897
243243   AM_RANGE(0x082000, 0x0827ff) AM_RAM_WRITE(ddragon3_bg_videoram_w) AM_BASE(m_bg_videoram) /* Background (32x32 Tiles - 2 by per tile) */
244244   AM_RANGE(0x082800, 0x082fff) AM_RAM
245245   AM_RANGE(0x0c0000, 0x0c000f) AM_READWRITE(ddragon3_scroll_r, ddragon3_scroll_w)
246   AM_RANGE(0x100000, 0x1005ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram") /* Palette RAM */
246   AM_RANGE(0x100000, 0x1005ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram") /* Palette RAM */
247247   AM_RANGE(0x140000, 0x14000f) AM_WRITE(ddragon3_io_w)
248248   AM_RANGE(0x180000, 0x180001) AM_READ_PORT("IN0")
249249   AM_RANGE(0x180002, 0x180003) AM_READ_PORT("IN1")
r14896r14897
257257   AM_RANGE(0xc000, 0xc7ff) AM_RAM
258258   AM_RANGE(0xc800, 0xc801) AM_DEVREADWRITE_LEGACY("ym2151", ym2151_r, ym2151_w)
259259   AM_RANGE(0xd800, 0xd800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
260   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
260   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
261261   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE_LEGACY("oki", oki_bankswitch_w)
262262ADDRESS_MAP_END
263263
r14896r14897
266266   AM_RANGE(0x8000, 0x87ff) AM_RAM
267267   AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("ym2151", ym2151_status_port_r, ym2151_w)
268268   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
269   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
269   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
270270ADDRESS_MAP_END
271271
272272/*************************************
src/mame/drivers/hotstuff.c
r14896r14897
88{
99public:
1010   hotstuff_state(const machine_config &mconfig, device_type type, const char *tag)
11      : driver_device(mconfig, type, tag) { }
11      : driver_device(mconfig, type, tag) ,
12      m_bitmapram(*this, "bitmapram"){ }
1213
13   UINT16* m_bitmapram;
14   required_shared_ptr<UINT16> m_bitmapram;
1415   struct
1516   {
1617      UINT8 index;
r14896r14897
4546
4647      for (p=0;p<0x10;p++)
4748      {
48         row_palette_data[p] = state->m_bitmapram[count+p];
49         row_palette_data[p] = state->m_bitmapram.target()[count+p];
4950
5051         row_palette_data_as_rgb32_pen_data[p] = MAKE_RGB( (row_palette_data[p] & 0x0f00)>>4, (row_palette_data[p] & 0x00f0)>>0, (row_palette_data[p] & 0x000f)<<4  );
5152
r14896r14897
5455      for(x = 0; x < xxx; x++)
5556      {
5657         {
57            bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(state->m_bitmapram[count] &0xf000)>>12];
58            bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(state->m_bitmapram.target()[count] &0xf000)>>12];
5859            x++;
59            bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(state->m_bitmapram[count] &0x0f00)>>8];
60            bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(state->m_bitmapram.target()[count] &0x0f00)>>8];
6061            x++;
61            bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(state->m_bitmapram[count] &0x00f0)>>4];
62            bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(state->m_bitmapram.target()[count] &0x00f0)>>4];
6263            x++;
63            bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(state->m_bitmapram[count] &0x000f)>>0];
64            bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(state->m_bitmapram.target()[count] &0x000f)>>0];
6465         }
6566
6667         count++;
r14896r14897
114115   AM_RANGE(0x680000, 0x680001) AM_READWRITE8(ioboard_status_r,ioboard_data_w,0xff00)
115116   AM_RANGE(0x680000, 0x680001) AM_READWRITE8(ioboard_unk_r,ioboard_reg_w,0x00ff)
116117
117   AM_RANGE(0x980000, 0x9bffff) AM_RAM AM_BASE(m_bitmapram)
118   AM_RANGE(0x980000, 0x9bffff) AM_RAM AM_SHARE("bitmapram")
118119ADDRESS_MAP_END
119120
120121static INPUT_PORTS_START( hotstuff )
src/mame/drivers/discoboy.c
r14896r14897
232232{
233233   //  printf("unk discoboy_port_03_w %02x\n", data);
234234   //  device_set_input_line(m_audiocpu, INPUT_LINE_NMI, HOLD_LINE);
235   soundlatch_w(space, 0, data);
235   soundlatch_byte_w(space, 0, data);
236236   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
237237}
238238
r14896r14897
349349   AM_RANGE(0xe400, 0xe400) AM_WRITE(yunsung8_adpcm_w)
350350   AM_RANGE(0xec00, 0xec01) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w)
351351   AM_RANGE(0xf000, 0xf7ff) AM_RAM
352   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
352   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
353353ADDRESS_MAP_END
354354
355355
src/mame/drivers/mediagx.c
r14896r14897
9292{
9393public:
9494   mediagx_state(const machine_config &mconfig, device_type type, const char *tag)
95      : driver_device(mconfig, type, tag) { }
95      : driver_device(mconfig, type, tag) ,
96      m_main_ram(*this, "main_ram"),
97      m_cga_ram(*this, "cga_ram"),
98      m_bios_ram(*this, "bios_ram"),
99      m_vram(*this, "vram"){ }
96100
97   UINT32 *m_cga_ram;
98   UINT32 *m_bios_ram;
99   UINT32 *m_vram;
101   required_shared_ptr<UINT32> m_main_ram;
102   required_shared_ptr<UINT32> m_cga_ram;
103   required_shared_ptr<UINT32> m_bios_ram;
104   required_shared_ptr<UINT32> m_vram;
100105   UINT8 m_pal[768];
101106
102   UINT32 *m_main_ram;
103107
104108   UINT32 m_disp_ctrl_reg[256/4];
105109   int m_frame_width;
r14896r14897
149153   UINT32 m_speedup_hits[12];
150154   int m_speedup_count;
151155#endif
156   DECLARE_READ32_MEMBER(disp_ctrl_r);
157   DECLARE_WRITE32_MEMBER(disp_ctrl_w);
158   DECLARE_READ32_MEMBER(memory_ctrl_r);
159   DECLARE_WRITE32_MEMBER(memory_ctrl_w);
160   DECLARE_READ32_MEMBER(biu_ctrl_r);
161   DECLARE_WRITE32_MEMBER(biu_ctrl_w);
162   DECLARE_WRITE32_MEMBER(bios_ram_w);
163   DECLARE_READ32_MEMBER(parallel_port_r);
164   DECLARE_WRITE32_MEMBER(parallel_port_w);
165   DECLARE_READ32_MEMBER(ad1847_r);
166   DECLARE_WRITE32_MEMBER(ad1847_w);
167   DECLARE_READ8_MEMBER(at_page8_r);
168   DECLARE_WRITE8_MEMBER(at_page8_w);
169   DECLARE_READ8_MEMBER(pc_dma_read_byte);
170   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
152171};
153172
154173// Display controller registers
r14896r14897
258277
259278   if (state->m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1)      // 8-bit mode
260279   {
261      UINT8 *framebuf = (UINT8*)&state->m_vram[state->m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4];
280      UINT8 *framebuf = (UINT8*)&state->m_vram.target()[state->m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4];
262281      UINT8 *pal = state->m_pal;
263282
264283      for (j=0; j < state->m_frame_height; j++)
r14896r14897
278297   }
279298   else         // 16-bit
280299   {
281      UINT16 *framebuf = (UINT16*)&state->m_vram[state->m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4];
300      UINT16 *framebuf = (UINT16*)&state->m_vram.target()[state->m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4];
282301
283302      // RGB 5-6-5 mode
284303      if ((state->m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x2) == 0)
r14896r14897
324343   mediagx_state *state = machine.driver_data<mediagx_state>();
325344   int i, j;
326345   const gfx_element *gfx = machine.gfx[0];
327   UINT32 *cga = state->m_cga_ram;
346   UINT32 *cga = state->m_cga_ram.target();
328347   int index = 0;
329348
330349   for (j=0; j < 25; j++)
r14896r14897
357376   return 0;
358377}
359378
360static READ32_HANDLER( disp_ctrl_r )
379READ32_MEMBER(mediagx_state::disp_ctrl_r)
361380{
362   mediagx_state *state = space->machine().driver_data<mediagx_state>();
363   UINT32 r = state->m_disp_ctrl_reg[offset];
381   UINT32 r = m_disp_ctrl_reg[offset];
364382
365383   switch (offset)
366384   {
367385      case DC_TIMING_CFG:
368386         r |= 0x40000000;
369387
370         if (space->machine().primary_screen->vpos() >= state->m_frame_height)
388         if (machine().primary_screen->vpos() >= m_frame_height)
371389            r &= ~0x40000000;
372390
373391#if SPEEDUP_HACKS
374392         // wait for vblank speedup
375         device_spin_until_interrupt(&space->device());
393         device_spin_until_interrupt(&space.device());
376394#endif
377395         break;
378396   }
r14896r14897
380398   return r;
381399}
382400
383static WRITE32_HANDLER( disp_ctrl_w )
401WRITE32_MEMBER(mediagx_state::disp_ctrl_w)
384402{
385   mediagx_state *state = space->machine().driver_data<mediagx_state>();
386403
387404//  printf("disp_ctrl_w %08X, %08X, %08X\n", data, offset*4, mem_mask);
388   COMBINE_DATA(state->m_disp_ctrl_reg + offset);
405   COMBINE_DATA(m_disp_ctrl_reg + offset);
389406}
390407
391408
r14896r14897
422439
423440
424441
425static READ32_HANDLER( memory_ctrl_r )
442READ32_MEMBER(mediagx_state::memory_ctrl_r)
426443{
427   mediagx_state *state = space->machine().driver_data<mediagx_state>();
428444
429   return state->m_memory_ctrl_reg[offset];
445   return m_memory_ctrl_reg[offset];
430446}
431447
432static WRITE32_HANDLER( memory_ctrl_w )
448WRITE32_MEMBER(mediagx_state::memory_ctrl_w)
433449{
434   mediagx_state *state = space->machine().driver_data<mediagx_state>();
435450
436451//  printf("memory_ctrl_w %08X, %08X, %08X\n", data, offset*4, mem_mask);
437452   if (offset == 0x20/4)
438453   {
439      ramdac_device *ramdac = space->machine().device<ramdac_device>("ramdac");
454      ramdac_device *ramdac = machine().device<ramdac_device>("ramdac");
440455
441      if((state->m_disp_ctrl_reg[DC_GENERAL_CFG] & 0x00e00000) == 0x00400000)
456      if((m_disp_ctrl_reg[DC_GENERAL_CFG] & 0x00e00000) == 0x00400000)
442457      {
443458         // guess: crtc params?
444459         // ...
445460      }
446      else if((state->m_disp_ctrl_reg[DC_GENERAL_CFG] & 0x00f00000) == 0x00000000)
461      else if((m_disp_ctrl_reg[DC_GENERAL_CFG] & 0x00f00000) == 0x00000000)
447462      {
448         state->m_pal_index = data;
449         ramdac->index_w( *space, 0, data );
463         m_pal_index = data;
464         ramdac->index_w( *&space, 0, data );
450465      }
451      else if((state->m_disp_ctrl_reg[DC_GENERAL_CFG] & 0x00f00000) == 0x00100000)
466      else if((m_disp_ctrl_reg[DC_GENERAL_CFG] & 0x00f00000) == 0x00100000)
452467      {
453         state->m_pal[state->m_pal_index] = data & 0xff;
454         state->m_pal_index++;
455         if (state->m_pal_index >= 768)
468         m_pal[m_pal_index] = data & 0xff;
469         m_pal_index++;
470         if (m_pal_index >= 768)
456471         {
457            state->m_pal_index = 0;
472            m_pal_index = 0;
458473         }
459         ramdac->pal_w( *space, 0, data );
474         ramdac->pal_w( *&space, 0, data );
460475      }
461476   }
462477   else
463478   {
464      COMBINE_DATA(state->m_memory_ctrl_reg + offset);
479      COMBINE_DATA(m_memory_ctrl_reg + offset);
465480   }
466481}
467482
468483
469484
470static READ32_HANDLER( biu_ctrl_r )
485READ32_MEMBER(mediagx_state::biu_ctrl_r)
471486{
472   mediagx_state *state = space->machine().driver_data<mediagx_state>();
473487
474488   if (offset == 0)
475489   {
476490      return 0xffffff;
477491   }
478   return state->m_biu_ctrl_reg[offset];
492   return m_biu_ctrl_reg[offset];
479493}
480494
481static WRITE32_HANDLER( biu_ctrl_w )
495WRITE32_MEMBER(mediagx_state::biu_ctrl_w)
482496{
483   mediagx_state *state = space->machine().driver_data<mediagx_state>();
484497
485498   //mame_printf_debug("biu_ctrl_w %08X, %08X, %08X\n", data, offset, mem_mask);
486   COMBINE_DATA(state->m_biu_ctrl_reg + offset);
499   COMBINE_DATA(m_biu_ctrl_reg + offset);
487500
488501   if (offset == 3)      // BC_XMAP_3 register
489502   {
r14896r14897
492505}
493506
494507#ifdef UNUSED_FUNCTION
495static WRITE32_HANDLER(bios_ram_w)
508WRITE32_MEMBER(mediagx_state::bios_ram_w)
496509{
497510
498511}
r14896r14897
552565   }
553566}
554567
555static READ32_HANDLER( parallel_port_r )
568READ32_MEMBER(mediagx_state::parallel_port_r)
556569{
557   mediagx_state *state = space->machine().driver_data<mediagx_state>();
558570   UINT32 r = 0;
559571   //static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7", "IN8" }; // but parallel_pointer takes values 0 -> 23
560572
561573   if (ACCESSING_BITS_8_15)
562574   {
563      UINT8 nibble = state->m_parallel_latched;//(input_port_read_safe(space->machine(), state->m_portnames[state->m_parallel_pointer / 3], 0) >> (4 * (state->m_parallel_pointer % 3))) & 15;
575      UINT8 nibble = m_parallel_latched;//(input_port_read_safe(machine(), m_portnames[m_parallel_pointer / 3], 0) >> (4 * (m_parallel_pointer % 3))) & 15;
564576      r |= ((~nibble & 0x08) << 12) | ((nibble & 0x07) << 11);
565      logerror("%08X:parallel_port_r()\n", cpu_get_pc(&space->device()));
577      logerror("%08X:parallel_port_r()\n", cpu_get_pc(&space.device()));
566578#if 0
567      if (state->m_controls_data == 0x18)
579      if (m_controls_data == 0x18)
568580      {
569         r |= input_port_read(space->machine(), "IN0") << 8;
581         r |= input_port_read(machine(), "IN0") << 8;
570582      }
571      else if (state->m_controls_data == 0x60)
583      else if (m_controls_data == 0x60)
572584      {
573         r |= input_port_read(space->machine(), "IN1") << 8;
585         r |= input_port_read(machine(), "IN1") << 8;
574586      }
575      else if (state->m_controls_data == 0xff || state->m_controls_data == 0x50)
587      else if (m_controls_data == 0xff || m_controls_data == 0x50)
576588      {
577         r |= input_port_read(space->machine(), "IN2") << 8;
589         r |= input_port_read(machine(), "IN2") << 8;
578590      }
579591
580      //r |= state->m_control_read << 8;
592      //r |= m_control_read << 8;
581593#endif
582594   }
583595   if (ACCESSING_BITS_16_23)
584596   {
585      r |= state->m_parport & 0xff0000;
597      r |= m_parport & 0xff0000;
586598   }
587599
588600   return r;
589601}
590602
591static WRITE32_HANDLER( parallel_port_w )
603WRITE32_MEMBER(mediagx_state::parallel_port_w)
592604{
593   mediagx_state *state = space->machine().driver_data<mediagx_state>();
594605   static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7", "IN8" };   // but parallel_pointer takes values 0 -> 23
595606
596   COMBINE_DATA( &state->m_parport );
607   COMBINE_DATA( &m_parport );
597608
598609   if (ACCESSING_BITS_0_7)
599610   {
r14896r14897
612623                7x..ff = advance pointer
613624        */
614625
615      logerror("%08X:", cpu_get_pc(&space->device()));
626      logerror("%08X:", cpu_get_pc(&space.device()));
616627
617      state->m_parallel_latched = (input_port_read_safe(space->machine(), portnames[state->m_parallel_pointer / 3], 0) >> (4 * (state->m_parallel_pointer % 3))) & 15;
628      m_parallel_latched = (input_port_read_safe(machine(), portnames[m_parallel_pointer / 3], 0) >> (4 * (m_parallel_pointer % 3))) & 15;
618629      //parallel_pointer++;
619630      //logerror("[%02X] Advance pointer to %d\n", data, parallel_pointer);
620631      switch (data & 0xfc)
621632      {
622633         case 0x18:
623            state->m_parallel_pointer = data & 3;
624            logerror("[%02X] Reset pointer to %d\n", data, state->m_parallel_pointer);
634            m_parallel_pointer = data & 3;
635            logerror("[%02X] Reset pointer to %d\n", data, m_parallel_pointer);
625636            break;
626637
627638         case 0x20:
r14896r14897
662673         default:
663674            if (data >= 0x70)
664675            {
665               state->m_parallel_pointer++;
666               logerror("[%02X] Advance pointer to %d\n", data, state->m_parallel_pointer);
676               m_parallel_pointer++;
677               logerror("[%02X] Advance pointer to %d\n", data, m_parallel_pointer);
667678            }
668679            else
669680               logerror("[%02X] Unknown write\n", data);
r14896r14897
748759   }
749760}
750761
751static READ32_HANDLER( ad1847_r )
762READ32_MEMBER(mediagx_state::ad1847_r)
752763{
753   mediagx_state *state = space->machine().driver_data<mediagx_state>();
754764
755765   switch (offset)
756766   {
757767      case 0x14/4:
758         return ((state->m_ad1847_sample_rate) / 100) - state->m_ad1847_sample_counter;
768         return ((m_ad1847_sample_rate) / 100) - m_ad1847_sample_counter;
759769   }
760770   return 0;
761771}
762772
763static WRITE32_HANDLER( ad1847_w )
773WRITE32_MEMBER(mediagx_state::ad1847_w)
764774{
765   mediagx_state *state = space->machine().driver_data<mediagx_state>();
766775
767776   if (offset == 0)
768777   {
769778      if (ACCESSING_BITS_16_31)
770779      {
771780         UINT16 ldata = (data >> 16) & 0xffff;
772         state->m_dacl[state->m_dacl_ptr++] = ldata;
781         m_dacl[m_dacl_ptr++] = ldata;
773782      }
774783      if (ACCESSING_BITS_0_15)
775784      {
776785         UINT16 rdata = data & 0xffff;
777         state->m_dacr[state->m_dacr_ptr++] = rdata;
786         m_dacr[m_dacr_ptr++] = rdata;
778787      }
779788
780      state->m_ad1847_sample_counter++;
789      m_ad1847_sample_counter++;
781790   }
782791   else if (offset == 3)
783792   {
784793      int reg = (data >> 8) & 0xf;
785      ad1847_reg_write(space->machine(), reg, data & 0xff);
794      ad1847_reg_write(machine(), reg, data & 0xff);
786795   }
787796}
788797
r14896r14897
794803 *************************************************************************/
795804
796805
797static READ8_HANDLER(at_page8_r)
806READ8_MEMBER(mediagx_state::at_page8_r)
798807{
799   mediagx_state *state = space->machine().driver_data<mediagx_state>();
800   UINT8 data = state->m_at_pages[offset % 0x10];
808   UINT8 data = m_at_pages[offset % 0x10];
801809
802810   switch(offset % 8)
803811   {
804812   case 1:
805      data = state->m_dma_offset[(offset / 8) & 1][2];
813      data = m_dma_offset[(offset / 8) & 1][2];
806814      break;
807815   case 2:
808      data = state->m_dma_offset[(offset / 8) & 1][3];
816      data = m_dma_offset[(offset / 8) & 1][3];
809817      break;
810818   case 3:
811      data = state->m_dma_offset[(offset / 8) & 1][1];
819      data = m_dma_offset[(offset / 8) & 1][1];
812820      break;
813821   case 7:
814      data = state->m_dma_offset[(offset / 8) & 1][0];
822      data = m_dma_offset[(offset / 8) & 1][0];
815823      break;
816824   }
817825   return data;
818826}
819827
820828
821static WRITE8_HANDLER(at_page8_w)
829WRITE8_MEMBER(mediagx_state::at_page8_w)
822830{
823   mediagx_state *state = space->machine().driver_data<mediagx_state>();
824831
825   state->m_at_pages[offset % 0x10] = data;
832   m_at_pages[offset % 0x10] = data;
826833
827834   switch(offset % 8)
828835   {
829836   case 1:
830      state->m_dma_offset[(offset / 8) & 1][2] = data;
837      m_dma_offset[(offset / 8) & 1][2] = data;
831838      break;
832839   case 2:
833      state->m_dma_offset[(offset / 8) & 1][3] = data;
840      m_dma_offset[(offset / 8) & 1][3] = data;
834841      break;
835842   case 3:
836      state->m_dma_offset[(offset / 8) & 1][1] = data;
843      m_dma_offset[(offset / 8) & 1][1] = data;
837844      break;
838845   case 7:
839      state->m_dma_offset[(offset / 8) & 1][0] = data;
846      m_dma_offset[(offset / 8) & 1][0] = data;
840847      break;
841848   }
842849}
r14896r14897
851858}
852859
853860
854static READ8_HANDLER( pc_dma_read_byte )
861READ8_MEMBER(mediagx_state::pc_dma_read_byte)
855862{
856   mediagx_state *state = space->machine().driver_data<mediagx_state>();
857   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
863   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
858864      & 0xFF0000;
859865
860   return space->read_byte(page_offset + offset);
866   return space.read_byte(page_offset + offset);
861867}
862868
863869
864static WRITE8_HANDLER( pc_dma_write_byte )
870WRITE8_MEMBER(mediagx_state::pc_dma_write_byte)
865871{
866   mediagx_state *state = space->machine().driver_data<mediagx_state>();
867   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
872   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
868873      & 0xFF0000;
869874
870   space->write_byte(page_offset + offset, data);
875   space.write_byte(page_offset + offset, data);
871876}
872877
873878static void set_dma_channel(device_t *device, int channel, int _state)
r14896r14897
886891{
887892   DEVCB_LINE(pc_dma_hrq_changed),
888893   DEVCB_NULL,
889   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
890   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
894   DEVCB_DRIVER_MEMBER(mediagx_state, pc_dma_read_byte),
895   DEVCB_DRIVER_MEMBER(mediagx_state, pc_dma_write_byte),
891896   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
892897   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
893898   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
908913/*****************************************************************************/
909914
910915static ADDRESS_MAP_START( mediagx_map, AS_PROGRAM, 32, mediagx_state )
911   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM AM_BASE(m_main_ram)
916   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM AM_SHARE("main_ram")
912917   AM_RANGE(0x000a0000, 0x000affff) AM_RAM
913   AM_RANGE(0x000b0000, 0x000b7fff) AM_RAM AM_BASE(m_cga_ram)
914   AM_RANGE(0x000c0000, 0x000fffff) AM_RAM AM_BASE(m_bios_ram)
918   AM_RANGE(0x000b0000, 0x000b7fff) AM_RAM AM_SHARE("cga_ram")
919   AM_RANGE(0x000c0000, 0x000fffff) AM_RAM AM_SHARE("bios_ram")
915920   AM_RANGE(0x00100000, 0x00ffffff) AM_RAM
916   AM_RANGE(0x40008000, 0x400080ff) AM_READWRITE_LEGACY(biu_ctrl_r, biu_ctrl_w)
917   AM_RANGE(0x40008300, 0x400083ff) AM_READWRITE_LEGACY(disp_ctrl_r, disp_ctrl_w)
918   AM_RANGE(0x40008400, 0x400084ff) AM_READWRITE_LEGACY(memory_ctrl_r, memory_ctrl_w)
919   AM_RANGE(0x40800000, 0x40bfffff) AM_RAM AM_BASE(m_vram)
921   AM_RANGE(0x40008000, 0x400080ff) AM_READWRITE(biu_ctrl_r, biu_ctrl_w)
922   AM_RANGE(0x40008300, 0x400083ff) AM_READWRITE(disp_ctrl_r, disp_ctrl_w)
923   AM_RANGE(0x40008400, 0x400084ff) AM_READWRITE(memory_ctrl_r, memory_ctrl_w)
924   AM_RANGE(0x40800000, 0x40bfffff) AM_RAM AM_SHARE("vram")
920925   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("bios", 0)   /* System BIOS */
921926ADDRESS_MAP_END
922927
r14896r14897
926931   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
927932   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
928933   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
929   AM_RANGE(0x0080, 0x009f) AM_READWRITE8_LEGACY(at_page8_r,            at_page8_w, 0xffffffff)
934   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,            at_page8_w, 0xffffffff)
930935   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0xffffffff)
931936   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
932937   AM_RANGE(0x00e8, 0x00eb) AM_NOP      // I/O delay port
933938   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
934   AM_RANGE(0x0378, 0x037b) AM_READWRITE_LEGACY(parallel_port_r, parallel_port_w)
939   AM_RANGE(0x0378, 0x037b) AM_READWRITE(parallel_port_r, parallel_port_w)
935940   AM_RANGE(0x03f0, 0x03ff) AM_DEVREADWRITE_LEGACY("ide", fdc_r, fdc_w)
936   AM_RANGE(0x0400, 0x04ff) AM_READWRITE_LEGACY(ad1847_r, ad1847_w)
941   AM_RANGE(0x0400, 0x04ff) AM_READWRITE(ad1847_r, ad1847_w)
937942   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE_LEGACY("pcibus", pci_32le_r,   pci_32le_w)
938943ADDRESS_MAP_END
939944
r14896r14897
12381243      state->m_speedup_hits[idx]++;
12391244      device_spin_until_interrupt(&space->device());
12401245   }
1241   return state->m_main_ram[state->m_speedup_table[idx].offset/4];
1246   return state->m_main_ram.target()[state->m_speedup_table[idx].offset/4];
12421247}
12431248
12441249static READ32_HANDLER( speedup0_r ) { return generic_speedup(space, 0); }
src/mame/drivers/summit.c
r14896r14897
2323{
2424public:
2525   summit_state(const machine_config &mconfig, device_type type, const char *tag)
26      : driver_device(mconfig, type, tag) { }
26      : driver_device(mconfig, type, tag) ,
27      m_attr(*this, "attr"),
28      m_vram(*this, "vram"){ }
2729
28   UINT8 *m_vram;
29   UINT8 *m_attr;
30   required_shared_ptr<UINT8> m_attr;
31   required_shared_ptr<UINT8> m_vram;
3032   DECLARE_WRITE8_MEMBER(out_w);
3133};
3234
r14896r14897
4850   {
4951      for (x=0;x<32;x++)
5052      {
51         int tile = (state->m_vram[count] | ((state->m_attr[count]&1)<<8) );
53         int tile = (state->m_vram.target()[count] | ((state->m_attr.target()[count]&1)<<8) );
5254         drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*8);
5355
5456         count++;
r14896r14897
6567static ADDRESS_MAP_START( mainmap, AS_PROGRAM, 8, summit_state )
6668   AM_RANGE(0x0000, 0x17ff) AM_ROM
6769
68   AM_RANGE(0x2000, 0x23ff) AM_RAM AM_BASE(m_attr)
69   AM_RANGE(0x2800, 0x2bff) AM_RAM AM_BASE(m_vram)
70   AM_RANGE(0x2000, 0x23ff) AM_RAM AM_SHARE("attr")
71   AM_RANGE(0x2800, 0x2bff) AM_RAM AM_SHARE("vram")
7072
7173   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("IN0")
7274//  AM_RANGE(0x3880, 0x3880) AM_WRITE(out_w)
src/mame/drivers/ambush.c
r14896r14897
5353
5454WRITE8_MEMBER(ambush_state::flip_screen_w)
5555{
56   flip_screen_set(machine(), data);
56   flip_screen_set(data);
5757}
5858
5959
src/mame/drivers/skimaxx.c
r14896r14897
4444{
4545public:
4646   skimaxx_state(const machine_config &mconfig, device_type type, const char *tag)
47      : driver_device(mconfig, type, tag) { }
47      : driver_device(mconfig, type, tag) ,
48      m_blitter_regs(*this, "blitter_regs"),
49      m_fpga_ctrl(*this, "fpga_ctrl"),
50      m_fg_buffer(*this, "fg_buffer"){ }
4851
52   required_shared_ptr<UINT32> m_blitter_regs;
53   required_shared_ptr<UINT32> m_fpga_ctrl;
54   required_shared_ptr<UINT16> m_fg_buffer;
4955   UINT32 *m_bg_buffer;
50   UINT16 *m_fg_buffer;
5156   UINT32 *m_bg_buffer_front;
5257   UINT32 *m_bg_buffer_back;
53   UINT32 *m_blitter_regs;
5458   UINT16 *m_blitter_gfx;
5559   UINT32 m_blitter_gfx_len;
5660   UINT32 m_blitter_src_x;
5761   UINT32 m_blitter_src_dx;
5862   UINT32 m_blitter_src_y;
5963   UINT32 m_blitter_src_dy;
60   UINT32 *m_fpga_ctrl;
6164   DECLARE_WRITE32_MEMBER(skimaxx_blitter_w);
6265   DECLARE_READ32_MEMBER(skimaxx_blitter_r);
6366   DECLARE_WRITE32_MEMBER(m68k_tms_w);
r14896r14897
8083// Set up blit parameters
8184WRITE32_MEMBER(skimaxx_state::skimaxx_blitter_w)
8285{
83   UINT32 newdata = COMBINE_DATA( &m_blitter_regs[offset] );
86   UINT32 newdata = COMBINE_DATA( &m_blitter_regs.target()[offset] );
8487
8588   switch (offset)
8689   {
r14896r14897
164167static void skimaxx_to_shiftreg(address_space *space, UINT32 address, UINT16 *shiftreg)
165168{
166169   skimaxx_state *state = space->machine().driver_data<skimaxx_state>();
167   memcpy(shiftreg, &state->m_fg_buffer[TOWORD(address)], 512 * sizeof(UINT16));
170   memcpy(shiftreg, &state->m_fg_buffer.target()[TOWORD(address)], 512 * sizeof(UINT16));
168171}
169172
170173static void skimaxx_from_shiftreg(address_space *space, UINT32 address, UINT16 *shiftreg)
171174{
172175   skimaxx_state *state = space->machine().driver_data<skimaxx_state>();
173   memcpy(&state->m_fg_buffer[TOWORD(address)], shiftreg, 512 * sizeof(UINT16));
176   memcpy(&state->m_fg_buffer.target()[TOWORD(address)], shiftreg, 512 * sizeof(UINT16));
174177}
175178
176179
r14896r14897
188191   if (params->rowaddr >= 0x220)
189192   {
190193      UINT32 rowaddr = (params->rowaddr - 0x220);
191      UINT16 *fg = &state->m_fg_buffer[rowaddr << 8];
194      UINT16 *fg = &state->m_fg_buffer.target()[rowaddr << 8];
192195      UINT32 *bg = &state->m_bg_buffer_front[rowaddr/2 * 1024/2];
193196      UINT16 *dest = &bitmap.pix16(scanline);
194197      //int coladdr = params->coladdr;
r14896r14897
375378   AM_RANGE(0x00000000, 0x000100ff) AM_RAM
376379   AM_RANGE(0x00008000, 0x0003ffff) AM_RAM
377380   AM_RANGE(0x00050000, 0x0005ffff) AM_RAM
378   AM_RANGE(0x00220000, 0x003fffff) AM_RAM AM_BASE(m_fg_buffer)
381   AM_RANGE(0x00220000, 0x003fffff) AM_RAM AM_SHARE("fg_buffer")
379382   AM_RANGE(0x02000000, 0x0200000f) AM_RAM
380383   AM_RANGE(0x02100000, 0x0210000f) AM_RAM
381384   AM_RANGE(0x04000000, 0x047fffff) AM_ROM AM_REGION("tmsgfx", 0)
src/mame/drivers/mwarr.c
r14896r14897
5050{
5151public:
5252   mwarr_state(const machine_config &mconfig, device_type type, const char *tag)
53      : driver_device(mconfig, type, tag) { }
53      : driver_device(mconfig, type, tag) ,
54      m_bg_videoram(*this, "bg_videoram"),
55      m_mlow_videoram(*this, "mlow_videoram"),
56      m_mhigh_videoram(*this, "mhigh_videoram"),
57      m_tx_videoram(*this, "tx_videoram"),
58      m_bg_scrollram(*this, "bg_scrollram"),
59      m_mlow_scrollram(*this, "mlow_scrollram"),
60      m_mhigh_scrollram(*this, "mhigh_scrollram"),
61      m_vidattrram(*this, "vidattrram"),
62      m_spriteram(*this, "spriteram"),
63      m_mwarr_ram(*this, "mwarr_ram"){ }
5464
5565   /* memory pointers */
56   UINT16 *m_bg_videoram;
57   UINT16 *m_mlow_videoram;
58   UINT16 *m_mhigh_videoram;
59   UINT16 *m_tx_videoram;
60   UINT16 *m_bg_scrollram;
61   UINT16 *m_mlow_scrollram;
62   UINT16 *m_mhigh_scrollram;
63   UINT16 *m_vidattrram;
64   UINT16 *m_spriteram;
66   required_shared_ptr<UINT16> m_bg_videoram;
67   required_shared_ptr<UINT16> m_mlow_videoram;
68   required_shared_ptr<UINT16> m_mhigh_videoram;
69   required_shared_ptr<UINT16> m_tx_videoram;
70   required_shared_ptr<UINT16> m_bg_scrollram;
71   required_shared_ptr<UINT16> m_mlow_scrollram;
72   required_shared_ptr<UINT16> m_mhigh_scrollram;
73   required_shared_ptr<UINT16> m_vidattrram;
74   required_shared_ptr<UINT16> m_spriteram;
6575//  UINT16 *m_paletteram;    // currently this uses generic palette handling
66   UINT16 *m_mwarr_ram;
76   required_shared_ptr<UINT16> m_mwarr_ram;
6777
6878   /* video-related */
6979   tilemap_t *m_bg_tilemap;
r14896r14897
93103WRITE16_MEMBER(mwarr_state::bg_videoram_w)
94104{
95105
96   COMBINE_DATA(&m_bg_videoram[offset]);
106   COMBINE_DATA(&m_bg_videoram.target()[offset]);
97107   m_bg_tilemap->mark_tile_dirty(offset);
98108}
99109
100110WRITE16_MEMBER(mwarr_state::mlow_videoram_w)
101111{
102112
103   COMBINE_DATA(&m_mlow_videoram[offset]);
113   COMBINE_DATA(&m_mlow_videoram.target()[offset]);
104114   m_mlow_tilemap->mark_tile_dirty(offset);
105115}
106116
107117WRITE16_MEMBER(mwarr_state::mhigh_videoram_w)
108118{
109119
110   COMBINE_DATA(&m_mhigh_videoram[offset]);
120   COMBINE_DATA(&m_mhigh_videoram.target()[offset]);
111121   m_mhigh_tilemap->mark_tile_dirty(offset);
112122}
113123
114124WRITE16_MEMBER(mwarr_state::tx_videoram_w)
115125{
116126
117   COMBINE_DATA(&m_tx_videoram[offset]);
127   COMBINE_DATA(&m_tx_videoram.target()[offset]);
118128   m_tx_tilemap->mark_tile_dirty(offset);
119129}
120130
r14896r14897
147157         /* refresh sprites on screen */
148158         for (i = 0; i < 0x800; i++)
149159         {
150            m_sprites_buffer[i] = m_spriteram[i];
160            m_sprites_buffer[i] = m_spriteram.target()[i];
151161         }
152162         break;
153163
r14896r14897
165175   int i;
166176   double brightness;
167177
168   COMBINE_DATA(&m_mwarr_ram[0x14 / 2]);
178   COMBINE_DATA(&m_mwarr_ram.target()[0x14 / 2]);
169179
170180   brightness = (double)(data & 0xff);
171181   for (i = 0; i < 0x800; i++)
r14896r14897
183193
184194static ADDRESS_MAP_START( mwarr_map, AS_PROGRAM, 16, mwarr_state )
185195   AM_RANGE(0x000000, 0x0fffff) AM_ROM
186   AM_RANGE(0x100000, 0x1007ff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(m_bg_videoram)
187   AM_RANGE(0x100800, 0x100fff) AM_RAM_WRITE(mlow_videoram_w) AM_BASE(m_mlow_videoram)
188   AM_RANGE(0x101000, 0x1017ff) AM_RAM_WRITE(mhigh_videoram_w) AM_BASE(m_mhigh_videoram)
189   AM_RANGE(0x101800, 0x1027ff) AM_RAM_WRITE(tx_videoram_w) AM_BASE(m_tx_videoram)
190   AM_RANGE(0x103000, 0x1033ff) AM_RAM AM_BASE(m_bg_scrollram)
191   AM_RANGE(0x103400, 0x1037ff) AM_RAM AM_BASE(m_mlow_scrollram)
192   AM_RANGE(0x103800, 0x103bff) AM_RAM AM_BASE(m_mhigh_scrollram)
193   AM_RANGE(0x103c00, 0x103fff) AM_RAM AM_BASE(m_vidattrram)
194   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
195   AM_RANGE(0x108000, 0x108fff) AM_RAM AM_BASE(m_spriteram)
196   AM_RANGE(0x100000, 0x1007ff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram")
197   AM_RANGE(0x100800, 0x100fff) AM_RAM_WRITE(mlow_videoram_w) AM_SHARE("mlow_videoram")
198   AM_RANGE(0x101000, 0x1017ff) AM_RAM_WRITE(mhigh_videoram_w) AM_SHARE("mhigh_videoram")
199   AM_RANGE(0x101800, 0x1027ff) AM_RAM_WRITE(tx_videoram_w) AM_SHARE("tx_videoram")
200   AM_RANGE(0x103000, 0x1033ff) AM_RAM AM_SHARE("bg_scrollram")
201   AM_RANGE(0x103400, 0x1037ff) AM_RAM AM_SHARE("mlow_scrollram")
202   AM_RANGE(0x103800, 0x103bff) AM_RAM AM_SHARE("mhigh_scrollram")
203   AM_RANGE(0x103c00, 0x103fff) AM_RAM AM_SHARE("vidattrram")
204   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
205   AM_RANGE(0x108000, 0x108fff) AM_RAM AM_SHARE("spriteram")
196206   AM_RANGE(0x110000, 0x110001) AM_READ_PORT("P1_P2")
197207   AM_RANGE(0x110002, 0x110003) AM_READ_PORT("SYSTEM")
198208   AM_RANGE(0x110004, 0x110005) AM_READ_PORT("DSW")
199209   AM_RANGE(0x110010, 0x110011) AM_DEVWRITE_LEGACY("oki2", oki1_bank_w)
200210   AM_RANGE(0x110014, 0x110015) AM_WRITE(mwarr_brightness_w)
201211   AM_RANGE(0x110016, 0x110017) AM_WRITE(sprites_commands_w)
202   AM_RANGE(0x110000, 0x11ffff) AM_RAM AM_BASE(m_mwarr_ram)
212   AM_RANGE(0x110000, 0x11ffff) AM_RAM AM_SHARE("mwarr_ram")
203213   AM_RANGE(0x180000, 0x180001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff)
204214   AM_RANGE(0x190000, 0x190001) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff)
205215ADDRESS_MAP_END
r14896r14897
342352static TILE_GET_INFO( get_bg_tile_info )
343353{
344354   mwarr_state *state = machine.driver_data<mwarr_state>();
345   int tileno = state->m_bg_videoram[tile_index] & 0x1fff;
346   int colour = (state->m_bg_videoram[tile_index] & 0xe000) >> 13;
355   int tileno = state->m_bg_videoram.target()[tile_index] & 0x1fff;
356   int colour = (state->m_bg_videoram.target()[tile_index] & 0xe000) >> 13;
347357
348358   SET_TILE_INFO(4, tileno, colour, 0);
349359}
r14896r14897
351361static TILE_GET_INFO( get_mlow_tile_info )
352362{
353363   mwarr_state *state = machine.driver_data<mwarr_state>();
354   int tileno = state->m_mlow_videoram[tile_index] & 0x1fff;
355   int colour = (state->m_mlow_videoram[tile_index] & 0xe000) >> 13;
364   int tileno = state->m_mlow_videoram.target()[tile_index] & 0x1fff;
365   int colour = (state->m_mlow_videoram.target()[tile_index] & 0xe000) >> 13;
356366
357367   SET_TILE_INFO(3, tileno, colour, 0);
358368}
r14896r14897
360370static TILE_GET_INFO( get_mhigh_tile_info )
361371{
362372   mwarr_state *state = machine.driver_data<mwarr_state>();
363   int tileno = state->m_mhigh_videoram[tile_index] & 0x1fff;
364   int colour = (state->m_mhigh_videoram[tile_index] & 0xe000) >> 13;
373   int tileno = state->m_mhigh_videoram.target()[tile_index] & 0x1fff;
374   int colour = (state->m_mhigh_videoram.target()[tile_index] & 0xe000) >> 13;
365375
366376   SET_TILE_INFO(2, tileno, colour, 0);
367377}
r14896r14897
369379static TILE_GET_INFO( get_tx_tile_info )
370380{
371381   mwarr_state *state = machine.driver_data<mwarr_state>();
372   int tileno = state->m_tx_videoram[tile_index] & 0x1fff;
373   int colour = (state->m_tx_videoram[tile_index] & 0xe000) >> 13;
382   int tileno = state->m_tx_videoram.target()[tile_index] & 0x1fff;
383   int colour = (state->m_tx_videoram.target()[tile_index] & 0xe000) >> 13;
374384
375385   SET_TILE_INFO(1, tileno, colour, 0);
376386}
r14896r14897
473483
474484   screen.machine().priority_bitmap.fill(0, cliprect);
475485
476   if (BIT(state->m_vidattrram[6], 0))
486   if (BIT(state->m_vidattrram.target()[6], 0))
477487   {
478488      for (i = 0; i < 256; i++)
479         state->m_bg_tilemap->set_scrollx(i, state->m_bg_scrollram[i] + 20);
489         state->m_bg_tilemap->set_scrollx(i, state->m_bg_scrollram.target()[i] + 20);
480490   }
481491   else
482492   {
483493      for (i = 0; i < 256; i++)
484         state->m_bg_tilemap->set_scrollx(i, state->m_bg_scrollram[0] + 19);
494         state->m_bg_tilemap->set_scrollx(i, state->m_bg_scrollram.target()[0] + 19);
485495   }
486496
487   if (BIT(state->m_vidattrram[6], 2))
497   if (BIT(state->m_vidattrram.target()[6], 2))
488498   {
489499      for (i = 0; i < 256; i++)
490         state->m_mlow_tilemap->set_scrollx(i, state->m_mlow_scrollram[i] + 19);
500         state->m_mlow_tilemap->set_scrollx(i, state->m_mlow_scrollram.target()[i] + 19);
491501   }
492502   else
493503   {
494504      for (i = 0; i < 256; i++)
495         state->m_mlow_tilemap->set_scrollx(i, state->m_mlow_scrollram[0] + 19);
505         state->m_mlow_tilemap->set_scrollx(i, state->m_mlow_scrollram.target()[0] + 19);
496506   }
497507
498   if (BIT(state->m_vidattrram[6], 4))
508   if (BIT(state->m_vidattrram.target()[6], 4))
499509   {
500510      for (i = 0; i < 256; i++)
501         state->m_mhigh_tilemap->set_scrollx(i, state->m_mhigh_scrollram[i] + 19);
511         state->m_mhigh_tilemap->set_scrollx(i, state->m_mhigh_scrollram.target()[i] + 19);
502512   }
503513   else
504514   {
505515      for (i = 0; i < 256; i++)
506         state->m_mhigh_tilemap->set_scrollx(i, state->m_mhigh_scrollram[0] + 19);
516         state->m_mhigh_tilemap->set_scrollx(i, state->m_mhigh_scrollram.target()[0] + 19);
507517   }
508518
509   state->m_bg_tilemap->set_scrolly(0, state->m_vidattrram[1] + 1);
510   state->m_mlow_tilemap->set_scrolly(0, state->m_vidattrram[2] + 1);
511   state->m_mhigh_tilemap->set_scrolly(0, state->m_vidattrram[3] + 1);
519   state->m_bg_tilemap->set_scrolly(0, state->m_vidattrram.target()[1] + 1);
520   state->m_mlow_tilemap->set_scrolly(0, state->m_vidattrram.target()[2] + 1);
521   state->m_mhigh_tilemap->set_scrolly(0, state->m_vidattrram.target()[3] + 1);
512522
513   state->m_tx_tilemap->set_scrollx(0, state->m_vidattrram[0] + 16);
514   state->m_tx_tilemap->set_scrolly(0, state->m_vidattrram[4] + 1);
523   state->m_tx_tilemap->set_scrollx(0, state->m_vidattrram.target()[0] + 16);
524   state->m_tx_tilemap->set_scrolly(0, state->m_vidattrram.target()[4] + 1);
515525
516526   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0x01);
517527   state->m_mlow_tilemap->draw(bitmap, cliprect, 0, 0x02);
src/mame/drivers/vroulet.c
r14896r14897
4545{
4646public:
4747   vroulet_state(const machine_config &mconfig, device_type type, const char *tag)
48      : driver_device(mconfig, type, tag) { }
48      : driver_device(mconfig, type, tag) ,
49      m_videoram(*this, "videoram"),
50      m_colorram(*this, "colorram"),
51      m_ball(*this, "ball"){ }
4952
50   UINT8 *m_ball;
51   UINT8 *m_videoram;
52   UINT8 *m_colorram;
53   required_shared_ptr<UINT8> m_videoram;
54   required_shared_ptr<UINT8> m_colorram;
55   required_shared_ptr<UINT8> m_ball;
5356   tilemap_t *m_bg_tilemap;
5457   DECLARE_WRITE8_MEMBER(vroulet_paletteram_w);
5558   DECLARE_WRITE8_MEMBER(vroulet_videoram_w);
r14896r14897
6366WRITE8_MEMBER(vroulet_state::vroulet_paletteram_w)
6467{
6568   /*
66     paletteram_xxxxBBBBGGGGRRRR_be_w
69     paletteram_xxxxBBBBGGGGRRRR_byte_be_w
6770     but... each palette has 8 colors only, not 16 as expected...
6871    */
6972
r14896r14897
8285
8386WRITE8_MEMBER(vroulet_state::vroulet_videoram_w)
8487{
85   m_videoram[offset] = data;
88   m_videoram.target()[offset] = data;
8689   m_bg_tilemap->mark_tile_dirty(offset);
8790}
8891
8992WRITE8_MEMBER(vroulet_state::vroulet_colorram_w)
9093{
91   m_colorram[offset] = data;
94   m_colorram.target()[offset] = data;
9295   m_bg_tilemap->mark_tile_dirty(offset);
9396}
9497
9598static TILE_GET_INFO( get_bg_tile_info )
9699{
97100   vroulet_state *state = machine.driver_data<vroulet_state>();
98   int attr = state->m_colorram[tile_index];
99   int code = state->m_videoram[tile_index] + ((attr & 0xc0) << 2);
101   int attr = state->m_colorram.target()[tile_index];
102   int code = state->m_videoram.target()[tile_index] + ((attr & 0xc0) << 2);
100103   int color = attr & 0x1f;
101104
102105   SET_TILE_INFO(0, code, color, 0);
r14896r14897
114117   vroulet_state *state = screen.machine().driver_data<vroulet_state>();
115118   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
116119   drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[0], 0x320, 1, 0, 0,
117      state->m_ball[1], state->m_ball[0] - 12, 0);
120      state->m_ball.target()[1], state->m_ball.target()[0] - 12, 0);
118121   return 0;
119122}
120123
r14896r14897
124127   AM_RANGE(0x0000, 0x5fff) AM_ROM
125128   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_SHARE("nvram")
126129   AM_RANGE(0x8000, 0x8000) AM_NOP
127   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(vroulet_videoram_w) AM_BASE(m_videoram)
128   AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(vroulet_colorram_w) AM_BASE(m_colorram)
129   AM_RANGE(0xa000, 0xa001) AM_RAM AM_BASE(m_ball)
130   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(vroulet_videoram_w) AM_SHARE("videoram")
131   AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(vroulet_colorram_w) AM_SHARE("colorram")
132   AM_RANGE(0xa000, 0xa001) AM_RAM AM_SHARE("ball")
130133   AM_RANGE(0xb000, 0xb0ff) AM_WRITE(vroulet_paletteram_w) AM_SHARE("paletteram")
131134   AM_RANGE(0xc000, 0xc000) AM_NOP
132135ADDRESS_MAP_END
src/mame/drivers/coinmvga.c
r14896r14897
223223{
224224public:
225225   coinmvga_state(const machine_config &mconfig, device_type type, const char *tag)
226      : driver_device(mconfig, type, tag) { }
226      : driver_device(mconfig, type, tag) ,
227      m_vram(*this, "vram"){ }
227228
228   UINT16 *m_vram;
229   required_shared_ptr<UINT16> m_vram;
229230   struct { int r,g,b,offs,offs_internal; } m_bgpal, m_fgpal;
230231   DECLARE_WRITE8_MEMBER(debug_w);
231232   DECLARE_WRITE16_MEMBER(ramdac_bg_w);
r14896r14897
257258   {
258259      for (x=0;x<128;x++)
259260      {
260         int tile = state->m_vram[count];
261         int tile = state->m_vram.target()[count];
261262         //int colour = tile>>12;
262263         drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*8);
263264
r14896r14897
360361
361362//  AM_RANGE(0x0a0000, 0x0fffff) AM_RAM
362363//  AM_RANGE(0x100000, 0x1fffff) AM_RAM //colorama
363   AM_RANGE(0x210000, 0x21ffff) AM_RAM AM_BASE(m_vram)
364   AM_RANGE(0x210000, 0x21ffff) AM_RAM AM_SHARE("vram")
364365//  AM_RANGE(0x40746e, 0x40746f) AM_READ(test_r) AM_WRITENOP //touch screen related, colorama
365366//  AM_RANGE(0x403afa, 0x403afb) AM_READ(test_r) AM_WRITENOP //touch screen related, cmrltv75
366367   AM_RANGE(0x400000, 0x40ffff) AM_RAM
src/mame/drivers/twins.c
r14896r14897
5757{
5858public:
5959   twins_state(const machine_config &mconfig, device_type type, const char *tag)
60      : driver_device(mconfig, type, tag) { }
60      : driver_device(mconfig, type, tag) ,
61      m_videoram(*this, "videoram"){ }
6162
62   UINT16 *m_videoram;
63   required_shared_ptr<UINT16> m_videoram;
6364   UINT16 *m_pal;
6465   UINT16 m_paloff;
6566   DECLARE_READ16_MEMBER(twins_port4_r);
r14896r14897
9697
9798static ADDRESS_MAP_START( twins_map, AS_PROGRAM, 16, twins_state )
9899   AM_RANGE(0x00000, 0x0ffff) AM_RAM
99   AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_BASE(m_videoram)
100   AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_SHARE("videoram")
100101   AM_RANGE(0x20000, 0xfffff) AM_ROM
101102ADDRESS_MAP_END
102103
r14896r14897
145146   {
146147      for(x=0;x<xxx;x++)
147148      {
148         bitmap.pix16(y, x) = ((UINT8 *)state->m_videoram)[BYTE_XOR_LE(count)];
149         bitmap.pix16(y, x) = ((UINT8 *)state->m_videoram.target())[BYTE_XOR_LE(count)];
149150         count++;
150151      }
151152   }
r14896r14897
244245   {
245246      for(x=0;x<xxx;x++)
246247      {
247         bitmap.pix16(y, x) = ((UINT8 *)state->m_videoram)[BYTE_XOR_LE(count)];
248         bitmap.pix16(y, x) = ((UINT8 *)state->m_videoram.target())[BYTE_XOR_LE(count)];
248249         count++;
249250      }
250251   }
src/mame/drivers/powerins.c
r14896r14897
6262WRITE16_MEMBER(powerins_state::powerins_soundlatch_w)
6363{
6464   if (ACCESSING_BITS_0_7)
65      soundlatch_w(space, 0, data & 0xff);
65      soundlatch_byte_w(space, 0, data & 0xff);
6666}
6767
6868READ8_MEMBER(powerins_state::powerinb_fake_ym2203_r)
r14896r14897
114114static ADDRESS_MAP_START( powerins_sound_map, AS_PROGRAM, 8, powerins_state )
115115   AM_RANGE(0x0000, 0xbfff) AM_ROM
116116   AM_RANGE(0xc000, 0xdfff) AM_RAM
117   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
117   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
118118//  AM_RANGE(0xe000, 0xe000) AM_WRITENOP // ? written only once ?
119119//  AM_RANGE(0xe001, 0xe001) AM_WRITENOP // ?
120120ADDRESS_MAP_END
src/mame/drivers/cultures.c
r14896r14897
1818{
1919public:
2020   cultures_state(const machine_config &mconfig, device_type type, const char *tag)
21      : driver_device(mconfig, type, tag) { }
21      : driver_device(mconfig, type, tag) ,
22      m_bg0_videoram(*this, "bg0_videoram"),
23      m_bg0_regs_x(*this, "bg0_regs_x"),
24      m_bg0_regs_y(*this, "bg0_regs_y"),
25      m_bg1_regs_x(*this, "bg1_regs_x"),
26      m_bg1_regs_y(*this, "bg1_regs_y"),
27      m_bg2_regs_x(*this, "bg2_regs_x"),
28      m_bg2_regs_y(*this, "bg2_regs_y"){ }
2229
30   UINT8     m_paletteram[0x4000];
2331   /* memory pointers */
24   UINT8 *   m_bg0_videoram;
25   UINT8     m_paletteram[0x4000];
26   UINT8 *   m_bg0_regs_x;
27   UINT8 *   m_bg1_regs_x;
28   UINT8 *   m_bg2_regs_x;
29   UINT8 *   m_bg0_regs_y;
30   UINT8 *   m_bg1_regs_y;
31   UINT8 *   m_bg2_regs_y;
32   required_shared_ptr<UINT8> m_bg0_videoram;
33   required_shared_ptr<UINT8> m_bg0_regs_x;
34   required_shared_ptr<UINT8> m_bg0_regs_y;
35   required_shared_ptr<UINT8> m_bg1_regs_x;
36   required_shared_ptr<UINT8> m_bg1_regs_y;
37   required_shared_ptr<UINT8> m_bg2_regs_x;
38   required_shared_ptr<UINT8> m_bg2_regs_y;
3239
3340   /* video-related */
3441   tilemap_t  *m_bg0_tilemap;
r14896r14897
6673static TILE_GET_INFO( get_bg0_tile_info )
6774{
6875   cultures_state *state = machine.driver_data<cultures_state>();
69   int code = state->m_bg0_videoram[tile_index * 2] + (state->m_bg0_videoram[tile_index * 2 + 1] << 8);
76   int code = state->m_bg0_videoram.target()[tile_index * 2] + (state->m_bg0_videoram.target()[tile_index * 2 + 1] << 8);
7077   SET_TILE_INFO(0, code, code >> 12, 0);
7178}
7279
r14896r14897
95102   int attr;
96103
97104   // tilemaps attributes
98   attr = (state->m_bg0_regs_x[3] & 1 ? TILEMAP_FLIPX : 0) | (state->m_bg0_regs_y[3] & 1 ? TILEMAP_FLIPY : 0);
105   attr = (state->m_bg0_regs_x.target()[3] & 1 ? TILEMAP_FLIPX : 0) | (state->m_bg0_regs_y.target()[3] & 1 ? TILEMAP_FLIPY : 0);
99106   state->m_bg0_tilemap->set_flip(attr);
100107
101   attr = (state->m_bg1_regs_x[3] & 1 ? TILEMAP_FLIPX : 0) | (state->m_bg1_regs_y[3] & 1 ? TILEMAP_FLIPY : 0);
108   attr = (state->m_bg1_regs_x.target()[3] & 1 ? TILEMAP_FLIPX : 0) | (state->m_bg1_regs_y.target()[3] & 1 ? TILEMAP_FLIPY : 0);
102109   state->m_bg1_tilemap->set_flip(attr);
103110
104   attr = (state->m_bg2_regs_x[3] & 1 ? TILEMAP_FLIPX : 0) | (state->m_bg2_regs_y[3] & 1 ? TILEMAP_FLIPY : 0);
111   attr = (state->m_bg2_regs_x.target()[3] & 1 ? TILEMAP_FLIPX : 0) | (state->m_bg2_regs_y.target()[3] & 1 ? TILEMAP_FLIPY : 0);
105112   state->m_bg2_tilemap->set_flip(attr);
106113
107114   // tilemaps scrolls
108   state->m_bg0_tilemap->set_scrollx(0, (state->m_bg0_regs_x[2] << 8) + state->m_bg0_regs_x[0]);
109   state->m_bg1_tilemap->set_scrollx(0, (state->m_bg1_regs_x[2] << 8) + state->m_bg1_regs_x[0]);
110   state->m_bg2_tilemap->set_scrollx(0, (state->m_bg2_regs_x[2] << 8) + state->m_bg2_regs_x[0]);
111   state->m_bg0_tilemap->set_scrolly(0, (state->m_bg0_regs_y[2] << 8) + state->m_bg0_regs_y[0]);
112   state->m_bg1_tilemap->set_scrolly(0, (state->m_bg1_regs_y[2] << 8) + state->m_bg1_regs_y[0]);
113   state->m_bg2_tilemap->set_scrolly(0, (state->m_bg2_regs_y[2] << 8) + state->m_bg2_regs_y[0]);
115   state->m_bg0_tilemap->set_scrollx(0, (state->m_bg0_regs_x.target()[2] << 8) + state->m_bg0_regs_x.target()[0]);
116   state->m_bg1_tilemap->set_scrollx(0, (state->m_bg1_regs_x.target()[2] << 8) + state->m_bg1_regs_x.target()[0]);
117   state->m_bg2_tilemap->set_scrollx(0, (state->m_bg2_regs_x.target()[2] << 8) + state->m_bg2_regs_x.target()[0]);
118   state->m_bg0_tilemap->set_scrolly(0, (state->m_bg0_regs_y.target()[2] << 8) + state->m_bg0_regs_y.target()[0]);
119   state->m_bg1_tilemap->set_scrolly(0, (state->m_bg1_regs_y.target()[2] << 8) + state->m_bg1_regs_y.target()[0]);
120   state->m_bg2_tilemap->set_scrolly(0, (state->m_bg2_regs_y.target()[2] << 8) + state->m_bg2_regs_y.target()[0]);
114121
115122   state->m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
116123   state->m_bg0_tilemap->draw(bitmap, cliprect, 0, 0);
r14896r14897
142149   }
143150   else
144151   {
145      m_bg0_videoram[offset] = data;
152      m_bg0_videoram.target()[offset] = data;
146153      m_bg0_tilemap->mark_tile_dirty(offset >> 1);
147154   }
148155}
r14896r14897
183190static ADDRESS_MAP_START( cultures_map, AS_PROGRAM, 8, cultures_state )
184191   AM_RANGE(0x0000, 0x3fff) AM_ROM
185192   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
186   AM_RANGE(0x8000, 0xbfff) AM_RAM_WRITE(bg0_videoram_w) AM_BASE(m_bg0_videoram)
193   AM_RANGE(0x8000, 0xbfff) AM_RAM_WRITE(bg0_videoram_w) AM_SHARE("bg0_videoram")
187194   AM_RANGE(0xc000, 0xdfff) AM_RAM
188195   AM_RANGE(0xf000, 0xffff) AM_RAM
189196ADDRESS_MAP_END
r14896r14897
192199   ADDRESS_MAP_GLOBAL_MASK(0xff)
193200   AM_RANGE(0x00, 0x03) AM_RAM
194201   AM_RANGE(0x10, 0x13) AM_RAM
195   AM_RANGE(0x20, 0x23) AM_RAM AM_BASE(m_bg0_regs_x)
196   AM_RANGE(0x30, 0x33) AM_RAM AM_BASE(m_bg0_regs_y)
197   AM_RANGE(0x40, 0x43) AM_RAM AM_BASE(m_bg1_regs_x)
198   AM_RANGE(0x50, 0x53) AM_RAM AM_BASE(m_bg1_regs_y)
199   AM_RANGE(0x60, 0x63) AM_RAM AM_BASE(m_bg2_regs_x)
200   AM_RANGE(0x70, 0x73) AM_RAM AM_BASE(m_bg2_regs_y)
202   AM_RANGE(0x20, 0x23) AM_RAM AM_SHARE("bg0_regs_x")
203   AM_RANGE(0x30, 0x33) AM_RAM AM_SHARE("bg0_regs_y")
204   AM_RANGE(0x40, 0x43) AM_RAM AM_SHARE("bg1_regs_x")
205   AM_RANGE(0x50, 0x53) AM_RAM AM_SHARE("bg1_regs_y")
206   AM_RANGE(0x60, 0x63) AM_RAM AM_SHARE("bg2_regs_x")
207   AM_RANGE(0x70, 0x73) AM_RAM AM_SHARE("bg2_regs_y")
201208   AM_RANGE(0x80, 0x80) AM_WRITE(cpu_bankswitch_w)
202209   AM_RANGE(0x90, 0x90) AM_WRITE(misc_w)
203210   AM_RANGE(0xa0, 0xa0) AM_WRITE(bg_bank_w)
src/mame/drivers/5clown.c
r14896r14897
455455{
456456public:
457457   _5clown_state(const machine_config &mconfig, device_type type, const char *tag)
458      : driver_device(mconfig, type, tag) { }
458      : driver_device(mconfig, type, tag) ,
459      m_videoram(*this, "videoram"),
460      m_colorram(*this, "colorram"){ }
459461
460462   UINT8 m_main_latch_d800;
461463   UINT8 m_snd_latch_0800;
462464   UINT8 m_snd_latch_0a02;
463465   UINT8 m_ay8910_addr;
464466   device_t *m_ay8910;
465   UINT8 *m_videoram;
466   UINT8 *m_colorram;
467   required_shared_ptr<UINT8> m_videoram;
468   required_shared_ptr<UINT8> m_colorram;
467469   tilemap_t *m_bg_tilemap;
468470   int m_mux_data;
469471   DECLARE_WRITE8_MEMBER(fclown_videoram_w);
r14896r14897
486488
487489WRITE8_MEMBER(_5clown_state::fclown_videoram_w)
488490{
489   m_videoram[offset] = data;
491   m_videoram.target()[offset] = data;
490492   m_bg_tilemap->mark_tile_dirty(offset);
491493}
492494
493495WRITE8_MEMBER(_5clown_state::fclown_colorram_w)
494496{
495   m_colorram[offset] = data;
497   m_colorram.target()[offset] = data;
496498   m_bg_tilemap->mark_tile_dirty(offset);
497499}
498500
r14896r14897
510512    x--- ----   Extra color for 7's.
511513*/
512514
513   int attr = state->m_colorram[tile_index];
514   int code = ((attr & 0x01) << 8) | ((attr & 0x40) << 2) | state->m_videoram[tile_index];   /* bit 8 for extended char set */
515   int attr = state->m_colorram.target()[tile_index];
516   int code = ((attr & 0x01) << 8) | ((attr & 0x40) << 2) | state->m_videoram.target()[tile_index];   /* bit 8 for extended char set */
515517   int bank = (attr & 0x02) >> 1;                                       /* bit 1 switch the gfx banks */
516518   int color = (attr & 0x3c) >> 2 | ((attr & 0x80) >> 3);                     /* bits 2-3-4-5-7 for color */
517519
r14896r14897
723725   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
724726   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
725727   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
726   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(fclown_videoram_w) AM_BASE(m_videoram)   /* Init'ed at $2042 */
727   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(fclown_colorram_w) AM_BASE(m_colorram)   /* Init'ed at $2054 */
728   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(fclown_videoram_w) AM_SHARE("videoram")   /* Init'ed at $2042 */
729   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(fclown_colorram_w) AM_SHARE("colorram")   /* Init'ed at $2054 */
728730   AM_RANGE(0x2000, 0x7fff) AM_ROM               /* ROM space */
729731
730732   AM_RANGE(0xc048, 0xc048) AM_WRITE(cpu_c048_w )
src/mame/drivers/tgtpanic.c
r14896r14897
1717{
1818public:
1919   tgtpanic_state(const machine_config &mconfig, device_type type, const char *tag)
20      : driver_device(mconfig, type, tag) { }
20      : driver_device(mconfig, type, tag) ,
21      m_ram(*this, "ram"){ }
2122
22   UINT8 *m_ram;
23   required_shared_ptr<UINT8> m_ram;
2324   UINT8 m_color;
2425   DECLARE_WRITE8_MEMBER(color_w);
2526};
r14896r14897
4546
4647   for (offs = 0; offs < 0x2000; ++offs)
4748   {
48      UINT8 val = state->m_ram[offs];
49      UINT8 val = state->m_ram.target()[offs];
4950
5051      y = (offs & 0x7f) << 1;
5152      x = (offs >> 7) << 2;
r14896r14897
8283
8384static ADDRESS_MAP_START( prg_map, AS_PROGRAM, 8, tgtpanic_state )
8485   AM_RANGE(0x0000, 0x7fff) AM_ROM
85   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(m_ram)
86   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_SHARE("ram")
8687ADDRESS_MAP_END
8788
8889static ADDRESS_MAP_START( io_map, AS_IO, 8, tgtpanic_state )
src/mame/drivers/exedexes.c
r14896r14897
3535   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2")
3636   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW0")
3737   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW1")
38   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
38   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_byte_w)
3939   AM_RANGE(0xc804, 0xc804) AM_WRITE(exedexes_c804_w)                        /* coin counters + text layer enable */
4040   AM_RANGE(0xc806, 0xc806) AM_WRITENOP                                 /* Watchdog ?? */
4141   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(exedexes_videoram_w) AM_BASE(m_videoram)   /* Video RAM */
r14896r14897
5353static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, exedexes_state )
5454   AM_RANGE(0x0000, 0x3fff) AM_ROM
5555   AM_RANGE(0x4000, 0x47ff) AM_RAM
56   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
56   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
5757   AM_RANGE(0x8000, 0x8001) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
5858   AM_RANGE(0x8002, 0x8002) AM_DEVWRITE_LEGACY("sn1", sn76496_w)
5959   AM_RANGE(0x8003, 0x8003) AM_DEVWRITE_LEGACY("sn2", sn76496_w)
src/mame/drivers/jedi.c
r14896r14897
270270   AM_RANGE(0x0c00, 0x0c00) AM_MIRROR(0x03fe) AM_READ_PORT("0c00") AM_WRITENOP
271271   AM_RANGE(0x0c01, 0x0c01) AM_MIRROR(0x03fe) AM_READ_PORT("0c01") AM_WRITENOP
272272   AM_RANGE(0x1000, 0x13ff) AM_NOP
273   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x03ff) AM_READ_LEGACY(jedi_audio_ack_latch_r) AM_WRITENOP
273   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x03ff) AM_READ(jedi_audio_ack_latch_r) AM_WRITENOP
274274   AM_RANGE(0x1800, 0x1800) AM_MIRROR(0x03ff) AM_READ(a2d_data_r) AM_WRITENOP
275275   AM_RANGE(0x1c00, 0x1c01) AM_MIRROR(0x007f) AM_READNOP AM_WRITE(nvram_enable_w)
276276   AM_RANGE(0x1c80, 0x1c82) AM_MIRROR(0x0078) AM_READNOP AM_WRITE(a2d_select_w)
r14896r14897
282282   AM_RANGE(0x1e82, 0x1e83) AM_MIRROR(0x0078) AM_NOP   /* write: LED control - not used */
283283   AM_RANGE(0x1e84, 0x1e84) AM_MIRROR(0x0078) AM_READNOP AM_WRITEONLY AM_BASE(m_foreground_bank)
284284   AM_RANGE(0x1e85, 0x1e85) AM_MIRROR(0x0078) AM_NOP
285   AM_RANGE(0x1e86, 0x1e86) AM_MIRROR(0x0078) AM_READNOP AM_WRITE_LEGACY(jedi_audio_reset_w)
285   AM_RANGE(0x1e86, 0x1e86) AM_MIRROR(0x0078) AM_READNOP AM_WRITE(jedi_audio_reset_w)
286286   AM_RANGE(0x1e87, 0x1e87) AM_MIRROR(0x0078) AM_READNOP AM_WRITEONLY AM_BASE(m_video_off)
287   AM_RANGE(0x1f00, 0x1f00) AM_MIRROR(0x007f) AM_READNOP AM_WRITE_LEGACY(jedi_audio_latch_w)
287   AM_RANGE(0x1f00, 0x1f00) AM_MIRROR(0x007f) AM_READNOP AM_WRITE(jedi_audio_latch_w)
288288   AM_RANGE(0x1f80, 0x1f80) AM_MIRROR(0x007f) AM_READNOP AM_WRITE(rom_banksel_w)
289289   AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE(m_backgroundram)
290290   AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE(m_paletteram)
src/mame/drivers/seta2.c
r14896r14897
118118
119119***************************************************************************/
120120
121static WRITE16_HANDLER( seta2_sound_bank_w )
121WRITE16_MEMBER(seta2_state::seta2_sound_bank_w)
122122{
123123   if (ACCESSING_BITS_0_7)
124124   {
125      UINT8 *ROM = space->machine().region( "x1snd" )->base();
126      int banks = (space->machine().region( "x1snd" )->bytes() - 0x100000) / 0x20000;
125      UINT8 *ROM = machine().region( "x1snd" )->base();
126      int banks = (machine().region( "x1snd" )->bytes() - 0x100000) / 0x20000;
127127      if (data >= banks)
128128      {
129         logerror("CPU #0 PC %06X: invalid sound bank %04X\n",cpu_get_pc(&space->device()),data);
129         logerror("CPU #0 PC %06X: invalid sound bank %04X\n",cpu_get_pc(&space.device()),data);
130130         data %= banks;
131131      }
132132      memcpy(ROM + offset * 0x20000, ROM + 0x100000 + data * 0x20000, 0x20000);
r14896r14897
138138                                Guardians
139139***************************************************************************/
140140
141static WRITE16_HANDLER( grdians_lockout_w )
141WRITE16_MEMBER(seta2_state::grdians_lockout_w)
142142{
143143   if (ACCESSING_BITS_0_7)
144144   {
145145      // initially 0, then either $25 (coin 1) or $2a (coin 2)
146      coin_counter_w(space->machine(), 0,data & 0x01);   // or 0x04
147      coin_counter_w(space->machine(), 1,data & 0x02);   // or 0x08
146      coin_counter_w(machine(), 0,data & 0x01);   // or 0x04
147      coin_counter_w(machine(), 1,data & 0x02);   // or 0x08
148148   }
149149//  popmessage("%04X", data & 0xffff);
150150}
r14896r14897
159159   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P2")               // P2
160160   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("SYSTEM")            // Coins
161161   AM_RANGE(0x70000c, 0x70000d) AM_READ(watchdog_reset16_r)      // Watchdog
162   AM_RANGE(0x800000, 0x800001) AM_WRITE_LEGACY(grdians_lockout_w)
162   AM_RANGE(0x800000, 0x800001) AM_WRITE(grdians_lockout_w)
163163   AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
164164   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites
165   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
165   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
166166   AM_RANGE(0xc50000, 0xc5ffff) AM_RAM                        // cleared
167167   AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_BASE(m_vregs)   // Video Registers
168   AM_RANGE(0xe00010, 0xe0001f) AM_WRITE_LEGACY(seta2_sound_bank_w)      // Samples Banks
168   AM_RANGE(0xe00010, 0xe0001f) AM_WRITE(seta2_sound_bank_w)      // Samples Banks
169169   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)   // TMP68301 Registers
170170ADDRESS_MAP_END
171171
r14896r14897
199199   AM_RANGE(0x700008, 0x700009) AM_READ_PORT("IN0")            // P1
200200   AM_RANGE(0x70000a, 0x70000b) AM_READ_PORT("IN1")            // P2
201201   AM_RANGE(0x70000c, 0x70000d) AM_WRITE(watchdog_reset16_w)
202   AM_RANGE(0x800000, 0x800001) AM_WRITE_LEGACY(grdians_lockout_w)
202   AM_RANGE(0x800000, 0x800001) AM_WRITE(grdians_lockout_w)
203203   AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
204204   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
205   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
205   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
206206   AM_RANGE(0xc50000, 0xc5ffff) AM_RAM                        // cleared
207207   AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_BASE(m_vregs)   // Video Registers
208   AM_RANGE(0xe00010, 0xe0001f) AM_WRITE_LEGACY(seta2_sound_bank_w)      // Samples Banks
208   AM_RANGE(0xe00010, 0xe0001f) AM_WRITE(seta2_sound_bank_w)      // Samples Banks
209209   AM_RANGE(0xfffd0a, 0xfffd0b) AM_DEVREADWRITE_LEGACY("eeprom", gundamex_eeprom_r,gundamex_eeprom_w)   // parallel data register
210210   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)   // TMP68301 Registers
211211ADDRESS_MAP_END
r14896r14897
215215                      Wakakusamonogatari Mahjong Yonshimai
216216***************************************************************************/
217217
218static READ16_HANDLER( mj4simai_p1_r )
218READ16_MEMBER(seta2_state::mj4simai_p1_r)
219219{
220   seta2_state *state = space->machine().driver_data<seta2_state>();
221220
222   switch (state->m_keyboard_row)
221   switch (m_keyboard_row)
223222   {
224      case 0x01: return input_port_read(space->machine(), "P1_KEY0");
225      case 0x02: return input_port_read(space->machine(), "P1_KEY1");
226      case 0x04: return input_port_read(space->machine(), "P1_KEY2");
227      case 0x08: return input_port_read(space->machine(), "P1_KEY3");
228      case 0x10: return input_port_read(space->machine(), "P1_KEY4");
229      default:   logerror("p1_r with keyboard_row = %02x\n", state->m_keyboard_row); return 0xffff;
223      case 0x01: return input_port_read(machine(), "P1_KEY0");
224      case 0x02: return input_port_read(machine(), "P1_KEY1");
225      case 0x04: return input_port_read(machine(), "P1_KEY2");
226      case 0x08: return input_port_read(machine(), "P1_KEY3");
227      case 0x10: return input_port_read(machine(), "P1_KEY4");
228      default:   logerror("p1_r with keyboard_row = %02x\n", m_keyboard_row); return 0xffff;
230229   }
231230}
232231
233static READ16_HANDLER( mj4simai_p2_r )
232READ16_MEMBER(seta2_state::mj4simai_p2_r)
234233{
235   seta2_state *state = space->machine().driver_data<seta2_state>();
236234
237   switch (state->m_keyboard_row)
235   switch (m_keyboard_row)
238236   {
239      case 0x01: return input_port_read(space->machine(), "P2_KEY0");
240      case 0x02: return input_port_read(space->machine(), "P2_KEY1");
241      case 0x04: return input_port_read(space->machine(), "P2_KEY2");
242      case 0x08: return input_port_read(space->machine(), "P2_KEY3");
243      case 0x10: return input_port_read(space->machine(), "P2_KEY4");
244      default:   logerror("p2_r with keyboard_row = %02x\n", state->m_keyboard_row); return 0xffff;
237      case 0x01: return input_port_read(machine(), "P2_KEY0");
238      case 0x02: return input_port_read(machine(), "P2_KEY1");
239      case 0x04: return input_port_read(machine(), "P2_KEY2");
240      case 0x08: return input_port_read(machine(), "P2_KEY3");
241      case 0x10: return input_port_read(machine(), "P2_KEY4");
242      default:   logerror("p2_r with keyboard_row = %02x\n", m_keyboard_row); return 0xffff;
245243   }
246244}
247245
248static WRITE16_HANDLER( mj4simai_keyboard_w )
246WRITE16_MEMBER(seta2_state::mj4simai_keyboard_w)
249247{
250   seta2_state *state = space->machine().driver_data<seta2_state>();
251248
252249   if (ACCESSING_BITS_0_7)
253      state->m_keyboard_row = data & 0xff;
250      m_keyboard_row = data & 0xff;
254251}
255252
256253static ADDRESS_MAP_START( mj4simai_map, AS_PROGRAM, 16, seta2_state )
257254   AM_RANGE(0x000000, 0x1fffff) AM_ROM                        // ROM
258255   AM_RANGE(0x200000, 0x20ffff) AM_RAM                        // RAM
259   AM_RANGE(0x600000, 0x600001) AM_READ_LEGACY(mj4simai_p1_r)            // P1
260   AM_RANGE(0x600002, 0x600003) AM_READ_LEGACY(mj4simai_p2_r)            // P2
261   AM_RANGE(0x600004, 0x600005) AM_WRITE_LEGACY(mj4simai_keyboard_w)      // select keyboard row to read
256   AM_RANGE(0x600000, 0x600001) AM_READ(mj4simai_p1_r)            // P1
257   AM_RANGE(0x600002, 0x600003) AM_READ(mj4simai_p2_r)            // P2
258   AM_RANGE(0x600004, 0x600005) AM_WRITE(mj4simai_keyboard_w)      // select keyboard row to read
262259   AM_RANGE(0x600006, 0x600007) AM_READ(watchdog_reset16_r)      // Watchdog
263260   AM_RANGE(0x600100, 0x600101) AM_READ_PORT("SYSTEM")            //
264261   AM_RANGE(0x600200, 0x600201) AM_WRITENOP                  // Leds? Coins?
265262   AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1")            // DSW 1
266263   AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW2")            // DSW 2
267   AM_RANGE(0x600300, 0x60030f) AM_WRITE_LEGACY(seta2_sound_bank_w)      // Samples Banks
264   AM_RANGE(0x600300, 0x60030f) AM_WRITE(seta2_sound_bank_w)      // Samples Banks
268265   AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
269266   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
270   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
267   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
271268   AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_BASE(m_vregs)   // Video Registers
272269   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)   // TMP68301 Registers
273270ADDRESS_MAP_END
r14896r14897
287284   AM_RANGE(0x700200, 0x700201) AM_WRITENOP                  // Leds? Coins?
288285   AM_RANGE(0x700300, 0x700301) AM_READ_PORT("DSW1")            // DSW 1
289286   AM_RANGE(0x700302, 0x700303) AM_READ_PORT("DSW2")            // DSW 2
290   AM_RANGE(0x700310, 0x70031f) AM_WRITE_LEGACY(seta2_sound_bank_w)      // Samples Banks
287   AM_RANGE(0x700310, 0x70031f) AM_WRITE(seta2_sound_bank_w)      // Samples Banks
291288   AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
292289   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites
293   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
290   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
294291   AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_BASE(m_vregs)            // Video Registers
295292   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)      // TMP68301 Registers
296293ADDRESS_MAP_END
r14896r14897
310307   AM_RANGE(0x600200, 0x600201) AM_WRITENOP                  // Leds? Coins?
311308   AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1")            // DSW 1
312309   AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW2")            // DSW 2
313   AM_RANGE(0x600300, 0x60030f) AM_WRITE_LEGACY(seta2_sound_bank_w)      // Samples Banks
310   AM_RANGE(0x600300, 0x60030f) AM_WRITE(seta2_sound_bank_w)      // Samples Banks
314311   AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
315312   AM_RANGE(0xd00000, 0xd3ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites
316   AM_RANGE(0xd40000, 0xd4ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
313   AM_RANGE(0xd40000, 0xd4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
317314   AM_RANGE(0xd60000, 0xd6003f) AM_WRITE(seta2_vregs_w) AM_BASE(m_vregs)         // Video Registers
318315   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)      // TMP68301 Registers
319316ADDRESS_MAP_END
r14896r14897
325322
326323/*  The game checks for a specific value read from the ROM region.
327324    The offset to use is stored in RAM at address 0x20BA16 */
328static READ16_HANDLER( pzlbowl_protection_r )
325READ16_MEMBER(seta2_state::pzlbowl_protection_r)
329326{
330   UINT32 address = (space->read_word(0x20ba16) << 16) | space->read_word(0x20ba18);
331   return space->machine().region("maincpu")->base()[address - 2];
327   UINT32 address = (space.read_word(0x20ba16) << 16) | space.read_word(0x20ba18);
328   return machine().region("maincpu")->base()[address - 2];
332329}
333330
334static READ16_HANDLER( pzlbowl_coins_r )
331READ16_MEMBER(seta2_state::pzlbowl_coins_r)
335332{
336   return input_port_read(space->machine(), "SYSTEM") | (space->machine().rand() & 0x80 );
333   return input_port_read(machine(), "SYSTEM") | (machine().rand() & 0x80 );
337334}
338335
339static WRITE16_HANDLER( pzlbowl_coin_counter_w )
336WRITE16_MEMBER(seta2_state::pzlbowl_coin_counter_w)
340337{
341338   if (ACCESSING_BITS_0_7)
342339   {
343      coin_counter_w(space->machine(), 0,data & 0x10);
344      coin_counter_w(space->machine(), 1,data & 0x20);
340      coin_counter_w(machine(), 0,data & 0x10);
341      coin_counter_w(machine(), 1,data & 0x20);
345342   }
346343}
347344
r14896r14897
350347   AM_RANGE(0x200000, 0x20ffff) AM_RAM                           // RAM
351348   AM_RANGE(0x400300, 0x400301) AM_READ_PORT("DSW1")               // DSW 1
352349   AM_RANGE(0x400302, 0x400303) AM_READ_PORT("DSW2")               // DSW 2
353   AM_RANGE(0x400300, 0x40030f) AM_WRITE_LEGACY(seta2_sound_bank_w)         // Samples Banks
350   AM_RANGE(0x400300, 0x40030f) AM_WRITE(seta2_sound_bank_w)         // Samples Banks
354351   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")                  // P1
355352   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")                  // P2
356   AM_RANGE(0x500004, 0x500005) AM_READWRITE_LEGACY(pzlbowl_coins_r,pzlbowl_coin_counter_w)   // Coins + Protection?
353   AM_RANGE(0x500004, 0x500005) AM_READWRITE(pzlbowl_coins_r,pzlbowl_coin_counter_w)   // Coins + Protection?
357354   AM_RANGE(0x500006, 0x500007) AM_READ(watchdog_reset16_r)         // Watchdog
358   AM_RANGE(0x700000, 0x700001) AM_READ_LEGACY(pzlbowl_protection_r)         // Protection
355   AM_RANGE(0x700000, 0x700001) AM_READ(pzlbowl_protection_r)         // Protection
359356   AM_RANGE(0x800000, 0x83ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites
360   AM_RANGE(0x840000, 0x84ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
357   AM_RANGE(0x840000, 0x84ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
361358   AM_RANGE(0x860000, 0x86003f) AM_WRITE(seta2_vregs_w) AM_BASE(m_vregs)            // Video Registers
362359   AM_RANGE(0x900000, 0x903fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
363360   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)      // TMP68301 Registers
r14896r14897
375372   AM_RANGE(0x300000, 0x30ffff) AM_RAM                        // RAM
376373   AM_RANGE(0x500300, 0x500301) AM_READ_PORT("DSW1")            // DSW 1
377374   AM_RANGE(0x500302, 0x500303) AM_READ_PORT("DSW2")            // DSW 2
378   AM_RANGE(0x500300, 0x50030f) AM_WRITE_LEGACY(seta2_sound_bank_w)      // Samples Banks
375   AM_RANGE(0x500300, 0x50030f) AM_WRITE(seta2_sound_bank_w)      // Samples Banks
379376   AM_RANGE(0x600000, 0x600001) AM_READ_PORT("P1")               // P1
380377   AM_RANGE(0x600002, 0x600003) AM_READ_PORT("P2")               // P2
381378   AM_RANGE(0x600004, 0x600005) AM_READ_PORT("SYSTEM")            // Coins
382   AM_RANGE(0x600004, 0x600005) AM_WRITE_LEGACY(pzlbowl_coin_counter_w)   // Coins Counter
379   AM_RANGE(0x600004, 0x600005) AM_WRITE(pzlbowl_coin_counter_w)   // Coins Counter
383380   AM_RANGE(0x600006, 0x600007) AM_READ(watchdog_reset16_r)      // Watchdog
384   //AM_RANGE(0x700000, 0x700001) AM_READ_LEGACY(pzlbowl_protection_r)      // Protection
381   //AM_RANGE(0x700000, 0x700001) AM_READ(pzlbowl_protection_r)      // Protection
385382   AM_RANGE(0xb00000, 0xb3ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites
386   AM_RANGE(0xb40000, 0xb4ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
383   AM_RANGE(0xb40000, 0xb4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
387384   AM_RANGE(0xb60000, 0xb6003f) AM_WRITE(seta2_vregs_w) AM_BASE(m_vregs)
388385   AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
389386   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)      // TMP68301 Registers
r14896r14897
394391                              Reel'N Quake
395392***************************************************************************/
396393
397static WRITE16_HANDLER( reelquak_leds_w )
394WRITE16_MEMBER(seta2_state::reelquak_leds_w)
398395{
399396   if (ACCESSING_BITS_0_7)
400397   {
401      set_led_status( space->machine(), 0, data & 0x0001 );   // start
402      set_led_status( space->machine(), 1, data & 0x0002 );   // small
403      set_led_status( space->machine(), 2, data & 0x0004 );   // bet
404      set_led_status( space->machine(), 3, data & 0x0008 );   // big
405      set_led_status( space->machine(), 4, data & 0x0010 );   // double up
406      set_led_status( space->machine(), 5, data & 0x0020 );   // collect
407      set_led_status( space->machine(), 6, data & 0x0040 );   // bet cancel
398      set_led_status( machine(), 0, data & 0x0001 );   // start
399      set_led_status( machine(), 1, data & 0x0002 );   // small
400      set_led_status( machine(), 2, data & 0x0004 );   // bet
401      set_led_status( machine(), 3, data & 0x0008 );   // big
402      set_led_status( machine(), 4, data & 0x0010 );   // double up
403      set_led_status( machine(), 5, data & 0x0020 );   // collect
404      set_led_status( machine(), 6, data & 0x0040 );   // bet cancel
408405   }
409406   if (ACCESSING_BITS_8_15)
410407   {
411      ticket_dispenser_w(space->machine().device("ticket"), 0, (data & 0x0100) >> 1);   // ticket dispenser
408      machine().device<ticket_dispenser_device>("ticket")->write(*&space, 0, (data & 0x0100) >> 1);   // ticket dispenser
412409   }
413410
414411//  popmessage("LED %04X", data);
415412}
416413
417static WRITE16_HANDLER( reelquak_coin_w )
414WRITE16_MEMBER(seta2_state::reelquak_coin_w)
418415{
419416   if (ACCESSING_BITS_0_7)
420417   {
421      coin_counter_w(space->machine(), 0, data & 0x01);   // coin in
422      coin_counter_w(space->machine(), 1, data & 0x02);   // coin in
423      coin_counter_w(space->machine(), 2, data & 0x04);   // pay out
424      coin_counter_w(space->machine(), 3, data & 0x08);   // key in
418      coin_counter_w(machine(), 0, data & 0x01);   // coin in
419      coin_counter_w(machine(), 1, data & 0x02);   // coin in
420      coin_counter_w(machine(), 2, data & 0x04);   // pay out
421      coin_counter_w(machine(), 3, data & 0x08);   // key in
425422      //                                data & 0x10); // Sound IRQ Ack.? 1->0
426423      //                                data & 0x20); // Vblank IRQ.? 1
427424   }
r14896r14897
436433   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("TICKET")            // Tickets
437434   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("SYSTEM")            // Coins
438435   AM_RANGE(0x400006, 0x400007) AM_READ(watchdog_reset16_r)      // Watchdog
439   AM_RANGE(0x400200, 0x400201) AM_WRITE_LEGACY(reelquak_coin_w)         // Coin Counters / IRQ Ack
436   AM_RANGE(0x400200, 0x400201) AM_WRITE(reelquak_coin_w)         // Coin Counters / IRQ Ack
440437   AM_RANGE(0x400300, 0x400301) AM_READ_PORT("DSW1")            // DSW 1
441438   AM_RANGE(0x400302, 0x400303) AM_READ_PORT("DSW2")            // DSW 2
442   AM_RANGE(0x400300, 0x40030f) AM_WRITE_LEGACY(seta2_sound_bank_w)      // Samples Banks
439   AM_RANGE(0x400300, 0x40030f) AM_WRITE(seta2_sound_bank_w)      // Samples Banks
443440   AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
444441   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites
445   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
442   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
446443   AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_BASE(m_vregs)            // Video Registers
447   AM_RANGE(0xfffd0a, 0xfffd0b) AM_WRITE_LEGACY(reelquak_leds_w )      // parallel data register (leds)
444   AM_RANGE(0xfffd0a, 0xfffd0b) AM_WRITE(reelquak_leds_w )      // parallel data register (leds)
448445   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)      // TMP68301 Registers
449446ADDRESS_MAP_END
450447
r14896r14897
467464                            Sammy Outdoor Shooting
468465***************************************************************************/
469466
470static WRITE16_HANDLER( samshoot_coin_w )
467WRITE16_MEMBER(seta2_state::samshoot_coin_w)
471468{
472469   if (ACCESSING_BITS_0_7)
473470   {
474      coin_counter_w(space->machine(), 0, data & 0x10);
475      coin_counter_w(space->machine(), 1, data & 0x20);
471      coin_counter_w(machine(), 0, data & 0x10);
472      coin_counter_w(machine(), 1, data & 0x20);
476473      // Are these connected? They are set in I/O test
477      coin_lockout_w(space->machine(), 0,~data & 0x40);
478      coin_lockout_w(space->machine(), 1,~data & 0x80);
474      coin_lockout_w(machine(), 0,~data & 0x40);
475      coin_lockout_w(machine(), 1,~data & 0x80);
479476   }
480477//  popmessage("%04x",data);
481478}
r14896r14897
488485   AM_RANGE( 0x400000, 0x400001 ) AM_READ_PORT("DSW1")            // DSW 1
489486   AM_RANGE( 0x400002, 0x400003 ) AM_READ_PORT("BUTTONS")         // Buttons
490487
491   AM_RANGE( 0x400300, 0x40030f ) AM_WRITE_LEGACY(seta2_sound_bank_w )   // Samples Banks
488   AM_RANGE( 0x400300, 0x40030f ) AM_WRITE(seta2_sound_bank_w )   // Samples Banks
492489
493490   AM_RANGE( 0x500000, 0x500001 ) AM_READ_PORT("GUN1")            // P1
494491   AM_RANGE( 0x580000, 0x580001 ) AM_READ_PORT("GUN2")            // P2
495492
496493   AM_RANGE( 0x700000, 0x700001 ) AM_READ_PORT("TRIGGER")         // Trigger
497494   AM_RANGE( 0x700002, 0x700003 ) AM_READ_PORT("PUMP")            // Pump
498   AM_RANGE( 0x700004, 0x700005 ) AM_READ_PORT("COIN")   AM_WRITE_LEGACY(samshoot_coin_w )   // Coins
495   AM_RANGE( 0x700004, 0x700005 ) AM_READ_PORT("COIN")   AM_WRITE(samshoot_coin_w )   // Coins
499496   AM_RANGE( 0x700006, 0x700007 ) AM_READ(watchdog_reset16_r )   // Watchdog?
500497
501498   AM_RANGE( 0x800000, 0x83ffff ) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
502   AM_RANGE( 0x840000, 0x84ffff ) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
499   AM_RANGE( 0x840000, 0x84ffff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
503500   AM_RANGE( 0x860000, 0x86003f ) AM_WRITE(seta2_vregs_w) AM_BASE(m_vregs)   // Video Registers
504501
505502   AM_RANGE( 0x900000, 0x903fff ) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r, seta_sound_word_w   )   // Sound
r14896r14897
516513// Bus conversion functions:
517514
518515// RAM shared with the sub CPU
519static READ32_HANDLER( funcube_nvram_dword_r )
516READ32_MEMBER(seta2_state::funcube_nvram_dword_r)
520517{
521   seta2_state *state = space->machine().driver_data<seta2_state>();
522   UINT16 val = state->m_nvram[offset];
518   UINT16 val = m_nvram[offset];
523519   return ((val & 0xff00) << 8) | (val & 0x00ff);
524520}
525521
526static WRITE32_HANDLER( funcube_nvram_dword_w )
522WRITE32_MEMBER(seta2_state::funcube_nvram_dword_w)
527523{
528   seta2_state *state = space->machine().driver_data<seta2_state>();
529524   if (ACCESSING_BITS_0_7)
530525   {
531      state->m_nvram[offset] = (state->m_nvram[offset] & 0xff00) | (data & 0x000000ff);
526      m_nvram[offset] = (m_nvram[offset] & 0xff00) | (data & 0x000000ff);
532527   }
533528   if (ACCESSING_BITS_16_23)
534529   {
535      state->m_nvram[offset] = (state->m_nvram[offset] & 0x00ff) | ((data & 0x00ff0000) >> 8);
530      m_nvram[offset] = (m_nvram[offset] & 0x00ff) | ((data & 0x00ff0000) >> 8);
536531   }
537532}
538533
539static WRITE16_HANDLER( spriteram16_word_w )
534WRITE16_MEMBER(seta2_state::spriteram16_word_w)
540535{
541   seta2_state *state = space->machine().driver_data<seta2_state>();
542536
543   COMBINE_DATA( &state->m_spriteram[offset] );
537   COMBINE_DATA( &m_spriteram[offset] );
544538}
545539
546static READ16_HANDLER( spriteram16_word_r )
540READ16_MEMBER(seta2_state::spriteram16_word_r)
547541{
548   seta2_state *state = space->machine().driver_data<seta2_state>();
549542
550   return state->m_spriteram[offset];
543   return m_spriteram[offset];
551544}
552545
553static WRITE32_HANDLER( paletteram32_dword_w )
554{
555   seta2_state *state = space->machine().driver_data<seta2_state>();
556   COMBINE_DATA( &state->m_generic_paletteram_32[offset] );
557   if (ACCESSING_BITS_16_31)
558      state->set_color_555(offset * 2 + 0, 10+16, 5+16, 0+16, state->m_generic_paletteram_32[offset]);
559   if (ACCESSING_BITS_0_15)
560      state->set_color_555(offset * 2 + 1, 10, 5, 0, state->m_generic_paletteram_32[offset]);
561}
562
563546// Main CPU
564547
565548// ColdFire peripherals
r14896r14897
569552   CF_MBSR      =   0x1ec/4
570553};
571554
572static WRITE32_HANDLER( coldfire_regs_w )
555WRITE32_MEMBER(seta2_state::coldfire_regs_w)
573556{
574   seta2_state *state = space->machine().driver_data<seta2_state>();
575557
576   COMBINE_DATA( &state->m_coldfire_regs[offset] );
558   COMBINE_DATA( &m_coldfire_regs[offset] );
577559}
578560
579static READ32_HANDLER( coldfire_regs_r )
561READ32_MEMBER(seta2_state::coldfire_regs_r)
580562{
581   seta2_state *state = space->machine().driver_data<seta2_state>();
582563
583564   switch( offset )
584565   {
585566      case CF_MBSR:
586         return space->machine().rand();
567         return machine().rand();
587568
588569      case CF_PPDAT:
589         return input_port_read(space->machine(), "BATTERY") << 16;
570         return input_port_read(machine(), "BATTERY") << 16;
590571   }
591572
592   return state->m_coldfire_regs[offset];
573   return m_coldfire_regs[offset];
593574}
594575
595static READ32_HANDLER( funcube_debug_r )
576READ32_MEMBER(seta2_state::funcube_debug_r)
596577{
597   UINT32 ret = input_port_read(space->machine(),"DEBUG");
578   UINT32 ret = input_port_read(machine(),"DEBUG");
598579
599580   // This bits let you move the crosshair in the inputs / touch panel test with a joystick
600   if (!(space->machine().primary_screen->frame_number() % 3))
581   if (!(machine().primary_screen->frame_number() % 3))
601582      ret |= 0x3f;
602583
603584   return ret;
r14896r14897
626607   AM_RANGE( 0x00000000, 0x0007ffff ) AM_ROM
627608   AM_RANGE( 0x00200000, 0x0020ffff ) AM_RAM
628609
629   AM_RANGE( 0x00500000, 0x00500003 ) AM_READ_LEGACY(funcube_debug_r )
610   AM_RANGE( 0x00500000, 0x00500003 ) AM_READ(funcube_debug_r )
630611   AM_RANGE( 0x00500004, 0x00500007 ) AM_READ(watchdog_reset32_r ) AM_WRITENOP
631612
632613   AM_RANGE( 0x00600000, 0x00600003 ) AM_DEVREADWRITE_LEGACY("oki", oki_read, oki_write)
633614
634   AM_RANGE( 0x00800000, 0x0083ffff ) AM_READWRITE16_LEGACY(spriteram16_word_r,  spriteram16_word_w, 0xffffffff ) AM_BASE_SIZE(m_spriteram, m_spriteram_size)
635   AM_RANGE( 0x00840000, 0x0084ffff ) AM_RAM_WRITE_LEGACY(paletteram32_dword_w) AM_SHARE("paletteram")
615   AM_RANGE( 0x00800000, 0x0083ffff ) AM_READWRITE16(spriteram16_word_r,  spriteram16_word_w, 0xffffffff ) AM_BASE_SIZE(m_spriteram, m_spriteram_size)
616   AM_RANGE( 0x00840000, 0x0084ffff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_dword_be_w) AM_SHARE("paletteram")
636617   AM_RANGE( 0x00860000, 0x0086003f ) AM_WRITE16(seta2_vregs_w, 0xffffffff ) AM_BASE(m_vregs)
637618
638   AM_RANGE( 0x00c00000, 0x00c002ff ) AM_READWRITE_LEGACY(funcube_nvram_dword_r, funcube_nvram_dword_w )
619   AM_RANGE( 0x00c00000, 0x00c002ff ) AM_READWRITE(funcube_nvram_dword_r, funcube_nvram_dword_w )
639620
640   AM_RANGE(0xf0000000, 0xf00001ff ) AM_READWRITE_LEGACY(coldfire_regs_r, coldfire_regs_w ) AM_BASE(m_coldfire_regs)   // Module
621   AM_RANGE(0xf0000000, 0xf00001ff ) AM_READWRITE(coldfire_regs_r, coldfire_regs_w ) AM_BASE(m_coldfire_regs)   // Module
641622   AM_RANGE(0xffffe000, 0xffffffff ) AM_RAM   // SRAM
642623ADDRESS_MAP_END
643624
r14896r14897
655636
656637#define FUNCUBE_SUB_CPU_CLOCK (XTAL_14_7456MHz)
657638
658static READ8_HANDLER( funcube_coins_r )
639READ8_MEMBER(seta2_state::funcube_coins_r)
659640{
660   seta2_state *state = space->machine().driver_data<seta2_state>();
661   UINT8 ret = input_port_read(space->machine(),"SWITCH");
641   UINT8 ret = input_port_read(machine(),"SWITCH");
662642   UINT8 coin_bit0 = 1;   // active low
663643   UINT8 coin_bit1 = 1;
664644
665   UINT8 hopper_bit = (state->m_funcube_hopper_motor && !(space->machine().primary_screen->frame_number()%20)) ? 1 : 0;
645   UINT8 hopper_bit = (m_funcube_hopper_motor && !(machine().primary_screen->frame_number()%20)) ? 1 : 0;
666646
667647   const UINT64 coin_total_cycles = FUNCUBE_SUB_CPU_CLOCK / (1000/20);
668648
669   if ( state->m_funcube_coin_start_cycles )
649   if ( m_funcube_coin_start_cycles )
670650   {
671      UINT64 elapsed = downcast<cpu_device *>(&space->device())->total_cycles() - state->m_funcube_coin_start_cycles;
651      UINT64 elapsed = downcast<cpu_device *>(&space.device())->total_cycles() - m_funcube_coin_start_cycles;
672652
673653      if ( elapsed < coin_total_cycles/2 )
674654         coin_bit0 = 0;
675655      else if ( elapsed < coin_total_cycles )
676656         coin_bit1 = 0;
677657      else
678         state->m_funcube_coin_start_cycles = 0;
658         m_funcube_coin_start_cycles = 0;
679659   }
680660   else
681661   {
682662      if (!(ret & 1))
683         state->m_funcube_coin_start_cycles = downcast<cpu_device *>(&space->device())->total_cycles();
663         m_funcube_coin_start_cycles = downcast<cpu_device *>(&space.device())->total_cycles();
684664   }
685665
686666   return (ret & ~7) | (hopper_bit << 2) | (coin_bit1 << 1) | coin_bit0;
687667}
688668
689static READ8_HANDLER( funcube_serial_r )
669READ8_MEMBER(seta2_state::funcube_serial_r)
690670{
691   seta2_state *state = space->machine().driver_data<seta2_state>();
692671   UINT8 ret = 0xff;
693672
694   switch( state->m_funcube_serial_count )
673   switch( m_funcube_serial_count )
695674   {
696      case 4:   ret = state->m_funcube_serial_fifo[0];   break;
697      case 3:   ret = state->m_funcube_serial_fifo[1];   break;
698      case 2:   ret = state->m_funcube_serial_fifo[2];   break;
699      case 1:   ret = state->m_funcube_serial_fifo[3];   break;
675      case 4:   ret = m_funcube_serial_fifo[0];   break;
676      case 3:   ret = m_funcube_serial_fifo[1];   break;
677      case 2:   ret = m_funcube_serial_fifo[2];   break;
678      case 1:   ret = m_funcube_serial_fifo[3];   break;
700679   }
701680
702   if (state->m_funcube_serial_count)
703      state->m_funcube_serial_count--;
681   if (m_funcube_serial_count)
682      m_funcube_serial_count--;
704683
705684   return ret;
706685}
r14896r14897
712691#endif
713692}
714693
715static WRITE8_HANDLER( funcube_leds_w )
694WRITE8_MEMBER(seta2_state::funcube_leds_w)
716695{
717   seta2_state *state = space->machine().driver_data<seta2_state>();
718696
719   *state->m_funcube_leds = data;
697   *m_funcube_leds = data;
720698
721   set_led_status( space->machine(), 0, (~data) & 0x01 );   // win lamp (red)
722   set_led_status( space->machine(), 1, (~data) & 0x02 );   // win lamp (green)
699   set_led_status( machine(), 0, (~data) & 0x01 );   // win lamp (red)
700   set_led_status( machine(), 1, (~data) & 0x02 );   // win lamp (green)
723701
724702   // Set in a moving pattern: 0111 -> 1011 -> 1101 -> 1110
725   set_led_status( space->machine(), 2, (~data) & 0x10 );
726   set_led_status( space->machine(), 3, (~data) & 0x20 );
727   set_led_status( space->machine(), 4, (~data) & 0x40 );
728   set_led_status( space->machine(), 5, (~data) & 0x80 );
703   set_led_status( machine(), 2, (~data) & 0x10 );
704   set_led_status( machine(), 3, (~data) & 0x20 );
705   set_led_status( machine(), 4, (~data) & 0x40 );
706   set_led_status( machine(), 5, (~data) & 0x80 );
729707
730708   funcube_debug_outputs();
731709}
732710
733static READ8_HANDLER( funcube_outputs_r )
711READ8_MEMBER(seta2_state::funcube_outputs_r)
734712{
735   seta2_state *state = space->machine().driver_data<seta2_state>();
736713
737714   // Bits 1,2,3 read
738   return *state->m_funcube_outputs;
715   return *m_funcube_outputs;
739716}
740717
741static WRITE8_HANDLER( funcube_outputs_w )
718WRITE8_MEMBER(seta2_state::funcube_outputs_w)
742719{
743   seta2_state *state = space->machine().driver_data<seta2_state>();
744720
745   *state->m_funcube_outputs = data;
721   *m_funcube_outputs = data;
746722
747723   // Bits 0,1,3 written
748724
749725   // Bit 0: hopper motor
750   state->m_funcube_hopper_motor = (~data) & 0x01;
726   m_funcube_hopper_motor = (~data) & 0x01;
751727
752728   // Bit 1: high on pay out
753729
754730   // Bit 3: low after coining up, blinks on pay out
755   set_led_status( space->machine(), 6, (~data) & 0x08 );
731   set_led_status( machine(), 6, (~data) & 0x08 );
756732
757733   funcube_debug_outputs();
758734}
759735
760736
761737static ADDRESS_MAP_START( funcube_sub_io, AS_IO, 8, seta2_state )
762   AM_RANGE( H8_PORT_7,   H8_PORT_7   )   AM_READ_LEGACY(funcube_coins_r )
738   AM_RANGE( H8_PORT_7,   H8_PORT_7   )   AM_READ(funcube_coins_r )
763739   AM_RANGE( H8_PORT_4,   H8_PORT_4   )   AM_NOP   // unused
764   AM_RANGE( H8_PORT_A,   H8_PORT_A   )   AM_READWRITE_LEGACY(funcube_outputs_r, funcube_outputs_w ) AM_BASE(m_funcube_outputs )
765   AM_RANGE( H8_PORT_B,   H8_PORT_B   )   AM_WRITE_LEGACY(funcube_leds_w )                           AM_BASE(m_funcube_leds )
740   AM_RANGE( H8_PORT_A,   H8_PORT_A   )   AM_READWRITE(funcube_outputs_r, funcube_outputs_w ) AM_BASE(m_funcube_outputs )
741   AM_RANGE( H8_PORT_B,   H8_PORT_B   )   AM_WRITE(funcube_leds_w )                           AM_BASE(m_funcube_leds )
766742//  AM_RANGE( H8_SERIAL_0, H8_SERIAL_0 )    // cabinets linking (jpunit)
767   AM_RANGE( H8_SERIAL_1, H8_SERIAL_1 )   AM_READ_LEGACY(funcube_serial_r )
743   AM_RANGE( H8_SERIAL_1, H8_SERIAL_1 )   AM_READ(funcube_serial_r )
768744ADDRESS_MAP_END
769745
770746
r14896r14897
15581534   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN       )
15591535
15601536   PORT_START("TICKET")   // $400003.b
1561   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SPECIAL       ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)   // ticket sensor
1537   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SPECIAL       ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)   // ticket sensor
15621538   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN       )
15631539   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN       )
15641540   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )                     // knock down
r14896r14897
21272103   MCFG_CPU_PROGRAM_MAP(reelquak_map)
21282104
21292105   MCFG_NVRAM_ADD_0FILL("nvram")
2130   MCFG_TICKET_DISPENSER_ADD("ticket", 200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
2106   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
21312107
21322108   // video hardware
21332109   MCFG_SCREEN_MODIFY("screen")
src/mame/drivers/flkatck.c
r14896r14897
6969         flkatck_bankswitch_w(space, 0, data);
7070         break;
7171      case 0x05:   /* sound code number */
72         soundlatch_w(space, 0, data);
72         soundlatch_byte_w(space, 0, data);
7373         break;
7474      case 0x06:   /* Cause interrupt on audio CPU */
7575         device_set_input_line(m_audiocpu, 0, HOLD_LINE);
r14896r14897
9696   AM_RANGE(0x0000, 0x0007) AM_RAM_WRITE(flkatck_k007121_regs_w)                           /* 007121 registers */
9797   AM_RANGE(0x0008, 0x03ff) AM_RAM                                                   /* RAM */
9898   AM_RANGE(0x0400, 0x041f) AM_READWRITE(flkatck_ls138_r, flkatck_ls138_w)                     /* inputs, DIPS, bankswitch, counters, sound command */
99   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_le_w) AM_SHARE("paletteram")   /* palette */
99   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_le_w) AM_SHARE("paletteram")   /* palette */
100100   AM_RANGE(0x1000, 0x1fff) AM_RAM                                                   /* RAM */
101101   AM_RANGE(0x2000, 0x3fff) AM_RAM_WRITE(flkatck_k007121_w) AM_BASE(m_k007121_ram)               /* Video RAM (007121) */
102102   AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank1")                                             /* banked ROM */
r14896r14897
110110//  AM_RANGE(0x9001, 0x9001) AM_RAM                                             /* ??? */
111111   AM_RANGE(0x9004, 0x9004) AM_READNOP                                 /* ??? */
112112   AM_RANGE(0x9006, 0x9006) AM_WRITENOP                              /* ??? */
113   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)                        /* soundlatch_r */
113   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)                        /* soundlatch_byte_r */
114114   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("konami", k007232_r, k007232_w)   /* 007232 registers */
115115   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)         /* YM2151 */
116116ADDRESS_MAP_END
src/mame/drivers/contra.c
r14896r14897
5353
5454WRITE8_MEMBER(contra_state::cpu_sound_command_w)
5555{
56   soundlatch_w(space, offset, data);
56   soundlatch_byte_w(space, offset, data);
5757}
5858
5959
r14896r14897
9696ADDRESS_MAP_END
9797
9898static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, contra_state )
99   AM_RANGE(0x0000, 0x0000) AM_READ(soundlatch_r)
99   AM_RANGE(0x0000, 0x0000) AM_READ(soundlatch_byte_r)
100100   AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
101101   AM_RANGE(0x4000, 0x4000) AM_WRITENOP /* read triggers irq reset and latch read (in the hardware only). */
102102   AM_RANGE(0x6000, 0x67ff) AM_RAM
src/mame/drivers/zn.c
r14896r14897
5656   int m_cbaj_to_r3k;
5757   int m_latch_to_z80;
5858   DECLARE_CUSTOM_INPUT_MEMBER(jdredd_gun_mux_read);
59   DECLARE_READ32_MEMBER(znsecsel_r);
60   DECLARE_WRITE32_MEMBER(znsecsel_w);
61   DECLARE_READ32_MEMBER(boardconfig_r);
62   DECLARE_READ32_MEMBER(unknown_r);
63   DECLARE_WRITE32_MEMBER(coin_w);
64   DECLARE_READ32_MEMBER(capcom_kickharness_r);
65   DECLARE_WRITE32_MEMBER(bank_coh1000c_w);
66   DECLARE_WRITE8_MEMBER(qsound_bankswitch_w);
67   DECLARE_WRITE32_MEMBER(zn_qsound_w);
68   DECLARE_WRITE32_MEMBER(bank_coh3002c_w);
69   DECLARE_WRITE32_MEMBER(bank_coh1000t_w);
70   DECLARE_WRITE8_MEMBER(fx1a_sound_bankswitch_w);
71   DECLARE_READ32_MEMBER(taitofx1a_ymsound_r);
72   DECLARE_WRITE32_MEMBER(taitofx1a_ymsound_w);
73   DECLARE_WRITE32_MEMBER(taitofx1b_volume_w);
74   DECLARE_WRITE32_MEMBER(taitofx1b_sound_w);
75   DECLARE_READ32_MEMBER(taitofx1b_sound_r);
76   DECLARE_WRITE32_MEMBER(coh1002e_bank_w);
77   DECLARE_WRITE32_MEMBER(coh1002e_latch_w);
78   DECLARE_WRITE32_MEMBER(bam2_sec_w);
79   DECLARE_WRITE32_MEMBER(bam2_mcu_w);
80   DECLARE_READ32_MEMBER(bam2_mcu_r);
81   DECLARE_READ32_MEMBER(bam2_unk_r);
82   DECLARE_WRITE32_MEMBER(acpsx_00_w);
83   DECLARE_WRITE32_MEMBER(acpsx_10_w);
84   DECLARE_WRITE32_MEMBER(nbajamex_80_w);
85   DECLARE_READ32_MEMBER(nbajamex_08_r);
86   DECLARE_READ32_MEMBER(nbajamex_80_r);
87   DECLARE_WRITE32_MEMBER(coh1001l_bnk_w);
88   DECLARE_WRITE32_MEMBER(coh1002v_bnk_w);
89   DECLARE_WRITE32_MEMBER(coh1002m_bank_w);
90   DECLARE_READ32_MEMBER(cbaj_z80_r);
91   DECLARE_WRITE32_MEMBER(cbaj_z80_w);
92   DECLARE_READ8_MEMBER(cbaj_z80_latch_r);
93   DECLARE_WRITE8_MEMBER(cbaj_z80_latch_w);
94   DECLARE_READ8_MEMBER(cbaj_z80_ready_r);
5995};
6096
6197INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
r14896r14897
238274   { NULL, NULL, NULL }
239275};
240276
241static READ32_HANDLER( znsecsel_r )
277READ32_MEMBER(zn_state::znsecsel_r)
242278{
243   zn_state *state = space->machine().driver_data<zn_state>();
244279
245   verboselog( space->machine(), 2, "znsecsel_r( %08x, %08x )\n", offset, mem_mask );
246   return state->m_n_znsecsel;
280   verboselog( machine(), 2, "znsecsel_r( %08x, %08x )\n", offset, mem_mask );
281   return m_n_znsecsel;
247282}
248283
249284static void sio_znsec0_handler( running_machine &machine, int n_data )
r14896r14897
321356   }
322357}
323358
324static WRITE32_HANDLER( znsecsel_w )
359WRITE32_MEMBER(zn_state::znsecsel_w)
325360{
326   zn_state *state = space->machine().driver_data<zn_state>();
327361
328   COMBINE_DATA( &state->m_n_znsecsel );
362   COMBINE_DATA( &m_n_znsecsel );
329363
330   if( ( state->m_n_znsecsel & 0x80 ) == 0 )
364   if( ( m_n_znsecsel & 0x80 ) == 0 )
331365   {
332      psx_sio_install_handler( space->machine(), 0, sio_pad_handler );
333      psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
366      psx_sio_install_handler( machine(), 0, sio_pad_handler );
367      psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
334368   }
335   else if( ( state->m_n_znsecsel & 0x08 ) == 0 )
369   else if( ( m_n_znsecsel & 0x08 ) == 0 )
336370   {
337371      znsec_start( 1 );
338      psx_sio_install_handler( space->machine(), 0, sio_znsec1_handler );
339      psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
372      psx_sio_install_handler( machine(), 0, sio_znsec1_handler );
373      psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
340374   }
341   else if( ( state->m_n_znsecsel & 0x04 ) == 0 )
375   else if( ( m_n_znsecsel & 0x04 ) == 0 )
342376   {
343377      znsec_start( 0 );
344      psx_sio_install_handler( space->machine(), 0, sio_znsec0_handler );
345      psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
378      psx_sio_install_handler( machine(), 0, sio_znsec0_handler );
379      psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
346380   }
347381   else
348382   {
349      state->m_n_dip_bit = 0;
350      state->m_b_lastclock = 1;
383      m_n_dip_bit = 0;
384      m_b_lastclock = 1;
351385
352      psx_sio_install_handler( space->machine(), 0, sio_dip_handler );
353      psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
386      psx_sio_install_handler( machine(), 0, sio_dip_handler );
387      psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
354388
355      state->m_dip_timer->adjust( downcast<cpu_device *>(&space->device())->cycles_to_attotime( 100 ), 1 );
389      m_dip_timer->adjust( downcast<cpu_device *>(&space.device())->cycles_to_attotime( 100 ), 1 );
356390   }
357391
358   verboselog( space->machine(), 2, "znsecsel_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
392   verboselog( machine(), 2, "znsecsel_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
359393}
360394
361395static TIMER_CALLBACK( dip_timer_fired )
r14896r14897
369403   }
370404}
371405
372static READ32_HANDLER( boardconfig_r )
406READ32_MEMBER(zn_state::boardconfig_r)
373407{
374408   /*
375409    ------00 mem=4M
r14896r14897
390424    111----- rev=5
391425    */
392426
393   if( space->machine().primary_screen->height() == 1024 )
427   if( machine().primary_screen->height() == 1024 )
394428   {
395429      return 64|32|8;
396430   }
r14896r14897
400434   }
401435}
402436
403static READ32_HANDLER( unknown_r )
437READ32_MEMBER(zn_state::unknown_r)
404438{
405   verboselog( space->machine(), 0, "unknown_r( %08x, %08x )\n", offset, mem_mask );
439   verboselog( machine(), 0, "unknown_r( %08x, %08x )\n", offset, mem_mask );
406440   return 0xffffffff;
407441}
408442
409static WRITE32_HANDLER( coin_w )
443WRITE32_MEMBER(zn_state::coin_w)
410444{
411445   /* 0x01=counter
412446       0x02=coin lock 1
r14896r14897
416450    */
417451   if( ( data & ~0x23 ) != 0 )
418452   {
419      verboselog( space->machine(), 0, "coin_w %08x\n", data );
453      verboselog( machine(), 0, "coin_w %08x\n", data );
420454   }
421455}
422456
r14896r14897
429463   AM_RANGE(0x1fa00300, 0x1fa00303) AM_READ_PORT("SYSTEM")
430464   AM_RANGE(0x1fa10000, 0x1fa10003) AM_READ_PORT("P3")
431465   AM_RANGE(0x1fa10100, 0x1fa10103) AM_READ_PORT("P4")
432   AM_RANGE(0x1fa10200, 0x1fa10203) AM_READ_LEGACY(boardconfig_r)
433   AM_RANGE(0x1fa10300, 0x1fa10303) AM_READWRITE_LEGACY(znsecsel_r, znsecsel_w)
434   AM_RANGE(0x1fa20000, 0x1fa20003) AM_WRITE_LEGACY(coin_w)
466   AM_RANGE(0x1fa10200, 0x1fa10203) AM_READ(boardconfig_r)
467   AM_RANGE(0x1fa10300, 0x1fa10303) AM_READWRITE(znsecsel_r, znsecsel_w)
468   AM_RANGE(0x1fa20000, 0x1fa20003) AM_WRITE(coin_w)
435469   AM_RANGE(0x1fa30000, 0x1fa30003) AM_NOP /* ?? */
436470   AM_RANGE(0x1fa40000, 0x1fa40003) AM_READNOP /* ?? */
437471   AM_RANGE(0x1fa60000, 0x1fa60003) AM_READNOP /* ?? */
438472   AM_RANGE(0x1faf0000, 0x1faf07ff) AM_DEVREADWRITE8_LEGACY("at28c16", at28c16_r, at28c16_w, 0xffffffff) /* eeprom */
439   AM_RANGE(0x1fb20000, 0x1fb20007) AM_READ_LEGACY(unknown_r)
473   AM_RANGE(0x1fb20000, 0x1fb20007) AM_READ(unknown_r)
440474   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_SHARE("share2") AM_REGION("user1", 0) /* bios */
441475   AM_RANGE(0x80000000, 0x803fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
442476   AM_RANGE(0x80400000, 0x807fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
r14896r14897
641675      Unpopulated sockets - 1.3B, 2.2E, 3.3E, 8.2K, 9.3K, 10.4K, 11.5K, 12.6K & 13.7K
642676*/
643677
644static READ32_HANDLER( capcom_kickharness_r )
678READ32_MEMBER(zn_state::capcom_kickharness_r)
645679{
646680   /* required for buttons 4,5&6 */
647   verboselog( space->machine(), 2, "capcom_kickharness_r( %08x, %08x )\n", offset, mem_mask );
681   verboselog( machine(), 2, "capcom_kickharness_r( %08x, %08x )\n", offset, mem_mask );
648682   return 0xffffffff;
649683}
650684
651static WRITE32_HANDLER( bank_coh1000c_w )
685WRITE32_MEMBER(zn_state::bank_coh1000c_w)
652686{
653   memory_set_bankptr( space->machine(), "bank2", space->machine().region( "user2" )->base() + 0x400000 + ( data * 0x400000 ) );
687   memory_set_bankptr( machine(), "bank2", machine().region( "user2" )->base() + 0x400000 + ( data * 0x400000 ) );
654688}
655689
656static WRITE8_HANDLER( qsound_bankswitch_w )
690WRITE8_MEMBER(zn_state::qsound_bankswitch_w)
657691{
658   memory_set_bankptr( space->machine(), "bank10", space->machine().region( "audiocpu" )->base() + 0x10000 + ( ( data & 0x0f ) * 0x4000 ) );
692   memory_set_bankptr( machine(), "bank10", machine().region( "audiocpu" )->base() + 0x10000 + ( ( data & 0x0f ) * 0x4000 ) );
659693}
660694
661695static INTERRUPT_GEN( qsound_interrupt )
r14896r14897
663697   device_set_input_line(device, 0, HOLD_LINE);
664698}
665699
666static WRITE32_HANDLER( zn_qsound_w )
700WRITE32_MEMBER(zn_state::zn_qsound_w)
667701{
668   zn_state *state = space->machine().driver_data<zn_state>();
669   state->soundlatch_w(*space, 0, data);
670   cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
702   soundlatch_byte_w(*&space, 0, data);
703   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
671704}
672705
673706static DRIVER_INIT( coh1000c )
674707{
708   zn_state *state = machine.driver_data<zn_state>();
675709   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f3fffff, "bank1" );     /* fixed game rom */
676710   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f400000, 0x1f7fffff, "bank2" );     /* banked game rom */
677   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fb00000, 0x1fb00003, FUNC(bank_coh1000c_w) ); /* bankswitch */
678   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler ( 0x1fb40010, 0x1fb40013, FUNC(capcom_kickharness_r) );
679   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler ( 0x1fb40020, 0x1fb40023, FUNC(capcom_kickharness_r) );
711   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::bank_coh1000c_w),state)); /* bankswitch */
712   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb40010, 0x1fb40013, read32_delegate(FUNC(zn_state::capcom_kickharness_r),state));
713   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb40020, 0x1fb40023, read32_delegate(FUNC(zn_state::capcom_kickharness_r),state));
680714   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1fb80000, 0x1fbfffff, "bank3" );     /* country rom */
681   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fb60000, 0x1fb60003, FUNC(zn_qsound_w) );
715   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb60000, 0x1fb60003, write32_delegate(FUNC(zn_state::zn_qsound_w),state));
682716
683717   zn_driver_init(machine);
684718
r14896r14897
704738   AM_RANGE(0x0000, 0x7fff) AM_ROM
705739   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank10")      /* banked (contains music data) */
706740   AM_RANGE(0xd000, 0xd002) AM_DEVWRITE_LEGACY("qsound", qsound_w)
707   AM_RANGE(0xd003, 0xd003) AM_WRITE_LEGACY(qsound_bankswitch_w)
741   AM_RANGE(0xd003, 0xd003) AM_WRITE(qsound_bankswitch_w)
708742   AM_RANGE(0xd007, 0xd007) AM_DEVREAD_LEGACY("qsound", qsound_r)
709743   AM_RANGE(0xf000, 0xffff) AM_RAM
710744ADDRESS_MAP_END
711745
712746static ADDRESS_MAP_START( qsound_portmap, AS_IO, 8, zn_state )
713747   ADDRESS_MAP_GLOBAL_MASK(0xff)
714   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
748   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)
715749ADDRESS_MAP_END
716750
717751static MACHINE_CONFIG_DERIVED( coh1000c, zn1_1mb_vram )
r14896r14897
882916                       Unpopulated sockets on Rival Schools - None
883917*/
884918
885static WRITE32_HANDLER( bank_coh3002c_w )
919WRITE32_MEMBER(zn_state::bank_coh3002c_w)
886920{
887   memory_set_bankptr( space->machine(), "bank2", space->machine().region( "user2" )->base() + 0x400000 + ( data * 0x400000 ) );
921   memory_set_bankptr( machine(), "bank2", machine().region( "user2" )->base() + 0x400000 + ( data * 0x400000 ) );
888922}
889923
890924static DRIVER_INIT( coh3002c )
891925{
926   zn_state *state = machine.driver_data<zn_state>();
892927   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f3fffff, "bank1" );     /* fixed game rom */
893928   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f400000, 0x1f7fffff, "bank2" );     /* banked game rom */
894   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler ( 0x1fb40010, 0x1fb40013, FUNC(capcom_kickharness_r) );
895   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler ( 0x1fb40020, 0x1fb40023, FUNC(capcom_kickharness_r) );
896   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fb00000, 0x1fb00003, FUNC(bank_coh3002c_w) ); /* bankswitch */
929   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb40010, 0x1fb40013, read32_delegate(FUNC(zn_state::capcom_kickharness_r),state));
930   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb40020, 0x1fb40023, read32_delegate(FUNC(zn_state::capcom_kickharness_r),state));
931   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::bank_coh3002c_w),state)); /* bankswitch */
897932   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1fb80000, 0x1fbfffff, "bank3" );     /* country rom */
898   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fb60000, 0x1fb60003, FUNC(zn_qsound_w) );
933   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb60000, 0x1fb60003, write32_delegate(FUNC(zn_state::zn_qsound_w),state));
899934
900935   zn_driver_init(machine);
901936}
r14896r14897
11401175      FM1208S        - RAMTRON 4096bit Nonvolatile Ferroelectric RAM (512w x 8b)
11411176*/
11421177
1143static WRITE32_HANDLER( bank_coh1000t_w )
1178WRITE32_MEMBER(zn_state::bank_coh1000t_w)
11441179{
1145   device_t *mb3773 = space->machine().device("mb3773");
1180   device_t *mb3773 = machine().device("mb3773");
11461181   mb3773_set_ck(mb3773, (data & 0x20) >> 5);
1147   verboselog( space->machine(), 1, "bank_coh1000t_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
1148   memory_set_bankptr( space->machine(), "bank1", space->machine().region( "user2" )->base() + ( ( data & 3 ) * 0x800000 ) );
1182   verboselog( machine(), 1, "bank_coh1000t_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
1183   memory_set_bankptr( machine(), "bank1", machine().region( "user2" )->base() + ( ( data & 3 ) * 0x800000 ) );
11491184}
11501185
1151static WRITE8_HANDLER( fx1a_sound_bankswitch_w )
1186WRITE8_MEMBER(zn_state::fx1a_sound_bankswitch_w)
11521187{
1153   memory_set_bankptr( space->machine(), "bank10", space->machine().region( "audiocpu" )->base() + 0x10000 + ( ( ( data - 1 ) & 0x07 ) * 0x4000 ) );
1188   memory_set_bankptr( machine(), "bank10", machine().region( "audiocpu" )->base() + 0x10000 + ( ( ( data - 1 ) & 0x07 ) * 0x4000 ) );
11541189}
11551190
1156static READ32_HANDLER( taitofx1a_ymsound_r )
1191READ32_MEMBER(zn_state::taitofx1a_ymsound_r)
11571192{
1158   device_t *tc0140syt = space->machine().device("tc0140syt");
1193   device_t *tc0140syt = machine().device("tc0140syt");
11591194   return tc0140syt_comm_r(tc0140syt, 0) << 16;
11601195}
11611196
1162static WRITE32_HANDLER( taitofx1a_ymsound_w )
1197WRITE32_MEMBER(zn_state::taitofx1a_ymsound_w)
11631198{
1164   device_t *tc0140syt = space->machine().device("tc0140syt");
1199   device_t *tc0140syt = machine().device("tc0140syt");
11651200
11661201   if (mem_mask == 0x0000ffff)
11671202   {
r14896r14897
11801215   machine.device<nvram_device>("eeprom1")->set_base(state->m_taitofx1_eeprom1, state->m_taitofx1_eeprom_size1);
11811216
11821217   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank     ( 0x1f000000, 0x1f7fffff, "bank1" );     /* banked game rom */
1183   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler    ( 0x1fb40000, 0x1fb40003, FUNC(bank_coh1000t_w) ); /* bankswitch */
1184   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1fb80000, 0x1fb80003, FUNC(taitofx1a_ymsound_r), FUNC(taitofx1a_ymsound_w) );
1218   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fb40000, 0x1fb40003, write32_delegate(FUNC(zn_state::bank_coh1000t_w),state)); /* bankswitch */
1219   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1fb80000, 0x1fb80003, read32_delegate(FUNC(zn_state::taitofx1a_ymsound_r),state), write32_delegate(FUNC(zn_state::taitofx1a_ymsound_w),state));
11851220   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank( 0x1fbe0000, 0x1fbe0000 + ( state->m_taitofx1_eeprom_size1 - 1 ), "bank2" );
11861221
11871222   zn_driver_init(machine);
r14896r14897
12051240   AM_RANGE(0xe400, 0xe403) AM_WRITENOP /* pan */
12061241   AM_RANGE(0xee00, 0xee00) AM_NOP /* ? */
12071242   AM_RANGE(0xf000, 0xf000) AM_WRITENOP /* ? */
1208   AM_RANGE(0xf200, 0xf200) AM_WRITE_LEGACY(fx1a_sound_bankswitch_w)
1243   AM_RANGE(0xf200, 0xf200) AM_WRITE(fx1a_sound_bankswitch_w)
12091244ADDRESS_MAP_END
12101245
12111246/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
r14896r14897
12431278   MCFG_TC0140SYT_ADD("tc0140syt", coh1000ta_tc0140syt_intf)
12441279MACHINE_CONFIG_END
12451280
1246static WRITE32_HANDLER( taitofx1b_volume_w )
1281WRITE32_MEMBER(zn_state::taitofx1b_volume_w)
12471282{
1248   verboselog( space->machine(), 1, "taitofx1_volume_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
1283   verboselog( machine(), 1, "taitofx1_volume_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
12491284}
12501285
1251static WRITE32_HANDLER( taitofx1b_sound_w )
1286WRITE32_MEMBER(zn_state::taitofx1b_sound_w)
12521287{
1253   verboselog( space->machine(), 1, "taitofx1_sound_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
1288   verboselog( machine(), 1, "taitofx1_sound_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
12541289}
12551290
1256static READ32_HANDLER( taitofx1b_sound_r )
1291READ32_MEMBER(zn_state::taitofx1b_sound_r)
12571292{
12581293   UINT32 data = 0; // bit 0 = busy?
1259   verboselog( space->machine(), 1, "taitofx1_sound_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
1294   verboselog( machine(), 1, "taitofx1_sound_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
12601295   return data;
12611296}
12621297
r14896r14897
12721307
12731308   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank     ( 0x1f000000, 0x1f7fffff, "bank1" ); /* banked game rom */
12741309   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank( 0x1fb00000, 0x1fb00000 + ( state->m_taitofx1_eeprom_size1 - 1 ), "bank2" );
1275   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler    ( 0x1fb40000, 0x1fb40003, FUNC(bank_coh1000t_w) ); /* bankswitch */
1276   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler    ( 0x1fb80000, 0x1fb8ffff, FUNC(taitofx1b_volume_w) );
1277   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler    ( 0x1fba0000, 0x1fbaffff, FUNC(taitofx1b_sound_w) );
1278   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler     ( 0x1fbc0000, 0x1fbc0003, FUNC(taitofx1b_sound_r) );
1310   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fb40000, 0x1fb40003, write32_delegate(FUNC(zn_state::bank_coh1000t_w),state)); /* bankswitch */
1311   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fb80000, 0x1fb8ffff, write32_delegate(FUNC(zn_state::taitofx1b_volume_w),state));
1312   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fba0000, 0x1fbaffff, write32_delegate(FUNC(zn_state::taitofx1b_sound_w),state));
1313   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler     ( 0x1fbc0000, 0x1fbc0003, read32_delegate(FUNC(zn_state::taitofx1b_sound_r),state));
12791314   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank( 0x1fbe0000, 0x1fbe0000 + ( state->m_taitofx1_eeprom_size2 - 1 ), "bank3" );
12801315
12811316   zn_driver_init(machine);
r14896r14897
16311666
16321667*/
16331668
1634static WRITE32_HANDLER( coh1002e_bank_w )
1669WRITE32_MEMBER(zn_state::coh1002e_bank_w)
16351670{
16361671   znsecsel_w( space, offset, data, mem_mask );
16371672
1638   memory_set_bankptr( space->machine(), "bank1", space->machine().region( "user2" )->base() + ( ( data & 3 ) * 0x800000 ) );
1673   memory_set_bankptr( machine(), "bank1", machine().region( "user2" )->base() + ( ( data & 3 ) * 0x800000 ) );
16391674}
16401675
1641static WRITE32_HANDLER( coh1002e_latch_w )
1676WRITE32_MEMBER(zn_state::coh1002e_latch_w)
16421677{
1643   zn_state *state = space->machine().driver_data<zn_state>();
16441678   if (offset)
1645      cputag_set_input_line(space->machine(), "audiocpu", 2, HOLD_LINE);   // irq 2 on the 68k
1679      cputag_set_input_line(machine(), "audiocpu", 2, HOLD_LINE);   // irq 2 on the 68k
16461680   else
1647      state->soundlatch_w(*space, 0, data);
1681      soundlatch_byte_w(*&space, 0, data);
16481682}
16491683
16501684static DRIVER_INIT( coh1002e )
16511685{
1686   zn_state *state = machine.driver_data<zn_state>();
16521687   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f7fffff, "bank1" );
1653   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fa10300, 0x1fa10303, FUNC(coh1002e_bank_w) );
1654   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fb00000, 0x1fb00007, FUNC(coh1002e_latch_w) );
1688   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fa10300, 0x1fa10303, write32_delegate(FUNC(zn_state::coh1002e_bank_w),state));
1689   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00007, write32_delegate(FUNC(zn_state::coh1002e_latch_w),state));
16551690
16561691   zn_driver_init(machine);
16571692}
r14896r14897
16661701   AM_RANGE(0x000000, 0x07ffff) AM_ROM
16671702   AM_RANGE(0x080000, 0x0fffff) AM_RAM
16681703   AM_RANGE(0x100000, 0x10001f) AM_DEVREADWRITE8_LEGACY("ymf", ymf271_r, ymf271_w, 0x00ff )
1669   AM_RANGE(0x180008, 0x180009) AM_READ8(soundlatch_r, 0x00ff )
1704   AM_RANGE(0x180008, 0x180009) AM_READ8(soundlatch_byte_r, 0x00ff )
16701705   AM_RANGE(0x000000, 0x07ffff) AM_WRITENOP
16711706   AM_RANGE(0x100020, 0xffffff) AM_WRITENOP
16721707ADDRESS_MAP_END
r14896r14897
17211756
17221757*/
17231758
1724static WRITE32_HANDLER( bam2_sec_w )
1759WRITE32_MEMBER(zn_state::bam2_sec_w)
17251760{
17261761   znsecsel_w( space, offset, data, mem_mask );
17271762}
r14896r14897
17421777*/
17431778
17441779
1745static WRITE32_HANDLER( bam2_mcu_w )
1780WRITE32_MEMBER(zn_state::bam2_mcu_w)
17461781{
1747   zn_state *state = space->machine().driver_data<zn_state>();
17481782
17491783   if (offset == 0)
17501784   {
17511785      if (ACCESSING_BITS_0_15)
17521786      {
1753         memory_set_bankptr( space->machine(), "bank2", space->machine().region( "user2" )->base() + ( ( data & 0xf ) * 0x400000 ) );
1787         memory_set_bankptr( machine(), "bank2", machine().region( "user2" )->base() + ( ( data & 0xf ) * 0x400000 ) );
17541788      }
17551789      else if (ACCESSING_BITS_16_31)
17561790      {
1757         state->m_bam2_mcu_command = data>>16;
1758         logerror("MCU command: %04x (PC %08x)\n", state->m_bam2_mcu_command, cpu_get_pc(&space->device()));
1791         m_bam2_mcu_command = data>>16;
1792         logerror("MCU command: %04x (PC %08x)\n", m_bam2_mcu_command, cpu_get_pc(&space.device()));
17591793      }
17601794   }
17611795}
17621796
1763static READ32_HANDLER( bam2_mcu_r )
1797READ32_MEMBER(zn_state::bam2_mcu_r)
17641798{
1765   zn_state *state = space->machine().driver_data<zn_state>();
17661799
17671800   switch (offset)
17681801   {
17691802      case 0:
1770         logerror("MCU port 0 read @ PC %08x mask %08x\n", cpu_get_pc(&space->device()), mem_mask);
1803         logerror("MCU port 0 read @ PC %08x mask %08x\n", cpu_get_pc(&space.device()), mem_mask);
17711804         break;
17721805
17731806      case 1:
1774         logerror("MCU status read @ PC %08x mask %08x\n", cpu_get_pc(&space->device()), mem_mask);
1807         logerror("MCU status read @ PC %08x mask %08x\n", cpu_get_pc(&space.device()), mem_mask);
17751808
1776         switch (state->m_bam2_mcu_command)
1809         switch (m_bam2_mcu_command)
17771810         {
17781811            case 0x7f:      // first drive check
17791812            case 0x1c:      // second drive check (causes HDD detected)
r14896r14897
17861819   return 0;
17871820}
17881821
1789static READ32_HANDLER( bam2_unk_r )
1822READ32_MEMBER(zn_state::bam2_unk_r)
17901823{
17911824   return 0;
17921825}
17931826
17941827static DRIVER_INIT( bam2 )
17951828{
1829   zn_state *state = machine.driver_data<zn_state>();
17961830   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f3fffff, "bank1" );
17971831   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f400000, 0x1f7fffff, "bank2" );
1798   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler ( 0x1fb00000, 0x1fb00007, FUNC(bam2_mcu_r) );
1799   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler ( 0x1fa20000, 0x1fa20003, FUNC(bam2_unk_r) );
1800   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fa10300, 0x1fa10303, FUNC(bam2_sec_w) );
1801   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fb00000, 0x1fb00007, FUNC(bam2_mcu_w) );
1832   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb00000, 0x1fb00007, read32_delegate(FUNC(zn_state::bam2_mcu_r),state));
1833   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fa20000, 0x1fa20003, read32_delegate(FUNC(zn_state::bam2_unk_r),state));
1834   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fa10300, 0x1fa10303, write32_delegate(FUNC(zn_state::bam2_sec_w),state));
1835   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00007, write32_delegate(FUNC(zn_state::bam2_mcu_w),state));
18021836
18031837   zn_driver_init(machine);
18041838}
r14896r14897
20772111   }
20782112}
20792113
2080static WRITE32_HANDLER( acpsx_00_w )
2114WRITE32_MEMBER(zn_state::acpsx_00_w)
20812115{
2082   verboselog( space->machine(), 0, "acpsx_00_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
2116   verboselog( machine(), 0, "acpsx_00_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
20832117}
20842118
2085static WRITE32_HANDLER( acpsx_10_w )
2119WRITE32_MEMBER(zn_state::acpsx_10_w)
20862120{
2087   verboselog( space->machine(), 0, "acpsx_10_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
2121   verboselog( machine(), 0, "acpsx_10_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
20882122}
20892123
2090static WRITE32_HANDLER( nbajamex_80_w )
2124WRITE32_MEMBER(zn_state::nbajamex_80_w)
20912125{
2092   verboselog( space->machine(), 0, "nbajamex_80_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
2093   psx_irq_set(space->machine(), 0x400);
2126   verboselog( machine(), 0, "nbajamex_80_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
2127   psx_irq_set(machine(), 0x400);
20942128}
20952129
2096static READ32_HANDLER( nbajamex_08_r )
2130READ32_MEMBER(zn_state::nbajamex_08_r)
20972131{
20982132   UINT32 data = 0xffffffff;
2099   verboselog( space->machine(), 0, "nbajamex_08_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
2133   verboselog( machine(), 0, "nbajamex_08_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
21002134   return data;
21012135}
21022136
2103static READ32_HANDLER( nbajamex_80_r )
2137READ32_MEMBER(zn_state::nbajamex_80_r)
21042138{
21052139   UINT32 data = 0xffffffff;
2106   verboselog( space->machine(), 0, "nbajamex_80_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
2140   verboselog( machine(), 0, "nbajamex_80_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
21072141   return data;
21082142}
21092143
r14896r14897
21122146   zn_state *state = machine.driver_data<zn_state>();
21132147
21142148   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f1fffff, "bank1" );
2115   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fbfff00, 0x1fbfff03, FUNC(acpsx_00_w) );
2116   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fbfff10, 0x1fbfff13, FUNC(acpsx_10_w) );
2149   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fbfff00, 0x1fbfff03, write32_delegate(FUNC(zn_state::acpsx_00_w),state));
2150   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fbfff10, 0x1fbfff13, write32_delegate(FUNC(zn_state::acpsx_10_w),state));
21172151
21182152   if( strcmp( machine.system().name, "nbajamex" ) == 0 )
21192153   {
r14896r14897
21212155      state->m_nbajamex_eeprom = auto_alloc_array( machine, UINT8, state->m_nbajamex_eeprom_size );
21222156
21232157      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank( 0x1f200000, 0x1f200000 + ( state->m_nbajamex_eeprom_size - 1 ), "bank2" );
2124      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler     ( 0x1fbfff08, 0x1fbfff0b, FUNC(nbajamex_08_r) );
2125      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1fbfff80, 0x1fbfff83, FUNC(nbajamex_80_r), FUNC(nbajamex_80_w) );
2158      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler     ( 0x1fbfff08, 0x1fbfff0b, read32_delegate(FUNC(zn_state::nbajamex_08_r),state));
2159      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1fbfff80, 0x1fbfff83, read32_delegate(FUNC(zn_state::nbajamex_80_r),state), write32_delegate(FUNC(zn_state::nbajamex_80_w),state));
21262160
21272161      memory_set_bankptr( machine, "bank2", state->m_nbajamex_eeprom ); /* ram/eeprom/?? */
21282162   }
r14896r14897
22822316      VSync        - 60Hz
22832317*/
22842318
2285static WRITE32_HANDLER( coh1001l_bnk_w )
2319WRITE32_MEMBER(zn_state::coh1001l_bnk_w)
22862320{
2287   memory_set_bankptr( space->machine(), "bank1", space->machine().region( "user2" )->base() + ( ( ( data >> 16 ) & 3 ) * 0x800000 ) );
2321   memory_set_bankptr( machine(), "bank1", machine().region( "user2" )->base() + ( ( ( data >> 16 ) & 3 ) * 0x800000 ) );
22882322}
22892323
22902324static DRIVER_INIT( coh1001l )
22912325{
2326   zn_state *state = machine.driver_data<zn_state>();
22922327   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f7fffff, "bank1" ); /* banked rom */
2293   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fb00000, 0x1fb00003, FUNC(coh1001l_bnk_w) );
2328   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::coh1001l_bnk_w),state) );
22942329
22952330   zn_driver_init(machine);
22962331}
r14896r14897
23242359
23252360*/
23262361
2327static WRITE32_HANDLER( coh1002v_bnk_w )
2362WRITE32_MEMBER(zn_state::coh1002v_bnk_w)
23282363{
2329   memory_set_bankptr( space->machine(), "bank2", space->machine().region( "user3" )->base() + ( data * 0x100000 ) );
2364   memory_set_bankptr( machine(), "bank2", machine().region( "user3" )->base() + ( data * 0x100000 ) );
23302365}
23312366
23322367static DRIVER_INIT( coh1002v )
23332368{
2369   zn_state *state = machine.driver_data<zn_state>();
23342370   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f27ffff, "bank1" );
23352371   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1fb00000, 0x1fbfffff, "bank2" );
2336   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fb00000, 0x1fb00003, FUNC(coh1002v_bnk_w) );
2372   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::coh1002v_bnk_w),state));
23372373
23382374   zn_driver_init(machine);
23392375}
r14896r14897
25072543      for 11 more 32MBit smt SOP44 MASKROMs.
25082544*/
25092545
2510static WRITE32_HANDLER( coh1002m_bank_w )
2546WRITE32_MEMBER(zn_state::coh1002m_bank_w)
25112547{
2512   verboselog( space->machine(), 1, "coh1002m_bank_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
2513   memory_set_bankptr( space->machine(), "bank1", space->machine().region( "user2" )->base() + ((data>>16) * 0x800000) );
2548   verboselog( machine(), 1, "coh1002m_bank_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
2549   memory_set_bankptr( machine(), "bank1", machine().region( "user2" )->base() + ((data>>16) * 0x800000) );
25142550}
25152551
2516static READ32_HANDLER( cbaj_z80_r )
2552READ32_MEMBER(zn_state::cbaj_z80_r)
25172553{
2518   zn_state *state = space->machine().driver_data<zn_state>();
25192554   int ready;
25202555
2521   space->machine().scheduler().synchronize();
2556   machine().scheduler().synchronize();
25222557
2523   ready = state->m_cbaj_to_r3k;
2524   state->m_cbaj_to_r3k &= ~2;
2525   return state->soundlatch2_r(*space,0) | ready<<24;
2558   ready = m_cbaj_to_r3k;
2559   m_cbaj_to_r3k &= ~2;
2560   return soundlatch2_byte_r(*&space,0) | ready<<24;
25262561}
25272562
2528static WRITE32_HANDLER( cbaj_z80_w )
2563WRITE32_MEMBER(zn_state::cbaj_z80_w)
25292564{
2530   zn_state *state = space->machine().driver_data<zn_state>();
2531   space->machine().scheduler().synchronize();
2565   machine().scheduler().synchronize();
25322566
2533   state->m_cbaj_to_z80 |= 2;
2534   state->m_latch_to_z80 = data;
2567   m_cbaj_to_z80 |= 2;
2568   m_latch_to_z80 = data;
25352569}
25362570
25372571static DRIVER_INIT( coh1002m )
25382572{
2573   zn_state *state = machine.driver_data<zn_state>();
25392574   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank               ( 0x1f000000, 0x1f7fffff, "bank1" );
2540   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1fb00000, 0x1fb00003, FUNC(cbaj_z80_r), FUNC(cbaj_z80_w) );
2541   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler    ( 0x1fb00004, 0x1fb00007, FUNC(coh1002m_bank_w) );
2575   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1fb00000, 0x1fb00003, read32_delegate(FUNC(zn_state::cbaj_z80_r),state), write32_delegate(FUNC(zn_state::cbaj_z80_w),state));
2576   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fb00004, 0x1fb00007, write32_delegate(FUNC(zn_state::coh1002m_bank_w),state));
25422577
25432578   zn_driver_init(machine);
25442579}
r14896r14897
25492584   zn_machine_init(machine);
25502585}
25512586
2552static READ8_HANDLER( cbaj_z80_latch_r )
2587READ8_MEMBER(zn_state::cbaj_z80_latch_r)
25532588{
2554   zn_state *state = space->machine().driver_data<zn_state>();
25552589
2556   state->m_cbaj_to_z80 &= ~2;
2557   return state->m_latch_to_z80;
2590   m_cbaj_to_z80 &= ~2;
2591   return m_latch_to_z80;
25582592}
25592593
2560static WRITE8_HANDLER( cbaj_z80_latch_w )
2594WRITE8_MEMBER(zn_state::cbaj_z80_latch_w)
25612595{
2562   zn_state *state = space->machine().driver_data<zn_state>();
25632596
2564   state->m_cbaj_to_r3k |= 2;
2565   state->soundlatch2_w(*space, 0, data);
2597   m_cbaj_to_r3k |= 2;
2598   soundlatch2_byte_w(*&space, 0, data);
25662599}
25672600
2568static READ8_HANDLER( cbaj_z80_ready_r )
2601READ8_MEMBER(zn_state::cbaj_z80_ready_r)
25692602{
2570   zn_state *state = space->machine().driver_data<zn_state>();
25712603
2572   int ret = state->m_cbaj_to_z80;
2604   int ret = m_cbaj_to_z80;
25732605
2574   state->m_cbaj_to_z80 &= ~2;
2606   m_cbaj_to_z80 &= ~2;
25752607
25762608   return ret;
25772609}
r14896r14897
25842616static ADDRESS_MAP_START( cbaj_z80_port_map, AS_IO, 8, zn_state )
25852617   ADDRESS_MAP_GLOBAL_MASK(0xff)
25862618   AM_RANGE( 0x84, 0x85 ) AM_DEVREADWRITE_LEGACY("ymz", ymz280b_r, ymz280b_w )
2587   AM_RANGE( 0x90, 0x90 ) AM_READWRITE_LEGACY(cbaj_z80_latch_r, cbaj_z80_latch_w )
2588   AM_RANGE( 0x91, 0x91 ) AM_READ_LEGACY(cbaj_z80_ready_r )
2619   AM_RANGE( 0x90, 0x90 ) AM_READWRITE(cbaj_z80_latch_r, cbaj_z80_latch_w )
2620   AM_RANGE( 0x91, 0x91 ) AM_READ(cbaj_z80_ready_r )
25892621ADDRESS_MAP_END
25902622
25912623
src/mame/drivers/galpani3.c
r14896r14897
900900   AM_RANGE(0x000000, 0x17ffff) AM_ROM
901901
902902   AM_RANGE(0x200000, 0x20ffff) AM_RAM // area [B] - Work RAM
903   AM_RANGE(0x280000, 0x287fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w)   AM_SHARE("paletteram") // area [A] - palette for sprites
903   AM_RANGE(0x280000, 0x287fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w)   AM_SHARE("paletteram") // area [A] - palette for sprites
904904
905905   AM_RANGE(0x300000, 0x303fff) AM_RAM_WRITE(galpani3_suprnova_sprite32_w) AM_SHARE("spriteram")
906906   AM_RANGE(0x380000, 0x38003f) AM_RAM_WRITE(galpani3_suprnova_sprite32regs_w) AM_BASE(m_sprregs)
src/mame/drivers/fitfight.c
r14896r14897
164164   AM_RANGE(0xb14000, 0xb17fff) AM_WRITENOP //used by histryma @0x0000b25a,b270
165165   AM_RANGE(0xb18000, 0xb1bfff) AM_WRITENOP //used by histryma @0x0000b25a,b270,b286
166166
167   AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
167   AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
168168
169169   AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE(m_spriteram)
170170
r14896r14897
195195   AM_RANGE(0xb0c000, 0xb0ffff) AM_RAM_WRITE(fof_txt_tileram_w) AM_BASE(m_fof_txt_tileram)
196196
197197   AM_RANGE(0xc00000, 0xc00fff) AM_READONLY
198   AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
198   AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
199199
200200   AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE(m_spriteram)
201201
src/mame/drivers/terracre.c
r14896r14897
146146
147147WRITE16_MEMBER(terracre_state::amazon_sound_w)
148148{
149   soundlatch_w(space,0,((data & 0x7f) << 1) | 1);
149   soundlatch_byte_w(space,0,((data & 0x7f) << 1) | 1);
150150}
151151
152152READ8_MEMBER(terracre_state::soundlatch_clear_r)
153153{
154   soundlatch_clear_w(space,0,0);
154   soundlatch_clear_byte_w(space,0,0);
155155   return 0;
156156}
157157
r14896r14897
239239   AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("dac1", dac_signed_w)
240240   AM_RANGE(0x03, 0x03) AM_DEVWRITE_LEGACY("dac2", dac_signed_w)
241241   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r)
242   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
242   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_byte_r)
243243ADDRESS_MAP_END
244244
245245static ADDRESS_MAP_START( sound_2203_io_map, AS_IO, 8, terracre_state )
r14896r14897
248248   AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("dac1", dac_signed_w)
249249   AM_RANGE(0x03, 0x03) AM_DEVWRITE_LEGACY("dac2", dac_signed_w)
250250   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r)
251   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
251   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_byte_r)
252252ADDRESS_MAP_END
253253
254254static INPUT_PORTS_START( terracre )
src/mame/drivers/deco32.c
r14896r14897
343343
344344WRITE32_MEMBER(deco32_state::deco32_sound_w)
345345{
346   soundlatch_w(space,0,data & 0xff);
346   soundlatch_byte_w(space,0,data & 0xff);
347347   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
348348}
349349
r14896r14897
669669   if (offset==0x700/4) {
670670
671671      /* bit 1 of nslasher_sound_irq specifies IRQ command writes */
672      soundlatch_w(space,0,(data>>16)&0xff);
672      soundlatch_byte_w(space,0,(data>>16)&0xff);
673673      m_nslasher_sound_irq |= 0x02;
674674      cputag_set_input_line(machine(), "audiocpu", 0, (m_nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
675675   }
r14896r14897
10041004   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
10051005   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
10061006   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
1007   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
1007   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
10081008   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
10091009   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
10101010   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
r14896r14897
10151015   /* bit 1 of nslasher_sound_irq specifies IRQ command writes */
10161016   m_nslasher_sound_irq &= ~0x02;
10171017   cputag_set_input_line(machine(), "audiocpu", 0, (m_nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
1018   return soundlatch_r(space,0);
1018   return soundlatch_byte_r(space,0);
10191019}
10201020
10211021static ADDRESS_MAP_START( nslasher_sound, AS_PROGRAM, 8, deco32_state )
r14896r14897
33523352
33533353   deco156_decrypt(machine);
33543354
3355   soundlatch_setclearedvalue(machine, 0xff);
3355    deco32_state *state = machine.driver_data<deco32_state>();
3356   state->soundlatch_setclearedvalue(0xff);
33563357
33573358   /* The board for Night Slashers is very close to the Fighter's History and
33583359    Tattoo Assassins boards, but has an encrypted ARM cpu. */
src/mame/drivers/argus.c
r14896r14897
198198   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2")
199199   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1")
200200   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
201   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_w)
201   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w)
202202   AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w)
203203   AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w)
204204   AM_RANGE(0xc300, 0xc301) AM_RAM AM_BASE(m_bg0_scrollx)
r14896r14897
222222   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2")
223223   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1")
224224   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
225   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_w)
225   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w)
226226   AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w)
227227   AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w)
228228   AM_RANGE(0xc300, 0xc300) AM_WRITE(valtric_unknown_w)
r14896r14897
247247   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1")
248248   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
249249   AM_RANGE(0xc100, 0xc100) AM_WRITE(butasan_unknown_w)
250   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_w)
250   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w)
251251   AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w)
252252   AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w)
253253   AM_RANGE(0xc203, 0xc203) AM_WRITE(butasan_pageselect_w)
r14896r14897
268268static ADDRESS_MAP_START( sound_map_a, AS_PROGRAM, 8, argus_state )
269269   AM_RANGE(0x0000, 0x7fff) AM_ROM
270270   AM_RANGE(0x8000, 0x87ff) AM_RAM
271   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r)
271   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r)
272272ADDRESS_MAP_END
273273
274274static ADDRESS_MAP_START( sound_map_b, AS_PROGRAM, 8, argus_state )
275275   AM_RANGE(0x0000, 0xbfff) AM_ROM
276276   AM_RANGE(0xc000, 0xc7ff) AM_RAM
277   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
277   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
278278ADDRESS_MAP_END
279279
280280#if 0
src/mame/drivers/superdq.c
r14896r14897
3232public:
3333   superdq_state(const machine_config &mconfig, device_type type, const char *tag)
3434      : driver_device(mconfig, type, tag),
35        m_laserdisc(*this, "laserdisc") { }
35        m_laserdisc(*this, "laserdisc") ,
36      m_videoram(*this, "videoram"){ }
3637
3738   required_device<pioneer_ldv1000_device> m_laserdisc;
3839   UINT8 m_ld_in_latch;
3940   UINT8 m_ld_out_latch;
4041
41   UINT8 *m_videoram;
42   required_shared_ptr<UINT8> m_videoram;
4243   tilemap_t *m_tilemap;
4344   int m_color_bank;
4445   DECLARE_WRITE8_MEMBER(superdq_videoram_w);
r14896r14897
5051static TILE_GET_INFO( get_tile_info )
5152{
5253   superdq_state *state = machine.driver_data<superdq_state>();
53   int tile = state->m_videoram[tile_index];
54   int tile = state->m_videoram.target()[tile_index];
5455
5556   SET_TILE_INFO(0, tile, state->m_color_bank, 0);
5657}
r14896r14897
146147WRITE8_MEMBER(superdq_state::superdq_videoram_w)
147148{
148149
149   m_videoram[offset] = data;
150   m_videoram.target()[offset] = data;
150151   m_tilemap->mark_tile_dirty(offset);
151152}
152153
r14896r14897
202203static ADDRESS_MAP_START( superdq_map, AS_PROGRAM, 8, superdq_state )
203204   AM_RANGE(0x0000, 0x3fff) AM_ROM
204205   AM_RANGE(0x4000, 0x47ff) AM_RAM
205   AM_RANGE(0x5c00, 0x5fff) AM_RAM_WRITE(superdq_videoram_w) AM_BASE(m_videoram)
206   AM_RANGE(0x5c00, 0x5fff) AM_RAM_WRITE(superdq_videoram_w) AM_SHARE("videoram")
206207ADDRESS_MAP_END
207208
208209static ADDRESS_MAP_START( superdq_io, AS_IO, 8, superdq_state )
src/mame/drivers/bestleag.c
r14896r14897
2727{
2828public:
2929   bestleag_state(const machine_config &mconfig, device_type type, const char *tag)
30      : driver_device(mconfig, type, tag) { }
30      : driver_device(mconfig, type, tag) ,
31      m_bgram(*this, "bgram"),
32      m_fgram(*this, "fgram"),
33      m_txram(*this, "txram"),
34      m_vregs(*this, "vregs"),
35      m_spriteram(*this, "spriteram"){ }
3136
32   UINT16 *m_txram;
33   UINT16 *m_bgram;
34   UINT16 *m_fgram;
35   UINT16 *m_vregs;
37   required_shared_ptr<UINT16> m_bgram;
38   required_shared_ptr<UINT16> m_fgram;
39   required_shared_ptr<UINT16> m_txram;
40   required_shared_ptr<UINT16> m_vregs;
41   required_shared_ptr<UINT16> m_spriteram;
3642   tilemap_t *m_tx_tilemap;
3743   tilemap_t *m_bg_tilemap;
3844   tilemap_t *m_fg_tilemap;
39   UINT16 *m_spriteram;
40   size_t m_spriteram_size;
4145   DECLARE_WRITE16_MEMBER(bestleag_txram_w);
4246   DECLARE_WRITE16_MEMBER(bestleag_bgram_w);
4347   DECLARE_WRITE16_MEMBER(bestleag_fgram_w);
r14896r14897
5054static TILE_GET_INFO( get_tx_tile_info )
5155{
5256   bestleag_state *state = machine.driver_data<bestleag_state>();
53   int code = state->m_txram[tile_index];
57   int code = state->m_txram.target()[tile_index];
5458
5559   SET_TILE_INFO(
5660         0,
r14896r14897
6266static TILE_GET_INFO( get_bg_tile_info )
6367{
6468   bestleag_state *state = machine.driver_data<bestleag_state>();
65   int code = state->m_bgram[tile_index];
69   int code = state->m_bgram.target()[tile_index];
6670
6771   SET_TILE_INFO(
6872         1,
r14896r14897
7478static TILE_GET_INFO( get_fg_tile_info )
7579{
7680   bestleag_state *state = machine.driver_data<bestleag_state>();
77   int code = state->m_fgram[tile_index];
81   int code = state->m_fgram.target()[tile_index];
7882
7983   SET_TILE_INFO(
8084         1,
r14896r14897
113117static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
114118{
115119   bestleag_state *state = machine.driver_data<bestleag_state>();
116   UINT16 *spriteram16 = state->m_spriteram;
120   UINT16 *spriteram16 = state->m_spriteram.target();
117121
118122   /*
119123
r14896r14897
123127
124128   int offs;
125129
126   for (offs = 0x16/2;offs < state->m_spriteram_size/2;offs += 4)
130   for (offs = 0x16/2;offs < state->m_spriteram.bytes()/2;offs += 4)
127131   {
128132      int code = spriteram16[offs+3] & 0xfff;
129133      int color = (spriteram16[offs+2] & 0xf000) >> 12;
r14896r14897
136140         return;
137141
138142      /* it can change sprites color mask like the original set */
139      if(state->m_vregs[0x00/2] & 0x1000)
143      if(state->m_vregs.target()[0x00/2] & 0x1000)
140144         color &= 7;
141145
142146      drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
r14896r14897
169173static SCREEN_UPDATE_IND16(bestleag)
170174{
171175   bestleag_state *state = screen.machine().driver_data<bestleag_state>();
172   state->m_bg_tilemap->set_scrollx(0,(state->m_vregs[0x00/2] & 0xfff) + (state->m_vregs[0x08/2] & 0x7) - 3);
173   state->m_bg_tilemap->set_scrolly(0,state->m_vregs[0x02/2]);
174   state->m_tx_tilemap->set_scrollx(0,state->m_vregs[0x04/2]);
175   state->m_tx_tilemap->set_scrolly(0,state->m_vregs[0x06/2]);
176   state->m_fg_tilemap->set_scrollx(0,state->m_vregs[0x08/2] & 0xfff8);
177   state->m_fg_tilemap->set_scrolly(0,state->m_vregs[0x0a/2]);
176   state->m_bg_tilemap->set_scrollx(0,(state->m_vregs.target()[0x00/2] & 0xfff) + (state->m_vregs.target()[0x08/2] & 0x7) - 3);
177   state->m_bg_tilemap->set_scrolly(0,state->m_vregs.target()[0x02/2]);
178   state->m_tx_tilemap->set_scrollx(0,state->m_vregs.target()[0x04/2]);
179   state->m_tx_tilemap->set_scrolly(0,state->m_vregs.target()[0x06/2]);
180   state->m_fg_tilemap->set_scrollx(0,state->m_vregs.target()[0x08/2] & 0xfff8);
181   state->m_fg_tilemap->set_scrolly(0,state->m_vregs.target()[0x0a/2]);
178182
179183   state->m_bg_tilemap->draw(bitmap, cliprect, 0,0);
180184   state->m_fg_tilemap->draw(bitmap, cliprect, 0,0);
r14896r14897
186190static SCREEN_UPDATE_IND16(bestleaw)
187191{
188192   bestleag_state *state = screen.machine().driver_data<bestleag_state>();
189   state->m_bg_tilemap->set_scrollx(0,state->m_vregs[0x08/2]);
190   state->m_bg_tilemap->set_scrolly(0,state->m_vregs[0x0a/2]);
191   state->m_tx_tilemap->set_scrollx(0,state->m_vregs[0x00/2]);
192   state->m_tx_tilemap->set_scrolly(0,state->m_vregs[0x02/2]);
193   state->m_fg_tilemap->set_scrollx(0,state->m_vregs[0x04/2]);
194   state->m_fg_tilemap->set_scrolly(0,state->m_vregs[0x06/2]);
193   state->m_bg_tilemap->set_scrollx(0,state->m_vregs.target()[0x08/2]);
194   state->m_bg_tilemap->set_scrolly(0,state->m_vregs.target()[0x0a/2]);
195   state->m_tx_tilemap->set_scrollx(0,state->m_vregs.target()[0x00/2]);
196   state->m_tx_tilemap->set_scrolly(0,state->m_vregs.target()[0x02/2]);
197   state->m_fg_tilemap->set_scrollx(0,state->m_vregs.target()[0x04/2]);
198   state->m_fg_tilemap->set_scrolly(0,state->m_vregs.target()[0x06/2]);
195199
196200   state->m_bg_tilemap->draw(bitmap, cliprect, 0,0);
197201   state->m_fg_tilemap->draw(bitmap, cliprect, 0,0);
r14896r14897
202206
203207WRITE16_MEMBER(bestleag_state::bestleag_txram_w)
204208{
205   m_txram[offset] = data;
209   m_txram.target()[offset] = data;
206210   m_tx_tilemap->mark_tile_dirty(offset);
207211}
208212
209213WRITE16_MEMBER(bestleag_state::bestleag_bgram_w)
210214{
211   m_bgram[offset] = data;
215   m_bgram.target()[offset] = data;
212216   m_bg_tilemap->mark_tile_dirty(offset);
213217}
214218
215219WRITE16_MEMBER(bestleag_state::bestleag_fgram_w)
216220{
217   m_fgram[offset] = data;
221   m_fgram.target()[offset] = data;
218222   m_fg_tilemap->mark_tile_dirty(offset);
219223}
220224
r14896r14897
230234static ADDRESS_MAP_START( bestleag_map, AS_PROGRAM, 16, bestleag_state )
231235   AM_RANGE(0x000000, 0x03ffff) AM_ROM
232236   AM_RANGE(0x0d2000, 0x0d3fff) AM_NOP // left over from the original game (only read / written in memory test)
233   AM_RANGE(0x0e0000, 0x0e3fff) AM_RAM_WRITE(bestleag_bgram_w) AM_BASE(m_bgram)
234   AM_RANGE(0x0e8000, 0x0ebfff) AM_RAM_WRITE(bestleag_fgram_w) AM_BASE(m_fgram)
235   AM_RANGE(0x0f0000, 0x0f3fff) AM_RAM_WRITE(bestleag_txram_w) AM_BASE(m_txram)
236   AM_RANGE(0x0f8000, 0x0f800b) AM_RAM AM_BASE(m_vregs)
237   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
238   AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
237   AM_RANGE(0x0e0000, 0x0e3fff) AM_RAM_WRITE(bestleag_bgram_w) AM_SHARE("bgram")
238   AM_RANGE(0x0e8000, 0x0ebfff) AM_RAM_WRITE(bestleag_fgram_w) AM_SHARE("fgram")
239   AM_RANGE(0x0f0000, 0x0f3fff) AM_RAM_WRITE(bestleag_txram_w) AM_SHARE("txram")
240   AM_RANGE(0x0f8000, 0x0f800b) AM_RAM AM_SHARE("vregs")
241   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
242   AM_RANGE(0x200000, 0x200fff) AM_RAM AM_SHARE("spriteram")
239243   AM_RANGE(0x300010, 0x300011) AM_READ_PORT("SYSTEM")
240244   AM_RANGE(0x300012, 0x300013) AM_READ_PORT("P1")
241245   AM_RANGE(0x300014, 0x300015) AM_READ_PORT("P2")
src/mame/drivers/tomcat.c
r14896r14897
4040{
4141public:
4242   tomcat_state(const machine_config &mconfig, device_type type, const char *tag)
43      : driver_device(mconfig, type, tag) { }
43      : driver_device(mconfig, type, tag) ,
44      m_shared_ram(*this, "shared_ram"){ }
4445
4546   int m_control_num;
46   UINT16 *m_shared_ram;
47   required_shared_ptr<UINT16> m_shared_ram;
4748   UINT8 m_nvram[0x800];
4849   int m_dsp_BIO;
4950   int m_dsp_idle;
r14896r14897
254255
255256READ16_MEMBER(tomcat_state::tomcat_shared_ram_r)
256257{
257   return m_shared_ram[offset];
258   return m_shared_ram.target()[offset];
258259}
259260
260261WRITE16_MEMBER(tomcat_state::tomcat_shared_ram_w)
261262{
262   COMBINE_DATA(&m_shared_ram[offset]);
263   COMBINE_DATA(&m_shared_ram.target()[offset]);
263264}
264265
265266READ8_MEMBER(tomcat_state::tomcat_nvram_r)
r14896r14897
303304ADDRESS_MAP_END
304305
305306static ADDRESS_MAP_START( dsp_map, AS_PROGRAM, 16, tomcat_state )
306   AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(m_shared_ram)
307   AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("shared_ram")
307308ADDRESS_MAP_END
308309
309310static ADDRESS_MAP_START( dsp_io_map, AS_IO, 16, tomcat_state )
r14896r14897
357358static MACHINE_START(tomcat)
358359{
359360   tomcat_state *state = machine.driver_data<tomcat_state>();
360   ((UINT16*)state->m_shared_ram)[0x0000] = 0xf600;
361   ((UINT16*)state->m_shared_ram)[0x0001] = 0x0000;
362   ((UINT16*)state->m_shared_ram)[0x0002] = 0xf600;
363   ((UINT16*)state->m_shared_ram)[0x0003] = 0x0000;
361   ((UINT16*)state->m_shared_ram.target())[0x0000] = 0xf600;
362   ((UINT16*)state->m_shared_ram.target())[0x0001] = 0x0000;
363   ((UINT16*)state->m_shared_ram.target())[0x0002] = 0xf600;
364   ((UINT16*)state->m_shared_ram.target())[0x0003] = 0x0000;
364365
365366   machine.device<nvram_device>("nvram")->set_base(state->m_nvram, 0x800);
366367
src/mame/drivers/zaxxon.c
r14896r14897
469469   AM_RANGE(0xc027, 0xc027) AM_MIRROR(0x1fc0) AM_WRITE(congo_color_bank_w)
470470   AM_RANGE(0xc028, 0xc029) AM_MIRROR(0x1fc4) AM_WRITE(zaxxon_bg_position_w)
471471   AM_RANGE(0xc030, 0xc033) AM_MIRROR(0x1fc4) AM_WRITE(congo_sprite_custom_w)
472   AM_RANGE(0xc038, 0xc03f) AM_MIRROR(0x1fc0) AM_WRITE(soundlatch_w)
472   AM_RANGE(0xc038, 0xc03f) AM_MIRROR(0x1fc0) AM_WRITE(soundlatch_byte_w)
473473ADDRESS_MAP_END
474474
475475
r14896r14897
875875
876876static const ppi8255_interface congo_ppi_intf =
877877{
878   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
878   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
879879   DEVCB_NULL,
880880   DEVCB_NULL,
881881   DEVCB_NULL,
src/mame/drivers/fastfred.c
r14896r14897
1919// These values were derived based on disassembly of the code. Usually, it
2020// was pretty obvious what the values should be. Of course, this will have
2121// to change if a different ROM set ever surfaces.
22static READ8_HANDLER( fastfred_custom_io_r )
22READ8_MEMBER(fastfred_state::fastfred_custom_io_r)
2323{
24    switch (cpu_get_pc(&space->device()))
24    switch (cpu_get_pc(&space.device()))
2525    {
2626    case 0x03c0: return 0x9d;
2727    case 0x03e6: return 0x9f;
r14896r14897
4747    case 0x7b58: return 0x20;
4848    }
4949
50    logerror("Uncaught custom I/O read %04X at %04X\n", 0xc800+offset, cpu_get_pc(&space->device()));
50    logerror("Uncaught custom I/O read %04X at %04X\n", 0xc800+offset, cpu_get_pc(&space.device()));
5151    return 0x00;
5252}
5353
54static READ8_HANDLER( flyboy_custom1_io_r )
54READ8_MEMBER(fastfred_state::flyboy_custom1_io_r)
5555{
5656
57   switch (cpu_get_pc(&space->device()))
57   switch (cpu_get_pc(&space.device()))
5858   {
5959    case 0x049d: return 0xad;   /* compare */
6060    case 0x04b9:         /* compare with 0x9e ??? When ??? */
r14896r14897
7575    return 0x00;
7676   }
7777
78   logerror("Uncaught custom I/O read %04X at %04X\n", 0xc085+offset, cpu_get_pc(&space->device()));
78   logerror("Uncaught custom I/O read %04X at %04X\n", 0xc085+offset, cpu_get_pc(&space.device()));
7979   return 0x00;
8080}
8181
82static READ8_HANDLER( flyboy_custom2_io_r )
82READ8_MEMBER(fastfred_state::flyboy_custom2_io_r)
8383{
8484
85   switch (cpu_get_pc(&space->device()))
85   switch (cpu_get_pc(&space.device()))
8686   {
8787    case 0x0395: return 0xf7;   /* $C900 compare         */
8888    case 0x03f5:         /* $c8fd                 */
r14896r14897
100100    return 0x00;
101101   }
102102
103   logerror("Uncaught custom I/O read %04X at %04X\n", 0xc8fb+offset, cpu_get_pc(&space->device()));
103   logerror("Uncaught custom I/O read %04X at %04X\n", 0xc8fb+offset, cpu_get_pc(&space.device()));
104104   return 0x00;
105105}
106106
107107
108static READ8_HANDLER( jumpcoas_custom_io_r )
108READ8_MEMBER(fastfred_state::jumpcoas_custom_io_r)
109109{
110110   if (offset == 0x100)  return 0x63;
111111
112112   return 0x00;
113113}
114114
115static READ8_HANDLER( boggy84_custom_io_r )
115READ8_MEMBER(fastfred_state::boggy84_custom_io_r)
116116{
117117   if (offset == 0x100)  return 0x6a;
118118
r14896r14897
130130   gfx_element_set_source(machine.gfx[1], state->m_imago_sprites);
131131}
132132
133static WRITE8_HANDLER( imago_dma_irq_w )
133WRITE8_MEMBER(fastfred_state::imago_dma_irq_w)
134134{
135   cputag_set_input_line(space->machine(), "maincpu", 0, data & 1 ? ASSERT_LINE : CLEAR_LINE);
135   cputag_set_input_line(machine(), "maincpu", 0, data & 1 ? ASSERT_LINE : CLEAR_LINE);
136136}
137137
138static WRITE8_HANDLER( imago_sprites_bank_w )
138WRITE8_MEMBER(fastfred_state::imago_sprites_bank_w)
139139{
140   fastfred_state *state = space->machine().driver_data<fastfred_state>();
141   state->m_imago_sprites_bank = (data & 2) >> 1;
140   m_imago_sprites_bank = (data & 2) >> 1;
142141}
143142
144static WRITE8_HANDLER( imago_sprites_dma_w )
143WRITE8_MEMBER(fastfred_state::imago_sprites_dma_w)
145144{
146   fastfred_state *state = space->machine().driver_data<fastfred_state>();
147   UINT8 *rom = (UINT8 *)space->machine().region("gfx2")->base();
145   UINT8 *rom = (UINT8 *)machine().region("gfx2")->base();
148146   UINT8 sprites_data;
149147
150   sprites_data = rom[state->m_imago_sprites_address + 0x2000*0 + state->m_imago_sprites_bank * 0x1000];
151   state->m_imago_sprites[offset + 0x800*0] = sprites_data;
148   sprites_data = rom[m_imago_sprites_address + 0x2000*0 + m_imago_sprites_bank * 0x1000];
149   m_imago_sprites[offset + 0x800*0] = sprites_data;
152150
153   sprites_data = rom[state->m_imago_sprites_address + 0x2000*1 + state->m_imago_sprites_bank * 0x1000];
154   state->m_imago_sprites[offset + 0x800*1] = sprites_data;
151   sprites_data = rom[m_imago_sprites_address + 0x2000*1 + m_imago_sprites_bank * 0x1000];
152   m_imago_sprites[offset + 0x800*1] = sprites_data;
155153
156   sprites_data = rom[state->m_imago_sprites_address + 0x2000*2 + state->m_imago_sprites_bank * 0x1000];
157   state->m_imago_sprites[offset + 0x800*2] = sprites_data;
154   sprites_data = rom[m_imago_sprites_address + 0x2000*2 + m_imago_sprites_bank * 0x1000];
155   m_imago_sprites[offset + 0x800*2] = sprites_data;
158156
159   gfx_element_mark_dirty(space->machine().gfx[1], offset/32);
157   gfx_element_mark_dirty(machine().gfx[1], offset/32);
160158}
161159
162static READ8_HANDLER( imago_sprites_offset_r )
160READ8_MEMBER(fastfred_state::imago_sprites_offset_r)
163161{
164   fastfred_state *state = space->machine().driver_data<fastfred_state>();
165   state->m_imago_sprites_address = offset;
162   m_imago_sprites_address = offset;
166163   return 0xff; //not really used
167164}
168165
169static WRITE8_HANDLER( nmi_mask_w )
166WRITE8_MEMBER(fastfred_state::nmi_mask_w)
170167{
171   fastfred_state *state = space->machine().driver_data<fastfred_state>();
172168
173   state->m_nmi_mask = data & 1;
169   m_nmi_mask = data & 1;
174170}
175171
176static WRITE8_HANDLER( sound_nmi_mask_w )
172WRITE8_MEMBER(fastfred_state::sound_nmi_mask_w)
177173{
178   fastfred_state *state = space->machine().driver_data<fastfred_state>();
179174
180   state->m_sound_nmi_mask = data & 1;
175   m_sound_nmi_mask = data & 1;
181176}
182177
183178static ADDRESS_MAP_START( fastfred_map, AS_PROGRAM, 8, fastfred_state )
r14896r14897
185180   AM_RANGE(0xc000, 0xc7ff) AM_RAM
186181   AM_RANGE(0xd000, 0xd3ff) AM_MIRROR(0x400) AM_RAM_WRITE_LEGACY(fastfred_videoram_w) AM_BASE(m_videoram)
187182   AM_RANGE(0xd800, 0xd83f) AM_RAM_WRITE_LEGACY(fastfred_attributes_w) AM_BASE(m_attributesram)
188   AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
183   AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
189184   AM_RANGE(0xd860, 0xdbff) AM_RAM // Unused, but initialized
190185   AM_RANGE(0xe000, 0xe000) AM_READ_PORT("BUTTONS") AM_WRITEONLY AM_BASE(m_background_color)
191186   AM_RANGE(0xe800, 0xe800) AM_READ_PORT("JOYS")
192187   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSW") AM_WRITENOP
193   AM_RANGE(0xf001, 0xf001) AM_WRITE_LEGACY(nmi_mask_w)
188   AM_RANGE(0xf001, 0xf001) AM_WRITE(nmi_mask_w)
194189   AM_RANGE(0xf002, 0xf002) AM_WRITE_LEGACY(fastfred_colorbank1_w)
195190   AM_RANGE(0xf003, 0xf003) AM_WRITE_LEGACY(fastfred_colorbank2_w)
196191   AM_RANGE(0xf004, 0xf004) AM_WRITE_LEGACY(fastfred_charbank1_w)
r14896r14897
199194   AM_RANGE(0xf007, 0xf007) AM_WRITE_LEGACY(fastfred_flip_screen_y_w)
200195   AM_RANGE(0xf116, 0xf116) AM_WRITE_LEGACY(fastfred_flip_screen_x_w)
201196   AM_RANGE(0xf117, 0xf117) AM_WRITE_LEGACY(fastfred_flip_screen_y_w)
202   AM_RANGE(0xf800, 0xf800) AM_READWRITE(watchdog_reset_r, soundlatch_w)
197   AM_RANGE(0xf800, 0xf800) AM_READWRITE(watchdog_reset_r, soundlatch_byte_w)
203198ADDRESS_MAP_END
204199
205200
r14896r14897
207202   AM_RANGE(0x0000, 0x7fff) AM_ROM
208203   AM_RANGE(0xc000, 0xc7ff) AM_RAM
209204   AM_RANGE(0xd000, 0xd03f) AM_RAM_WRITE_LEGACY(fastfred_attributes_w) AM_BASE(m_attributesram)
210   AM_RANGE(0xd040, 0xd05f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
205   AM_RANGE(0xd040, 0xd05f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
211206   AM_RANGE(0xd060, 0xd3ff) AM_RAM
212207   AM_RANGE(0xd800, 0xdbff) AM_MIRROR(0x400) AM_RAM_WRITE_LEGACY(fastfred_videoram_w) AM_BASE(m_videoram)
213208   AM_RANGE(0xe000, 0xe000) AM_WRITEONLY AM_BASE(m_background_color)
r14896r14897
216211   AM_RANGE(0xe802, 0xe802) AM_READ_PORT("BUTTONS")
217212   AM_RANGE(0xe803, 0xe803) AM_READ_PORT("JOYS")
218213   AM_RANGE(0xf000, 0xf000) AM_WRITENOP // Unused, but initialized
219   AM_RANGE(0xf001, 0xf001) AM_WRITE_LEGACY(nmi_mask_w)
214   AM_RANGE(0xf001, 0xf001) AM_WRITE(nmi_mask_w)
220215   AM_RANGE(0xf002, 0xf002) AM_WRITE_LEGACY(fastfred_colorbank1_w)
221216   AM_RANGE(0xf003, 0xf003) AM_WRITE_LEGACY(fastfred_colorbank2_w)
222217   AM_RANGE(0xf004, 0xf004) AM_WRITE_LEGACY(fastfred_charbank1_w)
r14896r14897
232227
233228static ADDRESS_MAP_START( imago_map, AS_PROGRAM, 8, fastfred_state )
234229   AM_RANGE(0x0000, 0x0fff) AM_ROM
235   AM_RANGE(0x1000, 0x1fff) AM_READ_LEGACY(imago_sprites_offset_r)
230   AM_RANGE(0x1000, 0x1fff) AM_READ(imago_sprites_offset_r)
236231   AM_RANGE(0x2000, 0x6fff) AM_ROM
237232   AM_RANGE(0xb000, 0xb3ff) AM_RAM // same fg videoram (which one of the 2 is really used?)
238   AM_RANGE(0xb800, 0xbfff) AM_RAM_WRITE_LEGACY(imago_sprites_dma_w)
233   AM_RANGE(0xb800, 0xbfff) AM_RAM_WRITE(imago_sprites_dma_w)
239234   AM_RANGE(0xc000, 0xc7ff) AM_RAM
240235   AM_RANGE(0xc800, 0xcbff) AM_RAM_WRITE_LEGACY(imago_fg_videoram_w) AM_BASE(m_imago_fg_videoram)
241236   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE_LEGACY(fastfred_videoram_w) AM_BASE(m_videoram)
242237   AM_RANGE(0xd800, 0xd83f) AM_RAM_WRITE_LEGACY(fastfred_attributes_w) AM_BASE(m_attributesram)
243   AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
238   AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
244239   AM_RANGE(0xd860, 0xd8ff) AM_RAM // Unused, but initialized
245240   AM_RANGE(0xe000, 0xe000) AM_READ_PORT("BUTTONS")
246241   AM_RANGE(0xe800, 0xe800) AM_READ_PORT("JOYS")
247242   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSW") AM_WRITENOP // writes 1 when level starts, 0 when game over
248   AM_RANGE(0xf001, 0xf001) AM_WRITE_LEGACY(nmi_mask_w)
243   AM_RANGE(0xf001, 0xf001) AM_WRITE(nmi_mask_w)
249244   AM_RANGE(0xf002, 0xf002) AM_WRITE_LEGACY(fastfred_colorbank1_w)
250245   AM_RANGE(0xf003, 0xf003) AM_WRITE_LEGACY(fastfred_colorbank2_w)
251   AM_RANGE(0xf004, 0xf004) AM_WRITE_LEGACY(imago_dma_irq_w)
246   AM_RANGE(0xf004, 0xf004) AM_WRITE(imago_dma_irq_w)
252247   AM_RANGE(0xf005, 0xf005) AM_WRITE_LEGACY(imago_charbank_w)
253248   AM_RANGE(0xf006, 0xf006) AM_WRITE_LEGACY(fastfred_flip_screen_x_w)
254249   AM_RANGE(0xf007, 0xf007) AM_WRITE_LEGACY(fastfred_flip_screen_y_w)
255250   AM_RANGE(0xf400, 0xf400) AM_WRITENOP // writes 0 or 2
256   AM_RANGE(0xf401, 0xf401) AM_WRITE_LEGACY(imago_sprites_bank_w)
257   AM_RANGE(0xf800, 0xf800) AM_READNOP AM_WRITE(soundlatch_w)
251   AM_RANGE(0xf401, 0xf401) AM_WRITE(imago_sprites_bank_w)
252   AM_RANGE(0xf800, 0xf800) AM_READNOP AM_WRITE(soundlatch_byte_w)
258253ADDRESS_MAP_END
259254
260255static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, fastfred_state )
261256   AM_RANGE(0x0000, 0x1fff) AM_ROM
262257   AM_RANGE(0x2000, 0x23ff) AM_RAM
263   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) AM_WRITE_LEGACY(sound_nmi_mask_w)
258   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r) AM_WRITE(sound_nmi_mask_w)
264259   AM_RANGE(0x4000, 0x4000) AM_WRITEONLY  // Reset PSG's
265260   AM_RANGE(0x5000, 0x5001) AM_DEVWRITE_LEGACY("ay8910.1", ay8910_address_data_w)
266261   AM_RANGE(0x6000, 0x6001) AM_DEVWRITE_LEGACY("ay8910.2", ay8910_address_data_w)
r14896r14897
10091004static DRIVER_INIT( flyboy )
10101005{
10111006   fastfred_state *state = machine.driver_data<fastfred_state>();
1012   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc085, 0xc099, FUNC(flyboy_custom1_io_r));
1013   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc8fb, 0xc900, FUNC(flyboy_custom2_io_r));
1007   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc085, 0xc099, read8_delegate(FUNC(fastfred_state::flyboy_custom1_io_r),state));
1008   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc8fb, 0xc900, read8_delegate(FUNC(fastfred_state::flyboy_custom2_io_r),state));
10141009   state->m_hardware_type = 1;
10151010}
10161011
r14896r14897
10231018static DRIVER_INIT( fastfred )
10241019{
10251020   fastfred_state *state = machine.driver_data<fastfred_state>();
1026   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc800, 0xcfff, FUNC(fastfred_custom_io_r));
1021   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::fastfred_custom_io_r),state));
10271022   machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff);
10281023   state->m_hardware_type = 1;
10291024}
r14896r14897
10311026static DRIVER_INIT( jumpcoas )
10321027{
10331028   fastfred_state *state = machine.driver_data<fastfred_state>();
1034   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc800, 0xcfff, FUNC(jumpcoas_custom_io_r));
1029   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),state));
10351030   machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff);
10361031   state->m_hardware_type = 0;
10371032}
r14896r14897
10391034static DRIVER_INIT( boggy84b )
10401035{
10411036   fastfred_state *state = machine.driver_data<fastfred_state>();
1042   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc800, 0xcfff, FUNC(jumpcoas_custom_io_r));
1037   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),state));
10431038   machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff);
10441039   state->m_hardware_type = 2;
10451040}
r14896r14897
10471042static DRIVER_INIT( boggy84 )
10481043{
10491044   fastfred_state *state = machine.driver_data<fastfred_state>();
1050   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc800, 0xcfff, FUNC(boggy84_custom_io_r));
1045   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::boggy84_custom_io_r),state));
10511046   machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff);
10521047   state->m_hardware_type = 2;
10531048}
src/mame/drivers/karnov.c
r14896r14897
361361         return;
362362
363363      case 2: /* SONREQ (Sound CPU byte) */
364         soundlatch_w(space, 0, data & 0xff);
364         soundlatch_byte_w(space, 0, data & 0xff);
365365         device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
366366         break;
367367
r14896r14897
440440
441441static ADDRESS_MAP_START( karnov_sound_map, AS_PROGRAM, 8, karnov_state )
442442   AM_RANGE(0x0000, 0x05ff) AM_RAM
443   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_r)
443   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r)
444444   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
445445   AM_RANGE(0x1800, 0x1801) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
446446   AM_RANGE(0x8000, 0xffff) AM_ROM
src/mame/drivers/lwings.c
r14896r14897
7474{
7575
7676   /* bit 0 is flip screen */
77   flip_screen_set(machine(), ~data & 0x01);
77   flip_screen_set(~data & 0x01);
7878
7979   /* bits 1 and 2 select ROM bank */
8080   memory_set_bank(machine(), "bank1", (data & 0x06) >> 1);
r14896r14897
127127   else if (pc == 0x0445)
128128   {
129129      m_soundstate = 0x80;
130      soundlatch_w(space, 0, data);
130      soundlatch_byte_w(space, 0, data);
131131   }
132132}
133133
r14896r14897
288288   AM_RANGE(0xdf80, 0xdfff) AM_RAM
289289   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(lwings_fgvideoram_w) AM_BASE(m_fgvideoram)
290290   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(lwings_bg1videoram_w) AM_BASE(m_bg1videoram)
291   AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_split2_w) AM_SHARE("paletteram2")
292   AM_RANGE(0xf400, 0xf7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_split1_w) AM_SHARE("paletteram")
291   AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_split_hi_w) AM_SHARE("paletteram2")
292   AM_RANGE(0xf400, 0xf7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_split_lo_w) AM_SHARE("paletteram")
293293   AM_RANGE(0xf800, 0xf801) AM_WRITE(lwings_bg1_scrollx_w)
294294   AM_RANGE(0xf802, 0xf803) AM_WRITE(lwings_bg1_scrolly_w)
295295   AM_RANGE(0xf804, 0xf804) AM_WRITE(trojan_bg2_scrollx_w)
r14896r14897
311311   AM_RANGE(0xde00, 0xdfff) AM_RAM AM_SHARE("spriteram")
312312   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(lwings_fgvideoram_w) AM_BASE(m_fgvideoram)
313313   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(lwings_bg1videoram_w) AM_BASE(m_bg1videoram)
314   AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_split2_w) AM_SHARE("paletteram2")
315   AM_RANGE(0xf400, 0xf7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_split1_w) AM_SHARE("paletteram")
314   AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_split_hi_w) AM_SHARE("paletteram2")
315   AM_RANGE(0xf400, 0xf7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_split_lo_w) AM_SHARE("paletteram")
316316
317317   AM_RANGE(0xf808, 0xf808) AM_READ_PORT("SERVICE")
318318   AM_RANGE(0xf809, 0xf809) AM_READ_PORT("P1")
r14896r14897
320320   AM_RANGE(0xf80a, 0xf80a) AM_READ_PORT("P2")
321321   AM_RANGE(0xf80b, 0xf80b) AM_READ_PORT("DSWA")
322322   AM_RANGE(0xf80a, 0xf80b) AM_WRITE(lwings_bg1_scrolly_w)
323   AM_RANGE(0xf80c, 0xf80c) AM_READ_PORT("DSWB") AM_WRITE(soundlatch_w)
323   AM_RANGE(0xf80c, 0xf80c) AM_READ_PORT("DSWB") AM_WRITE(soundlatch_byte_w)
324324   AM_RANGE(0xf80d, 0xf80d) AM_WRITE(watchdog_reset_w)
325325   AM_RANGE(0xf80e, 0xf80e) AM_WRITE(lwings_bankswitch_w)
326326ADDRESS_MAP_END
r14896r14897
333333   AM_RANGE(0xdf80, 0xdfff) AM_RAM
334334   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(lwings_fgvideoram_w) AM_BASE(m_fgvideoram)
335335   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(lwings_bg1videoram_w) AM_BASE(m_bg1videoram)
336   AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_split2_w) AM_SHARE("paletteram2")
337   AM_RANGE(0xf400, 0xf7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_split1_w) AM_SHARE("paletteram")
336   AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_split_hi_w) AM_SHARE("paletteram2")
337   AM_RANGE(0xf400, 0xf7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_split_lo_w) AM_SHARE("paletteram")
338338
339339   AM_RANGE(0xf800, 0xf801) AM_WRITE(lwings_bg1_scrollx_w)
340340   AM_RANGE(0xf802, 0xf803) AM_WRITE(lwings_bg1_scrolly_w)
r14896r14897
344344   AM_RANGE(0xf809, 0xf809) AM_READ_PORT("P1")
345345   AM_RANGE(0xf80a, 0xf80a) AM_READ_PORT("P2")
346346   AM_RANGE(0xf80b, 0xf80b) AM_READ_PORT("DSWA")
347   AM_RANGE(0xf80c, 0xf80c) AM_READ_PORT("DSWB") AM_WRITE(soundlatch_w)
348   AM_RANGE(0xf80d, 0xf80d) AM_WRITE(soundlatch2_w)
347   AM_RANGE(0xf80c, 0xf80c) AM_READ_PORT("DSWB") AM_WRITE(soundlatch_byte_w)
348   AM_RANGE(0xf80d, 0xf80d) AM_WRITE(soundlatch2_byte_w)
349349   AM_RANGE(0xf80e, 0xf80e) AM_WRITE(lwings_bankswitch_w)
350350ADDRESS_MAP_END
351351
352352static ADDRESS_MAP_START( lwings_sound_map, AS_PROGRAM, 8, lwings_state )
353353   AM_RANGE(0x0000, 0x7fff) AM_ROM
354354   AM_RANGE(0xc000, 0xc7ff) AM_RAM
355   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
355   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r)
356356   AM_RANGE(0xe000, 0xe001) AM_DEVWRITE_LEGACY("2203a", ym2203_w)
357357   AM_RANGE(0xe002, 0xe003) AM_DEVWRITE_LEGACY("2203b", ym2203_w)
358358   AM_RANGE(0xe006, 0xe006) AM_READ(avengers_soundlatch2_r) //AT: (avengers061gre)
r14896r14897
372372
373373static ADDRESS_MAP_START( trojan_adpcm_io_map, AS_IO, 8, lwings_state )
374374   ADDRESS_MAP_GLOBAL_MASK(0xff)
375   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_r)
375   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r)
376376   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("5205", msm5205_w)
377377ADDRESS_MAP_END
378378
src/mame/drivers/xtheball.c
r14896r14897
1818{
1919public:
2020   xtheball_state(const machine_config &mconfig, device_type type, const char *tag)
21      : driver_device(mconfig, type, tag) { }
21      : driver_device(mconfig, type, tag) ,
22      m_vram_bg(*this, "vrabg"),
23      m_vram_fg(*this, "vrafg"){ }
2224
23   UINT16 *m_vram_bg;
24   UINT16 *m_vram_fg;
25   required_shared_ptr<UINT16> m_vram_bg;
26   required_shared_ptr<UINT16> m_vram_fg;
2527   UINT8 m_bitvals[32];
2628   DECLARE_WRITE16_MEMBER(bit_controls_w);
2729   DECLARE_READ16_MEMBER(analogx_r);
r14896r14897
4042static void xtheball_scanline_update(screen_device &screen, bitmap_rgb32 &bitmap, int scanline, const tms34010_display_params *params)
4143{
4244   xtheball_state *state = screen.machine().driver_data<xtheball_state>();
43   UINT16 *srcbg = &state->m_vram_bg[(params->rowaddr << 8) & 0xff00];
45   UINT16 *srcbg = &state->m_vram_bg.target()[(params->rowaddr << 8) & 0xff00];
4446   UINT32 *dest = &bitmap.pix32(scanline);
4547   const rgb_t *pens = tlc34076_get_pens(screen.machine().device("tlc34076"));
4648   int coladdr = params->coladdr;
r14896r14897
5052   if (!state->m_bitvals[0x13])
5153   {
5254      /* mode 0: foreground is the same as background */
53      UINT16 *srcfg = &state->m_vram_fg[(params->rowaddr << 8) & 0xff00];
55      UINT16 *srcfg = &state->m_vram_fg.target()[(params->rowaddr << 8) & 0xff00];
5456
5557      for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++)
5658      {
r14896r14897
6567   {
6668      /* mode 1: foreground is half background resolution in */
6769      /* X and supports two pages */
68      UINT16 *srcfg = &state->m_vram_fg[(params->rowaddr << 7) & 0xff00];
70      UINT16 *srcfg = &state->m_vram_fg.target()[(params->rowaddr << 7) & 0xff00];
6971
7072      for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++)
7173      {
r14896r14897
9193{
9294   xtheball_state *state = space->machine().driver_data<xtheball_state>();
9395   if (address >= 0x01000000 && address <= 0x010fffff)
94      memcpy(shiftreg, &state->m_vram_bg[TOWORD(address & 0xff000)], TOBYTE(0x1000));
96      memcpy(shiftreg, &state->m_vram_bg.target()[TOWORD(address & 0xff000)], TOBYTE(0x1000));
9597   else if (address >= 0x02000000 && address <= 0x020fffff)
96      memcpy(shiftreg, &state->m_vram_fg[TOWORD(address & 0xff000)], TOBYTE(0x1000));
98      memcpy(shiftreg, &state->m_vram_fg.target()[TOWORD(address & 0xff000)], TOBYTE(0x1000));
9799   else
98100      logerror("%s:xtheball_to_shiftreg(%08X)\n", space->machine().describe_context(), address);
99101}
r14896r14897
103105{
104106   xtheball_state *state = space->machine().driver_data<xtheball_state>();
105107   if (address >= 0x01000000 && address <= 0x010fffff)
106      memcpy(&state->m_vram_bg[TOWORD(address & 0xff000)], shiftreg, TOBYTE(0x1000));
108      memcpy(&state->m_vram_bg.target()[TOWORD(address & 0xff000)], shiftreg, TOBYTE(0x1000));
107109   else if (address >= 0x02000000 && address <= 0x020fffff)
108      memcpy(&state->m_vram_fg[TOWORD(address & 0xff000)], shiftreg, TOBYTE(0x1000));
110      memcpy(&state->m_vram_fg.target()[TOWORD(address & 0xff000)], shiftreg, TOBYTE(0x1000));
109111   else
110112      logerror("%s:xtheball_from_shiftreg(%08X)\n", space->machine().describe_context(), address);
111113}
r14896r14897
130132         switch (offset)
131133         {
132134            case 7:
133               ticket_dispenser_w(machine().device("ticket"), 0, data << 7);
135               machine().device<ticket_dispenser_device>("ticket")->write(space, 0, data << 7);
134136               break;
135137
136138            case 8:
r14896r14897
210212
211213static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, xtheball_state )
212214   AM_RANGE(0x00000000, 0x0001ffff) AM_RAM AM_SHARE("nvram")
213   AM_RANGE(0x01000000, 0x010fffff) AM_RAM AM_BASE(m_vram_bg)
214   AM_RANGE(0x02000000, 0x020fffff) AM_RAM AM_BASE(m_vram_fg)
215   AM_RANGE(0x01000000, 0x010fffff) AM_RAM AM_SHARE("vrabg")
216   AM_RANGE(0x02000000, 0x020fffff) AM_RAM AM_SHARE("vrafg")
215217   AM_RANGE(0x03000000, 0x030000ff) AM_DEVREADWRITE8_LEGACY("tlc34076", tlc34076_r, tlc34076_w, 0x00ff)
216218   AM_RANGE(0x03040000, 0x030401ff) AM_WRITE(bit_controls_w)
217219   AM_RANGE(0x03040080, 0x0304008f) AM_READ_PORT("DSW")
r14896r14897
240242static INPUT_PORTS_START( xtheball )
241243   PORT_START("DSW")
242244   PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED )
243   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
245   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
244246   PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNUSED )
245247   PORT_DIPNAME( 0x0700, 0x0000, "Target Tickets")
246248   PORT_DIPSETTING(      0x0000, "3" )
r14896r14897
340342
341343   MCFG_NVRAM_ADD_1FILL("nvram")
342344
343   MCFG_TICKET_DISPENSER_ADD("ticket", 100, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
345   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
344346
345347   /* video hardware */
346348   MCFG_TLC34076_ADD("tlc34076", TLC34076_6_BIT)
src/mame/drivers/punchout.c
r14896r14897
350350   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
351351   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
352352   AM_RANGE(0x00, 0x01) AM_WRITENOP   /* the 2A03 #1 is not present */
353   AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW2") AM_WRITE(soundlatch_w)
354   AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1") AM_WRITE(soundlatch2_w)
353   AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW2") AM_WRITE(soundlatch_byte_w)
354   AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1") AM_WRITE(soundlatch2_byte_w)
355355   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("vlm", vlm5030_data_w)   /* VLM5030 */
356356//  AM_RANGE(0x05, 0x05) AM_WRITENOP  /* unused */
357357//  AM_RANGE(0x06, 0x06) AM_WRITENOP
r14896r14897
370370
371371static ADDRESS_MAP_START( punchout_sound_map, AS_PROGRAM, 8, punchout_state )
372372   AM_RANGE(0x0000, 0x07ff) AM_RAM
373   AM_RANGE(0x4016, 0x4016) AM_READ(soundlatch_r)
374   AM_RANGE(0x4017, 0x4017) AM_READ(soundlatch2_r)
373   AM_RANGE(0x4016, 0x4016) AM_READ(soundlatch_byte_r)
374   AM_RANGE(0x4017, 0x4017) AM_READ(soundlatch2_byte_r)
375375   AM_RANGE(0x4000, 0x4017) AM_DEVREADWRITE_LEGACY("nes", nes_psg_r,nes_psg_w)
376376   AM_RANGE(0xe000, 0xffff) AM_ROM
377377ADDRESS_MAP_END
src/mame/drivers/news.c
r14896r14897
2323   AM_RANGE(0x0000, 0x7fff) AM_ROM    /* 4000-7fff is written to during startup, probably leftover code */
2424   AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(news_fgram_w) AM_BASE(m_fgram)
2525   AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(news_bgram_w) AM_BASE(m_bgram)
26   AM_RANGE(0x9000, 0x91ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_be_w) AM_SHARE("paletteram")
26   AM_RANGE(0x9000, 0x91ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_be_w) AM_SHARE("paletteram")
2727   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSW")
2828   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("INPUTS")
2929   AM_RANGE(0xc002, 0xc002) AM_DEVREADWRITE("oki", okim6295_device, read, write)
src/mame/drivers/segaybd.c
r14896r14897
238238   segas1x_state *state = machine.driver_data<segas1x_state>();
239239   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
240240
241   state->soundlatch_w(*space, 0, param);
241   state->soundlatch_byte_w(*space, 0, param);
242242   device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, ASSERT_LINE);
243243}
244244
r14896r14897
254254{
255255   segas1x_state *state = space->machine().driver_data<segas1x_state>();
256256   device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, CLEAR_LINE);
257   return state->soundlatch_r(*space, offset);
257   return state->soundlatch_byte_r(*space, offset);
258258}
259259
260260
src/mame/drivers/cclimber.c
r14896r14897
216216
217217WRITE8_MEMBER(cclimber_state::swimmer_sh_soundlatch_w)
218218{
219   soundlatch_w(space,offset,data);
219   soundlatch_byte_w(space,offset,data);
220220   cputag_set_input_line_and_vector(machine(), "audiocpu", 0, HOLD_LINE, 0xff);
221221}
222222
r14896r14897
399399static ADDRESS_MAP_START( swimmer_audio_map, AS_PROGRAM, 8, cclimber_state )
400400   AM_RANGE(0x0000, 0x0fff) AM_ROM
401401   AM_RANGE(0x2000, 0x23ff) AM_RAM
402   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
402   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
403403   AM_RANGE(0x4000, 0x4001) AM_RAM            /* ??? */
404404ADDRESS_MAP_END
405405
src/mame/drivers/foodf.c
r14896r14897
8989 *
9090 *************************************/
9191
92static WRITE16_HANDLER( nvram_recall_w )
92WRITE16_MEMBER(foodf_state::nvram_recall_w)
9393{
94   foodf_state *state = space->machine().driver_data<foodf_state>();
95   state->m_nvram->recall(0);
96   state->m_nvram->recall(1);
97   state->m_nvram->recall(0);
94   m_nvram->recall(0);
95   m_nvram->recall(1);
96   m_nvram->recall(0);
9897}
9998
10099
r14896r14897
160159 *
161160 *************************************/
162161
163static WRITE8_HANDLER( digital_w )
162WRITE8_MEMBER(foodf_state::digital_w)
164163{
165   foodf_state *state = space->machine().driver_data<foodf_state>();
166   foodf_set_flip(state, data & 0x01);
164   foodf_set_flip(data & 0x01);
167165
168   state->m_nvram->store(data & 0x02);
166   m_nvram->store(data & 0x02);
169167
170168   if (!(data & 0x04))
171      atarigen_scanline_int_ack_w(space,0,0,0xffff);
169      atarigen_scanline_int_ack_w(&space,0,0,0xffff);
172170   if (!(data & 0x08))
173      atarigen_video_int_ack_w(space,0,0,0xffff);
171      atarigen_video_int_ack_w(&space,0,0,0xffff);
174172
175173   output_set_led_value(0, (data >> 4) & 1);
176174   output_set_led_value(1, (data >> 5) & 1);
177175
178   coin_counter_w(space->machine(), 0, (data >> 6) & 1);
179   coin_counter_w(space->machine(), 1, (data >> 7) & 1);
176   coin_counter_w(machine(), 0, (data >> 6) & 1);
177   coin_counter_w(machine(), 1, (data >> 7) & 1);
180178}
181179
182180
r14896r14897
187185 *
188186 *************************************/
189187
190static READ16_HANDLER( analog_r )
188READ16_MEMBER(foodf_state::analog_r)
191189{
192190   static const char *const portnames[] = { "STICK0_X", "STICK1_X", "STICK0_Y", "STICK1_Y" };
193   foodf_state *state = space->machine().driver_data<foodf_state>();
194191
195   return input_port_read(space->machine(), portnames[state->m_whichport]);
192   return input_port_read(machine(), portnames[m_whichport]);
196193}
197194
198195
199static WRITE16_HANDLER( analog_w )
196WRITE16_MEMBER(foodf_state::analog_w)
200197{
201   foodf_state *state = space->machine().driver_data<foodf_state>();
202   state->m_whichport = offset ^ 3;
198   m_whichport = offset ^ 3;
203199}
204200
205201
r14896r14897
219215   AM_RANGE(0x01c000, 0x01c0ff) AM_MIRROR(0x3e3f00) AM_RAM AM_BASE(m_spriteram)
220216   AM_RANGE(0x800000, 0x8007ff) AM_MIRROR(0x03f800) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_BASE(m_playfield)
221217   AM_RANGE(0x900000, 0x9001ff) AM_MIRROR(0x03fe00) AM_DEVREADWRITE8("nvram", x2212_device, read, write, 0x00ff)
222   AM_RANGE(0x940000, 0x940007) AM_MIRROR(0x023ff8) AM_READ_LEGACY(analog_r)
223   AM_RANGE(0x944000, 0x944007) AM_MIRROR(0x023ff8) AM_WRITE_LEGACY(analog_w)
224   AM_RANGE(0x948000, 0x948001) AM_MIRROR(0x023ffe) AM_READ_PORT("SYSTEM") AM_WRITE8_LEGACY(digital_w, 0x00ff)
225   AM_RANGE(0x950000, 0x9501ff) AM_MIRROR(0x023e00) AM_WRITE_LEGACY(foodf_paletteram_w) AM_SHARE("paletteram")
226   AM_RANGE(0x954000, 0x954001) AM_MIRROR(0x023ffe) AM_WRITE_LEGACY(nvram_recall_w)
218   AM_RANGE(0x940000, 0x940007) AM_MIRROR(0x023ff8) AM_READ(analog_r)
219   AM_RANGE(0x944000, 0x944007) AM_MIRROR(0x023ff8) AM_WRITE(analog_w)
220   AM_RANGE(0x948000, 0x948001) AM_MIRROR(0x023ffe) AM_READ_PORT("SYSTEM") AM_WRITE8(digital_w, 0x00ff)
221   AM_RANGE(0x950000, 0x9501ff) AM_MIRROR(0x023e00) AM_WRITE(foodf_paletteram_w) AM_SHARE("paletteram")
222   AM_RANGE(0x954000, 0x954001) AM_MIRROR(0x023ffe) AM_WRITE(nvram_recall_w)
227223   AM_RANGE(0x958000, 0x958001) AM_MIRROR(0x023ffe) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w)
228224   AM_RANGE(0xa40000, 0xa4001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8_LEGACY("pokey2", pokey_r, pokey_w, 0x00ff)
229225   AM_RANGE(0xa80000, 0xa8001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8_LEGACY("pokey1", pokey_r, pokey_w, 0x00ff)
r14896r14897
479475 *
480476 *************************************/
481477
482GAME( 1982, foodf,  0,     foodf, foodf, 0, ROT0, "Atari", "Food Fight (rev 3)", GAME_SUPPORTS_SAVE )
483GAME( 1982, foodf2, foodf, foodf, foodf, 0, ROT0, "Atari", "Food Fight (rev 2)", GAME_SUPPORTS_SAVE )
484GAME( 1982, foodfc, foodf, foodf, foodf, 0, ROT0, "Atari", "Food Fight (cocktail)", GAME_SUPPORTS_SAVE )
478GAME( 1982, foodf,  0,     foodf, foodf, 0, ROT0, "General Computer Corporation (Atari license)", "Food Fight (rev 3)", GAME_SUPPORTS_SAVE )
479GAME( 1982, foodf2, foodf, foodf, foodf, 0, ROT0, "General Computer Corporation (Atari license)", "Food Fight (rev 2)", GAME_SUPPORTS_SAVE )
480GAME( 1982, foodfc, foodf, foodf, foodf, 0, ROT0, "General Computer Corporation (Atari license)", "Food Fight (cocktail)", GAME_SUPPORTS_SAVE )
src/mame/drivers/cesclass.c
r14896r14897
3232   cesclassic_state(const machine_config &mconfig, device_type type, const char *tag)
3333   : driver_device(mconfig, type, tag),
3434   m_maincpu(*this, "maincpu"),
35   m_oki(*this, "oki")
36   { }
35   m_oki(*this, "oki"),
36   m_vram(*this, "vram"){ }
3737
3838   DECLARE_WRITE16_MEMBER(irq2_ack_w);
3939   DECLARE_WRITE16_MEMBER(irq3_ack_w);
4040   DECLARE_WRITE16_MEMBER(lamps_w);
4141   DECLARE_WRITE16_MEMBER(outputs_w);
4242
43   UINT16 *m_vram;
4443
4544   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
4645
r14896r14897
5049   required_device<cpu_device> m_maincpu;
5150   required_device<okim6295_device> m_oki;
5251
52   required_shared_ptr<UINT16> m_vram;
5353   // driver_device overrides
5454   virtual void video_start();
5555
r14896r14897
7575            {
7676               UINT8 color;
7777
78               color = (((m_vram[x+y*16+0x400])>>(15-xi)) & 1);
79               color |= (((m_vram[x+y*16])>>(15-xi)) & 1)<<1;
78               color = (((m_vram.target()[x+y*16+0x400])>>(15-xi)) & 1);
79               color |= (((m_vram.target()[x+y*16])>>(15-xi)) & 1)<<1;
8080
8181               if((x*16+xi)<256 && ((y)+0)<256)
8282                  bitmap.pix32(y, x*16+xi) = machine().pens[color];
r14896r14897
119119static ADDRESS_MAP_START( cesclassic_map, AS_PROGRAM, 16, cesclassic_state )
120120   AM_RANGE(0x000000, 0x0fffff) AM_ROM
121121   AM_RANGE(0x400000, 0x40cfff) AM_RAM
122   AM_RANGE(0x40d000, 0x40ffff) AM_RAM AM_BASE(m_vram)
122   AM_RANGE(0x40d000, 0x40ffff) AM_RAM AM_SHARE("vram")
123123   AM_RANGE(0x410000, 0x410001) AM_READ_PORT("VBLANK") //probably m68681 lies there instead
124124   AM_RANGE(0x410004, 0x410005) AM_WRITE(irq3_ack_w)
125125   AM_RANGE(0x410006, 0x410007) AM_WRITE(irq2_ack_w)
src/mame/drivers/aliens.c
r14896r14897
3838WRITE8_MEMBER(aliens_state::bankedram_w)
3939{
4040   if (m_palette_selected)
41      paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset, data);
41      paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
4242   else
4343      m_ram[offset] = data;
4444}
r14896r14897
6969WRITE8_MEMBER(aliens_state::aliens_sh_irqtrigger_w)
7070{
7171
72   soundlatch_w(space, offset, data);
72   soundlatch_byte_w(space, offset, data);
7373   device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0xff);
7474}
7575
r14896r14897
133133   AM_RANGE(0x0000, 0x7fff) AM_ROM                        /* ROM g04_b03.bin */
134134   AM_RANGE(0x8000, 0x87ff) AM_RAM                        /* RAM */
135135   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
136   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r)            /* soundlatch_r */
136   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r)            /* soundlatch_byte_r */
137137   AM_RANGE(0xe000, 0xe00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)
138138ADDRESS_MAP_END
139139
src/mame/drivers/88games.c
r14896r14897
128128
129129static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, _88games_state )
130130   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE(m_banked_rom) /* banked ROM + palette RAM */
131   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_be_w) AM_BASE(m_paletteram_1000)   /* banked ROM + palette RAM */
131   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_BASE(m_paletteram_1000)   /* banked ROM + palette RAM */
132132   AM_RANGE(0x2000, 0x2fff) AM_RAM
133133   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("nvram")
134134   AM_RANGE(0x3800, 0x3fff) AM_READWRITE(bankedram_r, bankedram_w) AM_BASE(m_ram)
135135   AM_RANGE(0x5f84, 0x5f84) AM_WRITE(k88games_5f84_w)
136136   AM_RANGE(0x5f88, 0x5f88) AM_WRITE(watchdog_reset_w)
137   AM_RANGE(0x5f8c, 0x5f8c) AM_WRITE(soundlatch_w)
137   AM_RANGE(0x5f8c, 0x5f8c) AM_WRITE(soundlatch_byte_w)
138138   AM_RANGE(0x5f90, 0x5f90) AM_WRITE(k88games_sh_irqtrigger_w)
139139   AM_RANGE(0x5f94, 0x5f94) AM_READ_PORT("IN0")
140140   AM_RANGE(0x5f95, 0x5f95) AM_READ_PORT("IN1")
r14896r14897
150150   AM_RANGE(0x0000, 0x7fff) AM_ROM
151151   AM_RANGE(0x8000, 0x87ff) AM_RAM
152152   AM_RANGE(0x9000, 0x9000) AM_WRITE(speech_msg_w)
153   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
153   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
154154   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
155155   AM_RANGE(0xe000, 0xe000) AM_WRITE(speech_control_w)
156156ADDRESS_MAP_END
src/mame/drivers/ddenlovr.c
r14896r14897
20902090WRITE8_MEMBER(dynax_state::mmpanic_soundlatch_w)
20912091{
20922092
2093   soundlatch_w(*&space, 0, data);
2093   soundlatch_byte_w(*&space, 0, data);
20942094   device_set_input_line(m_soundcpu, INPUT_LINE_NMI, PULSE_LINE);
20952095}
20962096
r14896r14897
22002200
22012201static ADDRESS_MAP_START( mmpanic_sound_portmap, AS_IO, 8, dynax_state )
22022202   ADDRESS_MAP_GLOBAL_MASK(0xff)
2203   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
2203   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)
22042204   AM_RANGE(0x02, 0x02) AM_READNOP      // read just before port 00
22052205   AM_RANGE(0x04, 0x04) AM_NOP               // read only once at the start
22062206   AM_RANGE(0x06, 0x06) AM_WRITENOP   // almost always 1, sometimes 0
r14896r14897
23382338
23392339static ADDRESS_MAP_START( funkyfig_sound_portmap, AS_IO, 8, dynax_state )
23402340   ADDRESS_MAP_GLOBAL_MASK(0xff)
2341   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
2341   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_byte_r)
23422342   AM_RANGE(0x04, 0x04) AM_READNOP   // read only once at the start
23432343ADDRESS_MAP_END
23442344
src/mame/drivers/chinagat.c
r14896r14897
140140   switch (offset)
141141   {
142142      case 0: /* 3e00 - SND irq */
143         state->soundlatch_w(*space, 0, data);
143         state->soundlatch_byte_w(*space, 0, data);
144144         device_set_input_line(state->m_snd_cpu, state->m_sound_irq, (state->m_sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE );
145145         break;
146146
r14896r14897
175175   state->m_scrolly_hi = ((data & 0x02) >> 1);
176176   state->m_scrollx_hi = data & 0x01;
177177
178   flip_screen_set(space->machine(), ~data & 0x04);
178   state->flip_screen_set(~data & 0x04);
179179}
180180
181181static WRITE8_HANDLER( chinagat_bankswitch_w )
r14896r14897
309309   AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("share1")
310310   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(ddragon_fgvideoram_w) AM_BASE(m_fgvideoram)
311311   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(ddragon_bgvideoram_w) AM_BASE(m_bgvideoram)
312   AM_RANGE(0x3000, 0x317f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("paletteram")
313   AM_RANGE(0x3400, 0x357f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("paletteram2")
312   AM_RANGE(0x3000, 0x317f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram")
313   AM_RANGE(0x3400, 0x357f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
314314   AM_RANGE(0x3800, 0x397f) AM_WRITE_BANK("bank3") AM_BASE_SIZE(m_spriteram, m_spriteram_size)
315315   AM_RANGE(0x3e00, 0x3e04) AM_WRITE_LEGACY(chinagat_interrupt_w)
316316   AM_RANGE(0x3e06, 0x3e06) AM_WRITEONLY AM_BASE(m_scrolly_lo)
r14896r14897
341341   AM_RANGE(0x8000, 0x87ff) AM_RAM
342342   AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
343343   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
344   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
344   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_byte_r)
345345ADDRESS_MAP_END
346346
347347static ADDRESS_MAP_START( ym2203c_sound_map, AS_PROGRAM, 8, ddragon_state )
r14896r14897
359359
360360//  AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
361361//  AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
362   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
362   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_byte_r)
363363ADDRESS_MAP_END
364364
365365static ADDRESS_MAP_START( saiyugoub1_sound_map, AS_PROGRAM, 8, ddragon_state )
r14896r14897
367367   AM_RANGE(0x8000, 0x87ff) AM_RAM
368368   AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
369369   AM_RANGE(0x9800, 0x9800) AM_WRITE_LEGACY(saiyugoub1_mcu_command_w)
370   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
370   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_byte_r)
371371ADDRESS_MAP_END
372372
373373static ADDRESS_MAP_START( i8748_map, AS_PROGRAM, 8, ddragon_state )
src/mame/drivers/kaneko16.c
r14896r14897
307307{
308308   if (ACCESSING_BITS_8_15)
309309   {
310      soundlatch_w(space, 0, (data & 0xff00) >> 8 );
310      soundlatch_byte_w(space, 0, (data & 0xff00) >> 8 );
311311      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
312312   }
313313}
r14896r14897
372372   AM_RANGE(0x000000, 0x03ffff) AM_ROM      // ROM
373373   AM_RANGE(0x200000, 0x20ffff) AM_RAM      // Work RAM
374374   AM_RANGE(0x30e000, 0x30ffff) AM_RAM AM_SHARE("spriteram")      // Sprites
375   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
375   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
376376//  AM_RANGE(0x480000, 0x480001) AM_RAM     // ?
377377   AM_RANGE(0x500000, 0x500001) AM_READWRITE(kaneko16_bg15_reg_r, kaneko16_bg15_reg_w) AM_BASE(m_bg15_reg)   // High Color Background
378378   AM_RANGE(0x580000, 0x580001) AM_READWRITE(kaneko16_bg15_select_r, kaneko16_bg15_select_w) AM_BASE(m_bg15_select)
r14896r14897
429429   AM_RANGE(0x582000, 0x582fff) AM_RAM AM_BASE(m_vscroll[3])                           //
430430   AM_RANGE(0x583000, 0x583fff) AM_RAM AM_BASE(m_vscroll[2])                           //
431431   AM_RANGE(0x600000, 0x601fff) AM_RAM AM_SHARE("spriteram")               // Sprites
432   AM_RANGE(0x700000, 0x700fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
432   AM_RANGE(0x700000, 0x700fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
433433   AM_RANGE(0x800000, 0x80001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(m_layers_0_regs)   // Layers 0 Regs
434434   AM_RANGE(0x900000, 0x90001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(m_sprites_regs   )   // Sprites Regs
435435   AM_RANGE(0xa80000, 0xa80001) AM_READ(watchdog_reset16_r)   // Watchdog
r14896r14897
449449static ADDRESS_MAP_START( blazeon, AS_PROGRAM, 16, kaneko16_state )
450450   AM_RANGE(0x000000, 0x07ffff) AM_ROM      // ROM
451451   AM_RANGE(0x300000, 0x30ffff) AM_RAM      // Work RAM
452   AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
452   AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
453453   AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(m_vram[1])   // Layers 0
454454   AM_RANGE(0x601000, 0x601fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(m_vram[0])   //
455455   AM_RANGE(0x602000, 0x602fff) AM_RAM AM_BASE(m_vscroll[1])                           //
r14896r14897
513513   AM_RANGE(0x2b0000, 0x2b0001) AM_WRITE(toybox_mcu_com1_w)
514514   AM_RANGE(0x2c0000, 0x2c0001) AM_WRITE(toybox_mcu_com2_w)
515515   AM_RANGE(0x2d0000, 0x2d0001) AM_WRITE(toybox_mcu_com3_w)
516   AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
516   AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
517517   AM_RANGE(0x400000, 0x401fff) AM_RAM AM_SHARE("spriteram")               // Sprites
518518   AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(m_vram[1])   // Layers 0
519519   AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(m_vram[0])   //
r14896r14897
575575   AM_RANGE(0x2b0000, 0x2b0001) AM_WRITE(toybox_mcu_com1_w)
576576   AM_RANGE(0x2c0000, 0x2c0001) AM_WRITE(toybox_mcu_com2_w)
577577   AM_RANGE(0x2d0000, 0x2d0001) AM_WRITE(toybox_mcu_com3_w)
578   AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
578   AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
579579   AM_RANGE(0x400000, 0x401fff) AM_RAM AM_SHARE("spriteram")               // Sprites
580580   AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(m_vram[1])   // Layers 0
581581   AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(m_vram[0])   //
r14896r14897
655655   AM_RANGE(0x2c0000, 0x2c0001) AM_WRITE(toybox_mcu_com2_w)
656656   AM_RANGE(0x2d0000, 0x2d0001) AM_WRITE(toybox_mcu_com3_w)
657657
658   AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
658   AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
659659   AM_RANGE(0x310000, 0x327fff) AM_RAM                                                      //
660660   AM_RANGE(0x400000, 0x401fff) AM_RAM AM_SHARE("spriteram")                  // Sprites
661661
r14896r14897
731731   AM_RANGE(0x2c0000, 0x2c0001) AM_WRITE(toybox_mcu_com2_w)
732732   AM_RANGE(0x2d0000, 0x2d0001) AM_WRITE(toybox_mcu_com3_w)
733733
734   AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
734   AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
735735   AM_RANGE(0x310000, 0x327fff) AM_RAM //
736736   AM_RANGE(0x400000, 0x401fff) AM_RAM AM_SHARE("spriteram") // Sprites
737737
r14896r14897
778778   AM_RANGE(0x400000, 0x40001f) AM_DEVREADWRITE_LEGACY("ay1", kaneko16_YM2149_r, kaneko16_YM2149_w)   // Sound
779779   AM_RANGE(0x400200, 0x40021f) AM_DEVREADWRITE_LEGACY("ay2", kaneko16_YM2149_r, kaneko16_YM2149_w)
780780   AM_RANGE(0x400400, 0x400401) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
781   AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
781   AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
782782   AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(m_vram[1])   // Layers 0
783783   AM_RANGE(0x601000, 0x601fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(m_vram[0])   //
784784   AM_RANGE(0x602000, 0x602fff) AM_RAM AM_BASE(m_vscroll[1])                           //
r14896r14897
846846   AM_RANGE(0x2b0000, 0x2b0001) AM_WRITE(calc3_mcu_com2_w)
847847   //AM_RANGE(0x2c0000, 0x2c0001) AM_WRITE_LEGACY(calc3_run) // guess, might be irqack
848848   AM_RANGE(0x2d0000, 0x2d0001) AM_WRITE(calc3_mcu_com3_w)
849   AM_RANGE(0x380000, 0x380fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
849   AM_RANGE(0x380000, 0x380fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
850850   AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff)   // Samples
851851   AM_RANGE(0x480000, 0x480001) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff)
852852   AM_RANGE(0x580000, 0x581fff) AM_RAM AM_SHARE("spriteram")               // Sprites
r14896r14897
887887static ADDRESS_MAP_START( blazeon_soundport, AS_IO, 8, kaneko16_state )
888888   ADDRESS_MAP_GLOBAL_MASK(0xff)
889889   AM_RANGE(0x02, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
890   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
890   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_byte_r)
891891ADDRESS_MAP_END
892892
893893
src/mame/drivers/cybertnk.c
r14896r14897
170170{
171171public:
172172   cybertnk_state(const machine_config &mconfig, device_type type, const char *tag)
173      : driver_device(mconfig, type, tag) { }
173      : driver_device(mconfig, type, tag) ,
174      m_spr_ram(*this, "spr_ram"),
175      m_tx_vram(*this, "tx_vram"),
176      m_bg_vram(*this, "bg_vram"),
177      m_fg_vram(*this, "fg_vram"),
178      m_io_ram(*this, "io_ram"),
179      m_roadram(*this, "roadram"){ }
174180
175181   tilemap_t *m_tx_tilemap;
176   UINT16 *m_tx_vram;
177   UINT16 *m_bg_vram;
178   UINT16 *m_fg_vram;
179   UINT16 *m_spr_ram;
180   UINT16 *m_io_ram;
181   UINT16 *m_roadram;
182   required_shared_ptr<UINT16> m_spr_ram;
183   required_shared_ptr<UINT16> m_tx_vram;
184   required_shared_ptr<UINT16> m_bg_vram;
185   required_shared_ptr<UINT16> m_fg_vram;
186   required_shared_ptr<UINT16> m_io_ram;
187   required_shared_ptr<UINT16> m_roadram;
182188   int m_test_x;
183189   int m_test_y;
184190   int m_start_offs;
r14896r14897
195201static TILE_GET_INFO( get_tx_tile_info )
196202{
197203   cybertnk_state *state = machine.driver_data<cybertnk_state>();
198   int code = state->m_tx_vram[tile_index];
204   int code = state->m_tx_vram.target()[tile_index];
199205   SET_TILE_INFO(
200206         0,
201207         code & 0x1fff,
r14896r14897
232238
233239      for (i=0;i<0x1000/4;i+=4)
234240      {
235         UINT16 param1 = state->m_roadram[i+2];
236         UINT16 param2 = state->m_roadram[i+0];
241         UINT16 param1 = state->m_roadram.target()[i+2];
242         UINT16 param2 = state->m_roadram.target()[i+0];
237243
238244         drawgfx_transpen(bitmap,cliprect,gfx,param1,0x23,0,0,-param2+screen_shift,i/4,0);
239245
r14896r14897
253259      {
254260         for (x=0;x<128;x++)
255261         {
256            UINT16 tile = state->m_bg_vram[count] & 0x1fff;
257            UINT16 color = (state->m_fg_vram[count] & 0xe000) >> 13;
262            UINT16 tile = state->m_bg_vram.target()[count] & 0x1fff;
263            UINT16 color = (state->m_fg_vram.target()[count] & 0xe000) >> 13;
258264
259265            drawgfx_transpen(bitmap,cliprect,gfx,tile,color+0x194,0,0,(x*8)+screen_shift,(y*8),0);
260266
r14896r14897
274280      {
275281         for (x=0;x<128;x++)
276282         {
277            UINT16 tile = state->m_fg_vram[count] & 0x1fff;
278            UINT16 color = (state->m_fg_vram[count] & 0xe000) >> 13;
283            UINT16 tile = state->m_fg_vram.target()[count] & 0x1fff;
284            UINT16 color = (state->m_fg_vram.target()[count] & 0xe000) >> 13;
279285
280286            drawgfx_transpen(bitmap,cliprect,gfx,tile,color+0x1c0,0,0,(x*8)+screen_shift,(y*8),0);
281287
r14896r14897
295301
296302      for(offs=0;offs<0x1000/2;offs+=8)
297303      {
298         z = (state->m_spr_ram[offs+(0x6/2)] & 0xffff);
299         if(z == 0xffff || state->m_spr_ram[offs+(0x0/2)] == 0x0000) //TODO: check the correct bit
304         z = (state->m_spr_ram.target()[offs+(0x6/2)] & 0xffff);
305         if(z == 0xffff || state->m_spr_ram.target()[offs+(0x0/2)] == 0x0000) //TODO: check the correct bit
300306            continue;
301         x = (state->m_spr_ram[offs+(0xa/2)] & 0x3ff);
302         y = (state->m_spr_ram[offs+(0x4/2)] & 0xff);
303         if(state->m_spr_ram[offs+(0x4/2)] & 0x100)
307         x = (state->m_spr_ram.target()[offs+(0xa/2)] & 0x3ff);
308         y = (state->m_spr_ram.target()[offs+(0x4/2)] & 0xff);
309         if(state->m_spr_ram.target()[offs+(0x4/2)] & 0x100)
304310            y = 0x100 - y;
305         spr_offs = (((state->m_spr_ram[offs+(0x0/2)] & 7) << 16) | (state->m_spr_ram[offs+(0x2/2)])) << 2;
306         xsize = ((state->m_spr_ram[offs+(0xc/2)] & 0x000f)+1) << 3;
307         ysize = (state->m_spr_ram[offs+(0x8/2)] & 0x00ff)+1;
308         fx = (state->m_spr_ram[offs+(0xa/2)] & 0x8000) >> 15;
309         zoom = (state->m_spr_ram[offs+(0xc/2)] & 0xff00) >> 8;
311         spr_offs = (((state->m_spr_ram.target()[offs+(0x0/2)] & 7) << 16) | (state->m_spr_ram.target()[offs+(0x2/2)])) << 2;
312         xsize = ((state->m_spr_ram.target()[offs+(0xc/2)] & 0x000f)+1) << 3;
313         ysize = (state->m_spr_ram.target()[offs+(0x8/2)] & 0x00ff)+1;
314         fx = (state->m_spr_ram.target()[offs+(0xa/2)] & 0x8000) >> 15;
315         zoom = (state->m_spr_ram.target()[offs+(0xc/2)] & 0xff00) >> 8;
310316
311         col_bank = (state->m_spr_ram[offs+(0x0/2)] & 0xff00) >> 8;
317         col_bank = (state->m_spr_ram.target()[offs+(0x0/2)] & 0xff00) >> 8;
312318
313319         xf = 0;
314320         yf = 0;
r14896r14897
516522
517523WRITE16_MEMBER(cybertnk_state::tx_vram_w)
518524{
519   COMBINE_DATA(&m_tx_vram[offset]);
525   COMBINE_DATA(&m_tx_vram.target()[offset]);
520526   m_tx_tilemap->mark_tile_dirty(offset);
521527}
522528
r14896r14897
531537      // 0x001100D5 is controller data
532538      // 0x00110004 low is controller data ready
533539      case 4/2:
534         switch( (m_io_ram[6/2]) & 0xff )
540         switch( (m_io_ram.target()[6/2]) & 0xff )
535541         {
536542            case 0:
537               m_io_ram[0xd4/2] = input_port_read(machine(), "TRAVERSE");
543               m_io_ram.target()[0xd4/2] = input_port_read(machine(), "TRAVERSE");
538544               break;
539545
540546            case 0x20:
541               m_io_ram[0xd4/2] = input_port_read(machine(), "ELEVATE");
547               m_io_ram.target()[0xd4/2] = input_port_read(machine(), "ELEVATE");
542548               break;
543549
544550            case 0x40:
545               m_io_ram[0xd4/2] = input_port_read(machine(), "ACCEL");
551               m_io_ram.target()[0xd4/2] = input_port_read(machine(), "ACCEL");
546552               break;
547553
548554            case 0x42:
r14896r14897
550556               // controller return value is stored in $42(a6)
551557               // but I don't see it referenced again.
552558               //popmessage("unknown controller device 0x42");
553               m_io_ram[0xd4/2] = 0;
559               m_io_ram.target()[0xd4/2] = 0;
554560               break;
555561
556562            case 0x60:
557               m_io_ram[0xd4/2] = input_port_read(machine(), "HANDLE");
563               m_io_ram.target()[0xd4/2] = input_port_read(machine(), "HANDLE");
558564               break;
559565
560566            //default:
r14896r14897
572578         return input_port_read(machine(), "DSW2");
573579
574580      case 0xd4/2:
575         return m_io_ram[offset]; // controller data
581         return m_io_ram.target()[offset]; // controller data
576582
577583      default:
578584      {
579585         //popmessage("unknown io read 0x%08x", offset);
580         return m_io_ram[offset];
586         return m_io_ram.target()[offset];
581587      }
582588   }
583589}
584590
585591WRITE16_MEMBER(cybertnk_state::io_w)
586592{
587   COMBINE_DATA(&m_io_ram[offset]);
593   COMBINE_DATA(&m_io_ram.target()[offset]);
588594
589595   switch( offset )
590596   {
r14896r14897
645651      case 0x80/2:
646652      case 0x82/2:
647653      case 0x84/2:
648         popmessage("%02x %02x %02x %02x %02x %02x %02x",m_io_ram[0x40/2],m_io_ram[0x42/2],m_io_ram[0x44/2],m_io_ram[0x46/2],m_io_ram[0x48/2],m_io_ram[0x4a/2],m_io_ram[0x4c/2]);
654         popmessage("%02x %02x %02x %02x %02x %02x %02x",m_io_ram.target()[0x40/2],m_io_ram.target()[0x42/2],m_io_ram.target()[0x44/2],m_io_ram.target()[0x46/2],m_io_ram.target()[0x48/2],m_io_ram.target()[0x4a/2],m_io_ram.target()[0x4c/2]);
649655         break;
650656
651657      default:
r14896r14897
656662
657663READ8_MEMBER(cybertnk_state::soundport_r)
658664{
659   return m_io_ram[0] & 0xff;
665   return m_io_ram.target()[0] & 0xff;
660666}
661667
662668static ADDRESS_MAP_START( master_mem, AS_PROGRAM, 16, cybertnk_state )
663669   AM_RANGE(0x000000, 0x03ffff) AM_ROM
664670   AM_RANGE(0x080000, 0x087fff) AM_RAM /*Work RAM*/
665   AM_RANGE(0x0a0000, 0x0a0fff) AM_RAM AM_BASE(m_spr_ram) // non-tile based sprite ram
666   AM_RANGE(0x0c0000, 0x0c1fff) AM_RAM_WRITE(tx_vram_w) AM_BASE(m_tx_vram)
667   AM_RANGE(0x0c4000, 0x0c5fff) AM_RAM AM_BASE(m_bg_vram)
668   AM_RANGE(0x0c8000, 0x0c9fff) AM_RAM AM_BASE(m_fg_vram)
671   AM_RANGE(0x0a0000, 0x0a0fff) AM_RAM AM_SHARE("spr_ram") // non-tile based sprite ram
672   AM_RANGE(0x0c0000, 0x0c1fff) AM_RAM_WRITE(tx_vram_w) AM_SHARE("tx_vram")
673   AM_RANGE(0x0c4000, 0x0c5fff) AM_RAM AM_SHARE("bg_vram")
674   AM_RANGE(0x0c8000, 0x0c9fff) AM_RAM AM_SHARE("fg_vram")
669675   AM_RANGE(0x0e0000, 0x0e0fff) AM_RAM AM_SHARE("sharedram")
670   AM_RANGE(0x100000, 0x107fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
671   AM_RANGE(0x110000, 0x1101ff) AM_READWRITE(io_r,io_w) AM_BASE(m_io_ram)
676   AM_RANGE(0x100000, 0x107fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
677   AM_RANGE(0x110000, 0x1101ff) AM_READWRITE(io_r,io_w) AM_SHARE("io_ram")
672678ADDRESS_MAP_END
673679
674680static ADDRESS_MAP_START( slave_mem, AS_PROGRAM, 16, cybertnk_state )
675681   AM_RANGE(0x000000, 0x01ffff) AM_ROM
676682   AM_RANGE(0x080000, 0x083fff) AM_RAM /*Work RAM*/
677   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM AM_BASE(m_roadram)
683   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM AM_SHARE("roadram")
678684   AM_RANGE(0x100000, 0x100fff) AM_RAM AM_SHARE("sharedram")
679685   AM_RANGE(0x140000, 0x140003) AM_NOP /*Watchdog? Written during loops and interrupts*/
680686ADDRESS_MAP_END
src/mame/drivers/wc90.c
r14896r14897
102102
103103WRITE8_MEMBER(wc90_state::wc90_sound_command_w)
104104{
105   soundlatch_w(space, offset, data);
105   soundlatch_byte_w(space, offset, data);
106106   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
107107}
108108
r14896r14897
145145   AM_RANGE(0xc000, 0xcfff) AM_RAM
146146   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
147147   AM_RANGE(0xd800, 0xdfff) AM_RAM
148   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_be_w) AM_SHARE("paletteram")
148   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_be_w) AM_SHARE("paletteram")
149149   AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank2")
150150   AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("share1")
151151   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(wc90_bankswitch1_w)
r14896r14897
157157   AM_RANGE(0xf000, 0xf7ff) AM_RAM
158158   AM_RANGE(0xf800, 0xf803) AM_DEVREADWRITE_LEGACY("ymsnd", ym2608_r, ym2608_w)
159159   AM_RANGE(0xfc00, 0xfc00) AM_READNOP /* ??? adpcm ??? */
160   AM_RANGE(0xfc10, 0xfc10) AM_READ(soundlatch_r)
160   AM_RANGE(0xfc10, 0xfc10) AM_READ(soundlatch_byte_r)
161161ADDRESS_MAP_END
162162
163163
src/mame/drivers/gauntlet.c
r14896r14897
185185 *
186186 *************************************/
187187
188static READ16_HANDLER( port4_r )
188READ16_MEMBER(gauntlet_state::port4_r)
189189{
190   gauntlet_state *state = space->machine().driver_data<gauntlet_state>();
191   int temp = input_port_read(space->machine(), "803008");
192   if (state->m_cpu_to_sound_ready) temp ^= 0x0020;
193   if (state->m_sound_to_cpu_ready) temp ^= 0x0010;
190   int temp = input_port_read(machine(), "803008");
191   if (m_cpu_to_sound_ready) temp ^= 0x0020;
192   if (m_sound_to_cpu_ready) temp ^= 0x0010;
194193   return temp;
195194}
196195
r14896r14897
202201 *
203202 *************************************/
204203
205static WRITE16_HANDLER( sound_reset_w )
204WRITE16_MEMBER(gauntlet_state::sound_reset_w)
206205{
207   gauntlet_state *state = space->machine().driver_data<gauntlet_state>();
208206   if (ACCESSING_BITS_0_7)
209207   {
210      int oldword = state->m_sound_reset_val;
211      COMBINE_DATA(&state->m_sound_reset_val);
208      int oldword = m_sound_reset_val;
209      COMBINE_DATA(&m_sound_reset_val);
212210
213      if ((oldword ^ state->m_sound_reset_val) & 1)
211      if ((oldword ^ m_sound_reset_val) & 1)
214212      {
215         cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, (state->m_sound_reset_val & 1) ? CLEAR_LINE : ASSERT_LINE);
216         atarigen_sound_reset(space->machine());
217         if (state->m_sound_reset_val & 1)
213         cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_RESET, (m_sound_reset_val & 1) ? CLEAR_LINE : ASSERT_LINE);
214         atarigen_sound_reset(machine());
215         if (m_sound_reset_val & 1)
218216         {
219            devtag_reset(space->machine(), "ymsnd");
220            devtag_reset(space->machine(), "tms");
221            tms5220_set_frequency(space->machine().device("tms"), ATARI_CLOCK_14MHz/2 / 11);
222            atarigen_set_ym2151_vol(space->machine(), 0);
223            atarigen_set_pokey_vol(space->machine(), 0);
224            atarigen_set_tms5220_vol(space->machine(), 0);
217            devtag_reset(machine(), "ymsnd");
218            devtag_reset(machine(), "tms");
219            tms5220_set_frequency(machine().device("tms"), ATARI_CLOCK_14MHz/2 / 11);
220            atarigen_set_ym2151_vol(machine(), 0);
221            atarigen_set_pokey_vol(machine(), 0);
222            atarigen_set_tms5220_vol(machine(), 0);
225223         }
226224      }
227225   }
r14896r14897
235233 *
236234 *************************************/
237235
238static READ8_HANDLER( switch_6502_r )
236READ8_MEMBER(gauntlet_state::switch_6502_r)
239237{
240   gauntlet_state *state = space->machine().driver_data<gauntlet_state>();
241238   int temp = 0x30;
242239
243   if (state->m_cpu_to_sound_ready) temp ^= 0x80;
244   if (state->m_sound_to_cpu_ready) temp ^= 0x40;
245   if (!tms5220_readyq_r(space->machine().device("tms"))) temp ^= 0x20;
246   if (!(input_port_read(space->machine(), "803008") & 0x0008)) temp ^= 0x10;
240   if (m_cpu_to_sound_ready) temp ^= 0x80;
241   if (m_sound_to_cpu_ready) temp ^= 0x40;
242   if (!tms5220_readyq_r(machine().device("tms"))) temp ^= 0x20;
243   if (!(input_port_read(machine(), "803008") & 0x0008)) temp ^= 0x10;
247244
248245   return temp;
249246}
r14896r14897
255252 *
256253 *************************************/
257254
258static WRITE8_HANDLER( sound_ctl_w )
255WRITE8_MEMBER(gauntlet_state::sound_ctl_w)
259256{
260   device_t *tms = space->machine().device("tms");
257   device_t *tms = machine().device("tms");
261258   switch (offset & 7)
262259   {
263260      case 0:   /* music reset, bit D7, low reset */
264         if (((data>>7)&1) == 0) devtag_reset(space->machine(), "ymsnd");
261         if (((data>>7)&1) == 0) devtag_reset(machine(), "ymsnd");
265262         break;
266263
267264      case 1:   /* speech write, bit D7, active low */
r14896r14897
287284 *
288285 *************************************/
289286
290static WRITE8_HANDLER( mixer_w )
287WRITE8_MEMBER(gauntlet_state::mixer_w)
291288{
292   atarigen_set_ym2151_vol(space->machine(), (data & 7) * 100 / 7);
293   atarigen_set_pokey_vol(space->machine(), ((data >> 3) & 3) * 100 / 3);
294   atarigen_set_tms5220_vol(space->machine(), ((data >> 5) & 7) * 100 / 7);
289   atarigen_set_ym2151_vol(machine(), (data & 7) * 100 / 7);
290   atarigen_set_pokey_vol(machine(), ((data >> 3) & 3) * 100 / 3);
291   atarigen_set_tms5220_vol(machine(), ((data >> 5) & 7) * 100 / 7);
295292}
296293
297294
r14896r14897
316313   AM_RANGE(0x803002, 0x803003) AM_MIRROR(0x2fcef0) AM_READ_PORT("803002")
317314   AM_RANGE(0x803004, 0x803005) AM_MIRROR(0x2fcef0) AM_READ_PORT("803004")
318315   AM_RANGE(0x803006, 0x803007) AM_MIRROR(0x2fcef0) AM_READ_PORT("803006")
319   AM_RANGE(0x803008, 0x803009) AM_MIRROR(0x2fcef0) AM_READ_LEGACY(port4_r)
316   AM_RANGE(0x803008, 0x803009) AM_MIRROR(0x2fcef0) AM_READ(port4_r)
320317   AM_RANGE(0x80300e, 0x80300f) AM_MIRROR(0x2fcef0) AM_READ_LEGACY(atarigen_sound_r)
321318   AM_RANGE(0x803100, 0x803101) AM_MIRROR(0x2fce8e) AM_WRITE(watchdog_reset16_w)
322   AM_RANGE(0x803120, 0x803121) AM_MIRROR(0x2fce8e) AM_WRITE_LEGACY(sound_reset_w)
319   AM_RANGE(0x803120, 0x803121) AM_MIRROR(0x2fce8e) AM_WRITE(sound_reset_w)
323320   AM_RANGE(0x803140, 0x803141) AM_MIRROR(0x2fce8e) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
324321   AM_RANGE(0x803150, 0x803151) AM_MIRROR(0x2fce8e) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
325322   AM_RANGE(0x803170, 0x803171) AM_MIRROR(0x2fce8e) AM_WRITE_LEGACY(atarigen_sound_w)
r14896r14897
331328   AM_RANGE(0x905f6e, 0x905f6f) AM_MIRROR(0x2c8000) AM_RAM_WRITE_LEGACY(gauntlet_yscroll_w) AM_BASE(m_yscroll)
332329   AM_RANGE(0x905000, 0x905f7f) AM_MIRROR(0x2c8000) AM_RAM_WRITE_LEGACY(atarigen_alpha_w) AM_BASE(m_alpha)
333330   AM_RANGE(0x905f80, 0x905fff) AM_MIRROR(0x2c8000) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
334   AM_RANGE(0x910000, 0x9107ff) AM_MIRROR(0x2cf800) AM_RAM_WRITE(paletteram16_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
331   AM_RANGE(0x910000, 0x9107ff) AM_MIRROR(0x2cf800) AM_RAM_WRITE(paletteram_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
335332   AM_RANGE(0x930000, 0x930001) AM_MIRROR(0x2cfffe) AM_WRITE_LEGACY(gauntlet_xscroll_w) AM_BASE(m_xscroll)
336333ADDRESS_MAP_END
337334
r14896r14897
349346   AM_RANGE(0x0000, 0x0fff) AM_MIRROR(0x2000) AM_RAM
350347   AM_RANGE(0x1000, 0x100f) AM_MIRROR(0x27c0) AM_WRITE_LEGACY(atarigen_6502_sound_w)
351348   AM_RANGE(0x1010, 0x101f) AM_MIRROR(0x27c0) AM_READ_LEGACY(atarigen_6502_sound_r)
352   AM_RANGE(0x1020, 0x102f) AM_MIRROR(0x27c0) AM_READ_PORT("COIN") AM_WRITE_LEGACY(mixer_w)
353   AM_RANGE(0x1030, 0x103f) AM_MIRROR(0x27c0) AM_READWRITE_LEGACY(switch_6502_r, sound_ctl_w)
349   AM_RANGE(0x1020, 0x102f) AM_MIRROR(0x27c0) AM_READ_PORT("COIN") AM_WRITE(mixer_w)
350   AM_RANGE(0x1030, 0x103f) AM_MIRROR(0x27c0) AM_READWRITE(switch_6502_r, sound_ctl_w)
354351   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x27c0) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
355352   AM_RANGE(0x1810, 0x1811) AM_MIRROR(0x27ce) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
356353   AM_RANGE(0x1820, 0x182f) AM_MIRROR(0x27c0) AM_DEVWRITE_LEGACY("tms", tms5220_data_w)
src/mame/drivers/ms32.c
r14896r14897
219219
220220WRITE32_MEMBER(ms32_state::ms32_sound_w)
221221{
222   soundlatch_w(space, 0, data & 0xff);
222   soundlatch_byte_w(space, 0, data & 0xff);
223223   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, ASSERT_LINE);
224224
225225   // give the Z80 time to respond
r14896r14897
13471347READ8_MEMBER(ms32_state::latch_r)
13481348{
13491349   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, CLEAR_LINE);
1350   return soundlatch_r(space,0)^0xff;
1350   return soundlatch_byte_r(space,0)^0xff;
13511351}
13521352
13531353WRITE8_MEMBER(ms32_state::ms32_snd_bank_w)
src/mame/drivers/darkseal.c
r14896r14897
3232      m_spriteram->copy();
3333      return;
3434    case 8: /* Sound CPU write */
35      soundlatch_w(space, 0, data & 0xff);
35      soundlatch_byte_w(space, 0, data & 0xff);
3636      cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
3737       return;
3838   case 0xa: /* IRQ Ack (VBL) */
r14896r14897
8888   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ym2", ym2151_r, ym2151_w)
8989   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
9090   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
91   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
91   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
9292   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
9393   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
9494   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/deniam.c
r14896r14897
5252{
5353   if (ACCESSING_BITS_8_15)
5454   {
55      soundlatch_w(space,offset, (data >> 8) & 0xff);
55      soundlatch_byte_w(space,offset, (data >> 8) & 0xff);
5656      device_set_input_line(m_audio_cpu, INPUT_LINE_NMI, PULSE_LINE);
5757   }
5858}
r14896r14897
101101
102102static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, deniam_state )
103103   ADDRESS_MAP_GLOBAL_MASK(0xff)
104   AM_RANGE(0x01, 0x01) AM_READ(soundlatch_r)
104   AM_RANGE(0x01, 0x01) AM_READ(soundlatch_byte_r)
105105   AM_RANGE(0x02, 0x03) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w)
106106   AM_RANGE(0x05, 0x05) AM_DEVREADWRITE("oki", okim6295_device, read, write)
107107   AM_RANGE(0x07, 0x07) AM_DEVWRITE_LEGACY("oki", deniam16b_oki_rom_bank_w)
src/mame/drivers/redalert.c
r14896r14897
158158   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0f8f) AM_READ_PORT("C000") AM_WRITENOP
159159   AM_RANGE(0xc010, 0xc010) AM_MIRROR(0x0f8f) AM_READ_PORT("C010") AM_WRITENOP
160160   AM_RANGE(0xc020, 0xc020) AM_MIRROR(0x0f8f) AM_READ_PORT("C020") AM_WRITENOP
161   AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE_LEGACY(redalert_audio_command_w)
161   AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE(redalert_audio_command_w)
162162   AM_RANGE(0xc040, 0xc040) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITEONLY AM_BASE(m_video_control)
163163   AM_RANGE(0xc050, 0xc050) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITEONLY AM_BASE(m_bitmap_color)
164   AM_RANGE(0xc060, 0xc060) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE_LEGACY(redalert_voice_command_w)
164   AM_RANGE(0xc060, 0xc060) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE(redalert_voice_command_w)
165165   AM_RANGE(0xc070, 0xc070) AM_MIRROR(0x0f8f) AM_READWRITE(redalert_interrupt_clear_r, redalert_interrupt_clear_w)
166166   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("maincpu", 0x8000)
167167ADDRESS_MAP_END
r14896r14897
174174   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0f8f) AM_READ_PORT("C000") AM_WRITENOP
175175   AM_RANGE(0xc010, 0xc010) AM_MIRROR(0x0f8f) AM_READ_PORT("C010") AM_WRITENOP
176176   AM_RANGE(0xc020, 0xc020) AM_MIRROR(0x0f8f) AM_READ_PORT("C020") AM_WRITENOP
177   AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE_LEGACY(redalert_audio_command_w)
177   AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE(redalert_audio_command_w)
178178   AM_RANGE(0xc040, 0xc040) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITEONLY AM_BASE(m_video_control)
179179   AM_RANGE(0xc050, 0xc050) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITEONLY AM_BASE(m_bitmap_color)
180180   AM_RANGE(0xc070, 0xc070) AM_MIRROR(0x0f8f) AM_READWRITE(redalert_interrupt_clear_r, redalert_interrupt_clear_w)
r14896r14897
189189   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0f8f) AM_READ_PORT("C000") AM_WRITENOP
190190   AM_RANGE(0xc010, 0xc010) AM_MIRROR(0x0f8f) AM_READ_PORT("C010") AM_WRITENOP
191191   AM_RANGE(0xc020, 0xc020) AM_MIRROR(0x0f8f) AM_READ(panther_unk_r) /* vblank? */
192   AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE_LEGACY(redalert_audio_command_w)
192   AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE(redalert_audio_command_w)
193193   AM_RANGE(0xc040, 0xc040) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITEONLY AM_BASE(m_video_control)
194194   AM_RANGE(0xc050, 0xc050) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITEONLY AM_BASE(m_bitmap_color)
195195   AM_RANGE(0xc070, 0xc070) AM_MIRROR(0x0f8f) AM_READWRITE(panther_interrupt_clear_r, redalert_interrupt_clear_w)
r14896r14897
204204   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0f8f) AM_READ_PORT("C000") AM_WRITENOP
205205   AM_RANGE(0xc010, 0xc010) AM_MIRROR(0x0f8f) AM_READ_PORT("C010") AM_WRITENOP
206206   AM_RANGE(0xc020, 0xc020) AM_MIRROR(0x0f8f) AM_READ_PORT("C020") AM_WRITENOP
207   AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE_LEGACY(demoneye_audio_command_w)
207   AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITE(demoneye_audio_command_w)
208208   AM_RANGE(0xc040, 0xc040) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITEONLY AM_BASE(m_video_control)
209209   AM_RANGE(0xc050, 0xc050) AM_MIRROR(0x0f8f) AM_READNOP AM_WRITEONLY AM_BASE(m_bitmap_color)
210210   AM_RANGE(0xc060, 0xc060) AM_MIRROR(0x0f80) AM_NOP   /* unknown */
src/mame/drivers/mcr3.c
r14896r14897
116116
117117
118118
119static WRITE8_HANDLER( mcrmono_control_port_w )
119WRITE8_MEMBER(mcr3_state::mcrmono_control_port_w)
120120{
121121   /*
122122        Bit layout is as follows:
r14896r14897
130130            D0 = coin meter 1
131131    */
132132
133   coin_counter_w(space->machine(), 0, (data >> 0) & 1);
133   coin_counter_w(machine(), 0, (data >> 0) & 1);
134134   mcr_cocktail_flip = (data >> 6) & 1;
135135}
136136
r14896r14897
141141 *
142142 *************************************/
143143
144static READ8_HANDLER( demoderm_ip1_r )
144READ8_MEMBER(mcr3_state::demoderm_ip1_r)
145145{
146   mcr3_state *state = space->machine().driver_data<mcr3_state>();
147   return input_port_read(space->machine(), "MONO.IP1") |
148      (input_port_read(space->machine(), state->m_input_mux ? "MONO.IP1.ALT2" : "MONO.IP1.ALT1") << 2);
146   return input_port_read(machine(), "MONO.IP1") |
147      (input_port_read(machine(), m_input_mux ? "MONO.IP1.ALT2" : "MONO.IP1.ALT1") << 2);
149148}
150149
151150
152static READ8_HANDLER( demoderm_ip2_r )
151READ8_MEMBER(mcr3_state::demoderm_ip2_r)
153152{
154   mcr3_state *state = space->machine().driver_data<mcr3_state>();
155   return input_port_read(space->machine(), "MONO.IP2") |
156      (input_port_read(space->machine(), state->m_input_mux ? "MONO.IP2.ALT2" : "MONO.IP2.ALT1") << 2);
153   return input_port_read(machine(), "MONO.IP2") |
154      (input_port_read(machine(), m_input_mux ? "MONO.IP2.ALT2" : "MONO.IP2.ALT1") << 2);
157155}
158156
159157
160static WRITE8_HANDLER( demoderm_op6_w )
158WRITE8_MEMBER(mcr3_state::demoderm_op6_w)
161159{
162   mcr3_state *state = space->machine().driver_data<mcr3_state>();
163160   /* top 2 bits select the input */
164   if (data & 0x80) state->m_input_mux = 0;
165   if (data & 0x40) state->m_input_mux = 1;
161   if (data & 0x80) m_input_mux = 0;
162   if (data & 0x40) m_input_mux = 1;
166163
167164   /* low 5 bits control the turbo CS */
168165   turbocs_data_w(space, offset, data);
r14896r14897
176173 *
177174 *************************************/
178175
179static READ8_HANDLER( maxrpm_ip1_r )
176READ8_MEMBER(mcr3_state::maxrpm_ip1_r)
180177{
181   mcr3_state *state = space->machine().driver_data<mcr3_state>();
182   return state->m_latched_input;
178   return m_latched_input;
183179}
184180
185181
186static READ8_HANDLER( maxrpm_ip2_r )
182READ8_MEMBER(mcr3_state::maxrpm_ip2_r)
187183{
188   mcr3_state *state = space->machine().driver_data<mcr3_state>();
189184   static const UINT8 shift_bits[5] = { 0x00, 0x05, 0x06, 0x01, 0x02 };
190   UINT8 start = input_port_read(space->machine(), "MONO.IP0");
191   UINT8 shift = input_port_read(space->machine(), "SHIFT");
185   UINT8 start = input_port_read(machine(), "MONO.IP0");
186   UINT8 shift = input_port_read(machine(), "SHIFT");
192187
193188   /* reset on a start */
194189   if (!(start & 0x08))
195      state->m_maxrpm_p1_shift = 0;
190      m_maxrpm_p1_shift = 0;
196191   if (!(start & 0x04))
197      state->m_maxrpm_p2_shift = 0;
192      m_maxrpm_p2_shift = 0;
198193
199194   /* increment, decrement on falling edge */
200   if (!(shift & 0x01) && (state->m_maxrpm_last_shift & 0x01))
195   if (!(shift & 0x01) && (m_maxrpm_last_shift & 0x01))
201196   {
202      state->m_maxrpm_p1_shift++;
203      if (state->m_maxrpm_p1_shift > 4)
204         state->m_maxrpm_p1_shift = 4;
197      m_maxrpm_p1_shift++;
198      if (m_maxrpm_p1_shift > 4)
199         m_maxrpm_p1_shift = 4;
205200   }
206   if (!(shift & 0x02) && (state->m_maxrpm_last_shift & 0x02))
201   if (!(shift & 0x02) && (m_maxrpm_last_shift & 0x02))
207202   {
208      state->m_maxrpm_p1_shift--;
209      if (state->m_maxrpm_p1_shift < 0)
210         state->m_maxrpm_p1_shift = 0;
203      m_maxrpm_p1_shift--;
204      if (m_maxrpm_p1_shift < 0)
205         m_maxrpm_p1_shift = 0;
211206   }
212   if (!(shift & 0x04) && (state->m_maxrpm_last_shift & 0x04))
207   if (!(shift & 0x04) && (m_maxrpm_last_shift & 0x04))
213208   {
214      state->m_maxrpm_p2_shift++;
215      if (state->m_maxrpm_p2_shift > 4)
216         state->m_maxrpm_p2_shift = 4;
209      m_maxrpm_p2_shift++;
210      if (m_maxrpm_p2_shift > 4)
211         m_maxrpm_p2_shift = 4;
217212   }
218   if (!(shift & 0x08) && (state->m_maxrpm_last_shift & 0x08))
213   if (!(shift & 0x08) && (m_maxrpm_last_shift & 0x08))
219214   {
220      state->m_maxrpm_p2_shift--;
221      if (state->m_maxrpm_p2_shift < 0)
222         state->m_maxrpm_p2_shift = 0;
215      m_maxrpm_p2_shift--;
216      if (m_maxrpm_p2_shift < 0)
217         m_maxrpm_p2_shift = 0;
223218   }
224219
225   state->m_maxrpm_last_shift = shift;
220   m_maxrpm_last_shift = shift;
226221
227   return ~((shift_bits[state->m_maxrpm_p1_shift] << 4) + shift_bits[state->m_maxrpm_p2_shift]);
222   return ~((shift_bits[m_maxrpm_p1_shift] << 4) + shift_bits[m_maxrpm_p2_shift]);
228223}
229224
230225
231static WRITE8_HANDLER( maxrpm_op5_w )
226WRITE8_MEMBER(mcr3_state::maxrpm_op5_w)
232227{
233   mcr3_state *state = space->machine().driver_data<mcr3_state>();
234228   /* latch the low 4 bits as input to the ADC0844 */
235   state->m_maxrpm_adc_control = data & 0x0f;
229   m_maxrpm_adc_control = data & 0x0f;
236230
237231   /* remaining bits go to standard connections */
238232   mcrmono_control_port_w(space, offset, data);
239233}
240234
241235
242static WRITE8_HANDLER( maxrpm_op6_w )
236WRITE8_MEMBER(mcr3_state::maxrpm_op6_w)
243237{
244   mcr3_state *state = space->machine().driver_data<mcr3_state>();
245238   static const char *const inputs[] = { "MONO.IP1", "MONO.IP1.ALT1", "MONO.IP1.ALT2", "MONO.IP1.ALT3" };
246239   /*
247240        Reflective Sensor Control:
r14896r14897
263256
264257   /* when the read is toggled is when the ADC value is latched */
265258   if (!(data & 0x80))
266      state->m_latched_input = input_port_read(space->machine(), inputs[state->m_maxrpm_adc_select]);
259      m_latched_input = input_port_read(machine(), inputs[m_maxrpm_adc_select]);
267260
268261   /* when both the write and the enable are low, it's a write to the ADC0844 */
269262   /* unfortunately the behavior below doesn't match up with the inputs on the */
270263   /* schematics and wiring diagrams, so they must be wrong */
271264   if (!(data & 0x40) && !(data & 0x20))
272      state->m_maxrpm_adc_select = (state->m_maxrpm_adc_control >> 1) & 3;
265      m_maxrpm_adc_select = (m_maxrpm_adc_control >> 1) & 3;
273266
274267   /* low 5 bits control the turbo CS */
275268   turbocs_data_w(space, offset, data);
r14896r14897
283276 *
284277 *************************************/
285278
286static READ8_HANDLER( rampage_ip4_r )
279READ8_MEMBER(mcr3_state::rampage_ip4_r)
287280{
288   return input_port_read(space->machine(), "MONO.IP4") | (soundsgood_status_r(space,0) << 7);
281   return input_port_read(machine(), "MONO.IP4") | (soundsgood_status_r(space,0) << 7);
289282}
290283
291284
292static WRITE8_HANDLER( rampage_op6_w )
285WRITE8_MEMBER(mcr3_state::rampage_op6_w)
293286{
294287   /* bit 5 controls reset of the Sounds Good board */
295   soundsgood_reset_w(space->machine(), (~data >> 5) & 1);
288   soundsgood_reset_w(machine(), (~data >> 5) & 1);
296289
297290   /* low 5 bits go directly to the Sounds Good board */
298291   soundsgood_data_w(space, offset, data);
r14896r14897
306299 *
307300 *************************************/
308301
309static READ8_HANDLER( powerdrv_ip2_r )
302READ8_MEMBER(mcr3_state::powerdrv_ip2_r)
310303{
311   return input_port_read(space->machine(), "MONO.IP2") | (soundsgood_status_r(space, 0) << 7);
304   return input_port_read(machine(), "MONO.IP2") | (soundsgood_status_r(space, 0) << 7);
312305}
313306
314307
315static WRITE8_HANDLER( powerdrv_op5_w )
308WRITE8_MEMBER(mcr3_state::powerdrv_op5_w)
316309{
317310   /*
318311        Lamp Board:
r14896r14897
324317   /* bit 3 -> J1-10 = lamp 1 */
325318   /* bit 2 -> J1-8 = lamp 2 */
326319   /* bit 1 -> J1-6 = lamp 3 */
327   set_led_status(space->machine(), 0, (data >> 3) & 1);
328   set_led_status(space->machine(), 1, (data >> 2) & 1);
329   set_led_status(space->machine(), 2, (data >> 1) & 1);
320   set_led_status(machine(), 0, (data >> 3) & 1);
321   set_led_status(machine(), 1, (data >> 2) & 1);
322   set_led_status(machine(), 2, (data >> 1) & 1);
330323
331324   /* remaining bits go to standard connections */
332325   mcrmono_control_port_w(space, offset, data);
333326}
334327
335328
336static WRITE8_HANDLER( powerdrv_op6_w )
329WRITE8_MEMBER(mcr3_state::powerdrv_op6_w)
337330{
338331   /* bit 5 controls reset of the Sounds Good board */
339   soundsgood_reset_w(space->machine(), (~data >> 5) & 1);
332   soundsgood_reset_w(machine(), (~data >> 5) & 1);
340333
341334   /* low 5 bits go directly to the Sounds Good board */
342335   soundsgood_data_w(space, offset, data);
r14896r14897
350343 *
351344 *************************************/
352345
353static READ8_HANDLER( stargrds_ip0_r )
346READ8_MEMBER(mcr3_state::stargrds_ip0_r)
354347{
355   mcr3_state *state = space->machine().driver_data<mcr3_state>();
356   UINT8 result = input_port_read(space->machine(), "MONO.IP0");
357   if (state->m_input_mux)
358      result = (result & ~0x0a) | (input_port_read(space->machine(), "MONO.IP0.ALT") & 0x0a);
348   UINT8 result = input_port_read(machine(), "MONO.IP0");
349   if (m_input_mux)
350      result = (result & ~0x0a) | (input_port_read(machine(), "MONO.IP0.ALT") & 0x0a);
359351   return (result & ~0x10) | ((soundsgood_status_r(space, 0) << 4) & 0x10);
360352}
361353
362354
363static WRITE8_HANDLER( stargrds_op5_w )
355WRITE8_MEMBER(mcr3_state::stargrds_op5_w)
364356{
365   mcr3_state *state = space->machine().driver_data<mcr3_state>();
366357   /* bit 1 controls input muxing on port 0 */
367   state->m_input_mux = (data >> 1) & 1;
358   m_input_mux = (data >> 1) & 1;
368359
369360   /* bit 2 controls light #0 */
370361   /* bit 3 controls light #1 */
371362   /* bit 4 controls light #2 */
372   set_led_status(space->machine(), 0, (data >> 2) & 1);
373   set_led_status(space->machine(), 1, (data >> 3) & 1);
374   set_led_status(space->machine(), 2, (data >> 4) & 1);
363   set_led_status(machine(), 0, (data >> 2) & 1);
364   set_led_status(machine(), 1, (data >> 3) & 1);
365   set_led_status(machine(), 2, (data >> 4) & 1);
375366
376367   /* remaining bits go to standard connections */
377368   mcrmono_control_port_w(space, offset, data);
378369}
379370
380371
381static WRITE8_HANDLER( stargrds_op6_w )
372WRITE8_MEMBER(mcr3_state::stargrds_op6_w)
382373{
383374   /* bit 6 controls reset of the Sounds Good board */
384   soundsgood_reset_w(space->machine(), (~data >> 6) & 1);
375   soundsgood_reset_w(machine(), (~data >> 6) & 1);
385376
386377   /* unline the other games, the STROBE is in the high bit instead of the low bit */
387378   soundsgood_data_w(space, offset, (data << 1) | (data >> 7));
r14896r14897
395386 *
396387 *************************************/
397388
398static READ8_HANDLER( spyhunt_ip1_r )
389READ8_MEMBER(mcr3_state::spyhunt_ip1_r)
399390{
400   return input_port_read(space->machine(), "SSIO.IP1") | (csdeluxe_status_r(space, 0) << 5);
391   return input_port_read(machine(), "SSIO.IP1") | (csdeluxe_status_r(space, 0) << 5);
401392}
402393
403394
404static READ8_HANDLER( spyhunt_ip2_r )
395READ8_MEMBER(mcr3_state::spyhunt_ip2_r)
405396{
406   mcr3_state *state = space->machine().driver_data<mcr3_state>();
407397   /* multiplexed steering wheel/gas pedal */
408   return input_port_read(space->machine(), state->m_input_mux ? "SSIO.IP2.ALT" : "SSIO.IP2");
398   return input_port_read(machine(), m_input_mux ? "SSIO.IP2.ALT" : "SSIO.IP2");
409399}
410400
411401
412static WRITE8_HANDLER( spyhunt_op4_w )
402WRITE8_MEMBER(mcr3_state::spyhunt_op4_w)
413403{
414   mcr3_state *state = space->machine().driver_data<mcr3_state>();
415404   /* Spy Hunter uses port 4 for talking to the Chip Squeak Deluxe */
416405   /* (and for toggling the lamps and muxing the analog inputs) */
417406
418407   /* mux select is in bit 7 */
419   state->m_input_mux = (data >> 7) & 1;
408   m_input_mux = (data >> 7) & 1;
420409
421410   /*
422411        Lamp Driver:
r14896r14897
427416            demuxer. The eight outputs directly control 8 lamps.
428417    */
429418   /* bit 5 = STR1 (J1-13) */
430   if (((state->m_last_op4 ^ data) & 0x20) && !(data & 0x20))
419   if (((m_last_op4 ^ data) & 0x20) && !(data & 0x20))
431420   {
432421      static const char *const lampname[8] =
433422      {
r14896r14897
440429      /* bit 0 -> J1-12 (A0) */
441430      output_set_value(lampname[data & 7], (data >> 3) & 1);
442431   }
443   state->m_last_op4 = data;
432   m_last_op4 = data;
444433
445434   /* low 5 bits go to control the Chip Squeak Deluxe */
446435   csdeluxe_data_w(space, offset, data);
r14896r14897
454443 *
455444 *************************************/
456445
457static READ8_HANDLER( turbotag_ip2_r )
446READ8_MEMBER(mcr3_state::turbotag_ip2_r)
458447{
459   mcr3_state *state = space->machine().driver_data<mcr3_state>();
460448   /* multiplexed steering wheel/gas pedal */
461   if (state->m_input_mux)
462      return input_port_read(space->machine(), "SSIO.IP2.ALT");
449   if (m_input_mux)
450      return input_port_read(machine(), "SSIO.IP2.ALT");
463451
464   return input_port_read(space->machine(), "SSIO.IP2") + 5 * (space->machine().primary_screen->frame_number() & 1);
452   return input_port_read(machine(), "SSIO.IP2") + 5 * (machine().primary_screen->frame_number() & 1);
465453}
466454
467455
468static READ8_HANDLER( turbotag_kludge_r )
456READ8_MEMBER(mcr3_state::turbotag_kludge_r)
469457{
470458   /* The checksum on the ttprog1.bin ROM seems to be bad by 1 bit */
471459   /* The checksum should come out to $82 but it should be $92     */
472460   /* Unfortunately, the game refuses to start if any bad ROM is   */
473461   /* found; to work around this, we catch the checksum byte read  */
474462   /* and modify it to what we know we will be getting.            */
475   if (cpu_get_previouspc(&space->device()) == 0xb29)
463   if (cpu_get_previouspc(&space.device()) == 0xb29)
476464      return 0x82;
477465   else
478466      return 0x92;
r14896r14897
507495   AM_RANGE(0x02, 0x02) AM_MIRROR(0x78) AM_READ_PORT("MONO.IP2")
508496   AM_RANGE(0x03, 0x03) AM_MIRROR(0x78) AM_READ_PORT("MONO.IP3")
509497   AM_RANGE(0x04, 0x04) AM_MIRROR(0x78) AM_READ_PORT("MONO.IP4")
510   AM_RANGE(0x05, 0x05) AM_MIRROR(0x78) AM_WRITE_LEGACY(mcrmono_control_port_w)
498   AM_RANGE(0x05, 0x05) AM_MIRROR(0x78) AM_WRITE(mcrmono_control_port_w)
511499   AM_RANGE(0x07, 0x07) AM_MIRROR(0x78) AM_WRITE(watchdog_reset_w)
512500   AM_RANGE(0xf0, 0xf3) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ctc", z80ctc_r, z80ctc_w)
513501ADDRESS_MAP_END
r14896r14897
15391527static DRIVER_INIT( demoderm )
15401528{
15411529   mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK);
1542   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x01, 0x01, FUNC(demoderm_ip1_r));
1543   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x02, 0x02, FUNC(demoderm_ip2_r));
1544   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x06, 0x06, FUNC(demoderm_op6_w));
1530   mcr3_state *state = machine.driver_data<mcr3_state>();
1531   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::demoderm_ip1_r),state));
1532   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::demoderm_ip2_r),state));
1533   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::demoderm_op6_w),state));
15451534}
15461535
15471536
15481537static DRIVER_INIT( sarge )
15491538{
1539   mcr3_state *state = machine.driver_data<mcr3_state>();
15501540   mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK);
1551   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x06, 0x06, FUNC(turbocs_data_w));
1541   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::turbocs_data_w),state));
15521542}
15531543
15541544
r14896r14897
15561546{
15571547   mcr3_state *state = machine.driver_data<mcr3_state>();
15581548   mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK);
1559   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x01, 0x01, FUNC(maxrpm_ip1_r));
1560   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x02, 0x02, FUNC(maxrpm_ip2_r));
1561   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x05, 0x05, FUNC(maxrpm_op5_w));
1562   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x06, 0x06, FUNC(maxrpm_op6_w));
1549   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::maxrpm_ip1_r),state));
1550   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::maxrpm_ip2_r),state));
1551   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::maxrpm_op5_w),state));
1552   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::maxrpm_op6_w),state));
15631553
15641554   state_save_register_global(machine, state->m_maxrpm_adc_control);
15651555   state_save_register_global(machine, state->m_maxrpm_adc_select);
r14896r14897
15711561
15721562static DRIVER_INIT( rampage )
15731563{
1564   mcr3_state *state = machine.driver_data<mcr3_state>();
15741565   mcr_common_init(machine, MCR_SOUNDS_GOOD);
1575   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x04, 0x04, FUNC(rampage_ip4_r));
1576   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x06, 0x06, FUNC(rampage_op6_w));
1566   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0x04, 0x04, read8_delegate(FUNC(mcr3_state::rampage_ip4_r),state));
1567   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::rampage_op6_w),state));
15771568}
15781569
15791570
15801571static DRIVER_INIT( powerdrv )
15811572{
1573   mcr3_state *state = machine.driver_data<mcr3_state>();
15821574   mcr_common_init(machine, MCR_SOUNDS_GOOD);
1583   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x02, 0x02, FUNC(powerdrv_ip2_r));
1584   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x05, 0x05, FUNC(powerdrv_op5_w));
1585   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x06, 0x06, FUNC(powerdrv_op6_w));
1575   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::powerdrv_ip2_r),state));
1576   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::powerdrv_op5_w),state));
1577   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::powerdrv_op6_w),state));
15861578}
15871579
15881580
15891581static DRIVER_INIT( stargrds )
15901582{
1583   mcr3_state *state = machine.driver_data<mcr3_state>();
15911584   mcr_common_init(machine, MCR_SOUNDS_GOOD);
1592   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x00, 0x00, FUNC(stargrds_ip0_r));
1593   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x05, 0x05, FUNC(stargrds_op5_w));
1594   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x06, 0x06, FUNC(stargrds_op6_w));
1585   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0x00, 0x00, read8_delegate(FUNC(mcr3_state::stargrds_ip0_r),state));
1586   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::stargrds_op5_w),state));
1587   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::stargrds_op6_w),state));
15951588}
15961589
15971590
r14896r14897
15991592{
16001593   mcr3_state *state = machine.driver_data<mcr3_state>();
16011594   mcr_common_init(machine, MCR_SSIO | MCR_CHIP_SQUEAK_DELUXE);
1602   ssio_set_custom_input(1, 0x60, spyhunt_ip1_r);
1603   ssio_set_custom_input(2, 0xff, spyhunt_ip2_r);
1604   ssio_set_custom_output(4, 0xff, spyhunt_op4_w);
1595   ssio_set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),state));
1596   ssio_set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::spyhunt_ip2_r),state));
1597   ssio_set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),state));
16051598
16061599   state->m_spyhunt_sprite_color_mask = 0x00;
16071600   state->m_spyhunt_scroll_offset = 16;
r14896r14897
16221615{
16231616   mcr3_state *state = machine.driver_data<mcr3_state>();
16241617   mcr_common_init(machine, MCR_SSIO | MCR_CHIP_SQUEAK_DELUXE);
1625   ssio_set_custom_input(1, 0x60, spyhunt_ip1_r);
1626   ssio_set_custom_input(2, 0xff, turbotag_ip2_r);
1627   ssio_set_custom_output(4, 0xff, spyhunt_op4_w);
1618   ssio_set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),state));
1619   ssio_set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::turbotag_ip2_r),state));
1620   ssio_set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),state));
16281621
16291622   state->m_spyhunt_sprite_color_mask = 0x00;
16301623   state->m_spyhunt_scroll_offset = 88;
r14896r14897
16331626   machine.device<cpu_device>("csdcpu")->suspend(SUSPEND_REASON_DISABLE, 1);
16341627
16351628   /* kludge for bad ROM read */
1636   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0b53, 0x0b53, FUNC(turbotag_kludge_r));
1629   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0b53, 0x0b53, read8_delegate(FUNC(mcr3_state::turbotag_kludge_r),state));
16371630}
16381631
16391632
src/mame/drivers/pipeline.c
r14896r14897
7676{
7777public:
7878   pipeline_state(const machine_config &mconfig, device_type type, const char *tag)
79      : driver_device(mconfig, type, tag) { }
79      : driver_device(mconfig, type, tag) ,
80      m_vram1(*this, "vram1"),
81      m_vram2(*this, "vram2"){ }
8082
8183   tilemap_t *m_tilemap1;
8284   tilemap_t *m_tilemap2;
83   UINT8 *m_vram1;
84   UINT8 *m_vram2;
85   required_shared_ptr<UINT8> m_vram1;
86   required_shared_ptr<UINT8> m_vram2;
8587   UINT8 m_vidctrl;
8688   UINT8 *m_palram;
8789   UINT8 m_toMCU;
r14896r14897
98100static TILE_GET_INFO( get_tile_info )
99101{
100102   pipeline_state *state = machine.driver_data<pipeline_state>();
101   int code = state->m_vram2[tile_index]+state->m_vram2[tile_index+0x800]*256;
103   int code = state->m_vram2.target()[tile_index]+state->m_vram2.target()[tile_index+0x800]*256;
102104   SET_TILE_INFO(
103105      0,
104106      code,
r14896r14897
109111static TILE_GET_INFO( get_tile_info2 )
110112{
111113   pipeline_state *state = machine.driver_data<pipeline_state>();
112   int code =state->m_vram1[tile_index]+((state->m_vram1[tile_index+0x800]>>4))*256;
113   int color=((state->m_vram1[tile_index+0x800])&0xf);
114   int code =state->m_vram1.target()[tile_index]+((state->m_vram1.target()[tile_index+0x800]>>4))*256;
115   int color=((state->m_vram1.target()[tile_index+0x800])&0xf);
114116   SET_TILE_INFO
115117   (
116118      1,
r14896r14897
149151   if(!(m_vidctrl&1))
150152   {
151153      m_tilemap1->mark_tile_dirty(offset&0x7ff);
152      m_vram2[offset]=data;
154      m_vram2.target()[offset]=data;
153155   }
154156   else
155157   {
r14896r14897
165167WRITE8_MEMBER(pipeline_state::vram1_w)
166168{
167169   m_tilemap2->mark_tile_dirty(offset&0x7ff);
168   m_vram1[offset]=data;
170   m_vram1.target()[offset]=data;
169171}
170172
171173static READ8_DEVICE_HANDLER(protection_r)
r14896r14897
189191static ADDRESS_MAP_START( cpu0_mem, AS_PROGRAM, 8, pipeline_state )
190192   AM_RANGE(0x0000, 0x7fff) AM_ROM
191193   AM_RANGE(0x8000, 0x87ff) AM_RAM
192   AM_RANGE(0x8800, 0x97ff) AM_RAM_WRITE(vram1_w) AM_BASE(m_vram1)
193   AM_RANGE(0x9800, 0xa7ff) AM_RAM_WRITE(vram2_w) AM_BASE(m_vram2)
194   AM_RANGE(0x8800, 0x97ff) AM_RAM_WRITE(vram1_w) AM_SHARE("vram1")
195   AM_RANGE(0x9800, 0xa7ff) AM_RAM_WRITE(vram2_w) AM_SHARE("vram2")
194196   AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)
195197   AM_RANGE(0xb810, 0xb813) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
196198   AM_RANGE(0xb830, 0xb830) AM_NOP
src/mame/drivers/stadhero.c
r14896r14897
4545      case 4: /* Interrupt ack (VBL - IRQ 5) */
4646         break;
4747      case 6: /* 6502 sound cpu */
48         soundlatch_w(space, 0, data & 0xff);
48         soundlatch_byte_w(space, 0, data & 0xff);
4949         cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
5050         break;
5151      default:
r14896r14897
6464   AM_RANGE(0x240010, 0x240017) AM_DEVWRITE_LEGACY("tilegen1", deco_bac06_pf_control_1_w)
6565   AM_RANGE(0x260000, 0x261fff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_data_r, deco_bac06_pf_data_w)
6666   AM_RANGE(0x30c000, 0x30c00b) AM_READWRITE(stadhero_control_r, stadhero_control_w)
67   AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
67   AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
6868   AM_RANGE(0xff8000, 0xffbfff) AM_RAM /* Main ram */
6969   AM_RANGE(0xffc000, 0xffc7ff) AM_MIRROR(0x000800) AM_RAM AM_BASE(m_spriteram)
7070ADDRESS_MAP_END
r14896r14897
7575   AM_RANGE(0x0000, 0x05ff) AM_RAM
7676   AM_RANGE(0x0800, 0x0801) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
7777   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym2", ym3812_w)
78   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
78   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
7979   AM_RANGE(0x3800, 0x3800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
8080   AM_RANGE(0x8000, 0xffff) AM_ROM
8181ADDRESS_MAP_END
src/mame/drivers/wwfsstar.c
r14896r14897
164164   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(wwfsstar_fg0_videoram_w) AM_BASE(m_fg0_videoram)   /* FG0 Ram */
165165   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(wwfsstar_bg0_videoram_w) AM_BASE(m_bg0_videoram)   /* BG0 Ram */
166166   AM_RANGE(0x100000, 0x1003ff) AM_RAM AM_BASE(m_spriteram)      /* SPR Ram */
167   AM_RANGE(0x140000, 0x140fff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
167   AM_RANGE(0x140000, 0x140fff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
168168   AM_RANGE(0x180000, 0x180003) AM_WRITE(wwfsstar_irqack_w)
169169   AM_RANGE(0x180000, 0x180001) AM_READ_PORT("DSW1")
170170   AM_RANGE(0x180002, 0x180003) AM_READ_PORT("DSW2")
r14896r14897
182182   AM_RANGE(0x8000, 0x87ff) AM_RAM
183183   AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
184184   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
185   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
185   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
186186ADDRESS_MAP_END
187187
188188
r14896r14897
208208
209209WRITE16_MEMBER(wwfsstar_state::wwfsstar_soundwrite)
210210{
211   soundlatch_w(space, 1, data & 0xff);
211   soundlatch_byte_w(space, 1, data & 0xff);
212212   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE );
213213}
214214
215215WRITE16_MEMBER(wwfsstar_state::wwfsstar_flipscreen_w)
216216{
217   flip_screen_set(machine(), data & 1);
217   flip_screen_set(data & 1);
218218}
219219
220220WRITE16_MEMBER(wwfsstar_state::wwfsstar_irqack_w)
src/mame/drivers/taito_b.c
r14896r14897
515515
516516static ADDRESS_MAP_START( rastsag2_map, AS_PROGRAM, 16, taitob_state )
517517   AM_RANGE(0x000000, 0x07ffff) AM_ROM
518   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
518   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
519519   AM_RANGE(0x600000, 0x607fff) AM_RAM   /* Main RAM */ /*ashura up to 603fff only*/
520520   TC0180VCU_MEMRW( 0x400000 )
521521   AM_RANGE(0x800000, 0x800001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
r14896r14897
530530   TC0180VCU_MEMRW( 0x400000 )
531531   AM_RANGE(0x600000, 0x600001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
532532   AM_RANGE(0x600002, 0x600003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
533   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
533   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
534534   AM_RANGE(0xa00000, 0xa0ffff) AM_RAM   /* Main RAM */
535535ADDRESS_MAP_END
536536
r14896r14897
542542   TC0180VCU_MEMRW( 0x400000 )
543543   AM_RANGE(0x600000, 0x60000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0xff00)
544544   AM_RANGE(0x800000, 0x807fff) AM_RAM   /* Main RAM */
545   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
545   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
546546ADDRESS_MAP_END
547547
548548static ADDRESS_MAP_START( tetrista_map, AS_PROGRAM, 16, taitob_state )
549549   AM_RANGE(0x000000, 0x07ffff) AM_ROM
550   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
550   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
551551   TC0180VCU_MEMRW( 0x400000 )
552552   AM_RANGE(0x600000, 0x600001) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_portreg_r, tc0220ioc_portreg_w, 0xff00)
553553   AM_RANGE(0x600002, 0x600003) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_port_r, tc0220ioc_port_w, 0xff00)
r14896r14897
565565   AM_RANGE(0x700000, 0x700001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
566566   AM_RANGE(0x700002, 0x700003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
567567   AM_RANGE(0x800000, 0x803fff) AM_RAM   /* Main RAM */
568   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
568   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
569569   AM_RANGE(0xb00000, 0xb7ffff) AM_RAM_WRITE(hitice_pixelram_w) AM_BASE(m_pixelram)
570570//  { 0xbffff0, 0xbffff1, ???
571571   AM_RANGE(0xbffff2, 0xbffff5) AM_WRITE(hitice_pixel_scroll_w)
r14896r14897
588588   AM_RANGE(0x60001c, 0x60001d) AM_READ(trackx2_lo_r)
589589   AM_RANGE(0x60001e, 0x60001f) AM_READ(trackx2_hi_r)
590590   AM_RANGE(0x800000, 0x803fff) AM_RAM   /* Main RAM */
591   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
591   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
592592ADDRESS_MAP_END
593593
594594
r14896r14897
603603   AM_RANGE(0x600000, 0x600003) AM_WRITE(gain_control_w)
604604   AM_RANGE(0x700000, 0x700001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
605605   AM_RANGE(0x700002, 0x700003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
606   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
606   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
607607   AM_RANGE(0x900000, 0x90ffff) AM_RAM   /* Main RAM */
608608ADDRESS_MAP_END
609609
r14896r14897
619619   AM_RANGE(0x600000, 0x600003) AM_WRITE(gain_control_w)
620620   AM_RANGE(0x700000, 0x700001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
621621   AM_RANGE(0x700002, 0x700003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
622   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
622   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
623623   AM_RANGE(0x900000, 0x90ffff) AM_RAM   /* Main RAM */
624624ADDRESS_MAP_END
625625
r14896r14897
631631   AM_RANGE(0x210000, 0x210001) AM_READ_PORT("IN3")
632632   AM_RANGE(0x220000, 0x220001) AM_READ_PORT("IN4")
633633   AM_RANGE(0x230000, 0x230001) AM_READ_PORT("IN5")
634   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
634   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
635635   AM_RANGE(0x302000, 0x303fff) AM_READONLY
636636   AM_RANGE(0x400000, 0x40ffff) AM_RAM   /* Main RAM */
637637   TC0180VCU_MEMRW( 0x500000 )
r14896r14897
649649   AM_RANGE(0x600000, 0x600001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
650650   AM_RANGE(0x600002, 0x600003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
651651   AM_RANGE(0x700000, 0x700003) AM_WRITE(gain_control_w)
652   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
652   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
653653   AM_RANGE(0x900000, 0x90ffff) AM_RAM   /* Main RAM */
654654ADDRESS_MAP_END
655655
r14896r14897
659659   AM_RANGE(0x200000, 0x200001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
660660   AM_RANGE(0x200002, 0x200003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
661661   TC0180VCU_MEMRW( 0x400000 )
662   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
662   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
663663   AM_RANGE(0x800000, 0x80000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0xff00)
664664   AM_RANGE(0xa00000, 0xa03fff) AM_RAM   /* Main RAM */
665665ADDRESS_MAP_END
r14896r14897
669669   AM_RANGE(0x000000, 0x07ffff) AM_ROM
670670   AM_RANGE(0x200000, 0x203fff) AM_RAM   /* Main RAM */
671671   TC0180VCU_MEMRW( 0x400000 )
672   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
672   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
673673   AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_portreg_r, tc0220ioc_portreg_w, 0xff00)
674674   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_port_r, tc0220ioc_port_w, 0xff00)
675675   AM_RANGE(0xa00000, 0xa00001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
r14896r14897
689689   AM_RANGE(0x230000, 0x230001) AM_READ_PORT("IN5")
690690   AM_RANGE(0x240000, 0x240001) AM_WRITENOP // ???
691691//  AM_RANGE(0x240000, 0x240001) AM_READNOP /* read 4 times at init */
692   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
692   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
693693   AM_RANGE(0x400000, 0x403fff) AM_RAM   /* Main RAM */
694694   TC0180VCU_MEMRW( 0x500000 )
695695ADDRESS_MAP_END
r14896r14897
699699   AM_RANGE(0x000000, 0x07ffff) AM_ROM
700700   AM_RANGE(0x100000, 0x103fff) AM_RAM   /* Main RAM */
701701   TC0180VCU_MEMRW( 0x200000 )
702   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
702   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
703703   AM_RANGE(0x400000, 0x40000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0xff00)
704704   AM_RANGE(0x410000, 0x41000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0xff00) /* mirror address - seems to be only used for coin control */
705705   AM_RANGE(0x500000, 0x500001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
r14896r14897
710710static ADDRESS_MAP_START( sbm_map, AS_PROGRAM, 16, taitob_state )
711711   AM_RANGE(0x000000, 0x07ffff) AM_ROM
712712   AM_RANGE(0x100000, 0x10ffff) AM_RAM   /* Main RAM */
713   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
713   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
714714   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE_LEGACY("tc0510nio", tc0510nio_halfword_wordswap_r, tc0510nio_halfword_wordswap_w)
715715   AM_RANGE(0x320000, 0x320001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
716716   AM_RANGE(0x320002, 0x320003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
r14896r14897
728728   AM_RANGE(0x188002, 0x188003) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_comm_w, 0xff00)
729729   AM_RANGE(0x18c000, 0x18c001) AM_WRITE(realpunc_output_w)
730730   TC0180VCU_MEMRW( 0x200000 )
731   AM_RANGE(0x280000, 0x281fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
731   AM_RANGE(0x280000, 0x281fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
732732   AM_RANGE(0x300000, 0x300001) AM_DEVREADWRITE_LEGACY("hd63484", hd63484_status_r, hd63484_address_w)
733733   AM_RANGE(0x300002, 0x300003) AM_DEVREADWRITE_LEGACY("hd63484", hd63484_data_r, hd63484_data_w)
734734//  AM_RANGE(0x320000, 0x320001) AM_READ_LEGACY(SMH_NOP) // ?
src/mame/drivers/viper.c
r14896r14897
322322   int m_unk1_bit;
323323   UINT32 m_voodoo3_pci_reg[0x100];
324324
325   DECLARE_READ32_MEMBER(epic_r);
326   DECLARE_WRITE32_MEMBER(epic_w);
327   DECLARE_WRITE64_MEMBER(unk2_w);
328   DECLARE_READ64_MEMBER(voodoo3_io_r);
329   DECLARE_WRITE64_MEMBER(voodoo3_io_w);
330   DECLARE_READ64_MEMBER(voodoo3_r);
331   DECLARE_WRITE64_MEMBER(voodoo3_w);
332   DECLARE_READ64_MEMBER(voodoo3_lfb_r);
333   DECLARE_WRITE64_MEMBER(voodoo3_lfb_w);
334   DECLARE_READ64_MEMBER(unk1_r);
335   DECLARE_READ64_MEMBER(e70000_r);
336   DECLARE_WRITE64_MEMBER(e70000_w);
337   DECLARE_WRITE64_MEMBER(unk1a_w);
338   DECLARE_WRITE64_MEMBER(unk1b_w);
339   DECLARE_READ64_MEMBER(e00008_r);
340   DECLARE_WRITE64_MEMBER(e00008_w);
341   DECLARE_READ64_MEMBER(e00000_r);
325342};
326343
327344UINT32 m_mpc8240_regs[256/4];
r14896r14897
641658   }
642659}
643660
644static READ32_HANDLER( epic_r )
661READ32_MEMBER(viper_state::epic_r)
645662{
646663   int reg;
647664   reg = offset * 4;
r14896r14897
651668      const char *regname = epic_get_register_name(reg);
652669      if (regname)
653670      {
654         printf("EPIC: read %08X (%s) at %08X\n", reg, regname, cpu_get_pc(&space->device()));
671         printf("EPIC: read %08X (%s) at %08X\n", reg, regname, cpu_get_pc(&space.device()));
655672      }
656673      else
657674      {
658         printf("EPIC: read %08X at %08X\n", reg, cpu_get_pc(&space->device()));
675         printf("EPIC: read %08X at %08X\n", reg, cpu_get_pc(&space.device()));
659676      }
660677   }
661678
r14896r14897
699716                     if (epic.i2c_cr & 0x40)
700717                     {
701718                        printf("I2C interrupt\n");
702                        mpc8240_interrupt(space->machine(), MPC8240_I2C_IRQ);
719                        mpc8240_interrupt(machine(), MPC8240_I2C_IRQ);
703720
704721                        // set interrupt flag in status register
705722                        epic.i2c_sr |= 0x2;
r14896r14897
718735                     /*if (epic.i2c_cr & 0x40)
719736                            {
720737                                printf("I2C interrupt\n");
721                                mpc8240_interrupt(space->machine, MPC8240_I2C_IRQ);
738                                mpc8240_interrupt(machine, MPC8240_I2C_IRQ);
722739
723740                                // set interrupt flag in status register
724741                                epic.i2c_sr |= 0x2;
r14896r14897
805822         {
806823            case 0x00a0:         // Offset 0x600A0 - IACK
807824            {
808               epic_update_interrupts(space->machine());
825               epic_update_interrupts(machine());
809826
810827               if (epic.active_irq >= 0)
811828               {
r14896r14897
826843   return 0;
827844}
828845
829static WRITE32_HANDLER( epic_w )
846WRITE32_MEMBER(viper_state::epic_w)
830847{
831848   int reg;
832849   reg = offset * 4;
r14896r14897
836853      const char *regname = epic_get_register_name(reg);
837854      if (regname)
838855      {
839         printf("EPIC: write %08X, %08X (%s) at %08X\n", data, reg, regname, cpu_get_pc(&space->device()));
856         printf("EPIC: write %08X, %08X (%s) at %08X\n", data, reg, regname, cpu_get_pc(&space.device()));
840857      }
841858      else
842859      {
843         printf("EPIC: write %08X, %08X at %08X\n", data, reg, cpu_get_pc(&space->device()));
860         printf("EPIC: write %08X, %08X at %08X\n", data, reg, cpu_get_pc(&space.device()));
844861      }
845862   }
846863
r14896r14897
898915                     if (epic.i2c_cr & 0x40)
899916                     {
900917                        printf("I2C interrupt\n");
901                        mpc8240_interrupt(space->machine(), MPC8240_I2C_IRQ);
918                        mpc8240_interrupt(machine(), MPC8240_I2C_IRQ);
902919
903920                        // set interrupt flag in status register
904921                        epic.i2c_sr |= 0x2;
r14896r14897
916933                     if (epic.i2c_cr & 0x40)
917934                     {
918935                        printf("I2C interrupt\n");
919                        mpc8240_interrupt(space->machine(), MPC8240_I2C_IRQ);
936                        mpc8240_interrupt(machine(), MPC8240_I2C_IRQ);
920937
921938                        // set interrupt flag in status register
922939                        epic.i2c_sr |= 0x2;
r14896r14897
957974               epic.irq[MPC8240_GTIMER0_IRQ + timer_num].priority = (data >> 16) & 0xf;
958975               epic.irq[MPC8240_GTIMER0_IRQ + timer_num].vector = data & 0xff;
959976
960               epic_update_interrupts(space->machine());
977               epic_update_interrupts(machine());
961978               break;
962979            }
963980            case 0x1130:         // Offset 0x41130 - Global timer 0 destination register
r14896r14897
969986
970987               epic.irq[MPC8240_GTIMER0_IRQ + timer_num].destination = data & 0x1;
971988
972               epic_update_interrupts(space->machine());
989               epic_update_interrupts(machine());
973990               break;
974991            }
975992            case 0x1110:         // Offset 0x41110 - Global timer 0 base count register
r14896r14897
10291046               epic.irq[MPC8240_IRQ0 + irq].priority = (data >> 16) & 0xf;
10301047               epic.irq[MPC8240_IRQ0 + irq].vector = data & 0xff;
10311048
1032               epic_update_interrupts(space->machine());
1049               epic_update_interrupts(machine());
10331050               break;
10341051            }
10351052            case 0x1020:         // Offset 0x51020 - I2C IRQ vector/priority register
r14896r14897
10381055               epic.irq[MPC8240_I2C_IRQ].priority = (data >> 16) & 0xf;
10391056               epic.irq[MPC8240_I2C_IRQ].vector = data & 0xff;
10401057
1041               epic_update_interrupts(space->machine());
1058               epic_update_interrupts(machine());
10421059               break;
10431060            }
10441061            case 0x0210:         // Offset 0x50210 - IRQ0 destination register
r14896r14897
10621079
10631080               epic.irq[MPC8240_IRQ0 + irq].destination = data & 0x1;
10641081
1065               epic_update_interrupts(space->machine());
1082               epic_update_interrupts(machine());
10661083               break;
10671084            }
10681085            case 0x1030:         // Offset 0x51030 - I2C IRQ destination register
10691086            {
10701087               epic.irq[MPC8240_I2C_IRQ].destination = data & 0x1;
1071               epic_update_interrupts(space->machine());
1088               epic_update_interrupts(machine());
10721089               break;
10731090            }
10741091         }
r14896r14897
10881105               epic.irq[epic.active_irq].active = 0;
10891106               epic.active_irq = -1;
10901107
1091               epic_update_interrupts(space->machine());
1108               epic_update_interrupts(machine());
10921109               break;
10931110         }
10941111         break;
10951112      }
10961113   }
10971114}
1098
1099static READ64_HANDLER(epic_64be_r)
1115/*
1116READ64_MEMBER(viper_state::epic_64be_r)
11001117{
1101   return read64be_with_32le_handler(epic_r, space, offset, mem_mask);
1118   return read64be_with_32le_handler(epic_r, &space, offset, mem_mask);
11021119}
1103static WRITE64_HANDLER(epic_64be_w)
1120WRITE64_MEMBER(viper_state::epic_64be_w)
11041121{
1105   write64be_with_32le_handler(epic_w, space, offset, data, mem_mask);
1122   write64be_with_32le_handler(epic_w, &space, offset, data, mem_mask);
11061123}
1124*/
11071125
1108
11091126static void mpc8240_interrupt(running_machine &machine, int irq)
11101127{
11111128   epic.irq[irq].pending = 1;
r14896r14897
13411358   }
13421359}
13431360
1344static WRITE64_HANDLER(unk2_w)
1361WRITE64_MEMBER(viper_state::unk2_w)
13451362{
1346   viper_state *state = space->machine().driver_data<viper_state>();
13471363
13481364   if (ACCESSING_BITS_56_63)
13491365   {
1350      state->m_cf_card_ide = 0;
1366      m_cf_card_ide = 0;
13511367   }
13521368}
13531369
r14896r14897
14881504   }
14891505}
14901506
1491static READ64_HANDLER(voodoo3_io_r)
1507READ64_MEMBER(viper_state::voodoo3_io_r)
14921508{
1493   device_t *device = space->machine().device("voodoo");
1509   device_t *device = machine().device("voodoo");
14941510   return read64be_with_32le_device_handler(banshee_io_r, device, offset, mem_mask);
14951511}
1496static WRITE64_HANDLER(voodoo3_io_w)
1512WRITE64_MEMBER(viper_state::voodoo3_io_w)
14971513{
1498//  printf("voodoo3_io_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space->device()));
1514//  printf("voodoo3_io_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space.device()));
14991515
1500   device_t *device = space->machine().device("voodoo");
1516   device_t *device = machine().device("voodoo");
15011517   write64be_with_32le_device_handler(banshee_io_w, device, offset, data, mem_mask);
15021518}
15031519
1504static READ64_HANDLER(voodoo3_r)
1520READ64_MEMBER(viper_state::voodoo3_r)
15051521{
1506   device_t *device = space->machine().device("voodoo");
1522   device_t *device = machine().device("voodoo");
15071523   return read64be_with_32le_device_handler(banshee_r, device, offset, mem_mask);
15081524}
1509static WRITE64_HANDLER(voodoo3_w)
1525WRITE64_MEMBER(viper_state::voodoo3_w)
15101526{
1511//  printf("voodoo3_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space->device()));
1527//  printf("voodoo3_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space.device()));
15121528
1513   device_t *device = space->machine().device("voodoo");
1529   device_t *device = machine().device("voodoo");
15141530   write64be_with_32le_device_handler(banshee_w, device,  offset, data, mem_mask);
15151531}
15161532
1517static READ64_HANDLER(voodoo3_lfb_r)
1533READ64_MEMBER(viper_state::voodoo3_lfb_r)
15181534{
1519   device_t *device = space->machine().device("voodoo");
1535   device_t *device = machine().device("voodoo");
15201536   return read64be_with_32le_device_handler(banshee_fb_r, device, offset, mem_mask);
15211537}
1522static WRITE64_HANDLER(voodoo3_lfb_w)
1538WRITE64_MEMBER(viper_state::voodoo3_lfb_w)
15231539{
1524//  printf("voodoo3_lfb_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space->device()));
1540//  printf("voodoo3_lfb_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space.device()));
15251541
1526   device_t *device = space->machine().device("voodoo");
1542   device_t *device = machine().device("voodoo");
15271543   write64be_with_32le_device_handler(banshee_fb_w, device, offset, data, mem_mask);
15281544}
15291545
r14896r14897
15631579   }
15641580}
15651581
1566static READ64_HANDLER(unk1_r)
1582READ64_MEMBER(viper_state::unk1_r)
15671583{
15681584   UINT64 r = 0;
15691585   //return 0;//U64(0x0000400000000000);
r14896r14897
15881604   }
15891605   if (ACCESSING_BITS_32_39)
15901606   {
1591      UINT64 reg = input_port_read(space->machine(), "IN0");
1607      UINT64 reg = input_port_read(machine(), "IN0");
15921608      r |= reg << 32;
15931609   }
15941610   if (ACCESSING_BITS_24_31)
15951611   {
1596      UINT64 reg = input_port_read(space->machine(), "IN1");
1612      UINT64 reg = input_port_read(machine(), "IN1");
15971613      r |= reg << 24;
15981614   }
15991615   if (ACCESSING_BITS_16_23)
r14896r14897
17111727
17121728}
17131729
1714static READ64_HANDLER(e70000_r)
1730READ64_MEMBER(viper_state::e70000_r)
17151731{
17161732   if (ACCESSING_BITS_56_63)
17171733   {
17181734      ds2430_bit_timer->reset();
17191735      ds2430_bit_timer->start_time();
17201736
1721//      printf("e70000_r: %08X (mask %08X%08X) at %08X\n", offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(space->cpu));
1737//      printf("e70000_r: %08X (mask %08X%08X) at %08X\n", offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(cpu));
17221738   }
17231739
17241740   return 0;
17251741}
17261742
1727static WRITE64_HANDLER(e70000_w)
1743WRITE64_MEMBER(viper_state::e70000_w)
17281744{
17291745   if (ACCESSING_BITS_56_63)
17301746   {
r14896r14897
17331749         ds2430_timer->adjust(attotime::from_usec(40), 1);   // presence pulse for 240 microsecs
17341750
17351751         unk1_bit = 1;
1736//          printf("e70000_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(&space->device()));
1752//          printf("e70000_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(&space.device()));
17371753      }
17381754      else
17391755      {
r14896r14897
17541770   }
17551771}
17561772
1757static WRITE64_HANDLER(unk1a_w)
1773WRITE64_MEMBER(viper_state::unk1a_w)
17581774{
17591775   if (ACCESSING_BITS_56_63)
17601776   {
1761   //  printf("unk1a_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(space->cpu));
1777   //  printf("unk1a_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(cpu));
17621778   }
17631779}
17641780
1765static WRITE64_HANDLER(unk1b_w)
1781WRITE64_MEMBER(viper_state::unk1b_w)
17661782{
17671783   if (ACCESSING_BITS_56_63)
17681784   {
17691785      unk1_bit = 0;
1770   //  printf("unk1b_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(space->cpu));
1786   //  printf("unk1b_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(cpu));
17711787   }
17721788}
17731789
17741790static UINT64 e00008_data;
17751791
1776static READ64_HANDLER(e00008_r)
1792READ64_MEMBER(viper_state::e00008_r)
17771793{
17781794   UINT64 r = 0;
17791795   if (ACCESSING_BITS_0_7)
r14896r14897
17841800   return r;
17851801}
17861802
1787static WRITE64_HANDLER(e00008_w)
1803WRITE64_MEMBER(viper_state::e00008_w)
17881804{
17891805   if (ACCESSING_BITS_0_7)
17901806   {
r14896r14897
17921808   }
17931809}
17941810
1795static READ64_HANDLER(e00000_r)
1811READ64_MEMBER(viper_state::e00000_r)
17961812{
17971813   UINT64 r = 0;//U64(0xffffffffffffffff);
17981814   return r;
r14896r14897
18041820
18051821static ADDRESS_MAP_START(viper_map, AS_PROGRAM, 64, viper_state )
18061822   AM_RANGE(0x00000000, 0x00ffffff) AM_MIRROR(0x1000000) AM_RAM
1807   AM_RANGE(0x80000000, 0x800fffff) AM_READWRITE_LEGACY(epic_64be_r, epic_64be_w)
1808   AM_RANGE(0x82000000, 0x83ffffff) AM_READWRITE_LEGACY(voodoo3_r, voodoo3_w)
1809   AM_RANGE(0x84000000, 0x85ffffff) AM_READWRITE_LEGACY(voodoo3_lfb_r, voodoo3_lfb_w)
1810   AM_RANGE(0xfe800000, 0xfe8000ff) AM_READWRITE_LEGACY(voodoo3_io_r, voodoo3_io_w)
1823   AM_RANGE(0x80000000, 0x800fffff) AM_READWRITE32(epic_r, epic_w,U64(0xffffffffffffffff))
1824   AM_RANGE(0x82000000, 0x83ffffff) AM_READWRITE(voodoo3_r, voodoo3_w)
1825   AM_RANGE(0x84000000, 0x85ffffff) AM_READWRITE(voodoo3_lfb_r, voodoo3_lfb_w)
1826   AM_RANGE(0xfe800000, 0xfe8000ff) AM_READWRITE(voodoo3_io_r, voodoo3_io_w)
18111827   AM_RANGE(0xfec00000, 0xfedfffff) AM_DEVREADWRITE_LEGACY("pcibus", pci_config_addr_r, pci_config_addr_w)
18121828   AM_RANGE(0xfee00000, 0xfeefffff) AM_DEVREADWRITE_LEGACY("pcibus", pci_config_data_r, pci_config_data_w)
18131829   // 0xff000000, 0xff000fff - cf_card_data_r/w (installed in DRIVER_INIT(vipercf))
18141830   // 0xff200000, 0xff200fff - cf_card_r/w (installed in DRIVER_INIT(vipercf))
18151831   AM_RANGE(0xff300000, 0xff300fff) AM_DEVREADWRITE_LEGACY("ide", ata_r, ata_w)
1816   AM_RANGE(0xffe00000, 0xffe00007) AM_READ_LEGACY(e00000_r)
1817   AM_RANGE(0xffe00008, 0xffe0000f) AM_READWRITE_LEGACY(e00008_r, e00008_w)
1818   AM_RANGE(0xffe10000, 0xffe10007) AM_READ_LEGACY(unk1_r)
1832   AM_RANGE(0xffe00000, 0xffe00007) AM_READ(e00000_r)
1833   AM_RANGE(0xffe00008, 0xffe0000f) AM_READWRITE(e00008_r, e00008_w)
1834   AM_RANGE(0xffe10000, 0xffe10007) AM_READ(unk1_r)
18191835   AM_RANGE(0xffe30000, 0xffe31fff) AM_DEVREADWRITE8_LEGACY("m48t58", timekeeper_r, timekeeper_w, U64(0xffffffffffffffff))
18201836   AM_RANGE(0xffe40000, 0xffe4000f) AM_NOP
1821   AM_RANGE(0xffe50000, 0xffe50007) AM_WRITE_LEGACY(unk2_w)
1822   AM_RANGE(0xffe70000, 0xffe7000f) AM_READWRITE_LEGACY(e70000_r, e70000_w)
1823   AM_RANGE(0xffe80000, 0xffe80007) AM_WRITE_LEGACY(unk1a_w)
1824   AM_RANGE(0xffe88000, 0xffe88007) AM_WRITE_LEGACY(unk1b_w)
1837   AM_RANGE(0xffe50000, 0xffe50007) AM_WRITE(unk2_w)
1838   AM_RANGE(0xffe70000, 0xffe7000f) AM_READWRITE(e70000_r, e70000_w)
1839   AM_RANGE(0xffe80000, 0xffe80007) AM_WRITE(unk1a_w)
1840   AM_RANGE(0xffe88000, 0xffe88007) AM_WRITE(unk1b_w)
18251841   AM_RANGE(0xffe9a000, 0xffe9bfff) AM_RAM                        // World Combat uses this
18261842   AM_RANGE(0xfff00000, 0xfff3ffff) AM_ROM AM_REGION("user1", 0)      // Boot ROM
18271843ADDRESS_MAP_END
src/mame/drivers/jackal.c
r14896r14897
9191WRITE8_MEMBER(jackal_state::jackal_flipscreen_w)
9292{
9393   m_irq_enable = data & 0x02;
94   flip_screen_set(machine(), data & 0x08);
94   flip_screen_set(data & 0x08);
9595}
9696
9797READ8_MEMBER(jackal_state::jackal_zram_r)
src/mame/drivers/mw8080bw.c
r14896r14897
331331   AM_RANGE(0x02, 0x02) AM_WRITE(seawolf_periscope_lamp_w)
332332   AM_RANGE(0x03, 0x03) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
333333   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
334   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(seawolf_audio_w)
334   AM_RANGE(0x05, 0x05) AM_WRITE(seawolf_audio_w)
335335ADDRESS_MAP_END
336336
337337
r14896r14897
421421WRITE8_MEMBER(mw8080bw_state::gunfight_io_w)
422422{
423423   if (offset & 0x01)
424      gunfight_audio_w(&space, 0, data);
424      gunfight_audio_w(space, 0, data);
425425
426426   if (offset & 0x02)
427427      mb14241_shift_count_w(m_mb14241, 0, data);
r14896r14897
754754   AM_RANGE(0x02, 0x02) AM_MIRROR(0x04) AM_READ_PORT("IN2")
755755   AM_RANGE(0x03, 0x03) AM_MIRROR(0x04) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r)
756756
757   AM_RANGE(0x02, 0x02) AM_WRITE_LEGACY(zzzap_audio_1_w)
757   AM_RANGE(0x02, 0x02) AM_WRITE(zzzap_audio_1_w)
758758   AM_RANGE(0x03, 0x03) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
759759   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
760   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(zzzap_audio_2_w)
760   AM_RANGE(0x05, 0x05) AM_WRITE(zzzap_audio_2_w)
761761   AM_RANGE(0x07, 0x07) AM_WRITE(watchdog_reset_w)
762762ADDRESS_MAP_END
763763
r14896r14897
15201520
15211521   AM_RANGE(0x01, 0x01) AM_WRITE(mw8080bw_reversable_shift_count_w)
15221522   AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
1523   AM_RANGE(0x03, 0x03) AM_WRITE_LEGACY(gmissile_audio_1_w)
1523   AM_RANGE(0x03, 0x03) AM_WRITE(gmissile_audio_1_w)
15241524   AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
1525   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(gmissile_audio_2_w)
1525   AM_RANGE(0x05, 0x05) AM_WRITE(gmissile_audio_2_w)
15261526   /* also writes 0x00 to 0x06, but it is not connected */
1527   AM_RANGE(0x07, 0x07) AM_WRITE_LEGACY(gmissile_audio_3_w)
1527   AM_RANGE(0x07, 0x07) AM_WRITE(gmissile_audio_3_w)
15281528ADDRESS_MAP_END
15291529
15301530
r14896r14897
16161616
16171617   AM_RANGE(0x01, 0x01) AM_WRITE(mw8080bw_reversable_shift_count_w)
16181618   AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
1619   AM_RANGE(0x03, 0x03) AM_WRITE_LEGACY(m4_audio_1_w)
1619   AM_RANGE(0x03, 0x03) AM_WRITE(m4_audio_1_w)
16201620   AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
1621   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(m4_audio_2_w)
1621   AM_RANGE(0x05, 0x05) AM_WRITE(m4_audio_2_w)
16221622ADDRESS_MAP_END
16231623
16241624
r14896r14897
17311731
17321732   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
17331733   AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
1734   AM_RANGE(0x03, 0x03) AM_WRITE_LEGACY(clowns_audio_1_w)
1734   AM_RANGE(0x03, 0x03) AM_WRITE(clowns_audio_1_w)
17351735   AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
17361736   AM_RANGE(0x05, 0x05) AM_DEVWRITE_LEGACY("discrete", midway_tone_generator_lo_w)
17371737   AM_RANGE(0x06, 0x06) AM_DEVWRITE_LEGACY("discrete", midway_tone_generator_hi_w)
r14896r14897
23122312   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
23132313   AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
23142314   AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
2315   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(phantom2_audio_1_w)
2316   AM_RANGE(0x06, 0x06) AM_WRITE_LEGACY(phantom2_audio_2_w)
2315   AM_RANGE(0x05, 0x05) AM_WRITE(phantom2_audio_1_w)
2316   AM_RANGE(0x06, 0x06) AM_WRITE(phantom2_audio_2_w)
23172317ADDRESS_MAP_END
23182318
23192319
r14896r14897
24402440   AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
24412441   AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
24422442   AM_RANGE(0x05, 0x05) AM_DEVWRITE_LEGACY("discrete", bowler_audio_1_w)
2443   AM_RANGE(0x06, 0x06) AM_WRITE_LEGACY(bowler_audio_2_w)
2443   AM_RANGE(0x06, 0x06) AM_WRITE(bowler_audio_2_w)
24442444   AM_RANGE(0x07, 0x07) AM_WRITE(bowler_lights_1_w)
2445   AM_RANGE(0x08, 0x08) AM_WRITE_LEGACY(bowler_audio_3_w)
2446   AM_RANGE(0x09, 0x09) AM_WRITE_LEGACY(bowler_audio_4_w)
2447   AM_RANGE(0x0a, 0x0a) AM_WRITE_LEGACY(bowler_audio_5_w)
2445   AM_RANGE(0x08, 0x08) AM_WRITE(bowler_audio_3_w)
2446   AM_RANGE(0x09, 0x09) AM_WRITE(bowler_audio_4_w)
2447   AM_RANGE(0x0a, 0x0a) AM_WRITE(bowler_audio_5_w)
24482448   AM_RANGE(0x0e, 0x0e) AM_WRITE(bowler_lights_2_w)
2449   AM_RANGE(0x0f, 0x0f) AM_WRITE_LEGACY(bowler_audio_6_w)
2449   AM_RANGE(0x0f, 0x0f) AM_WRITE(bowler_audio_6_w)
24502450ADDRESS_MAP_END
24512451
24522452
src/mame/drivers/pinkiri8.c
r14896r14897
3939{
4040public:
4141   pinkiri8_state(const machine_config &mconfig, device_type type, const char *tag)
42      : driver_device(mconfig, type, tag) { }
42      : driver_device(mconfig, type, tag) ,
43      m_janshi_back_vram(*this, "janshi_back_vram"),
44      m_janshi_vram1(*this, "janshi_vram1"),
45      m_janshi_unk1(*this, "janshi_unk1"),
46      m_janshi_widthflags(*this, "janshi_widthflags"),
47      m_janshi_unk2(*this, "janshi_unk2"),
48      m_janshi_vram2(*this, "janshi_vram2"),
49      m_janshi_crtc_regs(*this, "janshi_crtc_regs"){ }
4350
44   UINT8* m_janshi_vram1;
45   UINT8* m_janshi_vram2;
46   UINT8* m_janshi_back_vram;
47   UINT8* m_janshi_crtc_regs;
48   UINT8* m_janshi_unk1;
49   UINT8* m_janshi_widthflags;
50   UINT8* m_janshi_unk2;
51   required_shared_ptr<UINT8> m_janshi_back_vram;
52   required_shared_ptr<UINT8> m_janshi_vram1;
53   required_shared_ptr<UINT8> m_janshi_unk1;
54   required_shared_ptr<UINT8> m_janshi_widthflags;
55   required_shared_ptr<UINT8> m_janshi_unk2;
56   required_shared_ptr<UINT8> m_janshi_vram2;
57   required_shared_ptr<UINT8> m_janshi_crtc_regs;
5158   UINT32 m_vram_addr;
5259   int m_prev_writes;
5360   UINT8 m_mux_data;
r14896r14897
6875
6976static ADDRESS_MAP_START( janshi_vdp_map8, AS_0, 8, pinkiri8_state )
7077
71   AM_RANGE(0xfc0000, 0xfc1fff) AM_RAM AM_BASE(m_janshi_back_vram) // bg tilemap?
72   AM_RANGE(0xfc2000, 0xfc2fff) AM_RAM AM_BASE(m_janshi_vram1) // xpos, colour, tile number etc.
78   AM_RANGE(0xfc0000, 0xfc1fff) AM_RAM AM_SHARE("janshi_back_vram") // bg tilemap?
79   AM_RANGE(0xfc2000, 0xfc2fff) AM_RAM AM_SHARE("janshi_vram1") // xpos, colour, tile number etc.
7380
74   AM_RANGE(0xfc3700, 0xfc377f) AM_RAM AM_BASE(m_janshi_unk1) // ?? height related?
75   AM_RANGE(0xfc3780, 0xfc37bf) AM_RAM AM_BASE(m_janshi_widthflags)
76   AM_RANGE(0xfc37c0, 0xfc37ff) AM_RAM AM_BASE(m_janshi_unk2) // 2x increasing tables 00 10 20 30 etc.
81   AM_RANGE(0xfc3700, 0xfc377f) AM_RAM AM_SHARE("janshi_unk1") // ?? height related?
82   AM_RANGE(0xfc3780, 0xfc37bf) AM_RAM AM_SHARE("janshi_widthflags")
83   AM_RANGE(0xfc37c0, 0xfc37ff) AM_RAM AM_SHARE("janshi_unk2") // 2x increasing tables 00 10 20 30 etc.
7784
78   AM_RANGE(0xfc3800, 0xfc3fff) AM_RAM AM_BASE(m_janshi_vram2) // y pos + unknown
85   AM_RANGE(0xfc3800, 0xfc3fff) AM_RAM AM_SHARE("janshi_vram2") // y pos + unknown
7986
80   AM_RANGE(0xff0000, 0xff07ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w) AM_SHARE("paletteram")
81   AM_RANGE(0xff2000, 0xff27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w) AM_SHARE("paletteram2")
87   AM_RANGE(0xff0000, 0xff07ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w) AM_SHARE("paletteram")
88   AM_RANGE(0xff2000, 0xff27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
8289
83   AM_RANGE(0xff6000, 0xff601f) AM_RAM AM_BASE(m_janshi_crtc_regs)
90   AM_RANGE(0xff6000, 0xff601f) AM_RAM AM_SHARE("janshi_crtc_regs")
8491ADDRESS_MAP_END
8592
8693
r14896r14897
198205      for (i=0x00;i<0x40;i+=2)
199206      {
200207
201         printf("%02x, ", state->m_janshi_widthflags[i+1]);
208         printf("%02x, ", state->m_janshi_widthflags.target()[i+1]);
202209
203210         count2++;
204211
r14896r14897
216223
217224
218225
219   //popmessage("%02x",state->m_janshi_crtc_regs[0x0a]);
220   col_bank = (state->m_janshi_crtc_regs[0x0a] & 0x40) >> 6;
226   //popmessage("%02x",state->m_janshi_crtc_regs.target()[0x0a]);
227   col_bank = (state->m_janshi_crtc_regs.target()[0x0a] & 0x40) >> 6;
221228
222229   bitmap.fill(get_black_pen(screen.machine()), cliprect);
223230
r14896r14897
231238      {
232239         for(x=0;x<32;x++)
233240         {
234            tile = state->m_janshi_back_vram[count+1]<<8 | state->m_janshi_back_vram[count+0];
235            attr = state->m_janshi_back_vram[count+2] ^ 0xf0;
241            tile = state->m_janshi_back_vram.target()[count+1]<<8 | state->m_janshi_back_vram.target()[count+0];
242            attr = state->m_janshi_back_vram.target()[count+2] ^ 0xf0;
236243            col = (attr >> 4) | 0x10;
237244
238245            drawgfx_transpen(bitmap,cliprect,gfx,tile,col,0,0,x*16,y*8,0);
r14896r14897
268275
269276          */
270277
271         spr_offs = ((state->m_janshi_vram1[(i*4)+0] & 0xff) | (state->m_janshi_vram1[(i*4)+1]<<8)) & 0xffff;
272         col = (state->m_janshi_vram1[(i*4)+2] & 0xf8) >> 3;
273         x =   state->m_janshi_vram1[(i*4)+3];
278         spr_offs = ((state->m_janshi_vram1.target()[(i*4)+0] & 0xff) | (state->m_janshi_vram1.target()[(i*4)+1]<<8)) & 0xffff;
279         col = (state->m_janshi_vram1.target()[(i*4)+2] & 0xf8) >> 3;
280         x =   state->m_janshi_vram1.target()[(i*4)+3];
274281
275282         x &= 0xff;
276283         x *= 2;
277284
278//          unk2 = state->m_janshi_vram2[(i*2)+1];
279         y = (state->m_janshi_vram2[(i*2)+0]);
285//          unk2 = state->m_janshi_vram2.target()[(i*2)+1];
286         y = (state->m_janshi_vram2.target()[(i*2)+0]);
280287
281288         y = 0x100-y;
282289
r14896r14897
289296
290297
291298         // these bits seem to somehow determine the sprite height / widths for the sprite ram region?
292         int bit = state->m_janshi_widthflags[(i/0x20)*2 + 1];
299         int bit = state->m_janshi_widthflags.target()[(i/0x20)*2 + 1];
293300
294301         if (bit)
295302         {
src/mame/drivers/vaportra.c
r14896r14897
2525
2626   /* Force synchronisation between CPUs with fake timer */
2727   machine().scheduler().synchronize();
28   soundlatch_w(space, 0, data & 0xff);
28   soundlatch_byte_w(space, 0, data & 0xff);
2929   device_set_input_line(m_audiocpu, 0, ASSERT_LINE);
3030}
3131
r14896r14897
7272READ8_MEMBER(vaportra_state::vaportra_soundlatch_r)
7373{
7474   device_set_input_line(m_audiocpu, 0, CLEAR_LINE);
75   return soundlatch_r(space, offset);
75   return soundlatch_byte_r(space, offset);
7676}
7777
7878static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, vaportra_state )
src/mame/drivers/suna8.c
r14896r14897
502502*/
503503WRITE8_MEMBER(suna8_state::hardhead_flipscreen_w)
504504{
505   flip_screen_set(machine(),     data & 0x04);
505   flip_screen_set(data & 0x04);
506506   coin_lockout_w ( machine(), 0,   data & 0x08);
507507   coin_lockout_w ( machine(), 1,   data & 0x10);
508508}
r14896r14897
511511   AM_RANGE(0x0000, 0x7fff) AM_ROM                        // ROM
512512   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")                  // Banked ROM
513513   AM_RANGE(0xc000, 0xd7ff) AM_RAM                        // RAM
514   AM_RANGE(0xd800, 0xd9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")   // Palette
514   AM_RANGE(0xd800, 0xd9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")   // Palette
515515   AM_RANGE(0xda00, 0xda00) AM_RAM_READ(hardhead_ip_r) AM_BASE(m_hardhead_ip)   // Input Port Select
516   AM_RANGE(0xda80, 0xda80) AM_READ(soundlatch2_r) AM_WRITE(hardhead_bankswitch_w   )   // ROM Banking
517   AM_RANGE(0xdb00, 0xdb00) AM_WRITE(soundlatch_w         )   // To Sound CPU
516   AM_RANGE(0xda80, 0xda80) AM_READ(soundlatch2_byte_r) AM_WRITE(hardhead_bankswitch_w   )   // ROM Banking
517   AM_RANGE(0xdb00, 0xdb00) AM_WRITE(soundlatch_byte_w         )   // To Sound CPU
518518   AM_RANGE(0xdb80, 0xdb80) AM_WRITE(hardhead_flipscreen_w   )   // Flip Screen + Coin Lockout
519519   AM_RANGE(0xdc00, 0xdc00) AM_NOP                        // <- R (after bank select)
520520   AM_RANGE(0xdc80, 0xdc80) AM_NOP                        // <- R (after bank select)
r14896r14897
549549
550550   memory_set_bank(machine(), "bank1", bank);
551551
552   flip_screen_set(machine(),     data & 0x20);
552   flip_screen_set(data & 0x20);
553553   coin_lockout_w ( machine(), 0,   data & 0x40);
554554   coin_lockout_w ( machine(), 1,   data & 0x80);
555555}
r14896r14897
564564*/
565565READ8_MEMBER(suna8_state::rranger_soundstatus_r)
566566{
567   soundlatch2_r(space, offset);
567   soundlatch2_byte_r(space, offset);
568568   return 0x02;
569569}
570570
r14896r14897
578578static ADDRESS_MAP_START( rranger_map, AS_PROGRAM, 8, suna8_state )
579579   AM_RANGE(0x0000, 0x7fff) AM_ROM                        // ROM
580580   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")                  // Banked ROM
581   AM_RANGE(0xc000, 0xc000) AM_READWRITE(watchdog_reset_r, soundlatch_w)   // To Sound CPU
581   AM_RANGE(0xc000, 0xc000) AM_READWRITE(watchdog_reset_r, soundlatch_byte_w)   // To Sound CPU
582582   AM_RANGE(0xc002, 0xc002) AM_WRITE(rranger_bankswitch_w   )   // ROM Banking
583583   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P1")               // P1 (Inputs)
584584   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("P2")               // P2
r14896r14897
587587   AM_RANGE(0xc280, 0xc280) AM_WRITENOP   // ? NMI Ack
588588   AM_RANGE(0xc280, 0xc280) AM_READ_PORT("DSW1")            // DSW 1
589589   AM_RANGE(0xc2c0, 0xc2c0) AM_READ_PORT("DSW2")            // DSW 2
590   AM_RANGE(0xc600, 0xc7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")   // Palette
590   AM_RANGE(0xc600, 0xc7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")   // Palette
591591   AM_RANGE(0xc800, 0xdfff) AM_RAM                        // RAM
592592   AM_RANGE(0xe000, 0xffff) AM_RAM_WRITE(suna8_spriteram_w) AM_BASE(m_spriteram)   // Sprites
593593ADDRESS_MAP_END
r14896r14897
619619   if (data & ~0x02)   logerror("CPU #0 - PC %04X: unknown palettebank bits: %02X\n",cpu_get_pc(&space.device()),data);
620620
621621   /* Also used as soundlatch - depending on c0c0? */
622   soundlatch_w(space,0,data);
622   soundlatch_byte_w(space,0,data);
623623}
624624
625625/*
r14896r14897
632632
633633   m_spritebank = (data >> 1) & 1;
634634   if (data & ~0x03)   logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(&space.device()),data);
635   flip_screen_set(machine(),  data & 0x01 );
635   flip_screen_set(data & 0x01 );
636636}
637637
638638WRITE8_MEMBER(suna8_state::brickzn_unknown_w)
r14896r14897
693693*/
694694WRITE8_MEMBER(suna8_state::hardhea2_flipscreen_w)
695695{
696   flip_screen_set(machine(), data & 0x01);
696   flip_screen_set(data & 0x01);
697697   if (data & ~0x01)   logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",cpu_get_pc(&space.device()),data);
698698}
699699
r14896r14897
773773   AM_RANGE(0xc380, 0xc380) AM_WRITE(hardhea2_nmi_w            )   // ? NMI related ?
774774   AM_RANGE(0xc400, 0xc400) AM_WRITE(hardhea2_leds_w            )   // Leds + Coin Counter
775775   AM_RANGE(0xc480, 0xc480) AM_WRITENOP   // ~ROM Bank
776   AM_RANGE(0xc500, 0xc500) AM_WRITE(soundlatch_w            )   // To Sound CPU
776   AM_RANGE(0xc500, 0xc500) AM_WRITE(soundlatch_byte_w            )   // To Sound CPU
777777
778778   // *** Protection
779779   AM_RANGE(0xc50f, 0xc50f) AM_WRITE(hardhea2_spritebank_1_w )
r14896r14897
789789   AM_RANGE(0xc533, 0xc533) AM_WRITE(hardhea2_rambank_0_w )
790790   // Protection ***
791791
792   AM_RANGE(0xc600, 0xc7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram"   )   // Palette (Banked??)
792   AM_RANGE(0xc600, 0xc7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram"   )   // Palette (Banked??)
793793   AM_RANGE(0xc800, 0xdfff) AM_RAMBANK("bank2")                     // RAM (Banked?)
794794   AM_RANGE(0xe000, 0xffff) AM_READWRITE(suna8_banked_spriteram_r, suna8_banked_spriteram_w)   // Sprites (Banked)
795795ADDRESS_MAP_END
r14896r14897
824824   AM_RANGE(0xc280, 0xc280) AM_WRITE(hardhea2_rombank_w         )   // ROM Bank (?mirrored up to c2ff?)
825825   AM_RANGE(0xc300, 0xc300) AM_WRITE(hardhea2_flipscreen_w         )   // Flip Screen
826826   AM_RANGE(0xc400, 0xc400) AM_WRITE(hardhea2_leds_w            )   // Leds + Coin Counter
827   AM_RANGE(0xc500, 0xc500) AM_WRITE(soundlatch_w               )   // To Sound CPU
828   AM_RANGE(0xc600, 0xc7ff) AM_READWRITE(banked_paletteram_r, paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram"   )   // Palette (Banked??)
827   AM_RANGE(0xc500, 0xc500) AM_WRITE(soundlatch_byte_w               )   // To Sound CPU
828   AM_RANGE(0xc600, 0xc7ff) AM_READWRITE(banked_paletteram_r, paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram"   )   // Palette (Banked??)
829829   AM_RANGE(0xc800, 0xdfff) AM_RAM                           // RAM
830830   AM_RANGE(0xe000, 0xffff) AM_READWRITE(suna8_banked_spriteram_r, suna8_banked_spriteram_w)   // Sprites (Banked)
831831ADDRESS_MAP_END
r14896r14897
884884*/
885885WRITE8_MEMBER(suna8_state::sparkman_flipscreen_w)
886886{
887   flip_screen_set(machine(), data & 0x01);
887   flip_screen_set(data & 0x01);
888888   //if (data & ~0x01)     logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",cpu_get_pc(&space.device()),data);
889889}
890890
r14896r14897
957957   AM_RANGE(0xc380, 0xc3ff) AM_WRITE(sparkman_cmd_prot_w      )   // Protection
958958   AM_RANGE(0xc400, 0xc400) AM_WRITE(sparkman_leds_w         )   // Leds
959959   AM_RANGE(0xc480, 0xc480) AM_WRITE(sparkman_coin_counter_w   )   // Coin Counter
960   AM_RANGE(0xc500, 0xc500) AM_WRITE(soundlatch_w            )   // To Sound CPU
961   AM_RANGE(0xc600, 0xc7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram"   )   // Palette (Banked??)
960   AM_RANGE(0xc500, 0xc500) AM_WRITE(soundlatch_byte_w            )   // To Sound CPU
961   AM_RANGE(0xc600, 0xc7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram"   )   // Palette (Banked??)
962962   AM_RANGE(0xc800, 0xdfff) AM_RAM_WRITE(suna8_wram_w) AM_BASE(m_wram)                        // RAM
963963   AM_RANGE(0xe000, 0xffff) AM_READWRITE(suna8_banked_spriteram_r, suna8_banked_spriteram_w)   // Sprites (Banked)
964964ADDRESS_MAP_END
r14896r14897
982982   AM_RANGE(0xa002, 0xa003) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w      )
983983   AM_RANGE(0xc000, 0xc7ff) AM_RAM   // RAM
984984   AM_RANGE(0xc800, 0xc800) AM_DEVREAD_LEGACY("ymsnd", ym3812_status_port_r)   // ? unsure
985   AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch2_w            )   //
986   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_r            )   // From Main CPU
985   AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch2_byte_w            )   //
986   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r            )   // From Main CPU
987987ADDRESS_MAP_END
988988
989989
r14896r14897
10021002   AM_RANGE(0xa000, 0xa001) AM_DEVWRITE_LEGACY("ym1", ym2203_w         )   // Samples + Music
10031003   AM_RANGE(0xa002, 0xa003) AM_DEVWRITE_LEGACY("ym2", ym2203_w         )   // Music + FX
10041004   AM_RANGE(0xc000, 0xc7ff) AM_RAM   // RAM
1005   AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch2_w            )   // To Sound CPU
1006   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_r            )   // From Main CPU
1005   AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch2_byte_w            )   // To Sound CPU
1006   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r            )   // From Main CPU
10071007ADDRESS_MAP_END
10081008
10091009
r14896r14897
10161016   AM_RANGE(0xc000, 0xc001) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w   )
10171017   AM_RANGE(0xc002, 0xc003) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w      )
10181018   AM_RANGE(0xe000, 0xe7ff) AM_RAM   // RAM
1019   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch2_w            )   // To PCM CPU
1020   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r            )   // From Main CPU
1019   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch2_byte_w            )   // To PCM CPU
1020   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r            )   // From Main CPU
10211021ADDRESS_MAP_END
10221022
10231023
r14896r14897
10371037
10381038static ADDRESS_MAP_START( brickzn_pcm_io_map, AS_IO, 8, suna8_state )
10391039   ADDRESS_MAP_GLOBAL_MASK(0xff)
1040   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_r      )   // From Sound CPU
1040   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r      )   // From Sound CPU
10411041   AM_RANGE(0x00, 0x03) AM_WRITE(brickzn_pcm_w      )   // 4 x DAC
10421042ADDRESS_MAP_END
10431043
src/mame/drivers/chanbara.c
r14896r14897
5757{
5858public:
5959   chanbara_state(const machine_config &mconfig, device_type type, const char *tag)
60      : driver_device(mconfig, type, tag) { }
60      : driver_device(mconfig, type, tag) ,
61      m_videoram(*this, "videoram"),
62      m_colorram(*this, "colorram"),
63      m_spriteram(*this, "spriteram"),
64      m_videoram2(*this, "videoram2"),
65      m_colorram2(*this, "colorram2"){ }
6166
6267   /* memory pointers */
63   UINT8 *  m_videoram;
64   UINT8 *  m_videoram2;
65   UINT8 *  m_colorram;
66   UINT8 *  m_colorram2;
67   UINT8 *  m_spriteram;
68   required_shared_ptr<UINT8> m_videoram;
69   required_shared_ptr<UINT8> m_colorram;
70   required_shared_ptr<UINT8> m_spriteram;
71   required_shared_ptr<UINT8> m_videoram2;
72   required_shared_ptr<UINT8> m_colorram2;
6873
6974   /* video-related */
7075   tilemap_t  *m_bg_tilemap;
r14896r14897
98103WRITE8_MEMBER(chanbara_state::chanbara_videoram_w)
99104{
100105
101   m_videoram[offset] = data;
106   m_videoram.target()[offset] = data;
102107   m_bg_tilemap->mark_tile_dirty(offset);
103108}
104109
105110WRITE8_MEMBER(chanbara_state::chanbara_colorram_w)
106111{
107112
108   m_colorram[offset] = data;
113   m_colorram.target()[offset] = data;
109114   m_bg_tilemap->mark_tile_dirty(offset);
110115}
111116
112117WRITE8_MEMBER(chanbara_state::chanbara_videoram2_w)
113118{
114119
115   m_videoram2[offset] = data;
120   m_videoram2.target()[offset] = data;
116121   m_bg2_tilemap->mark_tile_dirty(offset);
117122}
118123
119124WRITE8_MEMBER(chanbara_state::chanbara_colorram2_w)
120125{
121126
122   m_colorram2[offset] = data;
127   m_colorram2.target()[offset] = data;
123128   m_bg2_tilemap->mark_tile_dirty(offset);
124129}
125130
r14896r14897
127132static TILE_GET_INFO( get_bg_tile_info )
128133{
129134   chanbara_state *state = machine.driver_data<chanbara_state>();
130   int code = state->m_videoram[tile_index] + ((state->m_colorram[tile_index] & 1) << 8);
131   int color = (state->m_colorram[tile_index] >> 1) & 0x1f;
135   int code = state->m_videoram.target()[tile_index] + ((state->m_colorram.target()[tile_index] & 1) << 8);
136   int color = (state->m_colorram.target()[tile_index] >> 1) & 0x1f;
132137
133138   SET_TILE_INFO(0, code, color, 0);
134139}
r14896r14897
136141static TILE_GET_INFO( get_bg2_tile_info )
137142{
138143   chanbara_state *state = machine.driver_data<chanbara_state>();
139   int code = state->m_videoram2[tile_index];
140   int color = (state->m_colorram2[tile_index] >> 1) & 0x1f;
144   int code = state->m_videoram2.target()[tile_index];
145   int color = (state->m_colorram2.target()[tile_index] >> 1) & 0x1f;
141146
142147   SET_TILE_INFO(2, code, color, 0);
143148}
r14896r14897
157162
158163   for (offs = 0; offs < 0x80; offs += 4)
159164   {
160      if (state->m_spriteram[offs + 0x80] & 0x80)
165      if (state->m_spriteram.target()[offs + 0x80] & 0x80)
161166      {
162         int attr = state->m_spriteram[offs + 0];
163         int code = state->m_spriteram[offs + 1];
164         int color = state->m_spriteram[offs + 0x80] & 0x1f;
167         int attr = state->m_spriteram.target()[offs + 0];
168         int code = state->m_spriteram.target()[offs + 1];
169         int color = state->m_spriteram.target()[offs + 0x80] & 0x1f;
165170         int flipx = 0;
166171         int flipy = attr & 2;
167         int sx = 240 - state->m_spriteram[offs + 3];
168         int sy = 232 - state->m_spriteram[offs + 2];
172         int sx = 240 - state->m_spriteram.target()[offs + 3];
173         int sy = 232 - state->m_spriteram.target()[offs + 2];
169174
170175         sy+=16;
171176
172         if (state->m_spriteram[offs + 0x80] & 0x10) code += 0x200;
173         if (state->m_spriteram[offs + 0x80] & 0x20) code += 0x400;
174         if (state->m_spriteram[offs + 0x80] & 0x40) code += 0x100;
177         if (state->m_spriteram.target()[offs + 0x80] & 0x10) code += 0x200;
178         if (state->m_spriteram.target()[offs + 0x80] & 0x20) code += 0x400;
179         if (state->m_spriteram.target()[offs + 0x80] & 0x40) code += 0x100;
175180
176181         if (attr & 0x10)
177182         {
r14896r14897
209214
210215static ADDRESS_MAP_START( chanbara_map, AS_PROGRAM, 8, chanbara_state )
211216   AM_RANGE(0x0000, 0x07ff) AM_RAM
212   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(chanbara_videoram_w) AM_BASE(m_videoram)
213   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(chanbara_colorram_w) AM_BASE(m_colorram)
214   AM_RANGE(0x1000, 0x10ff) AM_RAM AM_BASE(m_spriteram)
215   AM_RANGE(0x1800, 0x19ff) AM_RAM_WRITE(chanbara_videoram2_w) AM_BASE(m_videoram2)
216   AM_RANGE(0x1a00, 0x1bff) AM_RAM_WRITE(chanbara_colorram2_w) AM_BASE(m_colorram2)
217   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(chanbara_videoram_w) AM_SHARE("videoram")
218   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(chanbara_colorram_w) AM_SHARE("colorram")
219   AM_RANGE(0x1000, 0x10ff) AM_RAM AM_SHARE("spriteram")
220   AM_RANGE(0x1800, 0x19ff) AM_RAM_WRITE(chanbara_videoram2_w) AM_SHARE("videoram2")
221   AM_RANGE(0x1a00, 0x1bff) AM_RAM_WRITE(chanbara_colorram2_w) AM_SHARE("colorram2")
217222   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("DSW1")
218223   AM_RANGE(0x2001, 0x2001) AM_READ_PORT("SYSTEM")
219224   AM_RANGE(0x2002, 0x2002) AM_READ_PORT("P2")
r14896r14897
349354
350355   state->m_scrollhi = data & 0x01;
351356
352   flip_screen_set(device->machine(), data & 0x02);
357   state->flip_screen_set(data & 0x02);
353358
354359   memory_set_bank(device->machine(), "bank1", (data & 0x04) >> 2);
355360
src/mame/drivers/btime.c
r14896r14897
511511   AM_RANGE(0x5000, 0x5fff) AM_DEVWRITE_LEGACY("ay1", ay8910_address_w)
512512   AM_RANGE(0x6000, 0x6fff) AM_DEVWRITE_LEGACY("ay2", ay8910_data_w)
513513   AM_RANGE(0x7000, 0x7fff) AM_DEVWRITE_LEGACY("ay2", ay8910_address_w)
514   AM_RANGE(0x8000, 0x8fff) AM_READ(soundlatch_r) AM_WRITENOP /* ack ? */
514   AM_RANGE(0x8000, 0x8fff) AM_READ(soundlatch_byte_r) AM_WRITENOP /* ack ? */
515515   AM_RANGE(0xf000, 0xffff) AM_ROM
516516ADDRESS_MAP_END
517517
r14896r14897
541541
542542WRITE8_MEMBER(btime_state::audio_command_w)
543543{
544   soundlatch_w(space, offset, data);
544   soundlatch_byte_w(space, offset, data);
545545   device_set_input_line(m_audiocpu, 0, ASSERT_LINE);
546546}
547547
548548READ8_MEMBER(btime_state::audio_command_r)
549549{
550550   device_set_input_line(m_audiocpu, 0, CLEAR_LINE);
551   return soundlatch_r(space, offset);
551   return soundlatch_byte_r(space, offset);
552552}
553553
554554READ8_MEMBER(btime_state::zoar_dsw1_read)
src/mame/drivers/m14.c
r14896r14897
5858{
5959public:
6060   m14_state(const machine_config &mconfig, device_type type, const char *tag)
61      : driver_device(mconfig, type, tag) { }
61      : driver_device(mconfig, type, tag) ,
62      m_video_ram(*this, "video_ram"),
63      m_color_ram(*this, "color_ram"){ }
6264
6365   /* video-related */
6466   tilemap_t  *m_m14_tilemap;
65   UINT8 *  m_video_ram;
66   UINT8 *  m_color_ram;
67   required_shared_ptr<UINT8> m_video_ram;
68   required_shared_ptr<UINT8> m_color_ram;
6769
6870   /* input-related */
6971   UINT8 m_hop_mux;
r14896r14897
107109{
108110   m14_state *state = machine.driver_data<m14_state>();
109111
110   int code = state->m_video_ram[tile_index];
111   int color = state->m_color_ram[tile_index] & 0x0f;
112   int code = state->m_video_ram.target()[tile_index];
113   int color = state->m_color_ram.target()[tile_index] & 0x0f;
112114
113115   /* colorram & 0xf0 used but unknown purpose*/
114116
r14896r14897
138140WRITE8_MEMBER(m14_state::m14_vram_w)
139141{
140142
141   m_video_ram[offset] = data;
143   m_video_ram.target()[offset] = data;
142144   m_m14_tilemap->mark_tile_dirty(offset);
143145}
144146
145147WRITE8_MEMBER(m14_state::m14_cram_w)
146148{
147149
148   m_color_ram[offset] = data;
150   m_color_ram.target()[offset] = data;
149151   m_m14_tilemap->mark_tile_dirty(offset);
150152}
151153
r14896r14897
203205static ADDRESS_MAP_START( m14_map, AS_PROGRAM, 8, m14_state )
204206   AM_RANGE(0x0000, 0x1fff) AM_ROM
205207   AM_RANGE(0x2000, 0x23ff) AM_RAM
206   AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(m14_vram_w) AM_BASE(m_video_ram)
207   AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(m14_cram_w) AM_BASE(m_color_ram)
208   AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(m14_vram_w) AM_SHARE("video_ram")
209   AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(m14_cram_w) AM_SHARE("color_ram")
208210ADDRESS_MAP_END
209211
210212static ADDRESS_MAP_START( m14_io_map, AS_IO, 8, m14_state )
src/mame/drivers/dcon.c
r14896r14897
2828   AM_RANGE(0x8c800, 0x8cfff) AM_RAM_WRITE(dcon_foreground_w) AM_BASE(m_fore_data)
2929   AM_RANGE(0x8d000, 0x8d7ff) AM_RAM_WRITE(dcon_midground_w) AM_BASE(m_mid_data)
3030   AM_RANGE(0x8d800, 0x8e7ff) AM_RAM_WRITE(dcon_text_w) AM_BASE(m_textram)
31   AM_RANGE(0x8e800, 0x8f7ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
31   AM_RANGE(0x8e800, 0x8f7ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
3232   AM_RANGE(0x8f800, 0x8ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
3333   AM_RANGE(0x9d000, 0x9d7ff) AM_WRITE(dcon_gfxbank_w)
3434
src/mame/drivers/photon2.c
r14896r14897
1818public:
1919   photon2_state(const machine_config &mconfig, device_type type, const char *tag)
2020      : driver_device(mconfig, type, tag),
21      m_maincpu(*this,"maincpu")
22      { }
21      m_maincpu(*this,"maincpu"),
22      m_spectrum_video_ram(*this, "spectruvideo_ram"){ }
2323
24   UINT8 *m_spectrum_video_ram;
24   required_device<cpu_device> m_maincpu;
25   required_shared_ptr<UINT8> m_spectrum_video_ram;
2526   int m_spectrum_frame_number;
2627   int m_spectrum_flash_invert;
2728   UINT8 m_spectrum_port_fe;
2829   UINT8 m_nmi_enable;
2930
30   required_device<cpu_device> m_maincpu;
3131   DECLARE_WRITE8_MEMBER(photon2_membank_w);
3232   DECLARE_READ8_MEMBER(photon2_fe_r);
3333   DECLARE_WRITE8_MEMBER(photon2_fe_w);
r14896r14897
133133    unsigned char *attr, *scr;
134134//  int full_refresh = 1;
135135
136    scr=state->m_spectrum_video_ram;
136    scr=state->m_spectrum_video_ram.target();
137137
138138   bitmap.fill(state->m_spectrum_port_fe & 0x07, cliprect);
139139
src/mame/drivers/gstriker.c
r14896r14897
194194   if (ACCESSING_BITS_0_7)
195195   {
196196      m_pending_command = 1;
197      soundlatch_w(space, offset, data & 0xff);
197      soundlatch_byte_w(space, offset, data & 0xff);
198198      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
199199   }
200200}
r14896r14897
282282   AM_RANGE(0x140000, 0x141fff) AM_RAM AM_BASE(m_CG10103[0].vram)
283283   AM_RANGE(0x180000, 0x180fff) AM_RAM_WRITE(VS920A_0_vram_w) AM_BASE(m_VS920A[0].vram)
284284   AM_RANGE(0x181000, 0x181fff) AM_RAM AM_BASE(m_lineram)
285   AM_RANGE(0x1c0000, 0x1c0fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
285   AM_RANGE(0x1c0000, 0x1c0fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
286286
287287   AM_RANGE(0x200000, 0x20000f) AM_RAM_WRITE(MB60553_0_regs_w)
288288   AM_RANGE(0x200040, 0x20005f) AM_RAM //AM_BASE_LEGACY(&gs_mixer_regs)
r14896r14897
309309   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
310310   AM_RANGE(0x04, 0x04) AM_WRITE(gs_sh_bankswitch_w)
311311   AM_RANGE(0x08, 0x08) AM_WRITE(gs_sh_pending_command_clear_w)
312   AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_r)
312   AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_byte_r)
313313ADDRESS_MAP_END
314314
315315
r14896r14897
319319   AM_RANGE(0x140000, 0x141fff) AM_RAM AM_BASE(m_CG10103[0].vram)
320320   AM_RANGE(0x180000, 0x180fff) AM_RAM_WRITE(VS920A_0_vram_w) AM_BASE(m_VS920A[0].vram)
321321   AM_RANGE(0x181000, 0x181fff) AM_RAM AM_BASE(m_lineram)
322   AM_RANGE(0x1c0000, 0x1c4fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
322   AM_RANGE(0x1c0000, 0x1c4fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
323323   AM_RANGE(0x200000, 0x20000f) AM_RAM_WRITE(MB60553_0_regs_w)
324324   AM_RANGE(0x200040, 0x20005f) AM_RAM //AM_BASE_LEGACY(&gs_mixer_regs)
325325
src/mame/drivers/snk.c
r14896r14897
318318{
319319
320320   m_marvins_sound_busy_flag = 1;
321   soundlatch_w(space, offset, data);
321   soundlatch_byte_w(space, offset, data);
322322   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
323323}
324324
r14896r14897
326326{
327327
328328   m_marvins_sound_busy_flag = 0;
329   return soundlatch_r(space, 0);
329   return soundlatch_byte_r(space, 0);
330330}
331331
332332CUSTOM_INPUT_MEMBER(snk_state::marvins_sound_busy)
r14896r14897
368368
369369WRITE8_MEMBER(snk_state::sgladiat_soundlatch_w)
370370{
371   soundlatch_w(space, offset, data);
371   soundlatch_byte_w(space, offset, data);
372372   machine().scheduler().synchronize(FUNC(sgladiat_sndirq_update_callback), CMDIRQ_BUSY_ASSERT);
373373}
374374
375375READ8_MEMBER(snk_state::sgladiat_soundlatch_r)
376376{
377377   machine().scheduler().synchronize(FUNC(sgladiat_sndirq_update_callback), BUSY_CLEAR);
378   return soundlatch_r(space,0);
378   return soundlatch_byte_r(space,0);
379379}
380380
381381READ8_MEMBER(snk_state::sgladiat_sound_nmi_ack_r)
r14896r14897
491491
492492WRITE8_MEMBER(snk_state::snk_soundlatch_w)
493493{
494   soundlatch_w(space, offset, data);
494   soundlatch_byte_w(space, offset, data);
495495   machine().scheduler().synchronize(FUNC(sndirq_update_callback), CMDIRQ_BUSY_ASSERT);
496496}
497497
r14896r14897
541541READ8_MEMBER(snk_state::tnk3_busy_clear_r)
542542{
543543   // it's uncertain whether the latch should be cleared here or when it's read
544   soundlatch_clear_w(space, 0, 0);
544   soundlatch_clear_byte_w(space, 0, 0);
545545   machine().scheduler().synchronize(FUNC(sndirq_update_callback), BUSY_CLEAR);
546546   return 0xff;
547547}
r14896r14897
14341434static ADDRESS_MAP_START( tnk3_YM3526_sound_map, AS_PROGRAM, 8, snk_state )
14351435   AM_RANGE(0x0000, 0x7fff) AM_ROM
14361436   AM_RANGE(0x8000, 0x87ff) AM_RAM
1437   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
1437   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
14381438   AM_RANGE(0xc000, 0xc000) AM_READ(tnk3_busy_clear_r)
14391439   AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE_LEGACY("ym1", ym3526_r, ym3526_w)
14401440   AM_RANGE(0xe004, 0xe004) AM_READ(tnk3_cmdirq_ack_r)
r14896r14897
14441444static ADDRESS_MAP_START( aso_YM3526_sound_map, AS_PROGRAM, 8, snk_state )
14451445   AM_RANGE(0x0000, 0xbfff) AM_ROM
14461446   AM_RANGE(0xc000, 0xc7ff) AM_RAM
1447   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
1447   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r)
14481448   AM_RANGE(0xe000, 0xe000) AM_READ(tnk3_busy_clear_r)
14491449   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ym1", ym3526_r, ym3526_w)
14501450//  AM_RANGE(0xf002, 0xf002) AM_READNOP unknown
r14896r14897
14551455static ADDRESS_MAP_START( YM3526_YM3526_sound_map, AS_PROGRAM, 8, snk_state )
14561456   AM_RANGE(0x0000, 0xbfff) AM_ROM
14571457   AM_RANGE(0xc000, 0xcfff) AM_RAM
1458   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
1458   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
14591459   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("ym1", ym3526_status_port_r, ym3526_control_port_w)
14601460   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE_LEGACY("ym1", ym3526_write_port_w)
14611461   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE_LEGACY("ym2", ym3526_status_port_r, ym3526_control_port_w)
r14896r14897
14661466static ADDRESS_MAP_START( YM3812_sound_map, AS_PROGRAM, 8, snk_state )
14671467   AM_RANGE(0x0000, 0xbfff) AM_ROM
14681468   AM_RANGE(0xc000, 0xcfff) AM_RAM
1469   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
1469   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
14701470   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("ym1", ym3812_status_port_r, ym3812_control_port_w)
14711471   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE_LEGACY("ym1", ym3812_write_port_w)
14721472   AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
r14896r14897
14751475static ADDRESS_MAP_START( YM3526_Y8950_sound_map, AS_PROGRAM, 8, snk_state )
14761476   AM_RANGE(0x0000, 0xbfff) AM_ROM
14771477   AM_RANGE(0xc000, 0xcfff) AM_RAM
1478   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
1478   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
14791479   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("ym1", ym3526_status_port_r, ym3526_control_port_w)
14801480   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE_LEGACY("ym1", ym3526_write_port_w)
14811481   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE_LEGACY("ym2", y8950_status_port_r, y8950_control_port_w)
r14896r14897
14861486static ADDRESS_MAP_START( YM3812_Y8950_sound_map, AS_PROGRAM, 8, snk_state )
14871487   AM_RANGE(0x0000, 0xbfff) AM_ROM
14881488   AM_RANGE(0xc000, 0xcfff) AM_RAM
1489   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
1489   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
14901490   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("ym1", ym3812_status_port_r, ym3812_control_port_w)
14911491   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE_LEGACY("ym1", ym3812_write_port_w)
14921492   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE_LEGACY("ym2", y8950_status_port_r, y8950_control_port_w)
r14896r14897
14971497static ADDRESS_MAP_START( Y8950_sound_map, AS_PROGRAM, 8, snk_state )
14981498   AM_RANGE(0x0000, 0xbfff) AM_ROM
14991499   AM_RANGE(0xc000, 0xcfff) AM_RAM
1500   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
1500   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
15011501   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE_LEGACY("ym2", y8950_status_port_r, y8950_control_port_w)
15021502   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE_LEGACY("ym2", y8950_write_port_w)
15031503   AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
src/mame/drivers/highvdeo.c
r14896r14897
9494{
9595public:
9696   highvdeo_state(const machine_config &mconfig, device_type type, const char *tag)
97      : driver_device(mconfig, type, tag) { }
97      : driver_device(mconfig, type, tag) ,
98      m_blit_ram(*this, "blit_ram"){ }
9899
99   UINT16 *m_blit_ram;
100   required_shared_ptr<UINT16> m_blit_ram;
100101   UINT16 m_vblank_bit;
101102   UINT16 m_brasil_prot_latch;
102103   struct { int r,g,b,offs,offs_internal; } m_pal;
r14896r14897
140141      {
141142         UINT32 color;
142143
143         color = ((state->m_blit_ram[count]) & 0x00ff)>>0;
144         color = ((state->m_blit_ram.target()[count]) & 0x00ff)>>0;
144145
145146         if(cliprect.contains((x*2)+0, y))
146147            bitmap.pix32(y, (x*2)+0) = screen.machine().pens[color];
147148
148         color = ((state->m_blit_ram[count]) & 0xff00)>>8;
149         color = ((state->m_blit_ram.target()[count]) & 0xff00)>>8;
149150
150151         if(cliprect.contains((x*2)+1, y))
151152            bitmap.pix32(y, (x*2)+1) = screen.machine().pens[color];
r14896r14897
174175         UINT32 g;
175176         UINT32 r;
176177
177         color = (state->m_blit_ram[count]) & 0xffff;
178         color = (state->m_blit_ram.target()[count]) & 0xffff;
178179
179180         b = (color & 0x001f) << 3;
180181         g = (color & 0x07e0) >> 3;
r14896r14897
297298static ADDRESS_MAP_START( tv_vcf_map, AS_PROGRAM, 16, highvdeo_state )
298299   AM_RANGE(0x00000, 0x003ff) AM_RAM /*irq vector area*/
299300   AM_RANGE(0x00400, 0x03fff) AM_RAM AM_SHARE("nvram")
300   AM_RANGE(0x40000, 0x4ffff) AM_RAM AM_BASE(m_blit_ram) /*blitter ram*/
301   AM_RANGE(0x40000, 0x4ffff) AM_RAM AM_SHARE("blit_ram") /*blitter ram*/
301302   AM_RANGE(0x80000, 0xbffff) AM_ROMBANK("bank1")
302303   AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0)
303304ADDRESS_MAP_END
r14896r14897
344345static ADDRESS_MAP_START( tv_ncf_map, AS_PROGRAM, 16, highvdeo_state )
345346   AM_RANGE(0x00000, 0x003ff) AM_RAM /*irq vector area*/
346347   AM_RANGE(0x00400, 0x03fff) AM_RAM AM_SHARE("nvram")
347   AM_RANGE(0x20000, 0x2ffff) AM_RAM AM_BASE(m_blit_ram) /*blitter ram*/
348   AM_RANGE(0x20000, 0x2ffff) AM_RAM AM_SHARE("blit_ram") /*blitter ram*/
348349   AM_RANGE(0x40000, 0xbffff) AM_ROM AM_REGION("user1",0x40000)
349350   AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0)
350351ADDRESS_MAP_END
r14896r14897
388389static ADDRESS_MAP_START( tv_tcf_map, AS_PROGRAM, 16, highvdeo_state )
389390   AM_RANGE(0x00000, 0x003ff) AM_RAM /*irq vector area*/
390391   AM_RANGE(0x00400, 0x03fff) AM_RAM AM_SHARE("nvram")
391   AM_RANGE(0x40000, 0x5d4bf) AM_RAM AM_BASE(m_blit_ram) /*blitter ram*/
392   AM_RANGE(0x40000, 0x5d4bf) AM_RAM AM_SHARE("blit_ram") /*blitter ram*/
392393   AM_RANGE(0x7fe00, 0x7ffff) AM_RAM_WRITE(tv_tcf_paletteram_w ) AM_SHARE("paletteram")
393394   AM_RANGE(0x80000, 0xbffff) AM_ROMBANK("bank1")
394395   AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0)
r14896r14897
445446static ADDRESS_MAP_START( newmcard_map, AS_PROGRAM, 16, highvdeo_state )
446447   AM_RANGE(0x00000, 0x003ff) AM_RAM /*irq vector area*/
447448   AM_RANGE(0x00400, 0x0ffff) AM_RAM AM_SHARE("nvram")
448   AM_RANGE(0x40000, 0x7ffff) AM_RAM AM_BASE(m_blit_ram) /*blitter ram*/
449   AM_RANGE(0x40000, 0x7ffff) AM_RAM AM_SHARE("blit_ram") /*blitter ram*/
449450   AM_RANGE(0x80000, 0xbffff) AM_ROMBANK("bank1")
450451   AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0)
451452ADDRESS_MAP_END
r14896r14897
512513static ADDRESS_MAP_START( brasil_map, AS_PROGRAM, 16, highvdeo_state )
513514   AM_RANGE(0x00000, 0x003ff) AM_RAM /*irq vector area*/
514515   AM_RANGE(0x00400, 0x0ffff) AM_RAM AM_SHARE("nvram")
515   AM_RANGE(0x40000, 0x7ffff) AM_RAM AM_BASE(m_blit_ram) /*blitter ram*/
516   AM_RANGE(0x40000, 0x7ffff) AM_RAM AM_SHARE("blit_ram") /*blitter ram*/
516517   AM_RANGE(0x80000, 0xbffff) AM_ROMBANK("bank1")
517518   AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0)
518519ADDRESS_MAP_END
src/mame/drivers/namconb1.c
r14896r14897
471471   }
472472}
473473
474static WRITE32_HANDLER( namconb1_cpureg_w )
474WRITE32_MEMBER(namconb1_state::namconb1_cpureg_w)
475475{
476476   if(mem_mask & 0xff000000)
477      namconb1_cpureg8_w(space->machine(), offset*4, data >> 24);
477      namconb1_cpureg8_w(machine(), offset*4, data >> 24);
478478   if(mem_mask & 0x00ff0000)
479      namconb1_cpureg8_w(space->machine(), offset*4+1, data >> 16);
479      namconb1_cpureg8_w(machine(), offset*4+1, data >> 16);
480480   if(mem_mask & 0x0000ff00)
481      namconb1_cpureg8_w(space->machine(), offset*4+2, data >> 8);
481      namconb1_cpureg8_w(machine(), offset*4+2, data >> 8);
482482   if(mem_mask & 0x000000ff)
483      namconb1_cpureg8_w(space->machine(), offset*4+3, data);
483      namconb1_cpureg8_w(machine(), offset*4+3, data);
484484}
485485
486486
r14896r14897
539539   }
540540}
541541
542static WRITE32_HANDLER( namconb2_cpureg_w )
542WRITE32_MEMBER(namconb1_state::namconb2_cpureg_w)
543543{
544544   if(mem_mask & 0xff000000)
545      namconb2_cpureg8_w(space->machine(), offset*4, data >> 24);
545      namconb2_cpureg8_w(machine(), offset*4, data >> 24);
546546   if(mem_mask & 0x00ff0000)
547      namconb2_cpureg8_w(space->machine(), offset*4+1, data >> 16);
547      namconb2_cpureg8_w(machine(), offset*4+1, data >> 16);
548548   if(mem_mask & 0x0000ff00)
549      namconb2_cpureg8_w(space->machine(), offset*4+2, data >> 8);
549      namconb2_cpureg8_w(machine(), offset*4+2, data >> 8);
550550   if(mem_mask & 0x000000ff)
551      namconb2_cpureg8_w(space->machine(), offset*4+3, data);
551      namconb2_cpureg8_w(machine(), offset*4+3, data);
552552}
553553
554static READ32_HANDLER(namconb_cpureg_r)
554READ32_MEMBER(namconb1_state::namconb_cpureg_r)
555555{
556   namconb1_state *state = space->machine().driver_data<namconb1_state>();
557   return (state->m_namconb_cpureg[offset*4] << 24) | (state->m_namconb_cpureg[offset*4+1] << 16)
558      | (state->m_namconb_cpureg[offset*4+2] << 8) | state->m_namconb_cpureg[offset*4+3];
556   return (m_namconb_cpureg[offset*4] << 24) | (m_namconb_cpureg[offset*4+1] << 16)
557      | (m_namconb_cpureg[offset*4+2] << 8) | m_namconb_cpureg[offset*4+3];
559558}
560559
561560
r14896r14897
661660   namcos2_gametype = NAMCONB2_OUTFOXIES;
662661}
663662
664static READ32_HANDLER( custom_key_r )
663READ32_MEMBER(namconb1_state::custom_key_r)
665664{
666   namconb1_state *state = space->machine().driver_data<namconb1_state>();
667   UINT16 old_count = state->m_count;
665   UINT16 old_count = m_count;
668666
669667   do
670668   { /* pick a random number, but don't pick the same twice in a row */
671      state->m_count = space->machine().rand();
672   } while( state->m_count==old_count );
669      m_count = machine().rand();
670   } while( m_count==old_count );
673671
674672   switch( namcos2_gametype )
675673   {
r14896r14897
680678      switch( offset )
681679      {
682680      case 0: return 0x0189;
683      case 1: return  state->m_count<<16;
681      case 1: return  m_count<<16;
684682      }
685683      break;
686684
r14896r14897
688686      switch( offset )
689687      {
690688      case 0: return 0x01aa<<16;
691      case 4: return state->m_count<<16;
689      case 4: return m_count<<16;
692690      }
693691      break;
694692
r14896r14897
696694      switch( offset )
697695      {
698696      case 2: return 0x1b2<<16;
699      case 5: return state->m_count<<16;
697      case 5: return m_count<<16;
700698      }
701699      break;
702700
r14896r14897
704702      switch( offset )
705703      {
706704      case 0: return 0x0167;
707      case 1: return state->m_count<<16;
705      case 1: return m_count<<16;
708706      }
709707      break;
710708
r14896r14897
712710      switch( offset )
713711      {
714712      case 1: return 0;
715      case 3: return (0x0171<<16) | state->m_count;
713      case 3: return (0x0171<<16) | m_count;
716714      }
717715      break;
718716
r14896r14897
720718      switch( offset )
721719      {
722720      case 1: return 0x016e;
723      case 3: return state->m_count;
721      case 3: return m_count;
724722      }
725723      break;
726724
727725   case NAMCONB1_VSHOOT:
728726      switch( offset )
729727      {
730      case 2: return state->m_count<<16;
728      case 2: return m_count<<16;
731729      case 3: return 0x0170<<16;
732730      }
733731      break;
r14896r14897
736734      switch( offset )
737735      {
738736      case 0: return 0x0186;
739      case 1: return state->m_count<<16;
737      case 1: return m_count<<16;
740738      }
741739      break;
742740
r14896r14897
744742      break; /* no protection? */
745743   }
746744
747   logerror( "custom_key_r(%d); pc=%08x\n", offset, cpu_get_pc(&space->device()) );
745   logerror( "custom_key_r(%d); pc=%08x\n", offset, cpu_get_pc(&space.device()) );
748746   return 0;
749747} /* custom_key_r */
750748
r14896r14897
809807
810808/***************************************************************/
811809
812static READ32_HANDLER( gunbulet_gun_r )
810READ32_MEMBER(namconb1_state::gunbulet_gun_r)
813811{
814812   int result = 0;
815813
816814   switch( offset )
817815   {
818   case 0: case 1: result = (UINT8)(0x0f + input_port_read(space->machine(), "LIGHT1_Y") * 224/255); break; /* Y (p2) */
819   case 2: case 3: result = (UINT8)(0x26 + input_port_read(space->machine(), "LIGHT1_X") * 288/314); break; /* X (p2) */
820   case 4: case 5: result = (UINT8)(0x0f + input_port_read(space->machine(), "LIGHT0_Y") * 224/255); break; /* Y (p1) */
821   case 6: case 7: result = (UINT8)(0x26 + input_port_read(space->machine(), "LIGHT0_X") * 288/314); break; /* X (p1) */
816   case 0: case 1: result = (UINT8)(0x0f + input_port_read(machine(), "LIGHT1_Y") * 224/255); break; /* Y (p2) */
817   case 2: case 3: result = (UINT8)(0x26 + input_port_read(machine(), "LIGHT1_X") * 288/314); break; /* X (p2) */
818   case 4: case 5: result = (UINT8)(0x0f + input_port_read(machine(), "LIGHT0_Y") * 224/255); break; /* Y (p1) */
819   case 6: case 7: result = (UINT8)(0x26 + input_port_read(machine(), "LIGHT0_X") * 288/314); break; /* X (p1) */
822820   }
823821   return result<<24;
824822} /* gunbulet_gun_r */
r14896r14897
836834     */
837835} /* srand_w */
838836
839static READ32_HANDLER(namconb_share_r)
837READ32_MEMBER(namconb1_state::namconb_share_r)
840838{
841   namconb1_state *state = space->machine().driver_data<namconb1_state>();
842   return (state->m_namconb_shareram[offset*2] << 16) | state->m_namconb_shareram[offset*2+1];
839   return (m_namconb_shareram[offset*2] << 16) | m_namconb_shareram[offset*2+1];
843840}
844841
845static WRITE32_HANDLER(namconb_share_w)
842WRITE32_MEMBER(namconb1_state::namconb_share_w)
846843{
847   namconb1_state *state = space->machine().driver_data<namconb1_state>();
848   COMBINE_DATA(state->m_namconb_shareram+offset*2+1);
844   COMBINE_DATA(m_namconb_shareram+offset*2+1);
849845   data >>= 16;
850846   mem_mask >>= 16;
851   COMBINE_DATA(state->m_namconb_shareram+offset*2);
847   COMBINE_DATA(m_namconb_shareram+offset*2);
852848}
853849
854850static ADDRESS_MAP_START( namconb1_am, AS_PROGRAM, 32, namconb1_state )
855851   AM_RANGE(0x000000, 0x0fffff) AM_ROM
856   AM_RANGE(0x100000, 0x10001f) AM_READ_LEGACY(gunbulet_gun_r)
852   AM_RANGE(0x100000, 0x10001f) AM_READ(gunbulet_gun_r)
857853   AM_RANGE(0x1c0000, 0x1cffff) AM_RAM
858854   AM_RANGE(0x1e4000, 0x1e4003) AM_READWRITE(randgen_r,srand_w)
859   AM_RANGE(0x200000, 0x207fff) AM_READWRITE_LEGACY(namconb_share_r, namconb_share_w)
855   AM_RANGE(0x200000, 0x207fff) AM_READWRITE(namconb_share_r, namconb_share_w)
860856   AM_RANGE(0x208000, 0x2fffff) AM_RAM
861   AM_RANGE(0x400000, 0x40001f) AM_READWRITE_LEGACY(namconb_cpureg_r, namconb1_cpureg_w)
857   AM_RANGE(0x400000, 0x40001f) AM_READWRITE(namconb_cpureg_r, namconb1_cpureg_w)
862858   AM_RANGE(0x580000, 0x5807ff) AM_RAM AM_BASE(m_nvmem32)
863859   AM_RANGE(0x600000, 0x61ffff) AM_READWRITE_LEGACY(namco_obj32_r,namco_obj32_w)
864860   AM_RANGE(0x620000, 0x620007) AM_READWRITE_LEGACY(namco_spritepos32_r,namco_spritepos32_w)
865861   AM_RANGE(0x640000, 0x64ffff) AM_READWRITE_LEGACY(namco_tilemapvideoram32_r,namco_tilemapvideoram32_w )
866862   AM_RANGE(0x660000, 0x66003f) AM_READWRITE_LEGACY(namco_tilemapcontrol32_r,namco_tilemapcontrol32_w)
867863   AM_RANGE(0x680000, 0x68000f) AM_RAM AM_BASE(m_spritebank32)
868   AM_RANGE(0x6e0000, 0x6e001f) AM_READ_LEGACY(custom_key_r) AM_WRITENOP
864   AM_RANGE(0x6e0000, 0x6e001f) AM_READ(custom_key_r) AM_WRITENOP
869865   AM_RANGE(0x700000, 0x707fff) AM_RAM AM_SHARE("paletteram")
870866ADDRESS_MAP_END
871867
r14896r14897
873869   AM_RANGE(0x000000, 0x0fffff) AM_ROM
874870   AM_RANGE(0x1c0000, 0x1cffff) AM_RAM
875871   AM_RANGE(0x1e4000, 0x1e4003) AM_READWRITE(randgen_r,srand_w)
876   AM_RANGE(0x200000, 0x207fff) AM_READWRITE_LEGACY(namconb_share_r, namconb_share_w)
872   AM_RANGE(0x200000, 0x207fff) AM_READWRITE(namconb_share_r, namconb_share_w)
877873   AM_RANGE(0x208000, 0x2fffff) AM_RAM
878874   AM_RANGE(0x400000, 0x4fffff) AM_ROM AM_REGION("data", 0)
879875   AM_RANGE(0x600000, 0x61ffff) AM_READWRITE_LEGACY(namco_obj32_r,namco_obj32_w)
r14896r14897
888884   AM_RANGE(0x940000, 0x94000f) AM_RAM AM_BASE(m_tilebank32)
889885   AM_RANGE(0x980000, 0x98000f) AM_READ_LEGACY(namco_rozbank32_r) AM_WRITE_LEGACY(namco_rozbank32_w)
890886   AM_RANGE(0xa00000, 0xa007ff) AM_RAM AM_BASE(m_nvmem32)
891   AM_RANGE(0xc00000, 0xc0001f) AM_READ_LEGACY(custom_key_r) AM_WRITENOP
892   AM_RANGE(0xf00000, 0xf0001f) AM_READWRITE_LEGACY(namconb_cpureg_r, namconb2_cpureg_w)
887   AM_RANGE(0xc00000, 0xc0001f) AM_READ(custom_key_r) AM_WRITENOP
888   AM_RANGE(0xf00000, 0xf0001f) AM_READWRITE(namconb_cpureg_r, namconb2_cpureg_w)
893889ADDRESS_MAP_END
894890
895static WRITE16_HANDLER( nbmcu_shared_w )
891WRITE16_MEMBER(namconb1_state::nbmcu_shared_w)
896892{
897   namconb1_state *state = space->machine().driver_data<namconb1_state>();
898893   // HACK!  Many games data ROM routines redirect the vector from the sound command read to an RTS.
899894   // This needs more investigation.  nebulray and vshoot do NOT do this.
900895   // Timers A2 and A3 are set up in "external input counter" mode, this may be related.
r14896r14897
905900   }
906901#endif
907902
908   COMBINE_DATA(&state->m_namconb_shareram[offset]);
903   COMBINE_DATA(&m_namconb_shareram[offset]);
909904
910905   // C74 BIOS has a very short window on the CPU sync signal, so immediately let the '020 at it
911906   if ((offset == 0x6000/2) && (data & 0x80))
912907   {
913      device_spin_until_time(&space->device(), downcast<cpu_device *>(&space->device())->cycles_to_attotime(300));   // was 300
908      device_spin_until_time(&space.device(), downcast<cpu_device *>(&space.device())->cycles_to_attotime(300));   // was 300
914909   }
915910}
916911
917912static ADDRESS_MAP_START( namcoc75_am, AS_PROGRAM, 16, namconb1_state )
918913   AM_RANGE(0x002000, 0x002fff) AM_DEVREADWRITE("c352", c352_device, read, write)
919   AM_RANGE(0x004000, 0x00bfff) AM_RAM_WRITE_LEGACY(nbmcu_shared_w) AM_BASE(m_namconb_shareram)
914   AM_RANGE(0x004000, 0x00bfff) AM_RAM_WRITE(nbmcu_shared_w) AM_BASE(m_namconb_shareram)
920915   AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("c75", 0)
921916   AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("c75data", 0)
922917ADDRESS_MAP_END
923918
924919
925static READ8_HANDLER( port6_r )
920READ8_MEMBER(namconb1_state::port6_r)
926921{
927   namconb1_state *state = space->machine().driver_data<namconb1_state>();
928   return state->m_nbx_port6;
922   return m_nbx_port6;
929923}
930924
931static WRITE8_HANDLER( port6_w )
925WRITE8_MEMBER(namconb1_state::port6_w)
932926{
933   namconb1_state *state = space->machine().driver_data<namconb1_state>();
934   state->m_nbx_port6 = data;
927   m_nbx_port6 = data;
935928}
936929
937static READ8_HANDLER( port7_r )
930READ8_MEMBER(namconb1_state::port7_r)
938931{
939   namconb1_state *state = space->machine().driver_data<namconb1_state>();
940   switch (state->m_nbx_port6 & 0xf0)
932   switch (m_nbx_port6 & 0xf0)
941933   {
942934      case 0x00:
943         return input_port_read_safe(space->machine(), "P4", 0xff);
935         return input_port_read_safe(machine(), "P4", 0xff);
944936
945937      case 0x20:
946         return input_port_read(space->machine(), "MISC");
938         return input_port_read(machine(), "MISC");
947939
948940      case 0x40:
949         return input_port_read(space->machine(), "P1");
941         return input_port_read(machine(), "P1");
950942
951943      case 0x60:
952         return input_port_read(space->machine(), "P2");
944         return input_port_read(machine(), "P2");
953945
954946      default:
955947         break;
r14896r14897
961953// Is this madness?  No, this is Namco.  They didn't have enough digital ports for all 4 players,
962954// so the 8 bits of player 3 got routed to the 8 analog inputs.  +5V on the analog input will
963955// register full scale, so it works...
964static READ8_HANDLER(dac7_r)      // bit 7
956READ8_MEMBER(namconb1_state::dac7_r)// bit 7
965957{
966   return input_port_read_safe(space->machine(), "P3", 0xff)&0x80;
958   return input_port_read_safe(machine(), "P3", 0xff)&0x80;
967959}
968960
969static READ8_HANDLER(dac6_r)      // bit 3
961READ8_MEMBER(namconb1_state::dac6_r)// bit 3
970962{
971   return (input_port_read_safe(space->machine(), "P3", 0xff)<<1)&0x80;
963   return (input_port_read_safe(machine(), "P3", 0xff)<<1)&0x80;
972964}
973965
974static READ8_HANDLER(dac5_r)      // bit 2
966READ8_MEMBER(namconb1_state::dac5_r)// bit 2
975967{
976   return (input_port_read_safe(space->machine(), "P3", 0xff)<<2)&0x80;
968   return (input_port_read_safe(machine(), "P3", 0xff)<<2)&0x80;
977969}
978970
979static READ8_HANDLER(dac4_r)      // bit 1
971READ8_MEMBER(namconb1_state::dac4_r)// bit 1
980972{
981   return (input_port_read_safe(space->machine(), "P3", 0xff)<<3)&0x80;
973   return (input_port_read_safe(machine(), "P3", 0xff)<<3)&0x80;
982974}
983975
984static READ8_HANDLER(dac3_r)      // bit 0
976READ8_MEMBER(namconb1_state::dac3_r)// bit 0
985977{
986   return (input_port_read_safe(space->machine(), "P3", 0xff)<<4)&0x80;
978   return (input_port_read_safe(machine(), "P3", 0xff)<<4)&0x80;
987979}
988980
989static READ8_HANDLER(dac2_r)      // bit 4
981READ8_MEMBER(namconb1_state::dac2_r)// bit 4
990982{
991   return (input_port_read_safe(space->machine(), "P3", 0xff)<<5)&0x80;
983   return (input_port_read_safe(machine(), "P3", 0xff)<<5)&0x80;
992984}
993985
994static READ8_HANDLER(dac1_r)      // bit 5
986READ8_MEMBER(namconb1_state::dac1_r)// bit 5
995987{
996   return (input_port_read_safe(space->machine(), "P3", 0xff)<<6)&0x80;
988   return (input_port_read_safe(machine(), "P3", 0xff)<<6)&0x80;
997989}
998990
999static READ8_HANDLER(dac0_r)      // bit 6
991READ8_MEMBER(namconb1_state::dac0_r)// bit 6
1000992{
1001   return (input_port_read_safe(space->machine(), "P3", 0xff)<<7)&0x80;
993   return (input_port_read_safe(machine(), "P3", 0xff)<<7)&0x80;
1002994}
1003995
1004996static ADDRESS_MAP_START( namcoc75_io, AS_IO, 8, namconb1_state )
1005   AM_RANGE(M37710_PORT6, M37710_PORT6) AM_READWRITE_LEGACY(port6_r, port6_w)
1006   AM_RANGE(M37710_PORT7, M37710_PORT7) AM_READ_LEGACY(port7_r)
1007   AM_RANGE(M37710_ADC7_L, M37710_ADC7_L) AM_READ_LEGACY(dac7_r)
1008   AM_RANGE(M37710_ADC6_L, M37710_ADC6_L) AM_READ_LEGACY(dac6_r)
1009   AM_RANGE(M37710_ADC5_L, M37710_ADC5_L) AM_READ_LEGACY(dac5_r)
1010   AM_RANGE(M37710_ADC4_L, M37710_ADC4_L) AM_READ_LEGACY(dac4_r)
1011   AM_RANGE(M37710_ADC3_L, M37710_ADC3_L) AM_READ_LEGACY(dac3_r)
1012   AM_RANGE(M37710_ADC2_L, M37710_ADC2_L) AM_READ_LEGACY(dac2_r)
1013   AM_RANGE(M37710_ADC1_L, M37710_ADC1_L) AM_READ_LEGACY(dac1_r)
1014   AM_RANGE(M37710_ADC0_L, M37710_ADC0_L) AM_READ_LEGACY(dac0_r)
997   AM_RANGE(M37710_PORT6, M37710_PORT6) AM_READWRITE(port6_r, port6_w)
998   AM_RANGE(M37710_PORT7, M37710_PORT7) AM_READ(port7_r)
999   AM_RANGE(M37710_ADC7_L, M37710_ADC7_L) AM_READ(dac7_r)
1000   AM_RANGE(M37710_ADC6_L, M37710_ADC6_L) AM_READ(dac6_r)
1001   AM_RANGE(M37710_ADC5_L, M37710_ADC5_L) AM_READ(dac5_r)
1002   AM_RANGE(M37710_ADC4_L, M37710_ADC4_L) AM_READ(dac4_r)
1003   AM_RANGE(M37710_ADC3_L, M37710_ADC3_L) AM_READ(dac3_r)
1004   AM_RANGE(M37710_ADC2_L, M37710_ADC2_L) AM_READ(dac2_r)
1005   AM_RANGE(M37710_ADC1_L, M37710_ADC1_L) AM_READ(dac1_r)
1006   AM_RANGE(M37710_ADC0_L, M37710_ADC0_L) AM_READ(dac0_r)
10151007ADDRESS_MAP_END
10161008
10171009#define MASTER_CLOCK_HZ 48384000
src/mame/drivers/nsmpoker.c
r14896r14897
6868{
6969public:
7070   nsmpoker_state(const machine_config &mconfig, device_type type, const char *tag)
71      : driver_device(mconfig, type, tag) { }
71      : driver_device(mconfig, type, tag) ,
72      m_videoram(*this, "videoram"),
73      m_colorram(*this, "colorram"){ }
7274
73   UINT8 *m_videoram;
74   UINT8 *m_colorram;
75   required_shared_ptr<UINT8> m_videoram;
76   required_shared_ptr<UINT8> m_colorram;
7577   tilemap_t *m_bg_tilemap;
7678   DECLARE_WRITE8_MEMBER(nsmpoker_videoram_w);
7779   DECLARE_WRITE8_MEMBER(nsmpoker_colorram_w);
r14896r14897
8789
8890WRITE8_MEMBER(nsmpoker_state::nsmpoker_videoram_w)
8991{
90   m_videoram[offset] = data;
92   m_videoram.target()[offset] = data;
9193   m_bg_tilemap->mark_tile_dirty(offset);
9294}
9395
9496
9597WRITE8_MEMBER(nsmpoker_state::nsmpoker_colorram_w)
9698{
97   m_colorram[offset] = data;
99   m_colorram.target()[offset] = data;
98100   m_bg_tilemap->mark_tile_dirty(offset);
99101}
100102
r14896r14897
108110    ---- ----   color code.
109111    ---- ----   seems unused.
110112*/
111//  int attr = state->m_colorram[tile_index];
112   int code = state->m_videoram[tile_index];
113//  int attr = state->m_colorram.target()[tile_index];
114   int code = state->m_videoram.target()[tile_index];
113115//  int bank = (attr & 0x08) >> 3;
114116//  int color = (attr & 0x03);
115117
r14896r14897
166168   AM_RANGE(0x0000, 0x7fff) AM_ROM
167169   AM_RANGE(0x9000, 0xafff) AM_RAM   // OK... cleared at beginning.
168170   AM_RANGE(0xb000, 0xcfff) AM_ROM   // WRONG... just to map the last rom somewhere.
169   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(nsmpoker_videoram_w) AM_BASE(m_videoram) // WRONG... just a placeholder.
170   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(nsmpoker_colorram_w) AM_BASE(m_colorram) // WRONG... just a placeholder.
171   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(nsmpoker_videoram_w) AM_SHARE("videoram") // WRONG... just a placeholder.
172   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(nsmpoker_colorram_w) AM_SHARE("colorram") // WRONG... just a placeholder.
171173ADDRESS_MAP_END
172174
173175static ADDRESS_MAP_START( nsmpoker_portmap, AS_IO, 8, nsmpoker_state )
src/mame/drivers/fcrash.c
r14896r14897
4646
4747   if (ACCESSING_BITS_0_7)
4848   {
49      state->soundlatch_w(*space, 0, data & 0xff);
49      state->soundlatch_byte_w(*space, 0, data & 0xff);
5050      device_set_input_line(state->m_audiocpu, 0, HOLD_LINE);
5151   }
5252}
r14896r14897
224224   int videocontrol = state->m_cps_a_regs[0x22 / 2];
225225
226226
227   flip_screen_set(screen.machine(), videocontrol & 0x8000);
227   state->flip_screen_set(videocontrol & 0x8000);
228228
229229   layercontrol = state->m_cps_b_regs[0x20 / 2];
230230
r14896r14897
304304   int layercontrol, l0, l1, l2, l3;
305305   int videocontrol = state->m_cps_a_regs[0x22 / 2];
306306
307   flip_screen_set(screen.machine(), videocontrol & 0x8000);
307   state->flip_screen_set(videocontrol & 0x8000);
308308
309309   layercontrol = state->m_cps_b_regs[0x20 / 2];
310310
r14896r14897
399399   AM_RANGE(0xd800, 0xd801) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
400400   AM_RANGE(0xdc00, 0xdc01) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r, ym2203_w)
401401   AM_RANGE(0xe000, 0xe000) AM_WRITE_LEGACY(fcrash_snd_bankswitch_w)
402   AM_RANGE(0xe400, 0xe400) AM_READ(soundlatch_r)
402   AM_RANGE(0xe400, 0xe400) AM_READ(soundlatch_byte_r)
403403   AM_RANGE(0xe800, 0xe800) AM_WRITE_LEGACY(fcrash_msm5205_0_data_w)
404404   AM_RANGE(0xec00, 0xec00) AM_WRITE_LEGACY(fcrash_msm5205_1_data_w)
405405ADDRESS_MAP_END
src/mame/drivers/othello.c
r14896r14897
5151{
5252public:
5353   othello_state(const machine_config &mconfig, device_type type, const char *tag)
54      : driver_device(mconfig, type, tag) { }
54      : driver_device(mconfig, type, tag) ,
55      m_videoram(*this, "videoram"){ }
5556
5657   /* memory pointers */
57   UINT8 * m_videoram;
58   required_shared_ptr<UINT8> m_videoram;
5859
5960   /* video-related */
6061   int    m_tile_bank;
r14896r14897
103104
104105   for(cx = 0; cx < x_count; ++cx)
105106   {
106      data_address = ((state->m_videoram[ma + cx] + state->m_tile_bank) << 4) | ra;
107      data_address = ((state->m_videoram.target()[ma + cx] + state->m_tile_bank) << 4) | ra;
107108      tmp = gfx[data_address] | (gfx[data_address + 0x2000] << 8) | (gfx[data_address + 0x4000] << 16);
108109
109110      for(x = 0; x < TILE_WIDTH; ++x)
r14896r14897
135136static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, othello_state )
136137   AM_RANGE(0x0000, 0x1fff) AM_ROM
137138   AM_RANGE(0x8000, 0x97ff) AM_NOP /* not populated */
138   AM_RANGE(0x9800, 0x9fff) AM_RAM AM_BASE(m_videoram)
139   AM_RANGE(0x9800, 0x9fff) AM_RAM AM_SHARE("videoram")
139140   AM_RANGE(0xf000, 0xffff) AM_RAM
140141ADDRESS_MAP_END
141142
r14896r14897
196197   AM_RANGE(0x87, 0x87) AM_READ(unk_87_r)
197198   AM_RANGE(0x8a, 0x8a) AM_WRITE(unk_8a_w)
198199   AM_RANGE(0x8c, 0x8c) AM_READWRITE(unk_8c_r, unk_8c_w)
199   AM_RANGE(0x8d, 0x8d) AM_READWRITE(sound_ack_r, soundlatch_w)
200   AM_RANGE(0x8d, 0x8d) AM_READWRITE(sound_ack_r, soundlatch_byte_w)
200201   AM_RANGE(0x8f, 0x8f) AM_WRITE(unk_8f_w)
201202ADDRESS_MAP_END
202203
203204READ8_MEMBER(othello_state::latch_r)
204205{
205   int retval = soundlatch_r(space, 0);
206   soundlatch_clear_w(space, 0, 0);
206   int retval = soundlatch_byte_r(space, 0);
207   soundlatch_clear_byte_w(space, 0, 0);
207208   return retval;
208209}
209210
src/mame/drivers/f-32.c
r14896r14897
2222public:
2323   mosaicf2_state(const machine_config &mconfig, device_type type, const char *tag)
2424      : driver_device(mconfig, type, tag),
25        m_maincpu(*this, "maincpu") { }
25        m_maincpu(*this, "maincpu") ,
26      m_videoram(*this, "videoram"){ }
2627
2728   /* memory pointers */
2829   required_device<e132xn_device>   m_maincpu;
29   UINT32 * m_videoram;
30   required_shared_ptr<UINT32> m_videoram;
3031   DECLARE_READ32_MEMBER(f32_input_port_1_r);
3132};
3233
r14896r14897
4344
4445      if ((x < 0xa0) && (y < 0xe0))
4546      {
46         bitmap.pix16(y, (x * 2) + 0) = (state->m_videoram[offs] >> 16) & 0x7fff;
47         bitmap.pix16(y, (x * 2) + 1) = (state->m_videoram[offs] >>  0) & 0x7fff;
47         bitmap.pix16(y, (x * 2) + 0) = (state->m_videoram.target()[offs] >> 16) & 0x7fff;
48         bitmap.pix16(y, (x * 2) + 1) = (state->m_videoram.target()[offs] >>  0) & 0x7fff;
4849      }
4950   }
5051
r14896r14897
5556
5657static ADDRESS_MAP_START( common_map, AS_PROGRAM, 32, mosaicf2_state )
5758   AM_RANGE(0x00000000, 0x001fffff) AM_RAM
58   AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE(m_videoram)
59   AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_SHARE("videoram")
5960   AM_RANGE(0x80000000, 0x80ffffff) AM_ROM AM_REGION("user2",0)
6061   AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("user1",0)
6162ADDRESS_MAP_END
src/mame/drivers/cosmic.c
r14896r14897
347347
348348WRITE8_MEMBER(cosmic_state::flip_screen_w)
349349{
350   flip_screen_set(machine(), data & 0x80);
350   flip_screen_set(data & 0x80);
351351}
352352
353353
src/mame/drivers/bfm_sc5.c
r14896r14897
4343static INPUT_PORTS_START(  sc5 )
4444INPUT_PORTS_END
4545
46static INTERRUPT_GEN( sc5_fake_timer_int )
47{
48   // this should be coming from the Timer / SIM modules of the Coldfire
49   device_set_input_line_and_vector((legacy_cpu_device*)device->machine().device("maincpu"), 5, HOLD_LINE, 0x8c);
50}
51
4652static MACHINE_CONFIG_START( sc5, sc5_state )
4753   MCFG_CPU_ADD("maincpu", MCF5206E, 40000000) /* MCF5206eFT */
4854   MCFG_CPU_PROGRAM_MAP(sc5_map)
55   MCFG_CPU_PERIODIC_INT(sc5_fake_timer_int,1000)
4956
5057   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
5158   /* unknown sound */
r14896r14897
275282   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
276283   ROM_LOAD16_BYTE( "p1744p11.hi", 0x00000, 0x080000, CRC(c4634163) SHA1(6d7ed6afcabbe38f3315140b7aa985c0acab1af5) )
277284   ROM_LOAD16_BYTE( "p1744p11.lo", 0x00001, 0x080000, CRC(aaeef50f) SHA1(eccdbe5951314105ec5a06724582fc021e0dbd2c) )
278   sc_btrip_others
285   PR1743_CASINO_BULLSEYE_SOUNDS11
279286ROM_END
280287
281288ROM_START( sc5btripa )
282289   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
283290   ROM_LOAD16_BYTE( "p1744s11.hi", 0x00000, 0x080000, CRC(89649f68) SHA1(3e785dce35cab75d1e8eaa98b11db7af2bb08b0a) )
284291   ROM_LOAD16_BYTE( "p1744s11.lo", 0x00001, 0x080000, CRC(08bf00ea) SHA1(9eec569703d71db15d553b9f7a72931fa738f91a) )
285   sc_btrip_others
292   PR1743_CASINO_BULLSEYE_SOUNDS11
286293ROM_END
287294
288295
r14896r14897
604611   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
605612   ROM_LOAD16_BYTE( "p3317p71.hi", 0x00000, 0x080000, CRC(6b3964f1) SHA1(4f464ca86a59e30a7f05fe1d6ed8f30f8260d186) )
606613   ROM_LOAD16_BYTE( "p3317p71.lo", 0x00001, 0x080000, CRC(af2a8342) SHA1(4865f3ff996b67bebf38c93aad3f7b32afcb2d7e) )
607   sc_cmony_others
614   PR3317_COLOUR_OF_MONEY_SOUNDS11
608615ROM_END
609616
610617ROM_START( sc5colmoa )
611618   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
612619   ROM_LOAD16_BYTE( "p3317p73.hi", 0x00000, 0x080000, CRC(fad957ba) SHA1(56446892d5ef88488e4ee223bee489ce822a78ce) )
613620   ROM_LOAD16_BYTE( "p3317p73.lo", 0x00001, 0x080000, CRC(28ebb95e) SHA1(0dcde4f0fb1ffdc3f5efeadbf119fb89097da9fb) )
614   sc_cmony_others
621   PR3317_COLOUR_OF_MONEY_SOUNDS11
615622ROM_END
616623
617624ROM_START( sc5colmob )
618625   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
619626   ROM_LOAD16_BYTE( "p3317s71.hi", 0x00000, 0x080000, CRC(2883db1b) SHA1(a3cd5cc0f6e17425e4de4a81d18c710ec873da86) )
620627   ROM_LOAD16_BYTE( "p3317s71.lo", 0x00001, 0x080000, CRC(074f7cc2) SHA1(159071cce2a2c834e0e1b9bdd448b16b46577637) )
621   sc_cmony_others
628   PR3317_COLOUR_OF_MONEY_SOUNDS11
622629ROM_END
623630
624631ROM_START( sc5colmoc )
625632   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
626633   ROM_LOAD16_BYTE( "p3317s73.hi", 0x00000, 0x080000, CRC(3a9fdba2) SHA1(6bd035186e28bff42d2fc285b07c5c9ec683db7b) )
627634   ROM_LOAD16_BYTE( "p3317s73.lo", 0x00001, 0x080000, CRC(6ee18188) SHA1(73b01c51d12ba5d971b9a0da94e781a08788a6fa) )
628   sc_cmony_others
635   PR3317_COLOUR_OF_MONEY_SOUNDS11
629636ROM_END
630637
631638
r14896r14897
635642   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
636643   ROM_LOAD16_BYTE( "95426926.lo", 0x00001, 0x080000, CRC(905a15ce) SHA1(987782cd163f1a8869970912ad412e5440dacdf3) )
637644   ROM_LOAD16_BYTE( "95426927.hi", 0x00000, 0x080000, CRC(70fa9626) SHA1(e9a58b489665e8b540adaa220995d5237de1c820) )
638   sc_cmony_others
645   PR3502_C_OF_M_TEN_SOUNDS11
639646ROM_END
640647
641648ROM_START( sc5newcma )
642649   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
643650   ROM_LOAD16_BYTE( "95427926.lo", 0x00001, 0x080000, CRC(5897abbc) SHA1(7714218e76a1d2ebdda65c1403c4fc3f5a5263f6) )
644651   ROM_LOAD16_BYTE( "95427927.hi", 0x00000, 0x080000, CRC(4c44681c) SHA1(ed808ab3d06157da9dbe65b1e27925b3a3b53f91) )
645   sc_cmony_others
652   PR3502_C_OF_M_TEN_SOUNDS11
646653ROM_END
647654
648655ROM_START( sc5newcmb )
649656   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
650657   ROM_LOAD16_BYTE( "95426818.lo", 0x00001, 0x080000, CRC(898b5c17) SHA1(5e090bec5d9dc303e3d6d80a4b27c095c285eb29) )
651658   ROM_LOAD16_BYTE( "95426819.hi", 0x00000, 0x080000, CRC(d6eeeddd) SHA1(70d11f51b257d7d565bad65a9f0b0e7bde716bf7) )
652   sc_cmony_others
659   PR3502_C_OF_M_TEN_SOUNDS11
653660ROM_END
654661
655662ROM_START( sc5newcmc )
656663   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
657664   ROM_LOAD16_BYTE( "95427818.lo", 0x00001, 0x080000, CRC(f696797d) SHA1(fd1ae9bf1e248cadf547d18601a7df54f6384b91) )
658665   ROM_LOAD16_BYTE( "95427819.hi", 0x00000, 0x080000, CRC(ee6fadce) SHA1(47d14fcc8040f72c97e1cade26f1a62cf1ead511) )
659   sc_cmony_others
666   PR3502_C_OF_M_TEN_SOUNDS11
660667ROM_END
661668
662669ROM_START( sc5crcpt )
r14896r14897
974981   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
975982   ROM_LOAD16_BYTE( "95422086.lo", 0x00001, 0x080000, CRC(5deb6c03) SHA1(2ac729194d1e6b0fb71f5f248bf4918140f4ab2a) )
976983   ROM_LOAD16_BYTE( "95422087.hi", 0x00000, 0x080000, CRC(e194968f) SHA1(ca2a17f826671025c6cdd7b1361107b7ffe3ea07) )
977   sc_dndbl_others
984   PR3068_BEAT_THE_BANKER_SOUNDS11
978985ROM_END
979986
980987ROM_START( sc5dndbla )
981988   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
982989   ROM_LOAD16_BYTE( "95422148.lo", 0x00001, 0x080000, CRC(825d9ed9) SHA1(b123fd2190d10888286a5e58b3a796890b673bd6) )
983990   ROM_LOAD16_BYTE( "95422149.hi", 0x00000, 0x080000, CRC(b9dff341) SHA1(a27f5e7d1a2f78898c74eae1f87cb6c6b242791e) )
984   sc_dndbl_others
991   PR3068_BEAT_THE_BANKER_SOUNDS11
985992ROM_END
986993
987994ROM_START( sc5dndblb )
988995   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
989996   ROM_LOAD16_BYTE( "95422206.lo", 0x00001, 0x080000, CRC(b50bc3df) SHA1(29e5edddbc8f67fd5d13eef44b6dd03f714110f0) )
990997   ROM_LOAD16_BYTE( "95422207.hi", 0x00000, 0x080000, CRC(98a749aa) SHA1(0e3eecc9f257994dba4907e735b9371e81a25e8f) )
991   sc_dndbl_others
998   PR3068_BEAT_THE_BANKER_SOUNDS11
992999ROM_END
9931000
9941001ROM_START( sc5dndblc )
9951002   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
9961003   ROM_LOAD16_BYTE( "95422210.lo", 0x00001, 0x080000, CRC(ef3c7726) SHA1(7f9d2e548800c295731b8c15c5cc8119017069ba) )
9971004   ROM_LOAD16_BYTE( "95422211.hi", 0x00000, 0x080000, CRC(07545d4c) SHA1(d3dd3ff04c1d2f485dacd13b4214f2462254a6d5) )
998   sc_dndbl_others
1005   PR3068_BEAT_THE_BANKER_SOUNDS11
9991006ROM_END
10001007
10011008ROM_START( sc5dndbld )
10021009   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10031010   ROM_LOAD16_BYTE( "95422246.lo", 0x00001, 0x080000, CRC(ab3326ea) SHA1(d511f252f1acf76fc59d3f343c4d1db54bb8de8a) )
10041011   ROM_LOAD16_BYTE( "95422247.hi", 0x00000, 0x080000, CRC(b9c05994) SHA1(e6ca9c7f8e6df6aa2277a329ab211134dae684aa) )
1005   sc_dndbl_others
1012   PR3068_BEAT_THE_BANKER_SOUNDS11
10061013ROM_END
10071014
10081015ROM_START( sc5dndble )
10091016   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10101017   ROM_LOAD16_BYTE( "95422248.lo", 0x00001, 0x080000, CRC(45192ed6) SHA1(21980888e1deb5e4d8cf140b957d10e18cd7315a) )
10111018   ROM_LOAD16_BYTE( "95422249.hi", 0x00000, 0x080000, CRC(5b671826) SHA1(202f1b63e64c71fd7a1ef8c3159ed7a778d7d6f5) )
1012   sc_dndbl_others
1019   PR3068_BEAT_THE_BANKER_SOUNDS11
10131020ROM_END
10141021
10151022ROM_START( sc5dndblf )
10161023   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10171024   ROM_LOAD16_BYTE( "95422324.lo", 0x00001, 0x080000, CRC(681980ea) SHA1(11520621d11bc6642fa1ef6a81f36e4c2c5c2349) )
10181025   ROM_LOAD16_BYTE( "95422325.hi", 0x00000, 0x080000, CRC(9337c3c8) SHA1(55313e2658ebd3fe314d5d2fe7fc846b54cb6b6d) )
1019   sc_dndbl_others
1026   PR3068_BEAT_THE_BANKER_SOUNDS11
10201027ROM_END
10211028
10221029ROM_START( sc5dndblg )
10231030   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10241031   ROM_LOAD16_BYTE( "95422326.lo", 0x00001, 0x080000, CRC(5f886988) SHA1(6b97194b2da2ba32b36652b0cf6f033ca364e297) )
10251032   ROM_LOAD16_BYTE( "95422327.hi", 0x00000, 0x080000, CRC(71fdb9df) SHA1(c39ac2a70572bc4a337c1b578430e881cf5c0dc6) )
1026   sc_dndbl_others
1033   PR3068_BEAT_THE_BANKER_SOUNDS11
10271034ROM_END
10281035
10291036ROM_START( sc5dndblh )
10301037   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10311038   ROM_LOAD16_BYTE( "95423086.lo", 0x00001, 0x080000, CRC(330ad71d) SHA1(e80e38e0a7dc00271f589a35fa1666027ce7f764) )
10321039   ROM_LOAD16_BYTE( "95423087.hi", 0x00000, 0x080000, CRC(2c028fb9) SHA1(5ba125d474f6d916967ad90bddfc8ebabcdb18aa) )
1033   sc_dndbl_others
1040   PR3068_BEAT_THE_BANKER_SOUNDS11
10341041ROM_END
10351042
10361043ROM_START( sc5dndbli )
10371044   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10381045   ROM_LOAD16_BYTE( "95423148.lo", 0x00001, 0x080000, CRC(b2c47c77) SHA1(f788eaf4aaf8509de48d661341d5d46bee5ee1d9) )
10391046   ROM_LOAD16_BYTE( "95423149.hi", 0x00000, 0x080000, CRC(55164612) SHA1(06d666a611a89ee0e79072a54959508a5cd55981) )
1040   sc_dndbl_others
1047   PR3068_BEAT_THE_BANKER_SOUNDS11
10411048ROM_END
10421049
10431050ROM_START( sc5dndblj )
10441051   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10451052   ROM_LOAD16_BYTE( "95423206.lo", 0x00001, 0x080000, CRC(e734b65f) SHA1(04f38218aeb61305df1dd26574a24efb1cf04a33) )
10461053   ROM_LOAD16_BYTE( "95423207.hi", 0x00000, 0x080000, CRC(c0384d57) SHA1(c1841c1b06e47edeb760538a89b6302e67f6473d) )
1047   sc_dndbl_others
1054   PR3068_BEAT_THE_BANKER_SOUNDS11
10481055ROM_END
10491056
10501057ROM_START( sc5dndblk )
10511058   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10521059   ROM_LOAD16_BYTE( "95423210.lo", 0x00001, 0x080000, CRC(6db7b68f) SHA1(db23b755758bee7706ee1504743ef6fa84e542d0) )
10531060   ROM_LOAD16_BYTE( "95423211.hi", 0x00000, 0x080000, CRC(fc572112) SHA1(27b3bd337ce82b8029b0e2ab9bbcc45c1d2f5244) )
1054   sc_dndbl_others
1061   PR3068_BEAT_THE_BANKER_SOUNDS11
10551062ROM_END
10561063
10571064ROM_START( sc5dndbll )
10581065   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10591066   ROM_LOAD16_BYTE( "95423246.lo", 0x00001, 0x080000, CRC(36bdbe7a) SHA1(f8de104bafa301dc653b3aa01bbee08f57f42d33) )
10601067   ROM_LOAD16_BYTE( "95423247.hi", 0x00000, 0x080000, CRC(7432ef89) SHA1(1c71c4fc96afd6bf1b644cce9312a77370f1e201) )
1061   sc_dndbl_others
1068   PR3068_BEAT_THE_BANKER_SOUNDS11
10621069ROM_END
10631070
10641071ROM_START( sc5dndblm )
10651072   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10661073   ROM_LOAD16_BYTE( "95423248.lo", 0x00001, 0x080000, CRC(e3fe8ce9) SHA1(503ac6f37a24e36ce268f77e13cb7ef3719abca2) )
10671074   ROM_LOAD16_BYTE( "95423249.hi", 0x00000, 0x080000, CRC(cfc95a9e) SHA1(a9f235f3688ccd978c28c6425a4aeff68e433a75) )
1068   sc_dndbl_others
1075   PR3068_BEAT_THE_BANKER_SOUNDS11
10691076ROM_END
10701077
10711078ROM_START( sc5dndbln )
10721079   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10731080   ROM_LOAD16_BYTE( "95423324.lo", 0x00001, 0x080000, CRC(0d2469ff) SHA1(b219ee90cefb52ab495ec976f8554e834e2c8088) )
10741081   ROM_LOAD16_BYTE( "95423325.hi", 0x00000, 0x080000, CRC(4eabcf0c) SHA1(295b4771f64493466cd75098f71f0e118460e2f3) )
1075   sc_dndbl_others
1082   PR3068_BEAT_THE_BANKER_SOUNDS11
10761083ROM_END
10771084
10781085ROM_START( sc5dndblo )
10791086   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
10801087   ROM_LOAD16_BYTE( "95423326.lo", 0x00001, 0x080000, CRC(8bfe21a2) SHA1(1fc13b53cda62531322a12f210daa0e510391ba3) )
10811088   ROM_LOAD16_BYTE( "95423327.hi", 0x00000, 0x080000, CRC(883e7518) SHA1(8a437306751932f04a72cd532c567616e4d10315) )
1082   sc_dndbl_others
1089   PR3068_BEAT_THE_BANKER_SOUNDS11
10831090ROM_END
10841091
10851092
r14896r14897
38523859   ROM_LOAD( "39211344.bin", 0x0000, 0x4d2ac4, CRC(2c20765f) SHA1(0856649f6ebef51e1159fdf6a146136a50cf5325) )
38533860   ROM_LOAD( "39212339.bin", 0x0000, 0xa91458, CRC(73ed1ef5) SHA1(a8132e47d4b5644a2da26d512fa68c9078fb2bc1) )
38543861   ROM_LOAD( "39212344.bin", 0x0000, 0x4d2ac4, CRC(01c3c686) SHA1(1c5bb9da7f7ffbf3d2086de3c2a22fa0240187b3) )
3862   ROM_LOAD( "39211337.bin", 0x0000, 0xa9136a, CRC(4e984598) SHA1(8e5af7faeb7fb650f7bd44e5e7b3c1162514d15f) )
38553863   ROM_REGION( 0x5000, "pics", 0 )
38563864   ROM_LOAD( "95890492.bin", 0x0000, 0x5000, CRC(5bddee9e) SHA1(7c2af91793f1f8c3c7f12535874c032129af7c8c) )
38573865   ROM_LOAD( "95890494.bin", 0x0000, 0x5000, CRC(84513cb2) SHA1(8d45cff91953263c4aa8e7cb4a437c27371bd8a1) )
r14896r14897
42424250
42434251
42444252
4245ROM_START( ad5u1337 )
4246   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
42474253
4248   ROM_REGION( 0x1000000, "adder5", ROMREGION_ERASEFF )
4249   ROM_LOAD( "39211337.bin", 0x0000, 0xa9136a, CRC(4e984598) SHA1(8e5af7faeb7fb650f7bd44e5e7b3c1162514d15f) )
4250   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 )
4251ROM_END
4252
4253
4254
4255
42564254/*************************************************************************************************************************************************************************/
42574255/*************************************************************************************************************************************************************************/
42584256/*************************************************************************************************************************************************************************/
r14896r14897
44574455   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
44584456   ROM_LOAD16_BYTE( "95412716.lo", 0x00001, 0x080000, CRC(9b1fe8a2) SHA1(9d813b3001d9577faa26a44cfffbc2496ac64af8) )
44594457   ROM_LOAD16_BYTE( "95412717.hi", 0x00000, 0x080000, CRC(84e6009f) SHA1(f0ce4ca874d30d3cf3d365f4fe569ab7f710294c) )
4460   sc_bar7_others
4458   PR1492_CAS_BAR_SEVENS_SOUNDS11
44614459ROM_END
44624460
44634461ROM_START( sc5bar7a )
44644462   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
44654463   ROM_LOAD16_BYTE( "95413716.lo", 0x00001, 0x080000, CRC(2bb811f4) SHA1(4b12168b4fc9a79d8495ac5e8948546c8ba0a942) )
44664464   ROM_LOAD16_BYTE( "95413717.hi", 0x00000, 0x080000, CRC(9bb208dd) SHA1(08e09486a622e17e5cc0c3f948770e9656fa9096) )
4467   sc_bar7_others
4465   PR1492_CAS_BAR_SEVENS_SOUNDS11
44684466ROM_END
44694467
44704468ROM_START( sc5bar7b )
r14896r14897
45884586   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
45894587   ROM_LOAD16_BYTE( "p3318p71.hi", 0x00000, 0x080000, CRC(eb94716e) SHA1(f9ed42da57519b68eb7d9be48115aaf8607d6c93) )
45904588   ROM_LOAD16_BYTE( "p3318p71.lo", 0x00001, 0x080000, CRC(c55f25a4) SHA1(2554e8d1c3547f0e93e1fc5f7e6b42c43c7654b3) )
4591   sc_bull_others
4589   PR3318_BULLSEYE_SOUNDS11
45924590ROM_END
45934591
45944592ROM_START( sc5bull5a )
45954593   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
45964594   ROM_LOAD16_BYTE( "p3318p72.hi", 0x00000, 0x080000, CRC(a8693b6b) SHA1(380fdf5dd8518995d915583e547e94562a4c0f7b) )
45974595   ROM_LOAD16_BYTE( "p3318p72.lo", 0x00001, 0x080000, CRC(657bba1e) SHA1(f8fa202c4057d3e37540d32c15965368bb73accd) )
4598   sc_bull_others
4596   PR3318_BULLSEYE_SOUNDS11
45994597ROM_END
46004598
46014599ROM_START( sc5bull5b )
46024600   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
46034601   ROM_LOAD16_BYTE( "p3318s71.hi", 0x00000, 0x080000, CRC(7481c408) SHA1(13b12c77c66973df75ee32d151ce5be072b0b02e) )
46044602   ROM_LOAD16_BYTE( "p3318s71.lo", 0x00001, 0x080000, CRC(32bf3031) SHA1(e1c1b2207c988d3d4c8bbba386518760dc6c5245) )
4605   sc_bull_others
4603   PR3318_BULLSEYE_SOUNDS11
46064604ROM_END
46074605
46084606ROM_START( sc5bull5c )
46094607   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
46104608   ROM_LOAD16_BYTE( "p3318s72.hi", 0x00000, 0x080000, CRC(20c23a5e) SHA1(c6aa64a99b04fdf87cb56d1f2a15f16f3d3d075b) )
46114609   ROM_LOAD16_BYTE( "p3318s72.lo", 0x00001, 0x080000, CRC(03203e08) SHA1(70566d3d011b0d09dad6edf0812c6c2a6f4a68a6) )
4612   sc_bull_others
4610   PR3318_BULLSEYE_SOUNDS11
46134611ROM_END
46144612
4615ROM_START( ad5bull )
4616   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
4617   ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 )
4618   ROM_LOAD( "95008520.bin", 0x0000, 0x100000, CRC(ab418ce0) SHA1(39afbd449a21a31016acaffcfb4f6d684db300e7) ) // PR1702 BULLSEYE
4619   ROM_LOAD( "95008521.bin", 0x0000, 0x100000, CRC(7fd0f70c) SHA1(e6bf85b9e2528dac5811277ee89599e58e6358b0) )
4620   ROM_LOAD( "95008544.bin", 0x0000, 0x100000, CRC(19777f20) SHA1(da0cc08b00f9ab565a0e559761adbf7bcd7c327b) ) // PR1743 CASINO BULLSEYE
4621   ROM_LOAD( "95008575.bin", 0x0000, 0x100000, CRC(715901d2) SHA1(a7d3d0c7b9fc3eefb0df372cdf0cae7abe8bd959) ) // PR1758 BULLSEYE TRIPLE
4622   ROM_LOAD( "95009116.bin", 0x0000, 0x100000, CRC(5a01e206) SHA1(38ee3706d9edb68d17c90bb627aa17b4f908d721) ) // PR3318 BULLSEYE
4623   ROM_LOAD( "95009117.bin", 0x0000, 0x100000, CRC(c3623829) SHA1(92b0cf89678023bb02394699e2e214389317ec6c) )
4613ROM_START( ad5bull ) // we only seem to have the sounds of the adder unit for this?
4614   ROM_REGION( 0x1000000, "maincpu", ROMREGION_ERASEFF )
4615   ROM_LOAD( "program.bin", 0x00000, 0x1000000, NO_DUMP )
4616   PR1758_BULLSEYE_TRIPLE_SOUNDS11
46244617ROM_END
46254618
46264619ROM_START( sc5butch )
r14896r14897
54365429   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
54375430   ROM_LOAD16_BYTE( "g95426714.lo", 0x00001, 0x080000, CRC(c2d3f6d6) SHA1(fb5532a9f23c7f9740d55eb411f543b75e3b8ae6) )
54385431   ROM_LOAD16_BYTE( "g95426715.hi", 0x00000, 0x080000, CRC(bd812886) SHA1(2452499bc7c6ca51e8f6ed53c182a756e90bf9a0) )
5439   sc_crnjw_others
5432   PR000055_CJEWELS
54405433ROM_END
54415434
54425435ROM_START( sc5cjqpsa )
54435436   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
54445437   ROM_LOAD16_BYTE( "g95426894.lo", 0x00001, 0x080000, CRC(cc1d8324) SHA1(aae871fb7400e661f60f174491f4f2192dd12ebd) )
54455438   ROM_LOAD16_BYTE( "g95426895.hi", 0x00000, 0x080000, CRC(40820ce7) SHA1(e65c939563acd9ebe2d342116f884418b5562279) )
5446   sc_crnjw_others
5439   PR000055_CJEWELS
54475440ROM_END
54485441
54495442ROM_START( sc5cjqpsb )
54505443   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
54515444   ROM_LOAD16_BYTE( "g95427714.lo", 0x00001, 0x080000, CRC(1866575e) SHA1(7f772562a7a2d961777c5df55e4a62931934522e) )
54525445   ROM_LOAD16_BYTE( "g95427715.hi", 0x00000, 0x080000, CRC(db62827f) SHA1(96086d1976e443d026fc9534d861f3117b2d901a) )
5453   sc_crnjw_others
5446   PR000055_CJEWELS
54545447ROM_END
54555448
54565449ROM_START( sc5cjqpsc )
54575450   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
54585451   ROM_LOAD16_BYTE( "g95427894.lo", 0x00001, 0x080000, CRC(f18d39dd) SHA1(9633a857faa91cde927978bc3d06c2b1840d65ec) )
54595452   ROM_LOAD16_BYTE( "g95427895.hi", 0x00000, 0x080000, CRC(961802c6) SHA1(ae8da626d508e4a7697ef1911c2183da97b0f0cc) )
5460   sc_crnjw_others
5453   PR000055_CJEWELS
54615454ROM_END
54625455
54635456
r14896r14897
54665459   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
54675460   ROM_LOAD16_BYTE( "95418428.lo", 0x00001, 0x080000, CRC(e3402379) SHA1(54eb1c75e174083fb6e913c231706fd192ca8b22) )
54685461   ROM_LOAD16_BYTE( "95418429.hi", 0x00000, 0x080000, CRC(a7c8a115) SHA1(987485c9db6b9e05b6fc60307535533a931db7f2) )
5469   sc_dnd_others
5462   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
54705463ROM_END
54715464
54725465ROM_START( sc5dndcs )
54735466   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
54745467   ROM_LOAD16_BYTE( "95418446.lo", 0x00001, 0x080000, CRC(bb3df08e) SHA1(d1ae172cff3776b008d1b08772e2589dcc06f75e) )
54755468   ROM_LOAD16_BYTE( "95418447.hi", 0x00000, 0x080000, CRC(03ade18d) SHA1(c74f431245c1854577232c1c10b3a9868e59d38f) )
5476   sc_dnd_others
5469   PR1954_CASINO_DOND_R_SOUNDS11
54775470ROM_END
54785471
54795472ROM_START( sc5dndcsa )
54805473   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
54815474   ROM_LOAD16_BYTE( "95418582.lo", 0x00001, 0x080000, CRC(e77addb2) SHA1(37655aba352008d468b0b155a8178addf1f1bb85) )
54825475   ROM_LOAD16_BYTE( "95418583.hi", 0x00000, 0x080000, CRC(01c82328) SHA1(367ae0f2b4b08d194c567ea48f4576f68c921dde) )
5483   sc_dnd_others
5476   PR1954_CASINO_DOND_R_SOUNDS11
54845477ROM_END
54855478
54865479ROM_START( sc5dndcsb )
54875480   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
54885481   ROM_LOAD16_BYTE( "95418610.lo", 0x00001, 0x080000, CRC(6b25fe94) SHA1(f926758df4fceb8422fb6165497d5353cb51355b) )
54895482   ROM_LOAD16_BYTE( "95418611.hi", 0x00000, 0x080000, CRC(b1dd987d) SHA1(46e8e8015da8cdee87c202fbdfaf5b5ab157fcef) )
5490   sc_dnd_others
5483   PR1954_CASINO_DOND_R_SOUNDS11
54915484ROM_END
54925485
5486
5487ROM_START( sc5dndcsc )
5488   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5489   ROM_LOAD16_BYTE( "95418740.lo", 0x00001, 0x080000, CRC(d1cc7151) SHA1(c350c2a61e6dc927fdde3f57dadf07ffb7a74172) )
5490   ROM_LOAD16_BYTE( "95418741.hi", 0x00000, 0x080000, CRC(369f411b) SHA1(e24e60c2707a99e664b049bb2bace837423871ab) )
5491   PR1954_CASINO_DOND_R_SOUNDS11
5492ROM_END
5493
5494ROM_START( sc5dndcsd )
5495   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5496   ROM_LOAD16_BYTE( "95419446.lo", 0x00001, 0x080000, CRC(7f5dc09c) SHA1(022d368063398c3ec206c5576fff54e20ffc73c3) )
5497   ROM_LOAD16_BYTE( "95419447.hi", 0x00000, 0x080000, CRC(dd8b1ee5) SHA1(8d59e3f762dd4338706017d1717d06a7a718fbd9) )
5498   PR1954_CASINO_DOND_R_SOUNDS11
5499ROM_END
5500
5501ROM_START( sc5dndcse )
5502   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5503   ROM_LOAD16_BYTE( "95419582.lo", 0x00001, 0x080000, CRC(43e7545f) SHA1(53356002ab07f5e9e1df13eef1f1b65c44a9b7b7) )
5504   ROM_LOAD16_BYTE( "95419583.hi", 0x00000, 0x080000, CRC(39bf2015) SHA1(1884f7f79c5e6cc6b78929d7f4e743dd02fceddc) )
5505   PR1954_CASINO_DOND_R_SOUNDS11
5506ROM_END
5507
5508ROM_START( sc5dndcsf )
5509   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5510   ROM_LOAD16_BYTE( "95419610.lo", 0x00001, 0x080000, CRC(cfb87779) SHA1(c8df9cce5f3bc58fad35702f653f1ea5613f3cac) )
5511   ROM_LOAD16_BYTE( "95419611.hi", 0x00000, 0x080000, CRC(89aa9b40) SHA1(1369d2c92b41ecbf930c67adc1ca1ff74896d85c) )
5512   PR1954_CASINO_DOND_R_SOUNDS11
5513ROM_END
5514
5515ROM_START( sc5dndcsg )
5516   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5517   ROM_LOAD16_BYTE( "95419740.lo", 0x00001, 0x080000, CRC(be5583a6) SHA1(62889d112060f7876fee9d88315a6f6082ac3a81) )
5518   ROM_LOAD16_BYTE( "95419741.hi", 0x00000, 0x080000, CRC(d051eb76) SHA1(7fb107cfdd628f2196e15b98b38eb90540883ddf) )
5519   PR1954_CASINO_DOND_R_SOUNDS11
5520ROM_END
5521
5522ROM_START( sc5dndcsh )
5523   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5524   ROM_LOAD16_BYTE( "95423940.lo", 0x00001, 0x080000, CRC(845e82af) SHA1(7ebbe59e8eafc3517806e72fd759a61da282e5fc) )
5525   ROM_LOAD16_BYTE( "95423941.hi", 0x00000, 0x080000, CRC(2aef2c9a) SHA1(8a940c6f6f3fe4ee6625012cf61bde7b78260ddd) )
5526   PR1954_CASINO_DOND_R_SOUNDS11
5527ROM_END
5528
5529ROM_START( sc5dndcsi )
5530   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5531   ROM_LOAD16_BYTE( "95426464.lo", 0x00001, 0x080000, CRC(6dbb8ceb) SHA1(f79bc7f047ab5fca012d1d92672d34309ec159dc) )
5532   ROM_LOAD16_BYTE( "95426465.hi", 0x00000, 0x080000, CRC(89e9b45c) SHA1(246e69129bc80ec0263be7cd6dd02f859f550606) )
5533   PR1954_CASINO_DOND_R_SOUNDS11
5534ROM_END
5535
5536ROM_START( sc5dndcsj )
5537   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5538   ROM_LOAD16_BYTE( "95427464.lo", 0x00001, 0x080000, CRC(ab9bc5f4) SHA1(c36f5b6acdce0432c0227832618cb0ab8fec3dd2) )
5539   ROM_LOAD16_BYTE( "95427465.hi", 0x00000, 0x080000, CRC(a744775e) SHA1(78591fa7a4c733a456d442903003e4dc3ab7ba8d) )
5540   PR1954_CASINO_DOND_R_SOUNDS11
5541ROM_END
5542
54935543ROM_START( sc5dndc3 )
54945544   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
54955545   ROM_LOAD16_BYTE( "95418624.lo", 0x00001, 0x080000, CRC(d92cc819) SHA1(dbb5879b5290d3c217b237bd4c59865cf57e154c) )
54965546   ROM_LOAD16_BYTE( "95418625.hi", 0x00000, 0x080000, CRC(52f037cf) SHA1(0a4b8b2937577b103cf1e4eb47234687aae643c3) )
5497   sc_dnd_others
5547   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
54985548ROM_END
54995549
55005550ROM_START( sc5dnda )
55015551   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
55025552   ROM_LOAD16_BYTE( "95418626.lo", 0x00001, 0x080000, CRC(8825bac7) SHA1(b732499056718e0002e69ad92fd1a0dc1ddecfee) )
55035553   ROM_LOAD16_BYTE( "95418627.hi", 0x00000, 0x080000, CRC(38dde058) SHA1(74c729a4f7597a38ed645a638d1f09ab13b1fa93) )
5504   sc_dnd_others
5554   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
55055555ROM_END
55065556
55075557ROM_START( sc5dndc3a )
55085558   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
55095559   ROM_LOAD16_BYTE( "95418708.lo", 0x00001, 0x080000, CRC(30a98bc2) SHA1(5caf982d2853ce39294445ab89474906e2e41981) )
55105560   ROM_LOAD16_BYTE( "95418709.hi", 0x00000, 0x080000, CRC(9c657c50) SHA1(e72296e193693c3a9ff33632fb0db9c64fe75a97) )
5511   sc_dnd_others
5561   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
55125562ROM_END
55135563
5514ROM_START( sc5dndcsc )
5515   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5516   ROM_LOAD16_BYTE( "95418740.lo", 0x00001, 0x080000, CRC(d1cc7151) SHA1(c350c2a61e6dc927fdde3f57dadf07ffb7a74172) )
5517   ROM_LOAD16_BYTE( "95418741.hi", 0x00000, 0x080000, CRC(369f411b) SHA1(e24e60c2707a99e664b049bb2bace837423871ab) )
5518   sc_dnd_others
5519ROM_END
55205564
55215565ROM_START( sc5dndb )
55225566   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
55235567   ROM_LOAD16_BYTE( "95419428.lo", 0x00001, 0x080000, CRC(72a46f10) SHA1(933a5990fbe1ede6f3527315d8ea111e2814fa83) )
55245568   ROM_LOAD16_BYTE( "95419429.hi", 0x00000, 0x080000, CRC(7aadaaed) SHA1(19c452644db9da1ed5741173473b23a95e2133f5) )
5525   sc_dnd_others
5569   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
55265570ROM_END
55275571
5528ROM_START( sc5dndcsd )
5529   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5530   ROM_LOAD16_BYTE( "95419446.lo", 0x00001, 0x080000, CRC(7f5dc09c) SHA1(022d368063398c3ec206c5576fff54e20ffc73c3) )
5531   ROM_LOAD16_BYTE( "95419447.hi", 0x00000, 0x080000, CRC(dd8b1ee5) SHA1(8d59e3f762dd4338706017d1717d06a7a718fbd9) )
5532   sc_dnd_others
5533ROM_END
55345572
5535ROM_START( sc5dndcse )
5536   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5537   ROM_LOAD16_BYTE( "95419582.lo", 0x00001, 0x080000, CRC(43e7545f) SHA1(53356002ab07f5e9e1df13eef1f1b65c44a9b7b7) )
5538   ROM_LOAD16_BYTE( "95419583.hi", 0x00000, 0x080000, CRC(39bf2015) SHA1(1884f7f79c5e6cc6b78929d7f4e743dd02fceddc) )
5539   sc_dnd_others
5540ROM_END
5541
5542ROM_START( sc5dndcsf )
5543   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5544   ROM_LOAD16_BYTE( "95419610.lo", 0x00001, 0x080000, CRC(cfb87779) SHA1(c8df9cce5f3bc58fad35702f653f1ea5613f3cac) )
5545   ROM_LOAD16_BYTE( "95419611.hi", 0x00000, 0x080000, CRC(89aa9b40) SHA1(1369d2c92b41ecbf930c67adc1ca1ff74896d85c) )
5546   sc_dnd_others
5547ROM_END
5548
55495573ROM_START( sc5dndc3b )
55505574   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
55515575   ROM_LOAD16_BYTE( "95419624.lo", 0x00001, 0x080000, CRC(ac6733b8) SHA1(7f67cdf1b3b8d3ac5d2424aadd9c81fe8340f613) )
55525576   ROM_LOAD16_BYTE( "95419625.hi", 0x00000, 0x080000, CRC(a3733571) SHA1(3bbf7087b8446120f2f3e8d664efef5196ce9b0d) )
5553   sc_dnd_others
5577   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
55545578ROM_END
55555579
55565580ROM_START( sc5dndc )
55575581   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
55585582   ROM_LOAD16_BYTE( "95419626.lo", 0x00001, 0x080000, CRC(17b5d2ad) SHA1(7068b73fb1ec4a56d7121be4e548674ad2bb7ef6) )
55595583   ROM_LOAD16_BYTE( "95419627.hi", 0x00000, 0x080000, CRC(39e34c28) SHA1(b75456e108c8acf363cd83f80be294b6bfecce90) )
5560   sc_dnd_others
5584   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
55615585ROM_END
55625586
55635587ROM_START( sc5dndc3c )
55645588   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
55655589   ROM_LOAD16_BYTE( "95419708.lo", 0x00001, 0x080000, CRC(2c553048) SHA1(6c550e359226386612163f0a018ce20c66af530a) )
55665590   ROM_LOAD16_BYTE( "95419709.hi", 0x00000, 0x080000, CRC(872d1f42) SHA1(bb249b3aadfb8448d144f36bbda7397ff7464057) )
5567   sc_dnd_others
5591   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
55685592ROM_END
55695593
5570ROM_START( sc5dndcsg )
5571   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5572   ROM_LOAD16_BYTE( "95419740.lo", 0x00001, 0x080000, CRC(be5583a6) SHA1(62889d112060f7876fee9d88315a6f6082ac3a81) )
5573   ROM_LOAD16_BYTE( "95419741.hi", 0x00000, 0x080000, CRC(d051eb76) SHA1(7fb107cfdd628f2196e15b98b38eb90540883ddf) )
5574   sc_dnd_others
5575ROM_END
55765594
55775595ROM_START( sc5dndd )
55785596   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
55795597   ROM_LOAD16_BYTE( "95422024.lo", 0x00001, 0x080000, CRC(b5481bbb) SHA1(43e6e81e0ddcf6f2bf6bf301348cf17f37ec7d6c) )
55805598   ROM_LOAD16_BYTE( "95422025.hi", 0x00000, 0x080000, CRC(8a28b1a4) SHA1(bc895c4e3061f95c3136437df30a5d88df794146) )
5581   sc_dnd_others
5599   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
55825600ROM_END
55835601
5584ROM_START( sc5dndc2 )
5585   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5586   ROM_LOAD16_BYTE( "95422440.lo", 0x00001, 0x080000, CRC(a4c27e23) SHA1(1de762b8e78da0249c36316f3af25c5c2ee1c68f) )
5587   ROM_LOAD16_BYTE( "95422441.hi", 0x00000, 0x080000, CRC(7a8e9785) SHA1(4510a86664d6c50c1b62d63c679fde203bfb31ef) )
5588   sc_dnd_others
5589ROM_END
55905602
5591ROM_START( sc5dndc2e )
5592   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5593   ROM_LOAD16_BYTE( "95422442.lo", 0x00001, 0x080000, CRC(77d044a9) SHA1(e13af74b1aa5a35e0a041607ea4fd9a3e472c173) )
5594   ROM_LOAD16_BYTE( "95422443.hi", 0x00000, 0x080000, CRC(1b40f9e2) SHA1(1bdeeb429e4669964d805d3cb0f22038427dd567) )
5595   sc_dnd_others
5596ROM_END
5597
5598ROM_START( sc5dndc2f )
5599   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5600   ROM_LOAD16_BYTE( "95422450.lo", 0x00001, 0x080000, CRC(d300fe2c) SHA1(f2a5770d5c51a316fdbe31fa588eaccf94cb6639) )
5601   ROM_LOAD16_BYTE( "95422451.hi", 0x00000, 0x080000, CRC(af1e0a64) SHA1(e494bb57cb26100ce31b9ef2b9ab1963d434973d) )
5602   sc_dnd_others
5603ROM_END
5604
56055603ROM_START( sc5dnde )
56065604   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56075605   ROM_LOAD16_BYTE( "95422564.lo", 0x00001, 0x080000, CRC(1f63b69b) SHA1(733cb1959e4f63b7a45ba39e93375d49271cc2ba) )
56085606   ROM_LOAD16_BYTE( "95422565.hi", 0x00000, 0x080000, CRC(dbf27ae1) SHA1(4bd2be6f2fccf050bbbd2ea4d0a5b4246ca9da2c) )
5609   sc_dnd_others
5607   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56105608ROM_END
56115609
56125610ROM_START( sc5dndf )
56135611   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56145612   ROM_LOAD16_BYTE( "95422568.lo", 0x00001, 0x080000, CRC(2999d09e) SHA1(806275be7850b48332fdb85f4d78e616a16c12ab) )
56155613   ROM_LOAD16_BYTE( "95422569.hi", 0x00000, 0x080000, CRC(273c2338) SHA1(b44e176fa97b40975825cdb6b3f8dfa753535162) )
5616   sc_dnd_others
5614   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56175615ROM_END
56185616
56195617ROM_START( sc5dndg )
56205618   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56215619   ROM_LOAD16_BYTE( "95422832.lo", 0x00001, 0x080000, CRC(44fbc398) SHA1(dc84091f82a718401c967c25ffe756ae1186a38d) )
56225620   ROM_LOAD16_BYTE( "95422833.hi", 0x00000, 0x080000, CRC(80729e3f) SHA1(6d5fd934548c6254ed2ec9c9c77ffcce1eca039b) )
5623   sc_dnd_others
5621   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56245622ROM_END
56255623
56265624ROM_START( sc5dndh )
56275625   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56285626   ROM_LOAD16_BYTE( "95422862.lo", 0x00001, 0x080000, CRC(41f7ba62) SHA1(a7ad0dfdc477194e09df97331b75309c7aa976ea) )
56295627   ROM_LOAD16_BYTE( "95422863.hi", 0x00000, 0x080000, CRC(a7883de1) SHA1(812b17621f3ac4b0252b44ec32b81145b4212637) )
5630   sc_dnd_others
5628   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56315629ROM_END
56325630
56335631ROM_START( sc5dndi )
56345632   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56355633   ROM_LOAD16_BYTE( "95422886.lo", 0x00001, 0x080000, CRC(1b926605) SHA1(f97b91c73dd330f1848a879faf949085c23d53b6) )
56365634   ROM_LOAD16_BYTE( "95422887.hi", 0x00000, 0x080000, CRC(5f37e87a) SHA1(f1b86a3fb968be14787fb508d1fccb464cec2c4d) )
5637   sc_dnd_others
5635   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56385636ROM_END
56395637
56405638ROM_START( sc5dndj )
56415639   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56425640   ROM_LOAD16_BYTE( "95423024.lo", 0x00001, 0x080000, CRC(a825a790) SHA1(5bb676900881c93ef885e72c07a29b001a911a09) )
56435641   ROM_LOAD16_BYTE( "95423025.hi", 0x00000, 0x080000, CRC(a98a0ead) SHA1(e1624b73b4f058edcdc3aa49f6ea55afd642938c) )
5644   sc_dnd_others
5642   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56455643ROM_END
56465644
5647ROM_START( sc5dndc2a )
5648   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5649   ROM_LOAD16_BYTE( "95423440.lo", 0x00001, 0x080000, CRC(214d9f3a) SHA1(bf693dd08db022b51123dc0fdb07d16315444be0) )
5650   ROM_LOAD16_BYTE( "95423441.hi", 0x00000, 0x080000, CRC(4558b059) SHA1(cd37a546499b7314614edffb3e9f311cbcf8b510) )
5651   sc_dnd_others
5652ROM_END
56535645
5654ROM_START( sc5dndc2g )
5655   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5656   ROM_LOAD16_BYTE( "95423442.lo", 0x00001, 0x080000, CRC(a3b28d50) SHA1(42646bc8b3f8d36e9450f74fa7f77a67e60f82cc) )
5657   ROM_LOAD16_BYTE( "95423443.hi", 0x00000, 0x080000, CRC(0fb14bef) SHA1(3c80f62f86e0e248e8cc9cefc94e4d12c9cf63ca) )
5658   sc_dnd_others
5659ROM_END
56605646
5661ROM_START( sc5dndc2h )
5662   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5663   ROM_LOAD16_BYTE( "95423450.lo", 0x00001, 0x080000, CRC(6c884748) SHA1(72b458ef784c380d06074c3c5ae3dcbadd896307) )
5664   ROM_LOAD16_BYTE( "95423451.hi", 0x00000, 0x080000, CRC(f25bf41d) SHA1(47324b8c747405d68b193ca376929b3e49225037) )
5665   sc_dnd_others
5666ROM_END
5667
56685647ROM_START( sc5dndk )
56695648   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56705649   ROM_LOAD16_BYTE( "95423564.lo", 0x00001, 0x080000, CRC(13a2bc2d) SHA1(646dd4abff1c2a7f08aabcde1aa7850505f0893f) )
56715650   ROM_LOAD16_BYTE( "95423565.hi", 0x00000, 0x080000, CRC(aa269dbc) SHA1(7b91147ebbc48d1ff6a79d16b381989db829add8) )
5672   sc_dnd_others
5651   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56735652ROM_END
56745653
56755654ROM_START( sc5dndl )
56765655   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56775656   ROM_LOAD16_BYTE( "95423832.lo", 0x00001, 0x080000, CRC(62329f06) SHA1(7d531a7afaa0e7a04969afb4f1ef765f8552af3d) )
56785657   ROM_LOAD16_BYTE( "95423833.hi", 0x00000, 0x080000, CRC(ae915afa) SHA1(20938b42fa53c04ea4ac0eb563615bd1ce6f0725) )
5679   sc_dnd_others
5658   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56805659ROM_END
56815660
56825661ROM_START( sc5dndm )
56835662   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56845663   ROM_LOAD16_BYTE( "95423862.lo", 0x00001, 0x080000, CRC(758f1697) SHA1(ca40ee7d8f9d32745e1fb26f1d08fc3d7f9857f4) )
56855664   ROM_LOAD16_BYTE( "95423863.hi", 0x00000, 0x080000, CRC(9ce6e813) SHA1(55ab2bba5b2bb356807e9b0182d5260b1b6efa10) )
5686   sc_dnd_others
5665   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56875666ROM_END
56885667
56895668ROM_START( sc5dndn )
56905669   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
56915670   ROM_LOAD16_BYTE( "95423886.lo", 0x00001, 0x080000, CRC(6e0b8c7e) SHA1(cac697895f0a8a7d3a31389b7719a54eb300f465) )
56925671   ROM_LOAD16_BYTE( "95423887.hi", 0x00000, 0x080000, CRC(8b04bb99) SHA1(fea2cd96a2cc0f7bf5439020a2fbc35ee26cc558) )
5693   sc_dnd_others
5672   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
56945673ROM_END
56955674
5696ROM_START( sc5dndcsh )
5697   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5698   ROM_LOAD16_BYTE( "95423940.lo", 0x00001, 0x080000, CRC(845e82af) SHA1(7ebbe59e8eafc3517806e72fd759a61da282e5fc) )
5699   ROM_LOAD16_BYTE( "95423941.hi", 0x00000, 0x080000, CRC(2aef2c9a) SHA1(8a940c6f6f3fe4ee6625012cf61bde7b78260ddd) )
5700   sc_dnd_others
5701ROM_END
57025675
57035676ROM_START( sc5dndo )
57045677   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57055678   ROM_LOAD16_BYTE( "95426152.lo", 0x00001, 0x080000, CRC(b304710b) SHA1(443568b0acc8381992a1a8bfe77c9bed714fb05c) )
57065679   ROM_LOAD16_BYTE( "95426153.hi", 0x00000, 0x080000, CRC(f02a1df7) SHA1(9fc0fc6ecc5287012cf9ad2e01c4781f91b9541c) )
5707   sc_dnd_others
5680   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
57085681ROM_END
57095682
57105683ROM_START( sc5dndp )
57115684   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57125685   ROM_LOAD16_BYTE( "95426168.lo", 0x00001, 0x080000, CRC(be51f52d) SHA1(e61b385c52ea1f2dca2c615518f9a419075d1a4e) )
57135686   ROM_LOAD16_BYTE( "95426169.hi", 0x00000, 0x080000, CRC(c4c30953) SHA1(33645e956be7c5367dfab4704a7c8fbdd79f4126) )
5714   sc_dnd_others
5687   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
57155688ROM_END
57165689
5717ROM_START( sc5dndcsi )
5718   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5719   ROM_LOAD16_BYTE( "95426464.lo", 0x00001, 0x080000, CRC(6dbb8ceb) SHA1(f79bc7f047ab5fca012d1d92672d34309ec159dc) )
5720   ROM_LOAD16_BYTE( "95426465.hi", 0x00000, 0x080000, CRC(89e9b45c) SHA1(246e69129bc80ec0263be7cd6dd02f859f550606) )
5721   sc_dnd_others
5722ROM_END
5723
57245690ROM_START( sc5dndq )
57255691   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57265692   ROM_LOAD16_BYTE( "95427152.lo", 0x00001, 0x080000, CRC(58da107f) SHA1(297916acc353ac2c70218b84a5ed870513d649f1) )
57275693   ROM_LOAD16_BYTE( "95427153.hi", 0x00000, 0x080000, CRC(6f0b8161) SHA1(41f2454b05fb226720a813626b387b8f29a7e203) )
5728   sc_dnd_others
5694   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
57295695ROM_END
57305696
57315697ROM_START( sc5dndr )
57325698   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57335699   ROM_LOAD16_BYTE( "95427168.lo", 0x00001, 0x080000, CRC(3f2659e2) SHA1(37db9a4c54fb790a5d4bc7b335c4b92e1d88261e) )
57345700   ROM_LOAD16_BYTE( "95427169.hi", 0x00000, 0x080000, CRC(af31b846) SHA1(ac168ce36c09f1770520a2a9d3f4ace88f97c463) )
5735   sc_dnd_others
5701   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
57365702ROM_END
57375703
57385704ROM_START( sc5dnds )
57395705   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57405706   ROM_LOAD16_BYTE( "95422028.lo", 0x00001, 0x080000, CRC(55ecfc66) SHA1(ba6b8befe37318ecec9cce1ea3029afa701f1cff) )
57415707   ROM_LOAD16_BYTE( "95422029.hi", 0x00000, 0x080000, CRC(d53e86be) SHA1(72f1b6b21f284b27bd63fcea90826a88c6b16bef) )
5742   sc_dnd_others
5708   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
57435709ROM_END
57445710
57455711ROM_START( sc5dndt )
57465712   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57475713   ROM_LOAD16_BYTE( "95423028.lo", 0x00001, 0x080000, CRC(6a81fb48) SHA1(9e75c7601efd70aa91f9306b0ffd8d0a515912f6) )
57485714   ROM_LOAD16_BYTE( "95423029.hi", 0x00000, 0x080000, CRC(29828640) SHA1(a90ae840318f4ea3d662645735a352d0e7382b6b) )
5749   sc_dnd_others
5715   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
57505716ROM_END
57515717
5752ROM_START( sc5dndcsj )
5718
5719ROM_START( sc5dndc2 )
57535720   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5754   ROM_LOAD16_BYTE( "95427464.lo", 0x00001, 0x080000, CRC(ab9bc5f4) SHA1(c36f5b6acdce0432c0227832618cb0ab8fec3dd2) )
5755   ROM_LOAD16_BYTE( "95427465.hi", 0x00000, 0x080000, CRC(a744775e) SHA1(78591fa7a4c733a456d442903003e4dc3ab7ba8d) )
5756   sc_dnd_others
5721   ROM_LOAD16_BYTE( "95422440.lo", 0x00001, 0x080000, CRC(a4c27e23) SHA1(1de762b8e78da0249c36316f3af25c5c2ee1c68f) )
5722   ROM_LOAD16_BYTE( "95422441.hi", 0x00000, 0x080000, CRC(7a8e9785) SHA1(4510a86664d6c50c1b62d63c679fde203bfb31ef) )
5723   PR1964_DND
57575724ROM_END
57585725
5726ROM_START( sc5dndc2e )
5727   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5728   ROM_LOAD16_BYTE( "95422442.lo", 0x00001, 0x080000, CRC(77d044a9) SHA1(e13af74b1aa5a35e0a041607ea4fd9a3e472c173) )
5729   ROM_LOAD16_BYTE( "95422443.hi", 0x00000, 0x080000, CRC(1b40f9e2) SHA1(1bdeeb429e4669964d805d3cb0f22038427dd567) )
5730   PR1964_DND
5731ROM_END
5732
5733ROM_START( sc5dndc2f )
5734   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5735   ROM_LOAD16_BYTE( "95422450.lo", 0x00001, 0x080000, CRC(d300fe2c) SHA1(f2a5770d5c51a316fdbe31fa588eaccf94cb6639) )
5736   ROM_LOAD16_BYTE( "95422451.hi", 0x00000, 0x080000, CRC(af1e0a64) SHA1(e494bb57cb26100ce31b9ef2b9ab1963d434973d) )
5737   PR1964_DND
5738ROM_END
5739
5740ROM_START( sc5dndc2a )
5741   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5742   ROM_LOAD16_BYTE( "95423440.lo", 0x00001, 0x080000, CRC(214d9f3a) SHA1(bf693dd08db022b51123dc0fdb07d16315444be0) )
5743   ROM_LOAD16_BYTE( "95423441.hi", 0x00000, 0x080000, CRC(4558b059) SHA1(cd37a546499b7314614edffb3e9f311cbcf8b510) )
5744   PR1964_DND
5745ROM_END
5746
5747ROM_START( sc5dndc2g )
5748   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5749   ROM_LOAD16_BYTE( "95423442.lo", 0x00001, 0x080000, CRC(a3b28d50) SHA1(42646bc8b3f8d36e9450f74fa7f77a67e60f82cc) )
5750   ROM_LOAD16_BYTE( "95423443.hi", 0x00000, 0x080000, CRC(0fb14bef) SHA1(3c80f62f86e0e248e8cc9cefc94e4d12c9cf63ca) )
5751   PR1964_DND
5752ROM_END
5753
5754ROM_START( sc5dndc2h )
5755   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
5756   ROM_LOAD16_BYTE( "95423450.lo", 0x00001, 0x080000, CRC(6c884748) SHA1(72b458ef784c380d06074c3c5ae3dcbadd896307) )
5757   ROM_LOAD16_BYTE( "95423451.hi", 0x00000, 0x080000, CRC(f25bf41d) SHA1(47324b8c747405d68b193ca376929b3e49225037) )
5758   PR1964_DND
5759ROM_END
5760
57595761ROM_START( sc5dndc2i )
57605762   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57615763   ROM_LOAD16_BYTE( "p1964p01.hi", 0x00000, 0x080000, CRC(b99ee66e) SHA1(3f0a046661070b29604e85e29c233b31e5de1c83) )
57625764   ROM_LOAD16_BYTE( "p1964p01.lo", 0x00001, 0x080000, CRC(50480af0) SHA1(fbd5dd20e7e23700d4e039a1a9b17e8d83b86421) )
5763   sc_dnd_others
5765   PR1964_DND
57645766ROM_END
57655767
57665768ROM_START( sc5dndc2q )
57675769   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57685770   ROM_LOAD16_BYTE( "p1964p12.hi", 0x00000, 0x080000, CRC(44c95076) SHA1(aa0bd2dff04e5d1c8973612fb57c88095eb2b40e) )
57695771   ROM_LOAD16_BYTE( "p1964p12.lo", 0x00001, 0x080000, CRC(fcf337ed) SHA1(fc4bf9d1564e54f23f4d9c216c1ec2587c846c47) )
5770   sc_dnd_others
5772   PR1964_DND
57715773ROM_END
57725774
57735775ROM_START( sc5dndc2r )
57745776   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57755777   ROM_LOAD16_BYTE( "p1964p13.hi", 0x00000, 0x080000, CRC(84e732e0) SHA1(80bb7f1046791f94f895fa14b4c5fc7b768e81db) )
57765778   ROM_LOAD16_BYTE( "p1964p13.lo", 0x00001, 0x080000, CRC(6028bc0d) SHA1(f060e2bd4ad362a6e99ccc44b965fc1d5389e137) )
5777   sc_dnd_others
5779   PR1964_DND
57785780ROM_END
57795781
57805782ROM_START( sc5dndc2b )
57815783   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57825784   ROM_LOAD16_BYTE( "p1964p14.hi", 0x00000, 0x080000, CRC(7af2660b) SHA1(692532287053cc899bcf94bebb5526fda5e094b4) )
57835785   ROM_LOAD16_BYTE( "p1964p14.lo", 0x00001, 0x080000, CRC(f2786267) SHA1(a7fcfe231284c142a8bdb6a4361b5bcff9cf168b) )
5784   sc_dnd_others
5786   PR1964_DND
57855787ROM_END
57865788
57875789ROM_START( sc5dndc2u )
57885790   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57895791   ROM_LOAD16_BYTE( "p1964p21.hi", 0x00000, 0x080000, CRC(a32b78aa) SHA1(1acd470d7023dfce9a88f74cf28cce939dac4d5b) )
57905792   ROM_LOAD16_BYTE( "p1964p21.lo", 0x00001, 0x080000, CRC(e8dc4915) SHA1(d1ba8c081cf2ea3fd95e7a8d296239e18fde9908) )
5791   sc_dnd_others
5793   PR1964_DND
57925794ROM_END
57935795
57945796ROM_START( sc5dndc2c )
57955797   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
57965798   ROM_LOAD16_BYTE( "p1964pa2.hi", 0x00000, 0x080000, CRC(039d2202) SHA1(74dff4553a67cde468655b849f67c08f9bbeba00) )
57975799   ROM_LOAD16_BYTE( "p1964pa2.lo", 0x00001, 0x080000, CRC(d59725a5) SHA1(50babe37853e776c88e2be9b44a4422e3391f2dc) )
5798   sc_dnd_others
5800   PR1964_DND
57995801ROM_END
58005802
58015803ROM_START( sc5dndc2n )
58025804   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58035805   ROM_LOAD16_BYTE( "p1964pa3.hi", 0x00000, 0x080000, CRC(a1dab479) SHA1(2be3549906ac681842a5269e6014e78cc95715e4) )
58045806   ROM_LOAD16_BYTE( "p1964pa3.lo", 0x00001, 0x080000, CRC(24cb5334) SHA1(e0c1d3ad6ca14a9ab66531dabf70f2cc4c7d2166) )
5805   sc_dnd_others
5807   PR1964_DND
58065808ROM_END
58075809
58085810ROM_START( sc5dndc2j )
58095811   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58105812   ROM_LOAD16_BYTE( "p1964pa5.hi", 0x00000, 0x080000, CRC(d3a4858d) SHA1(bb818752ae761c7ff379df4903eb2771b05d059f) )
58115813   ROM_LOAD16_BYTE( "p1964pa5.lo", 0x00001, 0x080000, CRC(dc8a4f2b) SHA1(18883c15fb9ed19a3ee7b436fa8327be942fdd29) )
5812   sc_dnd_others
5814   PR1964_DND
58135815ROM_END
58145816
58155817ROM_START( sc5dndc2p )
58165818   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58175819   ROM_LOAD16_BYTE( "p1964pb1.hi", 0x00000, 0x080000, CRC(658e3793) SHA1(4b142c79031d053a614c62c964e02645bb6d28dd) )
58185820   ROM_LOAD16_BYTE( "p1964pb1.lo", 0x00001, 0x080000, CRC(04eface9) SHA1(7a3f93c63d6cfa5b7814d76fd875f704ec617df4) )
5819   sc_dnd_others
5821   PR1964_DND
58205822ROM_END
58215823
58225824ROM_START( sc5dndc2k )
58235825   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58245826   ROM_LOAD16_BYTE( "p1964s01.hi", 0x00000, 0x080000, CRC(d0fcdf89) SHA1(00ff2b7131ec0f3d87f58aa843f9a1aad2c33f61) )
58255827   ROM_LOAD16_BYTE( "p1964s01.lo", 0x00001, 0x080000, CRC(549c0843) SHA1(f706cbc7be60a1261304398d876ef10ad695ad5d) )
5826   sc_dnd_others
5828   PR1964_DND
58275829ROM_END
58285830
58295831ROM_START( sc5dndc2s )
58305832   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58315833   ROM_LOAD16_BYTE( "p1964s12.hi", 0x00000, 0x080000, CRC(f4d29330) SHA1(b86e601fb176ed963d6ef68e76f4d306b595e911) )
58325834   ROM_LOAD16_BYTE( "p1964s12.lo", 0x00001, 0x080000, CRC(6efc8f49) SHA1(b13bd8f7f740f27a79c583d51c398c481081ea81) )
5833   sc_dnd_others
5835   PR1964_DND
58345836ROM_END
58355837
58365838ROM_START( sc5dndc2t )
58375839   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58385840   ROM_LOAD16_BYTE( "p1964s13.hi", 0x00000, 0x080000, CRC(45935f32) SHA1(25d5411d8d247075ee3421f65e2d2a6c51451848) )
58395841   ROM_LOAD16_BYTE( "p1964s13.lo", 0x00001, 0x080000, CRC(1ae19e19) SHA1(05e0ee034e7185b51f0e1b6ef77ae8670b020cbf) )
5840   sc_dnd_others
5842   PR1964_DND
58415843ROM_END
58425844
58435845ROM_START( sc5dndc2w )
58445846   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58455847   ROM_LOAD16_BYTE( "p1964s14.hi", 0x00000, 0x080000, CRC(14319187) SHA1(9f678b14287c96dc586259d1a6ecda91cc62e434) )
58465848   ROM_LOAD16_BYTE( "p1964s14.lo", 0x00001, 0x080000, CRC(24e13c44) SHA1(53e0c49e510245615bb6cd5acf6bf5b8cc8de173) )
5847   sc_dnd_others
5849   PR1964_DND
58485850ROM_END
58495851
58505852ROM_START( sc5dndc2v )
58515853   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58525854   ROM_LOAD16_BYTE( "p1964s21.hi", 0x00000, 0x080000, CRC(0a12b6c4) SHA1(4a5ff6647d3e63aaf917d9d21dabe270dab179d1) )
58535855   ROM_LOAD16_BYTE( "p1964s21.lo", 0x00001, 0x080000, CRC(e77a2694) SHA1(1cdcf91b5a7d6ec252af19930c9533798e1679a6) )
5854   sc_dnd_others
5856   PR1964_DND
58555857ROM_END
58565858
58575859ROM_START( sc5dndc2d )
58585860   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58595861   ROM_LOAD16_BYTE( "p1964sa2.hi", 0x00000, 0x080000, CRC(361beeff) SHA1(cbd6aa20247df7b9e540b38b7e9199e557f62be7) )
58605862   ROM_LOAD16_BYTE( "p1964sa2.lo", 0x00001, 0x080000, CRC(491d0137) SHA1(e5ad054adc7bbbb89bf7112d564f51b3c1924afa) )
5861   sc_dnd_others
5863   PR1964_DND
58625864ROM_END
58635865
58645866ROM_START( sc5dndc2m )
58655867   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58665868   ROM_LOAD16_BYTE( "p1964sa3.hi", 0x00000, 0x080000, CRC(fcf198da) SHA1(60280812fd7148edfe52eb07f2c81b77384641a9) )
58675869   ROM_LOAD16_BYTE( "p1964sa3.lo", 0x00001, 0x080000, CRC(be729a5a) SHA1(34d29c9d041b97a008112f6c18a194767f1839ca) )
5868   sc_dnd_others
5870   PR1964_DND
58695871ROM_END
58705872
58715873ROM_START( sc5dndc2l )
58725874   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58735875   ROM_LOAD16_BYTE( "p1964sa5.hi", 0x00000, 0x080000, CRC(6e97cb56) SHA1(a6335601c8163430be430cff6d075562cc49200b) )
58745876   ROM_LOAD16_BYTE( "p1964sa5.lo", 0x00001, 0x080000, CRC(80d9d806) SHA1(ae089e2618e80dac8afbb5b97b9c75512974488a) )
5875   sc_dnd_others
5877   PR1964_DND
58765878ROM_END
58775879
58785880ROM_START( sc5dndc2o )
58795881   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
58805882   ROM_LOAD16_BYTE( "p1964sb1.hi", 0x00000, 0x080000, CRC(03c6811c) SHA1(32ea6379932589076dec0bbdf5c9255c374ec334) )
58815883   ROM_LOAD16_BYTE( "p1964sb1.lo", 0x00001, 0x080000, CRC(7254d4b6) SHA1(7f4ef8e05fddc1d03c3073ae7b3cb5894200a039) )
5882   sc_dnd_others
5884   PR1964_DND
58835885ROM_END
58845886
58855887
r14896r14897
59105912
59115913   ROM_LOAD( "39211171.bin", 0x0000, 0x1000000, CRC(a80f967a) SHA1(bc8dc5c2d30ec38a9119d577114f5e5813f38749) ) // PR3078 DOND
59125914   ROM_LOAD( "39212171.bin", 0x0000, 0x1000000, CRC(666fe2b4) SHA1(8baf5f8682f3937b4b49f8db93f3a21e8764c990) )
5915
5916   ROM_REGION( 0x1000000, "ymz", ROMREGION_ERASE00 )
5917   PR1945_CASINO_D_O_N_D_SOUNDS11
5918   PR1945_CASINO_DOND_R_SOUNDS12
59135919ROM_END
59145920
59155921ROM_START( sc5dndbb )
r14896r14897
59745980   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
59755981   ROM_LOAD16_BYTE( "95418892.lo", 0x00001, 0x080000, CRC(2368bbb6) SHA1(61a13578ac2516c9821ba875691c1f8009785b03) )
59765982   ROM_LOAD16_BYTE( "95418893.hi", 0x00000, 0x080000, CRC(1c2d5159) SHA1(3bafb9c60a9f4237f89519fa07158f53000c08a8) )
5977   sc_dndcl_others
5983   PR3068_BEAT_THE_BANKER_SOUNDS11
59785984ROM_END
59795985
59805986ROM_START( sc5dndcla )
59815987   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
59825988   ROM_LOAD16_BYTE( "95419892.lo", 0x00001, 0x080000, CRC(6fb61650) SHA1(2a89170ddca11fb86edb5072ed4841260c7b1501) )
59835989   ROM_LOAD16_BYTE( "95419893.hi", 0x00000, 0x080000, CRC(ec0fa9af) SHA1(880aebf71e327ea4275c4ddc0756143e807ee98a) )
5984   sc_dndcl_others
5990   PR3068_BEAT_THE_BANKER_SOUNDS11
59855991ROM_END
59865992
59875993ROM_START( ad5dndcl )
r14896r14897
75637569ROM_END
75647570
75657571
7572ROM_START( sc5dndcb )
7573   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
7574   ROM_LOAD16_BYTE( "95418992.lo", 0x00001, 0x080000, CRC(2bddf06e) SHA1(59e2c78e8da681fa842605b4834eb2e1440f9ad7) )
7575   ROM_LOAD16_BYTE( "95418993.hi", 0x00000, 0x080000, CRC(27a65baf) SHA1(506b20c825698210ea07096c6b0892fd0ce7ee42) )
7576   PR3068_BEAT_THE_BANKER_SOUNDS11
7577ROM_END
75667578
7579ROM_START( sc5dndcba )
7580   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
7581   ROM_LOAD16_BYTE( "95419992.lo", 0x00001, 0x080000, CRC(79d9ebe5) SHA1(cc0e75af683a742407de65d2854644a9be9937df) )
7582   ROM_LOAD16_BYTE( "95419993.hi", 0x00000, 0x080000, CRC(e546a0e7) SHA1(070677430430c35ab5ca616f7688e700b72e9e5f) )
7583   PR3068_BEAT_THE_BANKER_SOUNDS11
7584ROM_END
75677585
7586
75687587ROM_START( sc5dndww )
75697588   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
75707589   ROM_LOAD16_BYTE( "95418860.lo", 0x00001, 0x080000, CRC(955480f9) SHA1(a35484c215cc966bfd3309054ef9e00c470e6644) )
r14896r14897
75797598   sc_dndww_others
75807599ROM_END
75817600
7582ROM_START( sc5dndcb )
7583   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
7584   ROM_LOAD16_BYTE( "95418992.lo", 0x00001, 0x080000, CRC(2bddf06e) SHA1(59e2c78e8da681fa842605b4834eb2e1440f9ad7) )
7585   ROM_LOAD16_BYTE( "95418993.hi", 0x00000, 0x080000, CRC(27a65baf) SHA1(506b20c825698210ea07096c6b0892fd0ce7ee42) )
7586   sc_dndww_others
7587ROM_END
75887601
7602
7603
75897604ROM_START( sc5dndwwb )
75907605   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
75917606   ROM_LOAD16_BYTE( "95419860.lo", 0x00001, 0x080000, CRC(68f7a054) SHA1(eaaab4e7d5dac40e50f098df2edf1109ac5f6d1c) )
r14896r14897
76007615   sc_dndww_others
76017616ROM_END
76027617
7603ROM_START( sc5dndcba )
7604   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
7605   ROM_LOAD16_BYTE( "95419992.lo", 0x00001, 0x080000, CRC(79d9ebe5) SHA1(cc0e75af683a742407de65d2854644a9be9937df) )
7606   ROM_LOAD16_BYTE( "95419993.hi", 0x00000, 0x080000, CRC(e546a0e7) SHA1(070677430430c35ab5ca616f7688e700b72e9e5f) )
7607   sc_dndww_others
7608ROM_END
76097618
76107619ROM_START( sc5dndwwd )
76117620   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
r14896r14897
1394313952GAME( 200?, ad5tornc   ,0,         sc5, sc5, sc5, ROT0, "BFM","Tornado Club (Bellfruit) (Scorpion 5, Adder 5)", GAME_IS_SKELETON_MECHANICAL )
1394413953GAME( 200?, ad5vpa      ,0,         sc5, sc5, sc5, ROT0, "BFM","Video Poker Ace (Bellfruit) (Scorpion 5, Adder 5)", GAME_IS_SKELETON_MECHANICAL )
1394513954GAME( 200?, ad5vlv      ,0,         sc5, sc5, sc5, ROT0, "BFM","Viva Las Vegas (Bellfruit) (Scorpion 5, Adder 5)", GAME_IS_SKELETON_MECHANICAL )
13946GAME( 200?, ad5u1337   ,0,         sc5, sc5, sc5, ROT0, "Mazooma","unknown Scorpion '39211337' (Mazooma) (Scorpion 5, Adder 5)", GAME_IS_SKELETON_MECHANICAL )
1394713955
1394813956GAME( 200?, ad5crcpt   ,0,         sc5, sc5, sc5, ROT0, "BFM","Cops 'n' Robbers Community Party (Bellfruit) (Adder 5)", GAME_IS_SKELETON_MECHANICAL )
1394913957GAME( 200?, ad5bull      ,0,         sc5, sc5, sc5, ROT0, "BFM","Bullseye (Bellfruit) (Adder 5)", GAME_IS_SKELETON_MECHANICAL )
src/mame/drivers/model2.c
r14896r14897
258258}
259259
260260/* Timers - these count down at 25 MHz and pull IRQ2 when they hit 0 */
261static READ32_HANDLER( timers_r )
261READ32_MEMBER(model2_state::timers_r)
262262{
263   model2_state *state = space->machine().driver_data<model2_state>();
264   i960_noburst(&space->device());
263   i960_noburst(&space.device());
265264
266265   // if timer is running, calculate current value
267   if (state->m_timerrun[offset])
266   if (m_timerrun[offset])
268267   {
269268      // get elapsed time, convert to units of 25 MHz
270      UINT32 cur = (state->m_timers[offset]->time_elapsed() * 25000000).as_double();
269      UINT32 cur = (m_timers[offset]->time_elapsed() * 25000000).as_double();
271270
272271      // subtract units from starting value
273      state->m_timervals[offset] = state->m_timerorig[offset] - cur;
272      m_timervals[offset] = m_timerorig[offset] - cur;
274273   }
275274
276   return state->m_timervals[offset];
275   return m_timervals[offset];
277276}
278277
279static WRITE32_HANDLER( timers_w )
278WRITE32_MEMBER(model2_state::timers_w)
280279{
281   model2_state *state = space->machine().driver_data<model2_state>();
282280   attotime period;
283281
284   i960_noburst(&space->device());
285   COMBINE_DATA(&state->m_timervals[offset]);
282   i960_noburst(&space.device());
283   COMBINE_DATA(&m_timervals[offset]);
286284
287   state->m_timerorig[offset] = state->m_timervals[offset];
288   period = attotime::from_hz(25000000) * state->m_timerorig[offset];
289   state->m_timers[offset]->adjust(period);
290   state->m_timerrun[offset] = 1;
285   m_timerorig[offset] = m_timervals[offset];
286   period = attotime::from_hz(25000000) * m_timerorig[offset];
287   m_timers[offset]->adjust(period);
288   m_timerrun[offset] = 1;
291289}
292290
293291static TIMER_DEVICE_CALLBACK( model2_timer_cb )
r14896r14897
409407   palette_set_color_rgb(machine, color, pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10));
410408}
411409
412static WRITE32_HANDLER( pal32_w )
410WRITE32_MEMBER(model2_state::pal32_w)
413411{
414   model2_state *state = space->machine().driver_data<model2_state>();
415   COMBINE_DATA(state->m_paletteram32 + offset);
412   COMBINE_DATA(m_paletteram32 + offset);
416413   if(ACCESSING_BITS_0_15)
417      chcolor(space->machine(), offset * 2, state->m_paletteram32[offset]);
414      chcolor(machine(), offset * 2, m_paletteram32[offset]);
418415   if(ACCESSING_BITS_16_31)
419      chcolor(space->machine(), offset * 2 + 1, state->m_paletteram32[offset] >> 16);
416      chcolor(machine(), offset * 2 + 1, m_paletteram32[offset] >> 16);
420417}
421418
422static WRITE32_HANDLER( ctrl0_w )
419WRITE32_MEMBER(model2_state::ctrl0_w)
423420{
424   model2_state *state = space->machine().driver_data<model2_state>();
425421   if(ACCESSING_BITS_0_7)
426422   {
427      eeprom_device *eeprom = space->machine().device<eeprom_device>("eeprom");
428      state->m_ctrlmode = data & 0x01;
423      eeprom_device *eeprom = machine().device<eeprom_device>("eeprom");
424      m_ctrlmode = data & 0x01;
429425      eeprom->write_bit(data & 0x20);
430426      eeprom->set_clock_line((data & 0x80) ? ASSERT_LINE : CLEAR_LINE);
431427      eeprom->set_cs_line((data & 0x40) ? CLEAR_LINE : ASSERT_LINE);
432428   }
433429}
434430
435static WRITE32_HANDLER( analog_2b_w )
431WRITE32_MEMBER(model2_state::analog_2b_w)
436432{
437   model2_state *state = space->machine().driver_data<model2_state>();
438   state->m_analog_channel = (data >> 16) & 0x07;
433   m_analog_channel = (data >> 16) & 0x07;
439434}
440435
441436
442static READ32_HANDLER( fifoctl_r )
437READ32_MEMBER(model2_state::fifoctl_r)
443438{
444   model2_state *state = space->machine().driver_data<model2_state>();
445439   UINT32 r = 0;
446440
447   if (state->m_copro_fifoout_num == 0)
441   if (m_copro_fifoout_num == 0)
448442   {
449443      r |= 1;
450444   }
r14896r14897
453447   return r | 0x04;
454448}
455449
456static READ32_HANDLER( videoctl_r )
450READ32_MEMBER(model2_state::videoctl_r)
457451{
458   return (space->machine().primary_screen->frame_number() & 1) << 2;
452   return (machine().primary_screen->frame_number() & 1) << 2;
459453}
460454
461455CUSTOM_INPUT_MEMBER(model2_state::_1c00000_r)
r14896r14897
561555   return 0xffff;
562556}
563557
564static WRITE32_HANDLER( rchase2_devices_w )
558WRITE32_MEMBER(model2_state::rchase2_devices_w)
565559{
566   model2_state *state = space->machine().driver_data<model2_state>();
567560   /*
568561    0x00040000 start 1 lamp
569562    0x00080000 start 2 lamp
570563    */
571564
572565   if(mem_mask == 0x0000ffff)
573      state->m_cmd_data = data;
566      m_cmd_data = data;
574567}
575568
576569
577static WRITE32_HANDLER( srallyc_devices_w )
570WRITE32_MEMBER(model2_state::srallyc_devices_w)
578571{
579   model2_state *state = space->machine().driver_data<model2_state>();
580572   /*
581573    0x00040000 start 1 lamp
582574    0x00200000 vr lamp
r14896r14897
585577
586578   if(mem_mask == 0x000000ff || mem_mask == 0x0000ffff)
587579   {
588      state->m_driveio_comm_data = data & 0xff;
589      cputag_set_input_line(space->machine(), "drivecpu", 0, HOLD_LINE);
580      m_driveio_comm_data = data & 0xff;
581      cputag_set_input_line(machine(), "drivecpu", 0, HOLD_LINE);
590582   }
591583}
592584
593585/*****************************************************************************/
594586/* COPRO */
595587
596static READ32_HANDLER(copro_prg_r)
588READ32_MEMBER(model2_state::copro_prg_r)
597589{
598590
599591   return 0xffffffff;
600592}
601593
602static WRITE32_HANDLER(copro_prg_w)
594WRITE32_MEMBER(model2_state::copro_prg_w)
603595{
604   model2_state *state = space->machine().driver_data<model2_state>();
605   if (state->m_coproctl & 0x80000000)
596   if (m_coproctl & 0x80000000)
606597   {
607      logerror("copro_prg_w: %08X:   %08X\n", state->m_coprocnt, data);
608      state->m_coprocnt++;
598      logerror("copro_prg_w: %08X:   %08X\n", m_coprocnt, data);
599      m_coprocnt++;
609600   }
610601   else
611602   {
r14896r14897
613604   }
614605}
615606
616static WRITE32_HANDLER( copro_ctl1_w )
607WRITE32_MEMBER(model2_state::copro_ctl1_w)
617608{
618   model2_state *state = space->machine().driver_data<model2_state>();
619609   // did hi bit change?
620   if ((data ^ state->m_coproctl) == 0x80000000)
610   if ((data ^ m_coproctl) == 0x80000000)
621611   {
622612      if (data & 0x80000000)
623613      {
624614         logerror("Start copro upload\n");
625         state->m_coprocnt = 0;
615         m_coprocnt = 0;
626616      }
627617      else
628618      {
629         logerror("Boot copro, %d dwords\n", state->m_coprocnt);
630         if (state->m_dsp_type != DSP_TYPE_TGPX4)
619         logerror("Boot copro, %d dwords\n", m_coprocnt);
620         if (m_dsp_type != DSP_TYPE_TGPX4)
631621         {
632            if (state->m_dsp_type == DSP_TYPE_SHARC)
633               cputag_set_input_line(space->machine(), "dsp", INPUT_LINE_HALT, CLEAR_LINE);
622            if (m_dsp_type == DSP_TYPE_SHARC)
623               cputag_set_input_line(machine(), "dsp", INPUT_LINE_HALT, CLEAR_LINE);
634624            else
635               cputag_set_input_line(space->machine(), "tgp", INPUT_LINE_HALT, CLEAR_LINE);
625               cputag_set_input_line(machine(), "tgp", INPUT_LINE_HALT, CLEAR_LINE);
636626         }
637627      }
638628   }
639629
640   state->m_coproctl = data;
630   m_coproctl = data;
641631}
642632
643static WRITE32_HANDLER(copro_function_port_w)
633WRITE32_MEMBER(model2_state::copro_function_port_w)
644634{
645   model2_state *state = space->machine().driver_data<model2_state>();
646635   UINT32 d = data & 0x800fffff;
647636   UINT32 a = (offset >> 2) & 0xff;
648637   d |= a << 23;
649638
650639   //logerror("copro_function_port_w: %08X, %08X, %08X\n", data, offset, mem_mask);
651   if (state->m_dsp_type == DSP_TYPE_SHARC)
652      copro_fifoin_push(space->machine().device("dsp"), d);
640   if (m_dsp_type == DSP_TYPE_SHARC)
641      copro_fifoin_push(machine().device("dsp"), d);
653642   else
654      copro_fifoin_push(space->machine().device("tgp"), d);
643      copro_fifoin_push(machine().device("tgp"), d);
655644}
656645
657static READ32_HANDLER(copro_fifo_r)
646READ32_MEMBER(model2_state::copro_fifo_r)
658647{
659648   //logerror("copro_fifo_r: %08X, %08X\n", offset, mem_mask);
660   return copro_fifoout_pop(space);
649   return copro_fifoout_pop(&space);
661650}
662651
663static WRITE32_HANDLER(copro_fifo_w)
652WRITE32_MEMBER(model2_state::copro_fifo_w)
664653{
665   model2_state *state = space->machine().driver_data<model2_state>();
666   if (state->m_coproctl & 0x80000000)
654   if (m_coproctl & 0x80000000)
667655   {
668      if (state->m_dsp_type == DSP_TYPE_SHARC)
656      if (m_dsp_type == DSP_TYPE_SHARC)
669657      {
670         sharc_external_dma_write(space->machine().device("dsp"), state->m_coprocnt, data & 0xffff);
658         sharc_external_dma_write(machine().device("dsp"), m_coprocnt, data & 0xffff);
671659      }
672      else if (state->m_dsp_type == DSP_TYPE_TGP)
660      else if (m_dsp_type == DSP_TYPE_TGP)
673661      {
674         state->m_tgp_program[state->m_coprocnt] = data;
662         m_tgp_program[m_coprocnt] = data;
675663      }
676664
677      state->m_coprocnt++;
665      m_coprocnt++;
678666   }
679667   else
680668   {
681      //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space->device()));
682      if (state->m_dsp_type == DSP_TYPE_SHARC)
683         copro_fifoin_push(space->machine().device("dsp"), data);
669      //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
670      if (m_dsp_type == DSP_TYPE_SHARC)
671         copro_fifoin_push(machine().device("dsp"), data);
684672      else
685         copro_fifoin_push(space->machine().device("tgp"), data);
673         copro_fifoin_push(machine().device("tgp"), data);
686674   }
687675}
688676
689static WRITE32_HANDLER(copro_sharc_iop_w)
677WRITE32_MEMBER(model2_state::copro_sharc_iop_w)
690678{
691   model2_state *state = space->machine().driver_data<model2_state>();
692679   /* FIXME: clean this up */
693   if ((strcmp(space->machine().system().name, "schamp" ) == 0) ||
694      (strcmp(space->machine().system().name, "sfight" ) == 0) ||
695      (strcmp(space->machine().system().name, "fvipers" ) == 0) ||
696      (strcmp(space->machine().system().name, "vstriker" ) == 0) ||
697      (strcmp(space->machine().system().name, "vstrikero" ) == 0) ||
698      (strcmp(space->machine().system().name, "gunblade" ) == 0) ||
699      (strcmp(space->machine().system().name, "von" ) == 0) ||
700      (strcmp(space->machine().system().name, "vonj" ) == 0) ||
701      (strcmp(space->machine().system().name, "rchase2" ) == 0))
680   if ((strcmp(machine().system().name, "schamp" ) == 0) ||
681      (strcmp(machine().system().name, "sfight" ) == 0) ||
682      (strcmp(machine().system().name, "fvipers" ) == 0) ||
683      (strcmp(machine().system().name, "vstriker" ) == 0) ||
684      (strcmp(machine().system().name, "vstrikero" ) == 0) ||
685      (strcmp(machine().system().name, "gunblade" ) == 0) ||
686      (strcmp(machine().system().name, "von" ) == 0) ||
687      (strcmp(machine().system().name, "vonj" ) == 0) ||
688      (strcmp(machine().system().name, "rchase2" ) == 0))
702689   {
703      sharc_external_iop_write(space->machine().device("dsp"), offset, data);
690      sharc_external_iop_write(machine().device("dsp"), offset, data);
704691   }
705692   else
706693   {
707      if ((state->m_iop_write_num & 1) == 0)
694      if ((m_iop_write_num & 1) == 0)
708695      {
709         state->m_iop_data = data & 0xffff;
696         m_iop_data = data & 0xffff;
710697      }
711698      else
712699      {
713         state->m_iop_data |= (data & 0xffff) << 16;
714         sharc_external_iop_write(space->machine().device("dsp"), offset, state->m_iop_data);
700         m_iop_data |= (data & 0xffff) << 16;
701         sharc_external_iop_write(machine().device("dsp"), offset, m_iop_data);
715702      }
716      state->m_iop_write_num++;
703      m_iop_write_num++;
717704   }
718705}
719706
r14896r14897
725712/* GEO */
726713
727714
728static WRITE32_HANDLER( geo_ctl1_w )
715WRITE32_MEMBER(model2_state::geo_ctl1_w)
729716{
730   model2_state *state = space->machine().driver_data<model2_state>();
731717   // did hi bit change?
732   if ((data ^ state->m_geoctl) == 0x80000000)
718   if ((data ^ m_geoctl) == 0x80000000)
733719   {
734720      if (data & 0x80000000)
735721      {
736722         logerror("Start geo upload\n");
737         state->m_geocnt = 0;
723         m_geocnt = 0;
738724      }
739725      else
740726      {
741         logerror("Boot geo, %d dwords\n", state->m_geocnt);
727         logerror("Boot geo, %d dwords\n", m_geocnt);
742728      }
743729   }
744730
745   state->m_geoctl = data;
731   m_geoctl = data;
746732}
747733
748734
749735#ifdef UNUSED_FUNCTION
750static WRITE32_HANDLER( geo_sharc_ctl1_w )
736WRITE32_MEMBER(model2_state::geo_sharc_ctl1_w)
751737{
752   model2_state *state = space->machine().driver_data<model2_state>();
753738    // did hi bit change?
754    if ((data ^ state->m_geoctl) == 0x80000000)
739    if ((data ^ m_geoctl) == 0x80000000)
755740    {
756741        if (data & 0x80000000)
757742        {
758743            logerror("Start geo upload\n");
759            state->m_geocnt = 0;
744            m_geocnt = 0;
760745        }
761746        else
762747        {
763            logerror("Boot geo, %d dwords\n", state->m_geocnt);
764            cputag_set_input_line(space->machine(), "dsp2", INPUT_LINE_HALT, CLEAR_LINE);
765            //device_spin_until_time(&space->device(), attotime::from_usec(1000));       // Give the SHARC enough time to boot itself
748            logerror("Boot geo, %d dwords\n", m_geocnt);
749            cputag_set_input_line(machine(), "dsp2", INPUT_LINE_HALT, CLEAR_LINE);
750            //device_spin_until_time(&space.device(), attotime::from_usec(1000));       // Give the SHARC enough time to boot itself
766751        }
767752    }
768753
769    state->m_geoctl = data;
754    m_geoctl = data;
770755}
771756
772static READ32_HANDLER(geo_sharc_fifo_r)
757READ32_MEMBER(model2_state::geo_sharc_fifo_r)
773758{
774    if ((strcmp(space->machine().system().name, "manxtt" ) == 0) || (strcmp(space->machine().system().name, "srallyc" ) == 0))
759    if ((strcmp(machine().system().name, "manxtt" ) == 0) || (strcmp(machine().system().name, "srallyc" ) == 0))
775760    {
776761        return 8;
777762    }
r14896r14897
782767    }
783768}
784769
785static WRITE32_HANDLER(geo_sharc_fifo_w)
770WRITE32_MEMBER(model2_state::geo_sharc_fifo_w)
786771{
787   model2_state *state = space->machine().driver_data<model2_state>();
788    if (state->m_geoctl & 0x80000000)
772    if (m_geoctl & 0x80000000)
789773    {
790        sharc_external_dma_write(space->machine().device("dsp2"), state->m_geocnt, data & 0xffff);
774        sharc_external_dma_write(machine().device("dsp2"), m_geocnt, data & 0xffff);
791775
792        state->m_geocnt++;
776        m_geocnt++;
793777    }
794778    else
795779    {
796        //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space->device()));
780        //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
797781    }
798782}
799783
800static WRITE32_HANDLER(geo_sharc_iop_w)
784WRITE32_MEMBER(model2_state::geo_sharc_iop_w)
801785{
802   model2_state *state = space->machine().driver_data<model2_state>();
803    if ((strcmp(space->machine().system().name, "schamp" ) == 0))
786    if ((strcmp(machine().system().name, "schamp" ) == 0))
804787    {
805        sharc_external_iop_write(space->machine().device("dsp2"), offset, data);
788        sharc_external_iop_write(machine().device("dsp2"), offset, data);
806789    }
807790    else
808791    {
809        if ((state->m_geo_iop_write_num & 1) == 0)
792        if ((m_geo_iop_write_num & 1) == 0)
810793        {
811            state->m_geo_iop_data = data & 0xffff;
794            m_geo_iop_data = data & 0xffff;
812795        }
813796        else
814797        {
815            state->m_geo_iop_data |= (data & 0xffff) << 16;
816            sharc_external_iop_write(space->machine().device("dsp2"), offset, state->m_geo_iop_data);
798            m_geo_iop_data |= (data & 0xffff) << 16;
799            sharc_external_iop_write(machine().device("dsp2"), offset, m_geo_iop_data);
817800        }
818        state->m_geo_iop_write_num++;
801        m_geo_iop_write_num++;
819802    }
820803}
821804#endif
822805
823806
824static void push_geo_data(model2_state *state, UINT32 data)
807void model2_state::push_geo_data(UINT32 data)
825808{
826   //mame_printf_debug("push_geo_data: %08X: %08X\n", 0x900000+state->m_geo_write_start_address, data);
827   state->m_bufferram[state->m_geo_write_start_address/4] = data;
828   state->m_geo_write_start_address += 4;
809   //mame_printf_debug("push_geo_data: %08X: %08X\n", 0x900000+m_geo_write_start_address, data);
810   m_bufferram[m_geo_write_start_address/4] = data;
811   m_geo_write_start_address += 4;
829812}
830813
831static READ32_HANDLER(geo_prg_r)
814READ32_MEMBER(model2_state::geo_prg_r)
832815{
833816   return 0xffffffff;
834817}
835818
836static WRITE32_HANDLER(geo_prg_w)
819WRITE32_MEMBER(model2_state::geo_prg_w)
837820{
838   model2_state *state = space->machine().driver_data<model2_state>();
839   if (state->m_geoctl & 0x80000000)
821   if (m_geoctl & 0x80000000)
840822   {
841      //logerror("geo_prg_w: %08X:   %08X\n", state->m_geocnt, data);
842      state->m_geocnt++;
823      //logerror("geo_prg_w: %08X:   %08X\n", m_geocnt, data);
824      m_geocnt++;
843825   }
844826   else
845827   {
846      //mame_printf_debug("GEO: %08X: push %08X\n", state->m_geo_write_start_address, data);
847      push_geo_data(state, data);
828      //mame_printf_debug("GEO: %08X: push %08X\n", m_geo_write_start_address, data);
829      push_geo_data(data);
848830   }
849831}
850832
851static READ32_HANDLER( geo_r )
833READ32_MEMBER(model2_state::geo_r)
852834{
853   model2_state *state = space->machine().driver_data<model2_state>();
854835   int address = offset * 4;
855836   if (address == 0x2008)
856837   {
857      return state->m_geo_write_start_address;
838      return m_geo_write_start_address;
858839   }
859840   else if (address == 0x3008)
860841   {
861      return state->m_geo_read_start_address;
842      return m_geo_read_start_address;
862843   }
863844
864845//  fatalerror("geo_r: %08X, %08X\n", address, mem_mask);
865   mame_printf_debug("geo_r: PC:%08x - %08X\n", cpu_get_pc(&space->device()), address);
846   mame_printf_debug("geo_r: PC:%08x - %08X\n", cpu_get_pc(&space.device()), address);
866847
867848   return 0;
868849}
869850
870static WRITE32_HANDLER( geo_w )
851WRITE32_MEMBER(model2_state::geo_w)
871852{
872   model2_state *state = space->machine().driver_data<model2_state>();
873853   int address = offset * 4;
874854
875855   if (address < 0x1000)
r14896r14897
883863            for (i=0; i < 4; i++)
884864            {
885865                mame_printf_debug("   %08X: %08X %08X %08X %08X\n", 0x900000+(a*4)+(i*16),
886                    state->m_bufferram[a+(i*4)+0], state->m_bufferram[a+(i*4)+1], state->m_bufferram[a+(i*4)+2], state->m_bufferram[a+(i*4)+3]);
866                    m_bufferram[a+(i*4)+0], m_bufferram[a+(i*4)+1], m_bufferram[a+(i*4)+2], m_bufferram[a+(i*4)+3]);
887867            }
888868        }
889869        else
r14896r14897
907887         UINT32 r = 0;
908888         r |= data & 0x800fffff;
909889         r |= ((address >> 4) & 0x3f) << 23;
910         push_geo_data(state, r);
890         push_geo_data(r);
911891      }
912892      else
913893      {
r14896r14897
916896            UINT32 r = 0;
917897            r |= data & 0x000fffff;
918898            r |= ((address >> 4) & 0x3f) << 23;
919            push_geo_data(state, r);
899            push_geo_data(r);
920900         }
921901      }
922902   }
923903   else if (address == 0x1008)
924904   {
925905      //mame_printf_debug("GEO: Write Start Address: %08X\n", data);
926      state->m_geo_write_start_address = data & 0xfffff;
906      m_geo_write_start_address = data & 0xfffff;
927907   }
928908   else if (address == 0x3008)
929909   {
930910      //mame_printf_debug("GEO: Read Start Address: %08X\n", data);
931      state->m_geo_read_start_address = data & 0xfffff;
911      m_geo_read_start_address = data & 0xfffff;
932912   }
933913   else
934914   {
r14896r14897
939919/*****************************************************************************/
940920
941921
942static READ32_HANDLER(hotd_unk_r)
922READ32_MEMBER(model2_state::hotd_unk_r)
943923{
944924   return 0x000c0000;
945925}
946926
947927#ifdef UNUSED_FUNCTION
948static READ32_HANDLER(sonic_unk_r)
928READ32_MEMBER(model2_state::sonic_unk_r)
949929{
950930    return 0x001a0000;
951931}
952932#endif
953933
954static READ32_HANDLER(daytona_unk_r)
934READ32_MEMBER(model2_state::daytona_unk_r)
955935{
956936   return 0x00400000;
957937}
958938
959static READ32_HANDLER(desert_unk_r)
939READ32_MEMBER(model2_state::desert_unk_r)
960940{
961941   // vcop needs bit 3 clear (infinite loop otherwise)
962942   // desert needs other bits set (not sure which specifically)
r14896r14897
964944   return 0x00ff00f7;
965945}
966946
967static READ32_HANDLER(model2_irq_r)
947READ32_MEMBER(model2_state::model2_irq_r)
968948{
969   model2_state *state = space->machine().driver_data<model2_state>();
970   i960_noburst(&space->device());
949   i960_noburst(&space.device());
971950
972951   if (offset)
973952   {
974      return state->m_intena;
953      return m_intena;
975954   }
976955
977   return state->m_intreq;
956   return m_intreq;
978957}
979958
980static WRITE32_HANDLER(model2_irq_w)
959WRITE32_MEMBER(model2_state::model2_irq_w)
981960{
982   model2_state *state = space->machine().driver_data<model2_state>();
983   i960_noburst(&space->device());
961   i960_noburst(&space.device());
984962
985963   if (offset)
986964   {
987      COMBINE_DATA(&state->m_intena);
965      COMBINE_DATA(&m_intena);
988966      return;
989967   }
990968
991   state->m_intreq &= data;
969   m_intreq &= data;
992970}
993971
994972
r14896r14897
1021999   device_spin_until_time(&space->device(), attotime::from_usec(40));
10221000}
10231001
1024static READ32_HANDLER( model2_serial_r )
1002READ32_MEMBER(model2_state::model2_serial_r)
10251003{
10261004   if ((offset == 0) && (mem_mask == 0xffff0000))
10271005   {
r14896r14897
10311009   return 0xffffffff;
10321010}
10331011
1034static WRITE32_HANDLER( model2o_serial_w )
1012WRITE32_MEMBER(model2_state::model2o_serial_w)
10351013{
10361014   if (mem_mask == 0x0000ffff)
10371015   {
1038      snd_latch_to_68k_w(space, data&0xff);
1016      snd_latch_to_68k_w(&space, data&0xff);
10391017   }
10401018}
10411019
1042static WRITE32_HANDLER( model2_serial_w )
1020WRITE32_MEMBER(model2_state::model2_serial_w)
10431021{
10441022   if (ACCESSING_BITS_0_7 && (offset == 0))
10451023   {
1046      scsp_midi_in(space->machine().device("scsp"), 0, data&0xff, 0);
1024      scsp_midi_in(machine().device("scsp"), 0, data&0xff, 0);
10471025
10481026      // give the 68k time to notice
1049      device_spin_until_time(&space->device(), attotime::from_usec(40));
1027      device_spin_until_time(&space.device(), attotime::from_usec(40));
10501028   }
10511029}
10521030
r14896r14897
10681046   0x43,0x66,0x54,0x11,0x99,0xfe,0xcc,0x8e,0xdd,0x87,0x11,0x89,0x22,0xdf,0x44,0x09
10691047};
10701048
1071static READ32_HANDLER( model2_prot_r )
1049READ32_MEMBER(model2_state::model2_prot_r)
10721050{
1073   model2_state *state = space->machine().driver_data<model2_state>();
10741051   UINT32 retval = 0;
10751052
10761053   if (offset == 0x10000/4)
r14896r14897
10801057   }
10811058   else if (offset == 0x1000e/4)
10821059   {
1083      retval = state->m_protram[state->m_protstate+1] | state->m_protram[state->m_protstate]<<8;
1060      retval = m_protram[m_protstate+1] | m_protram[m_protstate]<<8;
10841061      retval <<= 16;
1085      state->m_protstate+=2;
1062      m_protstate+=2;
10861063   }
10871064   else if (offset == 0x7ff8/4)
10881065   {
1089      retval = state->m_protram[state->m_protstate+1] | state->m_protram[state->m_protstate]<<8;
1090      state->m_protstate+=2;
1066      retval = m_protram[m_protstate+1] | m_protram[m_protstate]<<8;
1067      m_protstate+=2;
10911068   }
10921069   else if (offset == 0x400c/4)
10931070   {
1094      state->m_prot_a = !state->m_prot_a;
1095      if (state->m_prot_a)
1071      m_prot_a = !m_prot_a;
1072      if (m_prot_a)
10961073         return 0xffff;
10971074      else
10981075         return 0xfff0;
10991076   }
1100   else logerror("Unhandled Protection READ @ %x mask %x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space->device()));
1077   else logerror("Unhandled Protection READ @ %x mask %x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device()));
11011078
11021079   return retval;
11031080}
11041081
1105static WRITE32_HANDLER( model2_prot_w )
1082WRITE32_MEMBER(model2_state::model2_prot_w)
11061083{
1107   model2_state *state = space->machine().driver_data<model2_state>();
11081084   if (mem_mask == 0xffff0000)
11091085   {
11101086      data >>= 16;
r14896r14897
11121088
11131089   if (offset == 0x10008/4)
11141090   {
1115      state->m_protpos = data;
1091      m_protpos = data;
11161092   }
11171093   else if (offset == 0x1000c/4)
11181094   {
r14896r14897
11201096      {
11211097         // dynamcop
11221098         case 0x7700:
1123            strcpy((char *)state->m_protram+2, "UCHIDA MOMOKA   ");
1099            strcpy((char *)m_protram+2, "UCHIDA MOMOKA   ");
11241100            break;
11251101
11261102         // dynamcop
11271103         case 0x1326:
1128            state->m_protstate = 0;
1129            memcpy(state->m_protram+2, DCOPKey1326, sizeof(DCOPKey1326));
1104            m_protstate = 0;
1105            memcpy(m_protram+2, DCOPKey1326, sizeof(DCOPKey1326));
11301106            break;
11311107
11321108         // zerogun
r14896r14897
11451121         case 0x98CC:
11461122         case 0x3422:
11471123         case 0x10:
1148            state->m_protstate = 0;
1149            memcpy(state->m_protram+2, ZGUNProt+((2*state->m_protpos)/12)*8, sizeof(ZGUNProt));
1124            m_protstate = 0;
1125            memcpy(m_protram+2, ZGUNProt+((2*m_protpos)/12)*8, sizeof(ZGUNProt));
11501126            break;
11511127
11521128         // pltkids
11531129         case 0x7140:
1154            state->m_protstate = 0;
1155            strcpy((char *)state->m_protram+2, "98-PILOT  ");
1130            m_protstate = 0;
1131            strcpy((char *)m_protram+2, "98-PILOT  ");
11561132            break;
11571133
11581134         default:
1159            state->m_protstate = 0;
1135            m_protstate = 0;
11601136            break;
11611137      }
11621138   }
r14896r14897
11641140   {
11651141      if (data == 0)
11661142      {
1167         state->m_protstate = 0;
1168         strcpy((char *)state->m_protram, "  TECMO LTD.  DEAD OR ALIVE  1996.10.22  VER. 1.00");
1143         m_protstate = 0;
1144         strcpy((char *)m_protram, "  TECMO LTD.  DEAD OR ALIVE  1996.10.22  VER. 1.00");
11691145      }
11701146   }
1171   else logerror("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space->device()));
1147   else logerror("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
11721148
11731149}
11741150
11751151/* Daytona "To The MAXX" PIC protection simulation */
11761152
11771153
1178static READ32_HANDLER( maxx_r )
1154READ32_MEMBER(model2_state::maxx_r)
11791155{
1180   model2_state *state = space->machine().driver_data<model2_state>();
1181   UINT32 *ROM = (UINT32 *)space->machine().region("maincpu")->base();
1156   UINT32 *ROM = (UINT32 *)machine().region("maincpu")->base();
11821157
11831158   if (offset <= 0x1f/4)
11841159   {
r14896r14897
11861161      if (mem_mask == 0xffff0000)
11871162      {
11881163         // 16-bit protection reads
1189         state->m_maxxstate++;
1190         state->m_maxxstate &= 0xf;
1191         if (!state->m_maxxstate)
1164         m_maxxstate++;
1165         m_maxxstate &= 0xf;
1166         if (!m_maxxstate)
11921167         {
11931168            return 0x00070000;
11941169         }
11951170         else
11961171         {
1197            if (state->m_maxxstate & 0x2)
1172            if (m_maxxstate & 0x2)
11981173            {
11991174               return 0;
12001175            }
r14896r14897
12211196
12221197
12231198
1224static READ32_HANDLER( network_r )
1199READ32_MEMBER(model2_state::network_r)
12251200{
1226   model2_state *state = space->machine().driver_data<model2_state>();
12271201   if ((mem_mask == 0xffffffff) || (mem_mask == 0x0000ffff) || (mem_mask == 0xffff0000))
12281202   {
12291203      return 0xffffffff;
r14896r14897
12311205
12321206   if (offset < 0x4000/4)
12331207   {
1234      return state->m_netram[offset];
1208      return m_netram[offset];
12351209   }
12361210
12371211   if (mem_mask == 0x00ff0000)
12381212   {
1239      return state->m_sysres<<16;
1213      return m_sysres<<16;
12401214   }
12411215   else if (mem_mask == 0x000000ff)
12421216   {
1243      return state->m_zflagi;
1217      return m_zflagi;
12441218   }
12451219
12461220   return 0xffffffff;
12471221}
12481222
1249static WRITE32_HANDLER( network_w )
1223WRITE32_MEMBER(model2_state::network_w)
12501224{
1251   model2_state *state = space->machine().driver_data<model2_state>();
12521225   if ((mem_mask == 0xffffffff) || (mem_mask == 0x0000ffff) || (mem_mask == 0xffff0000))
12531226   {
1254      COMBINE_DATA(&state->m_netram[offset+0x4000/4]);
1227      COMBINE_DATA(&m_netram[offset+0x4000/4]);
12551228      return;
12561229   }
12571230
12581231   if (offset < 0x4000/4)
12591232   {
1260      COMBINE_DATA(&state->m_netram[offset]);
1233      COMBINE_DATA(&m_netram[offset]);
12611234      return;
12621235   }
12631236
12641237   if (mem_mask == 0x00ff0000)
12651238   {
1266      state->m_sysres = data>>16;
1239      m_sysres = data>>16;
12671240   }
12681241   else if (mem_mask == 0x000000ff)
12691242   {
1270      state->m_zflagi = data;
1271      state->m_zflag = 0;
1272      if (data & 0x01) state->m_zflag |= 0x80;
1273      if (data & 0x80) state->m_zflag |= 0x01;
1243      m_zflagi = data;
1244      m_zflag = 0;
1245      if (data & 0x01) m_zflag |= 0x80;
1246      if (data & 0x80) m_zflag |= 0x01;
12741247   }
12751248}
12761249
12771250#ifdef UNUSED_FUNCTION
1278static WRITE32_HANDLER( copro_w )
1251WRITE32_MEMBER(model2_state::copro_w)
12791252{
12801253   int address = offset * 4;
12811254
r14896r14897
12941267}
12951268#endif
12961269
1297static WRITE32_HANDLER(mode_w)
1270WRITE32_MEMBER(model2_state::mode_w)
12981271{
12991272   mame_printf_debug("Mode = %08X\n", data);
13001273}
13011274
1302static WRITE32_HANDLER(model2o_tex_w0)
1275WRITE32_MEMBER(model2_state::model2o_tex_w0)
13031276{
1304   model2_state *state = space->machine().driver_data<model2_state>();
13051277   if ( (offset & 1) == 0 )
13061278   {
1307      state->m_textureram0[offset>>1] &= 0xffff0000;
1308      state->m_textureram0[offset>>1] |= data & 0xffff;
1279      m_textureram0[offset>>1] &= 0xffff0000;
1280      m_textureram0[offset>>1] |= data & 0xffff;
13091281   }
13101282   else
13111283   {
1312      state->m_textureram0[offset>>1] &= 0x0000ffff;
1313      state->m_textureram0[offset>>1] |= (data & 0xffff) << 16;
1284      m_textureram0[offset>>1] &= 0x0000ffff;
1285      m_textureram0[offset>>1] |= (data & 0xffff) << 16;
13141286   }
13151287}
13161288
1317static WRITE32_HANDLER(model2o_tex_w1)
1289WRITE32_MEMBER(model2_state::model2o_tex_w1)
13181290{
1319   model2_state *state = space->machine().driver_data<model2_state>();
13201291   if ( (offset & 1) == 0 )
13211292   {
1322      state->m_textureram1[offset>>1] &= 0xffff0000;
1323      state->m_textureram1[offset>>1] |= data & 0xffff;
1293      m_textureram1[offset>>1] &= 0xffff0000;
1294      m_textureram1[offset>>1] |= data & 0xffff;
13241295   }
13251296   else
13261297   {
1327      state->m_textureram1[offset>>1] &= 0x0000ffff;
1328      state->m_textureram1[offset>>1] |= (data & 0xffff) << 16;
1298      m_textureram1[offset>>1] &= 0x0000ffff;
1299      m_textureram1[offset>>1] |= (data & 0xffff) << 16;
13291300   }
13301301}
13311302
1332static WRITE32_HANDLER(model2o_luma_w)
1303WRITE32_MEMBER(model2_state::model2o_luma_w)
13331304{
1334   model2_state *state = space->machine().driver_data<model2_state>();
13351305   if ( (offset & 1) == 0 )
13361306   {
1337      state->m_lumaram[offset>>1] &= 0xffff0000;
1338      state->m_lumaram[offset>>1] |= data & 0xffff;
1307      m_lumaram[offset>>1] &= 0xffff0000;
1308      m_lumaram[offset>>1] |= data & 0xffff;
13391309   }
13401310   else
13411311   {
1342      state->m_lumaram[offset>>1] &= 0x0000ffff;
1343      state->m_lumaram[offset>>1] |= (data & 0xffff) << 16;
1312      m_lumaram[offset>>1] &= 0x0000ffff;
1313      m_lumaram[offset>>1] |= (data & 0xffff) << 16;
13441314   }
13451315}
13461316
1347static WRITE32_HANDLER(model2_3d_zclip_w)
1317WRITE32_MEMBER(model2_state::model2_3d_zclip_w)
13481318{
1349   model2_3d_set_zclip( space->machine(), data & 0xFF );
1319   model2_3d_set_zclip( machine(), data & 0xFF );
13501320}
13511321
13521322/* common map for all Model 2 versions */
r14896r14897
13551325
13561326   AM_RANGE(0x00500000, 0x005fffff) AM_RAM AM_BASE(m_workram)
13571327
1358   AM_RANGE(0x00800000, 0x00803fff) AM_READWRITE_LEGACY(geo_r, geo_w)
1328   AM_RANGE(0x00800000, 0x00803fff) AM_READWRITE(geo_r, geo_w)
13591329   //AM_RANGE(0x00800010, 0x00800013) AM_WRITENOP
13601330   //AM_RANGE(0x008000b0, 0x008000b3) AM_WRITENOP
13611331   //AM_RANGE(0x00804004, 0x0080400f) AM_WRITENOP  // quiet psikyo games
13621332
1363   //AM_RANGE(0x00880000, 0x00883fff) AM_WRITE_LEGACY(copro_w)
1333   //AM_RANGE(0x00880000, 0x00883fff) AM_WRITE(copro_w)
13641334
13651335   AM_RANGE(0x00900000, 0x0097ffff) AM_RAM AM_BASE(m_bufferram)
13661336
13671337
1368   AM_RANGE(0x00980004, 0x00980007) AM_READ_LEGACY(fifoctl_r)
1369   AM_RANGE(0x0098000c, 0x0098000f) AM_READ_LEGACY(videoctl_r)
1338   AM_RANGE(0x00980004, 0x00980007) AM_READ(fifoctl_r)
1339   AM_RANGE(0x0098000c, 0x0098000f) AM_READ(videoctl_r)
13701340
1371   AM_RANGE(0x00e80000, 0x00e80007) AM_READWRITE_LEGACY(model2_irq_r, model2_irq_w)
1341   AM_RANGE(0x00e80000, 0x00e80007) AM_READWRITE(model2_irq_r, model2_irq_w)
13721342
1373   AM_RANGE(0x00f00000, 0x00f0000f) AM_READWRITE_LEGACY(timers_r, timers_w)
1343   AM_RANGE(0x00f00000, 0x00f0000f) AM_READWRITE(timers_r, timers_w)
13741344
13751345   AM_RANGE(0x01000000, 0x0100ffff) AM_DEVREADWRITE("tile", segas24_tile, tile32_r, tile32_w) AM_MIRROR(0x110000)
13761346   AM_RANGE(0x01020000, 0x01020003) AM_WRITENOP AM_MIRROR(0x100000)      // Unknown, always 0
r14896r14897
13791349   AM_RANGE(0x01070000, 0x01070003) AM_WRITENOP AM_MIRROR(0x100000)      // Video synchronization switch
13801350   AM_RANGE(0x01080000, 0x010fffff) AM_DEVREADWRITE("tile", segas24_tile, char32_r, char32_w) AM_MIRROR(0x100000)
13811351
1382   AM_RANGE(0x01800000, 0x01803fff) AM_RAM_WRITE_LEGACY(pal32_w) AM_BASE(m_paletteram32)
1352   AM_RANGE(0x01800000, 0x01803fff) AM_RAM_WRITE(pal32_w) AM_BASE(m_paletteram32)
13831353   AM_RANGE(0x01810000, 0x0181bfff) AM_RAM AM_BASE(m_colorxlat)
1384   AM_RANGE(0x0181c000, 0x0181c003) AM_WRITE_LEGACY(model2_3d_zclip_w)
1385   AM_RANGE(0x01a10000, 0x01a1ffff) AM_READWRITE_LEGACY(network_r, network_w)
1354   AM_RANGE(0x0181c000, 0x0181c003) AM_WRITE(model2_3d_zclip_w)
1355   AM_RANGE(0x01a10000, 0x01a1ffff) AM_READWRITE(network_r, network_w)
13861356   AM_RANGE(0x01d00000, 0x01d03fff) AM_RAM AM_SHARE("backup1") // Backup sram
13871357   AM_RANGE(0x02000000, 0x03ffffff) AM_ROM AM_REGION("user1", 0)
13881358
13891359   // "extra" data
13901360   AM_RANGE(0x06000000, 0x06ffffff) AM_ROM AM_REGION("user1", 0x1000000)
13911361
1392   AM_RANGE(0x10000000, 0x101fffff) AM_WRITE_LEGACY(mode_w)
1362   AM_RANGE(0x10000000, 0x101fffff) AM_WRITE(mode_w)
13931363
13941364   AM_RANGE(0x11600000, 0x1167ffff) AM_RAM   AM_SHARE("share1") // framebuffer (last bronx)
13951365   AM_RANGE(0x11680000, 0x116fffff) AM_RAM   AM_SHARE("share1") // FB mirror
r14896r14897
14001370   AM_RANGE(0x00200000, 0x0021ffff) AM_RAM
14011371   AM_RANGE(0x00220000, 0x0023ffff) AM_ROM AM_REGION("maincpu", 0x20000)
14021372
1403   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE_LEGACY(geo_prg_r, geo_prg_w)
1373   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE(geo_prg_r, geo_prg_w)
14041374
1405   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE_LEGACY(geo_prg_r, geo_prg_w)
1406   AM_RANGE(0x00880000, 0x00883fff) AM_WRITE_LEGACY(copro_function_port_w)
1407   AM_RANGE(0x00884000, 0x00887fff) AM_READWRITE_LEGACY(copro_fifo_r, copro_fifo_w)
1375   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE(geo_prg_r, geo_prg_w)
1376   AM_RANGE(0x00880000, 0x00883fff) AM_WRITE(copro_function_port_w)
1377   AM_RANGE(0x00884000, 0x00887fff) AM_READWRITE(copro_fifo_r, copro_fifo_w)
14081378
1409   AM_RANGE(0x00980000, 0x00980003) AM_WRITE_LEGACY(copro_ctl1_w )
1410   AM_RANGE(0x00980008, 0x0098000b) AM_WRITE_LEGACY(geo_ctl1_w )
1411   AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE_LEGACY(model2_serial_r, model2o_serial_w )
1379   AM_RANGE(0x00980000, 0x00980003) AM_WRITE(copro_ctl1_w )
1380   AM_RANGE(0x00980008, 0x0098000b) AM_WRITE(geo_ctl1_w )
1381   AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE(model2_serial_r, model2o_serial_w )
14121382
1413   AM_RANGE(0x12000000, 0x121fffff) AM_RAM_WRITE_LEGACY(model2o_tex_w0) AM_MIRROR(0x200000) AM_BASE(m_textureram0)   // texture RAM 0
1414   AM_RANGE(0x12400000, 0x125fffff) AM_RAM_WRITE_LEGACY(model2o_tex_w1) AM_MIRROR(0x200000) AM_BASE(m_textureram1)   // texture RAM 1
1415   AM_RANGE(0x12800000, 0x1281ffff) AM_RAM_WRITE_LEGACY(model2o_luma_w) AM_BASE(m_lumaram) // polygon "luma" RAM
1383   AM_RANGE(0x12000000, 0x121fffff) AM_RAM_WRITE(model2o_tex_w0) AM_MIRROR(0x200000) AM_BASE(m_textureram0)   // texture RAM 0
1384   AM_RANGE(0x12400000, 0x125fffff) AM_RAM_WRITE(model2o_tex_w1) AM_MIRROR(0x200000) AM_BASE(m_textureram1)   // texture RAM 1
1385   AM_RANGE(0x12800000, 0x1281ffff) AM_RAM_WRITE(model2o_luma_w) AM_BASE(m_lumaram) // polygon "luma" RAM
14161386
14171387   AM_RANGE(0x01c00000, 0x01c00003) AM_READ_PORT("1c00000")
14181388   AM_RANGE(0x01c00004, 0x01c00007) AM_READ_PORT("1c00004")
14191389   AM_RANGE(0x01c00010, 0x01c00013) AM_READ_PORT("1c00010")
14201390   AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014")
1421   AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_LEGACY(desert_unk_r )
1422   AM_RANGE(0x01c00040, 0x01c00043) AM_READ_LEGACY(daytona_unk_r )
1391   AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ(desert_unk_r )
1392   AM_RANGE(0x01c00040, 0x01c00043) AM_READ(daytona_unk_r )
14231393   AM_RANGE(0x01c00200, 0x01c002ff) AM_RAM AM_SHARE("backup2")
1424   AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE_LEGACY(model2_serial_r, model2o_serial_w )
1394   AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE(model2_serial_r, model2o_serial_w )
14251395
14261396   AM_IMPORT_FROM(model2_base_mem)
14271397ADDRESS_MAP_END
r14896r14897
14301400static ADDRESS_MAP_START( model2a_crx_mem, AS_PROGRAM, 32, model2_state )
14311401   AM_RANGE(0x00200000, 0x0023ffff) AM_RAM
14321402
1433   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE_LEGACY(geo_prg_r, geo_prg_w)
1403   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE(geo_prg_r, geo_prg_w)
14341404
1435   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE_LEGACY(geo_prg_r, geo_prg_w)
1436   AM_RANGE(0x00880000, 0x00883fff) AM_WRITE_LEGACY(copro_function_port_w)
1437   AM_RANGE(0x00884000, 0x00887fff) AM_READWRITE_LEGACY(copro_fifo_r, copro_fifo_w)
1405   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE(geo_prg_r, geo_prg_w)
1406   AM_RANGE(0x00880000, 0x00883fff) AM_WRITE(copro_function_port_w)
1407   AM_RANGE(0x00884000, 0x00887fff) AM_READWRITE(copro_fifo_r, copro_fifo_w)
14381408
1439   AM_RANGE(0x00980000, 0x00980003) AM_WRITE_LEGACY(copro_ctl1_w )
1440   AM_RANGE(0x00980008, 0x0098000b) AM_WRITE_LEGACY(geo_ctl1_w )
1441   AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE_LEGACY(model2_serial_r, model2_serial_w )
1409   AM_RANGE(0x00980000, 0x00980003) AM_WRITE(copro_ctl1_w )
1410   AM_RANGE(0x00980008, 0x0098000b) AM_WRITE(geo_ctl1_w )
1411   AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE(model2_serial_r, model2_serial_w )
14421412
1443   AM_RANGE(0x12000000, 0x121fffff) AM_RAM_WRITE_LEGACY(model2o_tex_w0) AM_MIRROR(0x200000) AM_BASE(m_textureram0)   // texture RAM 0
1444   AM_RANGE(0x12400000, 0x125fffff) AM_RAM_WRITE_LEGACY(model2o_tex_w1) AM_MIRROR(0x200000) AM_BASE(m_textureram1)   // texture RAM 1
1445   AM_RANGE(0x12800000, 0x1281ffff) AM_RAM_WRITE_LEGACY(model2o_luma_w) AM_BASE(m_lumaram) // polygon "luma" RAM
1413   AM_RANGE(0x12000000, 0x121fffff) AM_RAM_WRITE(model2o_tex_w0) AM_MIRROR(0x200000) AM_BASE(m_textureram0)   // texture RAM 0
1414   AM_RANGE(0x12400000, 0x125fffff) AM_RAM_WRITE(model2o_tex_w1) AM_MIRROR(0x200000) AM_BASE(m_textureram1)   // texture RAM 1
1415   AM_RANGE(0x12800000, 0x1281ffff) AM_RAM_WRITE(model2o_luma_w) AM_BASE(m_lumaram) // polygon "luma" RAM
14461416
1447   AM_RANGE(0x01c00000, 0x01c00003) AM_READ_PORT("1c00000") AM_WRITE_LEGACY(ctrl0_w )
1417   AM_RANGE(0x01c00000, 0x01c00003) AM_READ_PORT("1c00000") AM_WRITE(ctrl0_w )
14481418   AM_RANGE(0x01c00004, 0x01c00007) AM_READ_PORT("1c00004")
14491419   AM_RANGE(0x01c00010, 0x01c00013) AM_READ_PORT("1c00010")
14501420   AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014")
1451   AM_RANGE(0x01c00018, 0x01c0001b) AM_READ_LEGACY(hotd_unk_r )
1452   AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c") AM_WRITE_LEGACY(analog_2b_w )
1453   AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE_LEGACY(model2_serial_r, model2_serial_w )
1421   AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_unk_r )
1422   AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c") AM_WRITE(analog_2b_w )
1423   AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE(model2_serial_r, model2_serial_w )
14541424
14551425   AM_IMPORT_FROM(model2_base_mem)
14561426ADDRESS_MAP_END
r14896r14897
14591429static ADDRESS_MAP_START( model2b_crx_mem, AS_PROGRAM, 32, model2_state )
14601430   AM_RANGE(0x00200000, 0x0023ffff) AM_RAM
14611431
1462   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE_LEGACY(geo_prg_r, geo_prg_w)
1463   //AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE_LEGACY(geo_sharc_fifo_r, geo_sharc_fifo_w)
1464   //AM_RANGE(0x00840000, 0x00840fff) AM_WRITE_LEGACY(geo_sharc_iop_w)
1432   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE(geo_prg_r, geo_prg_w)
1433   //AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE(geo_sharc_fifo_r, geo_sharc_fifo_w)
1434   //AM_RANGE(0x00840000, 0x00840fff) AM_WRITE(geo_sharc_iop_w)
14651435
1466   AM_RANGE(0x00880000, 0x00883fff) AM_WRITE_LEGACY(copro_function_port_w)
1467   AM_RANGE(0x00884000, 0x00887fff) AM_READWRITE_LEGACY(copro_fifo_r, copro_fifo_w)
1468   AM_RANGE(0x008c0000, 0x008c0fff) AM_WRITE_LEGACY(copro_sharc_iop_w)
1436   AM_RANGE(0x00880000, 0x00883fff) AM_WRITE(copro_function_port_w)
1437   AM_RANGE(0x00884000, 0x00887fff) AM_READWRITE(copro_fifo_r, copro_fifo_w)
1438   AM_RANGE(0x008c0000, 0x008c0fff) AM_WRITE(copro_sharc_iop_w)
14691439
1470   AM_RANGE(0x00980000, 0x00980003) AM_WRITE_LEGACY(copro_ctl1_w )
1440   AM_RANGE(0x00980000, 0x00980003) AM_WRITE(copro_ctl1_w )
14711441
1472   AM_RANGE(0x00980008, 0x0098000b) AM_WRITE_LEGACY(geo_ctl1_w )
1473   //AM_RANGE(0x00980008, 0x0098000b) AM_WRITE_LEGACY(geo_sharc_ctl1_w )
1442   AM_RANGE(0x00980008, 0x0098000b) AM_WRITE(geo_ctl1_w )
1443   //AM_RANGE(0x00980008, 0x0098000b) AM_WRITE(geo_sharc_ctl1_w )
14741444
1475   AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE_LEGACY(model2_serial_r, model2_serial_w )
1445   AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE(model2_serial_r, model2_serial_w )
14761446
14771447   AM_RANGE(0x11000000, 0x111fffff) AM_RAM   AM_BASE(m_textureram0)   // texture RAM 0 (2b/2c)
14781448   AM_RANGE(0x11200000, 0x113fffff) AM_RAM   AM_BASE(m_textureram1)   // texture RAM 1 (2b/2c)
14791449   AM_RANGE(0x11400000, 0x1140ffff) AM_RAM   AM_BASE(m_lumaram)      // polygon "luma" RAM (2b/2c)
14801450
14811451
1482   AM_RANGE(0x01c00000, 0x01c00003) AM_READ_PORT("1c00000") AM_WRITE_LEGACY(ctrl0_w )
1452   AM_RANGE(0x01c00000, 0x01c00003) AM_READ_PORT("1c00000") AM_WRITE(ctrl0_w )
14831453   AM_RANGE(0x01c00004, 0x01c00007) AM_READ_PORT("1c00004")
14841454   AM_RANGE(0x01c00010, 0x01c00013) AM_READ_PORT("1c00010")
14851455   AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014")
1486   AM_RANGE(0x01c00018, 0x01c0001b) AM_READ_LEGACY(hotd_unk_r )
1487   AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c") AM_WRITE_LEGACY(analog_2b_w )
1488   AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE_LEGACY(model2_serial_r, model2_serial_w )
1456   AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_unk_r )
1457   AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c") AM_WRITE(analog_2b_w )
1458   AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE(model2_serial_r, model2_serial_w )
14891459
14901460   AM_IMPORT_FROM(model2_base_mem)
14911461ADDRESS_MAP_END
r14896r14897
14941464static ADDRESS_MAP_START( model2c_crx_mem, AS_PROGRAM, 32, model2_state )
14951465   AM_RANGE(0x00200000, 0x0023ffff) AM_RAM
14961466
1497   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE_LEGACY(geo_prg_r, geo_prg_w)
1498   AM_RANGE(0x00884000, 0x00887fff) AM_READWRITE_LEGACY(copro_prg_r, copro_prg_w)
1467   AM_RANGE(0x00804000, 0x00807fff) AM_READWRITE(geo_prg_r, geo_prg_w)
1468   AM_RANGE(0x00884000, 0x00887fff) AM_READWRITE(copro_prg_r, copro_prg_w)
14991469
1500   AM_RANGE(0x00980000, 0x00980003) AM_WRITE_LEGACY(copro_ctl1_w )
1501   AM_RANGE(0x00980008, 0x0098000b) AM_WRITE_LEGACY(geo_ctl1_w )
1502   AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE_LEGACY(model2_serial_r, model2_serial_w )
1470   AM_RANGE(0x00980000, 0x00980003) AM_WRITE(copro_ctl1_w )
1471   AM_RANGE(0x00980008, 0x0098000b) AM_WRITE(geo_ctl1_w )
1472   AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE(model2_serial_r, model2_serial_w )
15031473
15041474   AM_RANGE(0x11000000, 0x111fffff) AM_RAM   AM_BASE(m_textureram0)   // texture RAM 0 (2b/2c)
15051475   AM_RANGE(0x11200000, 0x113fffff) AM_RAM   AM_BASE(m_textureram1)   // texture RAM 1 (2b/2c)
15061476   AM_RANGE(0x11400000, 0x1140ffff) AM_RAM   AM_BASE(m_lumaram)      // polygon "luma" RAM (2b/2c)
15071477
1508   AM_RANGE(0x01c00000, 0x01c00003) AM_READ_PORT("1c00000") AM_WRITE_LEGACY(ctrl0_w )
1478   AM_RANGE(0x01c00000, 0x01c00003) AM_READ_PORT("1c00000") AM_WRITE(ctrl0_w )
15091479   AM_RANGE(0x01c00004, 0x01c00007) AM_READ_PORT("1c00004")
15101480   AM_RANGE(0x01c00010, 0x01c00013) AM_READ_PORT("1c00010")
15111481   AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014")
1512   AM_RANGE(0x01c00018, 0x01c0001b) AM_READ_LEGACY(hotd_unk_r )
1513   AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c") AM_WRITE_LEGACY(analog_2b_w )
1514   AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE_LEGACY(model2_serial_r, model2_serial_w )
1482   AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_unk_r )
1483   AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c") AM_WRITE(analog_2b_w )
1484   AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE(model2_serial_r, model2_serial_w )
15151485
15161486   AM_IMPORT_FROM(model2_base_mem)
15171487ADDRESS_MAP_END
r14896r14897
18321802
18331803/* Model 1 sound board emulation */
18341804
1835static READ16_HANDLER( m1_snd_68k_latch_r )
1805READ16_MEMBER(model2_state::m1_snd_68k_latch_r)
18361806{
1837   model2_state *state = space->machine().driver_data<model2_state>();
1838   return state->m_to_68k;
1807   return m_to_68k;
18391808}
18401809
1841static READ16_HANDLER( m1_snd_v60_ready_r )
1810READ16_MEMBER(model2_state::m1_snd_v60_ready_r)
18421811{
18431812   return 1;
18441813}
r14896r14897
18481817   multipcm_set_bank(device, 0x100000 * (data & 0xf), 0x100000 * (data & 0xf));
18491818}
18501819
1851static WRITE16_HANDLER( m1_snd_68k_latch1_w )
1820WRITE16_MEMBER(model2_state::m1_snd_68k_latch1_w)
18521821{
18531822}
18541823
1855static WRITE16_HANDLER( m1_snd_68k_latch2_w )
1824WRITE16_MEMBER(model2_state::m1_snd_68k_latch2_w)
18561825{
18571826}
18581827
18591828static ADDRESS_MAP_START( model1_snd, AS_PROGRAM, 16, model2_state )
18601829   AM_RANGE(0x000000, 0x07ffff) AM_ROM
18611830   AM_RANGE(0x080000, 0x0bffff) AM_ROM AM_REGION("audiocpu", 0x20000)   // mirror of second program ROM
1862   AM_RANGE(0xc20000, 0xc20001) AM_READWRITE_LEGACY(m1_snd_68k_latch_r, m1_snd_68k_latch1_w )
1863   AM_RANGE(0xc20002, 0xc20003) AM_READWRITE_LEGACY(m1_snd_v60_ready_r, m1_snd_68k_latch2_w )
1831   AM_RANGE(0xc20000, 0xc20001) AM_READWRITE(m1_snd_68k_latch_r, m1_snd_68k_latch1_w )
1832   AM_RANGE(0xc20002, 0xc20003) AM_READWRITE(m1_snd_v60_ready_r, m1_snd_68k_latch2_w )
18641833   AM_RANGE(0xc40000, 0xc40007) AM_DEVREADWRITE8_LEGACY("sega1", multipcm_r, multipcm_w, 0x00ff )
18651834   AM_RANGE(0xc40012, 0xc40013) AM_WRITENOP
18661835   AM_RANGE(0xc50000, 0xc50001) AM_DEVWRITE_LEGACY("sega1", m1_snd_mpcm_bnk_w )
r14896r14897
18721841
18731842/* Model 2 sound board emulation */
18741843
1875static WRITE16_HANDLER( model2snd_ctrl )
1844WRITE16_MEMBER(model2_state::model2snd_ctrl)
18761845{
18771846   // handle sample banking
1878   if (space->machine().region("scsp")->bytes() > 0x800000)
1847   if (machine().region("scsp")->bytes() > 0x800000)
18791848   {
1880      UINT8 *snd = space->machine().region("scsp")->base();
1849      UINT8 *snd = machine().region("scsp")->base();
18811850      if (data & 0x20)
18821851      {
1883         memory_set_bankptr(space->machine(), "bank4", snd + 0x200000);
1884         memory_set_bankptr(space->machine(), "bank5", snd + 0x600000);
1852         memory_set_bankptr(machine(), "bank4", snd + 0x200000);
1853         memory_set_bankptr(machine(), "bank5", snd + 0x600000);
18851854      }
18861855      else
18871856      {
1888         memory_set_bankptr(space->machine(), "bank4", snd + 0x800000);
1889         memory_set_bankptr(space->machine(), "bank5", snd + 0xa00000);
1857         memory_set_bankptr(machine(), "bank4", snd + 0x800000);
1858         memory_set_bankptr(machine(), "bank5", snd + 0xa00000);
18901859      }
18911860   }
18921861}
r14896r14897
18941863static ADDRESS_MAP_START( model2_snd, AS_PROGRAM, 16, model2_state )
18951864   AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_REGION("audiocpu", 0) AM_BASE(m_soundram)
18961865   AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE_LEGACY("scsp", scsp_r, scsp_w)
1897   AM_RANGE(0x400000, 0x400001) AM_WRITE_LEGACY(model2snd_ctrl)
1866   AM_RANGE(0x400000, 0x400001) AM_WRITE(model2snd_ctrl)
18981867   AM_RANGE(0x600000, 0x67ffff) AM_ROM AM_REGION("audiocpu", 0x80000)
18991868   AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("scsp", 0)
19001869   AM_RANGE(0xa00000, 0xdfffff) AM_ROMBANK("bank4")
r14896r14897
19261895/*****************************************************************************/
19271896// SHARC memory maps
19281897
1929static READ32_HANDLER(copro_sharc_input_fifo_r)
1898READ32_MEMBER(model2_state::copro_sharc_input_fifo_r)
19301899{
19311900   UINT32 result = 0;
1932   //mame_printf_debug("SHARC FIFOIN pop at %08X\n", cpu_get_pc(&space->device()));
1901   //mame_printf_debug("SHARC FIFOIN pop at %08X\n", cpu_get_pc(&space.device()));
19331902
1934   copro_fifoin_pop(space->machine().device("dsp"), &result);
1903   copro_fifoin_pop(machine().device("dsp"), &result);
19351904   return result;
19361905}
19371906
1938static WRITE32_HANDLER(copro_sharc_output_fifo_w)
1907WRITE32_MEMBER(model2_state::copro_sharc_output_fifo_w)
19391908{
19401909   //mame_printf_debug("SHARC FIFOOUT push %08X\n", data);
1941   copro_fifoout_push(space->machine().device("dsp"), data);
1910   copro_fifoout_push(machine().device("dsp"), data);
19421911}
19431912
1944static READ32_HANDLER(copro_sharc_buffer_r)
1913READ32_MEMBER(model2_state::copro_sharc_buffer_r)
19451914{
1946   model2_state *state = space->machine().driver_data<model2_state>();
1947   return state->m_bufferram[offset & 0x7fff];
1915   return m_bufferram[offset & 0x7fff];
19481916}
19491917
1950static WRITE32_HANDLER(copro_sharc_buffer_w)
1918WRITE32_MEMBER(model2_state::copro_sharc_buffer_w)
19511919{
1952   model2_state *state = space->machine().driver_data<model2_state>();
1953   //mame_printf_debug("sharc_buffer_w: %08X at %08X, %08X, %f\n", offset, cpu_get_pc(&space->device()), data, *(float*)&data);
1954   state->m_bufferram[offset & 0x7fff] = data;
1920   //mame_printf_debug("sharc_buffer_w: %08X at %08X, %08X, %f\n", offset, cpu_get_pc(&space.device()), data, *(float*)&data);
1921   m_bufferram[offset & 0x7fff] = data;
19551922}
19561923
19571924static ADDRESS_MAP_START( copro_sharc_map, AS_DATA, 32, model2_state )
1958   AM_RANGE(0x0400000, 0x0bfffff) AM_READ_LEGACY(copro_sharc_input_fifo_r)
1959   AM_RANGE(0x0c00000, 0x13fffff) AM_WRITE_LEGACY(copro_sharc_output_fifo_w)
1960   AM_RANGE(0x1400000, 0x1bfffff) AM_READWRITE_LEGACY(copro_sharc_buffer_r, copro_sharc_buffer_w)
1925   AM_RANGE(0x0400000, 0x0bfffff) AM_READ(copro_sharc_input_fifo_r)
1926   AM_RANGE(0x0c00000, 0x13fffff) AM_WRITE(copro_sharc_output_fifo_w)
1927   AM_RANGE(0x1400000, 0x1bfffff) AM_READWRITE(copro_sharc_buffer_r, copro_sharc_buffer_w)
19611928   AM_RANGE(0x1c00000, 0x1dfffff) AM_ROM AM_REGION("user5", 0)
19621929ADDRESS_MAP_END
19631930
r14896r14897
19691936/*****************************************************************************/
19701937/* TGP memory maps */
19711938
1972static READ32_HANDLER(copro_tgp_buffer_r)
1939READ32_MEMBER(model2_state::copro_tgp_buffer_r)
19731940{
1974   model2_state *state = space->machine().driver_data<model2_state>();
1975   return state->m_bufferram[offset & 0x7fff];
1941   return m_bufferram[offset & 0x7fff];
19761942}
19771943
1978static WRITE32_HANDLER(copro_tgp_buffer_w)
1944WRITE32_MEMBER(model2_state::copro_tgp_buffer_w)
19791945{
1980   model2_state *state = space->machine().driver_data<model2_state>();
1981   state->m_bufferram[offset&0x7fff] = data;
1946   m_bufferram[offset&0x7fff] = data;
19821947}
19831948
19841949static ADDRESS_MAP_START( copro_tgp_map, AS_PROGRAM, 32, model2_state )
19851950   AM_RANGE(0x00000000, 0x00007fff) AM_RAM AM_BASE(m_tgp_program)
1986   AM_RANGE(0x00400000, 0x00407fff) AM_READWRITE_LEGACY(copro_tgp_buffer_r, copro_tgp_buffer_w)
1951   AM_RANGE(0x00400000, 0x00407fff) AM_READWRITE(copro_tgp_buffer_r, copro_tgp_buffer_w)
19871952   AM_RANGE(0xff800000, 0xff9fffff) AM_ROM AM_REGION("tgp", 0)
19881953ADDRESS_MAP_END
19891954
r14896r14897
21082073   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
21092074MACHINE_CONFIG_END
21102075
2111static READ8_HANDLER( driveio_port_r )
2076READ8_MEMBER(model2_state::driveio_port_r)
21122077{
2113   model2_state *state = space->machine().driver_data<model2_state>();
2114   return state->m_driveio_comm_data;
2078   return m_driveio_comm_data;
21152079}
21162080
2117static WRITE8_HANDLER( driveio_port_w )
2081WRITE8_MEMBER(model2_state::driveio_port_w)
21182082{
21192083//  TODO: hook up to the main CPU
21202084//  popmessage("%02x",data);
21212085}
21222086
2123static READ8_HANDLER( driveio_port_str_r )
2087READ8_MEMBER(model2_state::driveio_port_str_r)
21242088{
21252089   static const char sega_str[4] = { 'S', 'E', 'G', 'A' };
21262090
r14896r14897
21352099static ADDRESS_MAP_START( drive_io_map, AS_IO, 8, model2_state )
21362100   ADDRESS_MAP_GLOBAL_MASK(0xff)
21372101   AM_RANGE(0x00, 0x00) AM_WRITENOP //watchdog
2138   AM_RANGE(0x23, 0x23) AM_WRITE_LEGACY(driveio_port_w)
2139   AM_RANGE(0x26, 0x27) AM_READ_LEGACY(driveio_port_r)
2140   AM_RANGE(0x28, 0x2b) AM_READ_LEGACY(driveio_port_str_r)
2102   AM_RANGE(0x23, 0x23) AM_WRITE(driveio_port_w)
2103   AM_RANGE(0x26, 0x27) AM_READ(driveio_port_r)
2104   AM_RANGE(0x28, 0x2b) AM_READ(driveio_port_str_r)
21412105   AM_RANGE(0x40, 0x4f) AM_WRITENOP //Oki M6253
21422106   AM_RANGE(0x80, 0x83) AM_NOP //r/w it during irq
21432107ADDRESS_MAP_END
r14896r14897
51465110static DRIVER_INIT( genprot )
51475111{
51485112   model2_state *state = machine.driver_data<model2_state>();
5149   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x01d80000, 0x01dfffff, FUNC(model2_prot_r), FUNC(model2_prot_w));
5113   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),state), write32_delegate(FUNC(model2_state::model2_prot_w),state));
51505114   state->m_protstate = state->m_protpos = 0;
51515115}
51525116
r14896r14897
51555119   model2_state *state = machine.driver_data<model2_state>();
51565120   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
51575121
5158   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x01d80000, 0x01dfffff, FUNC(model2_prot_r), FUNC(model2_prot_w));
5122   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),state), write32_delegate(FUNC(model2_state::model2_prot_w),state));
51595123   state->m_protstate = state->m_protpos = 0;
51605124
51615125   // fix bug in program: it destroys the interrupt table and never fixes it
r14896r14897
51675131   model2_state *state = machine.driver_data<model2_state>();
51685132   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
51695133
5170   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x01d80000, 0x01dfffff, FUNC(model2_prot_r), FUNC(model2_prot_w));
5134   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),state), write32_delegate(FUNC(model2_state::model2_prot_w),state));
51715135   state->m_protstate = state->m_protpos = 0;
51725136
51735137   // fix bug in program: it destroys the interrupt table and never fixes it
r14896r14897
51765140
51775141static DRIVER_INIT( daytonam )
51785142{
5179   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x240000, 0x24ffff, FUNC(maxx_r) );
5143   model2_state *state = machine.driver_data<model2_state>();
5144   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x240000, 0x24ffff, read32_delegate(FUNC(model2_state::maxx_r),state));
51805145}
51815146
51825147/* very crude support for let the game set itself into stand-alone mode */
51835148
5184static READ32_HANDLER( jaleco_network_r )
5149READ32_MEMBER(model2_state::jaleco_network_r)
51855150{
5186   model2_state *state = space->machine().driver_data<model2_state>();
51875151   if(offset == 0x4000/4)
51885152   {
5189      if(state->m_netram[offset] == 0x00000000)
5190         state->m_jnet_time_out = 0;
5153      if(m_netram[offset] == 0x00000000)
5154         m_jnet_time_out = 0;
51915155
5192      if((state->m_netram[offset] & 0xffff) == 0x0001)
5193         state->m_jnet_time_out++;
5156      if((m_netram[offset] & 0xffff) == 0x0001)
5157         m_jnet_time_out++;
51945158
5195      if(state->m_jnet_time_out > 0x80)
5196         state->m_netram[offset]|= 0x00800000;
5159      if(m_jnet_time_out > 0x80)
5160         m_netram[offset]|= 0x00800000;
51975161
5198      return state->m_netram[offset];
5162      return m_netram[offset];
51995163   }
52005164
5201   return state->m_netram[offset];
5165   return m_netram[offset];
52025166}
52035167
5204static WRITE32_HANDLER( jaleco_network_w )
5168WRITE32_MEMBER(model2_state::jaleco_network_w)
52055169{
5206   model2_state *state = space->machine().driver_data<model2_state>();
5207   COMBINE_DATA(&state->m_netram[offset]);
5170   COMBINE_DATA(&m_netram[offset]);
52085171}
52095172
52105173static DRIVER_INIT( sgt24h )
r14896r14897
52125175   model2_state *state = machine.driver_data<model2_state>();
52135176   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
52145177
5215   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x01d80000, 0x01dfffff, FUNC(model2_prot_r), FUNC(model2_prot_w));
5216   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x01a10000, 0x01a1ffff, FUNC(jaleco_network_r), FUNC(jaleco_network_w));
5178   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),state), write32_delegate(FUNC(model2_state::model2_prot_w),state));
5179   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),state), write32_delegate(FUNC(model2_state::jaleco_network_w),state));
52175180
52185181   state->m_protstate = state->m_protpos = 0;
52195182
r14896r14897
52235186
52245187static DRIVER_INIT( overrev )
52255188{
5226   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x01a10000, 0x01a1ffff, FUNC(jaleco_network_r), FUNC(jaleco_network_w));
5189   model2_state *state = machine.driver_data<model2_state>();
5190   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),state), write32_delegate(FUNC(model2_state::jaleco_network_w),state));
52275191
52285192   //TODO: cache patch?
52295193}
r14896r14897
52345198   model2_state *state = machine.driver_data<model2_state>();
52355199   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
52365200
5237   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x01d80000, 0x01dfffff, FUNC(model2_prot_r), FUNC(model2_prot_w));
5201   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),state), write32_delegate(FUNC(model2_state::model2_prot_w),state));
52385202   state->m_protstate = state->m_protpos = 0;
52395203
52405204   ROM[0x630/4] = 0x08000004;
r14896r14897
52435207
52445208static DRIVER_INIT( rchase2 )
52455209{
5246   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x01c00008, 0x01c0000b, FUNC(rchase2_devices_w));
5210   model2_state *state = machine.driver_data<model2_state>();
5211   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01c00008, 0x01c0000b, write32_delegate(FUNC(model2_state::rchase2_devices_w),state));
52475212}
52485213
52495214static DRIVER_INIT( srallyc )
52505215{
5251   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x01c00008, 0x01c0000b, FUNC(srallyc_devices_w));
5216   model2_state *state = machine.driver_data<model2_state>();
5217   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01c00008, 0x01c0000b, write32_delegate(FUNC(model2_state::srallyc_devices_w),state));
52525218}
52535219
52545220
src/mame/drivers/sshot.c
r14896r14897
163163{
164164public:
165165   supershot_state(const machine_config &mconfig, device_type type, const char *tag)
166      : driver_device(mconfig, type, tag) { }
166      : driver_device(mconfig, type, tag) ,
167      m_videoram(*this, "videoram"){ }
167168
168   UINT8      *m_videoram;
169   required_shared_ptr<UINT8> m_videoram;
169170   tilemap_t   *m_tilemap;
170171   DECLARE_WRITE8_MEMBER(supershot_vidram_w);
171172   DECLARE_WRITE8_MEMBER(supershot_output0_w);
r14896r14897
182183{
183184   supershot_state *state = machine.driver_data<supershot_state>();
184185
185   UINT8 code = state->m_videoram[tile_index];
186   UINT8 code = state->m_videoram.target()[tile_index];
186187   SET_TILE_INFO(0, code, 0, 0);
187188}
188189
r14896r14897
202203WRITE8_MEMBER(supershot_state::supershot_vidram_w)
203204{
204205
205   m_videoram[offset] = data;
206   m_videoram.target()[offset] = data;
206207   m_tilemap->mark_tile_dirty(offset);
207208}
208209
src/mame/drivers/popeye.c
r14896r14897
395395{
396396   popeye_state *state = device->machine().driver_data<popeye_state>();
397397   /* bit 0 flips screen */
398   flip_screen_set(device->machine(), data & 1);
398   state->flip_screen_set(data & 1);
399399
400400   /* bits 1-3 select DSW1 bit to read */
401401   state->m_dswbit = (data & 0x0e) >> 1;
src/mame/drivers/gstream.c
r14896r14897
132132      : driver_device(mconfig, type, tag),
133133        m_maincpu(*this, "maincpu"),
134134        m_oki_1(*this, "oki1"),
135        m_oki_2(*this, "oki2") { }
135        m_oki_2(*this, "oki2") ,
136      m_workram(*this, "workram"),
137      m_vram(*this, "vram"),
138      m_paletteram(*this, "paletteram"){ }
136139
140   /* devices */
141   required_device<e132xt_device> m_maincpu;
142   required_device<okim6295_device> m_oki_1;
143   required_device<okim6295_device> m_oki_2;
144
137145   /* memory pointers */
138   UINT32 *  m_vram;
139   UINT32 *  m_workram;
140   UINT32 *  m_paletteram;
146   required_shared_ptr<UINT32> m_workram;
147   required_shared_ptr<UINT32> m_vram;
148   required_shared_ptr<UINT32> m_paletteram;
141149//  UINT32 *  m_nvram;    // currently this uses generic nvram handling
142150
143151   /* video-related */
r14896r14897
155163   int       m_oki_bank_0;
156164   int       m_oki_bank_1;
157165
158   /* devices */
159   required_device<e132xt_device> m_maincpu;
160   required_device<okim6295_device> m_oki_1;
161   required_device<okim6295_device> m_oki_2;
162166   DECLARE_WRITE32_MEMBER(gstream_palette_w);
163167   DECLARE_WRITE32_MEMBER(gstream_vram_w);
164168   DECLARE_WRITE32_MEMBER(gstream_tilemap1_scrollx_w);
r14896r14897
207211
208212WRITE32_MEMBER(gstream_state::gstream_palette_w)
209213{
210   COMBINE_DATA(&m_paletteram[offset]);
214   COMBINE_DATA(&m_paletteram.target()[offset]);
211215
212   palette_set_color_rgb(machine(), offset * 2, pal5bit(m_paletteram[offset] >> (0 + 16)),
213                           pal5bit(m_paletteram[offset] >> (6 + 16)),
214                           pal5bit(m_paletteram[offset] >> (11 + 16)));
216   palette_set_color_rgb(machine(), offset * 2, pal5bit(m_paletteram.target()[offset] >> (0 + 16)),
217                           pal5bit(m_paletteram.target()[offset] >> (6 + 16)),
218                           pal5bit(m_paletteram.target()[offset] >> (11 + 16)));
215219
216220
217   palette_set_color_rgb(machine(),offset * 2 + 1,pal5bit(m_paletteram[offset] >> (0)),
218                           pal5bit(m_paletteram[offset] >> (6)),
219                           pal5bit(m_paletteram[offset] >> (11)));
221   palette_set_color_rgb(machine(),offset * 2 + 1,pal5bit(m_paletteram.target()[offset] >> (0)),
222                           pal5bit(m_paletteram.target()[offset] >> (6)),
223                           pal5bit(m_paletteram.target()[offset] >> (11)));
220224}
221225
222226WRITE32_MEMBER(gstream_state::gstream_vram_w)
223227{
224   COMBINE_DATA(&m_vram[offset]);
228   COMBINE_DATA(&m_vram.target()[offset]);
225229
226230   if (ACCESSING_BITS_24_31)
227231   {
r14896r14897
271275}
272276
273277static ADDRESS_MAP_START( gstream_32bit_map, AS_PROGRAM, 32, gstream_state )
274   AM_RANGE(0x00000000, 0x003FFFFF) AM_RAM AM_BASE(m_workram) // work ram
278   AM_RANGE(0x00000000, 0x003FFFFF) AM_RAM AM_SHARE("workram") // work ram
275279//  AM_RANGE(0x40000000, 0x40FFFFFF) AM_RAM // ?? lots of data gets copied here if present, but game runs without it??
276   AM_RANGE(0x80000000, 0x80003FFF) AM_RAM_WRITE(gstream_vram_w) AM_BASE(m_vram) // video ram
280   AM_RANGE(0x80000000, 0x80003FFF) AM_RAM_WRITE(gstream_vram_w) AM_SHARE("vram") // video ram
277281   AM_RANGE(0x4E000000, 0x4E1FFFFF) AM_ROM AM_REGION("user2",0) // main game rom
278282   AM_RANGE(0x4F000000, 0x4F000003) AM_WRITE(gstream_tilemap3_scrollx_w)
279283   AM_RANGE(0x4F200000, 0x4F200003) AM_WRITE(gstream_tilemap3_scrolly_w)
280   AM_RANGE(0x4F400000, 0x4F406FFF) AM_RAM_WRITE(gstream_palette_w) AM_BASE(m_paletteram)
284   AM_RANGE(0x4F400000, 0x4F406FFF) AM_RAM_WRITE(gstream_palette_w) AM_SHARE("paletteram")
281285   AM_RANGE(0x4F800000, 0x4F800003) AM_WRITE(gstream_tilemap1_scrollx_w)
282286   AM_RANGE(0x4FA00000, 0x4FA00003) AM_WRITE(gstream_tilemap1_scrolly_w)
283287   AM_RANGE(0x4FC00000, 0x4FC00003) AM_WRITE(gstream_tilemap2_scrollx_w)
r14896r14897
443447static TILE_GET_INFO( get_gs1_tile_info )
444448{
445449   gstream_state *state = machine.driver_data<gstream_state>();
446   int tileno = (state->m_vram[tile_index + 0x000 / 4] & 0x0fff0000) >> 16;
447   int palette = (state->m_vram[tile_index + 0x000 / 4] & 0xc0000000) >> 30;
450   int tileno = (state->m_vram.target()[tile_index + 0x000 / 4] & 0x0fff0000) >> 16;
451   int palette = (state->m_vram.target()[tile_index + 0x000 / 4] & 0xc0000000) >> 30;
448452   SET_TILE_INFO(0, tileno, palette + 0x10, 0);
449453}
450454
451455static TILE_GET_INFO( get_gs2_tile_info )
452456{
453457   gstream_state *state = machine.driver_data<gstream_state>();
454   int tileno = (state->m_vram[tile_index + 0x400 / 4] & 0x0fff0000) >> 16;
455   int palette = (state->m_vram[tile_index + 0x400 / 4] & 0xc0000000) >> 30;
458   int tileno = (state->m_vram.target()[tile_index + 0x400 / 4] & 0x0fff0000) >> 16;
459   int palette = (state->m_vram.target()[tile_index + 0x400 / 4] & 0xc0000000) >> 30;
456460   SET_TILE_INFO(0, tileno + 0x1000, palette + 0x14, 0);
457461}
458462
r14896r14897
460464static TILE_GET_INFO( get_gs3_tile_info )
461465{
462466   gstream_state *state = machine.driver_data<gstream_state>();
463   int tileno = (state->m_vram[tile_index + 0x800 / 4] & 0x0fff0000) >> 16;
464   int palette = (state->m_vram[tile_index + 0x800 / 4] & 0xc0000000) >> 30;
467   int tileno = (state->m_vram.target()[tile_index + 0x800 / 4] & 0x0fff0000) >> 16;
468   int palette = (state->m_vram.target()[tile_index + 0x800 / 4] & 0xc0000000) >> 30;
465469   SET_TILE_INFO(0, tileno + 0x2000, palette + 0x18, 0);
466470}
467471
r14896r14897
514518   for (i = 0x0000 / 4; i < 0x4000 / 4; i += 4)
515519   {
516520      /* Upper bits are used by the tilemaps */
517      int code = state->m_vram[i + 0] & 0xffff;
518      int x = state->m_vram[i + 1] & 0xffff;
519      int y = state->m_vram[i + 2] & 0xffff;
520      int col = state->m_vram[i + 3] & 0x1f;
521      int code = state->m_vram.target()[i + 0] & 0xffff;
522      int x = state->m_vram.target()[i + 1] & 0xffff;
523      int y = state->m_vram.target()[i + 2] & 0xffff;
524      int col = state->m_vram.target()[i + 3] & 0x1f;
521525
522526      /* co-ordinates are signed */
523527      if (x & 0x8000) x -= 0x10000;
r14896r14897
638642      m_maincpu->eat_cycles(50);
639643   }
640644
641   return m_workram[0xd1ee0 / 4];
645   return m_workram.target()[0xd1ee0 / 4];
642646}
643647
644648static DRIVER_INIT( gstream )
src/mame/drivers/igs017.c
r14896r14897
5555   igs017_state(const machine_config &mconfig, device_type type, const char *tag)
5656      : driver_device(mconfig, type, tag),
5757      m_input_addr(-1),
58      m_maincpu(*this, "maincpu")
59      { }
58      m_maincpu(*this, "maincpu"),
59      m_spriteram(*this, "spriteram"),
60      m_fg_videoram(*this, "fg_videoram"),
61      m_bg_videoram(*this, "bg_videoram"){ }
6062
63   int m_input_addr;
64   required_device<cpu_device> m_maincpu;
65   required_shared_ptr<UINT8> m_spriteram;
66   required_shared_ptr<UINT8> m_fg_videoram;
67   required_shared_ptr<UINT8> m_bg_videoram;
68
6169   int m_toggle;
6270   int m_debug_addr;
6371   int m_debug_width;
6472   UINT8 m_video_disable;
65   UINT8 *m_fg_videoram;
66   UINT8 *m_bg_videoram;
6773   tilemap_t *m_fg_tilemap;
6874   tilemap_t *m_bg_tilemap;
6975   UINT8 *m_sprites_gfx;
r14896r14897
7177   int m_nmi_enable;
7278   int m_irq_enable;
7379   UINT8 m_input_select;
74   int m_input_addr;
7580   UINT8 m_hopper;
7681   UINT16 m_igs_magic[2];
7782   UINT8 m_scramble_data;
7883   UINT8 m_prot[2];
7984   int m_irq1_enable;
8085   int m_irq2_enable;
81   UINT8 *m_spriteram;
82
83   required_device<cpu_device> m_maincpu;
8486   DECLARE_WRITE8_MEMBER(video_disable_w);
8587   DECLARE_WRITE16_MEMBER(video_disable_lsb_w);
8688   DECLARE_WRITE8_MEMBER(fg_w);
r14896r14897
154156static TILE_GET_INFO( get_fg_tile_info )
155157{
156158   igs017_state *state = machine.driver_data<igs017_state>();
157   int code = state->m_fg_videoram[tile_index*4+0] + (state->m_fg_videoram[tile_index*4+1] << 8);
158   int attr = state->m_fg_videoram[tile_index*4+2] + (state->m_fg_videoram[tile_index*4+3] << 8);
159   int code = state->m_fg_videoram.target()[tile_index*4+0] + (state->m_fg_videoram.target()[tile_index*4+1] << 8);
160   int attr = state->m_fg_videoram.target()[tile_index*4+2] + (state->m_fg_videoram.target()[tile_index*4+3] << 8);
159161   SET_TILE_INFO(0, code, COLOR(attr), TILE_FLIPXY( attr >> 5 ));
160162}
161163static TILE_GET_INFO( get_bg_tile_info )
162164{
163165   igs017_state *state = machine.driver_data<igs017_state>();
164   int code = state->m_bg_videoram[tile_index*4+0] + (state->m_bg_videoram[tile_index*4+1] << 8);
165   int attr = state->m_bg_videoram[tile_index*4+2] + (state->m_bg_videoram[tile_index*4+3] << 8);
166   int code = state->m_bg_videoram.target()[tile_index*4+0] + (state->m_bg_videoram.target()[tile_index*4+1] << 8);
167   int attr = state->m_bg_videoram.target()[tile_index*4+2] + (state->m_bg_videoram.target()[tile_index*4+3] << 8);
166168   SET_TILE_INFO(0, code, COLOR(attr)+8, TILE_FLIPXY( attr >> 5 ));
167169}
168170
169171WRITE8_MEMBER(igs017_state::fg_w)
170172{
171   m_fg_videoram[offset] = data;
173   m_fg_videoram.target()[offset] = data;
172174   m_fg_tilemap->mark_tile_dirty(offset/4);
173175}
174176
175177WRITE8_MEMBER(igs017_state::bg_w)
176178{
177   m_bg_videoram[offset] = data;
179   m_bg_videoram.target()[offset] = data;
178180   m_bg_tilemap->mark_tile_dirty(offset/4);
179181}
180182
r14896r14897
182184
183185READ16_MEMBER(igs017_state::fg_lsb_r)
184186{
185   return m_fg_videoram[offset];
187   return m_fg_videoram.target()[offset];
186188}
187189WRITE16_MEMBER(igs017_state::fg_lsb_w)
188190{
r14896r14897
192194
193195READ16_MEMBER(igs017_state::bg_lsb_r)
194196{
195   return m_bg_videoram[offset];
197   return m_bg_videoram.target()[offset];
196198}
197199WRITE16_MEMBER(igs017_state::bg_lsb_w)
198200{
r14896r14897
202204
203205READ16_MEMBER(igs017_state::spriteram_lsb_r)
204206{
205   return m_spriteram[offset];
207   return m_spriteram.target()[offset];
206208}
207209WRITE16_MEMBER(igs017_state::spriteram_lsb_w)
208210{
209211   if (ACCESSING_BITS_0_7)
210      m_spriteram[offset] = data;
212      m_spriteram.target()[offset] = data;
211213}
212214
213215
r14896r14897
304306static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
305307{
306308   igs017_state *state = machine.driver_data<igs017_state>();
307   UINT8 *s   =   state->m_spriteram;
309   UINT8 *s   =   state->m_spriteram.target();
308310   UINT8 *end   =   state->m_spriteram + 0x800;
309311
310312   for ( ; s < end; s += 8 )
r14896r14897
12941296static ADDRESS_MAP_START( iqblocka_io, AS_IO, 8, igs017_state )
12951297   AM_RANGE( 0x0000, 0x003f ) AM_RAM // internal regs
12961298
1297   AM_RANGE( 0x1000, 0x17ff ) AM_RAM AM_BASE(m_spriteram)
1298   AM_RANGE( 0x1800, 0x1bff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w ) AM_SHARE("paletteram")
1299   AM_RANGE( 0x1000, 0x17ff ) AM_RAM AM_SHARE("spriteram")
1300   AM_RANGE( 0x1800, 0x1bff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w ) AM_SHARE("paletteram")
12991301   AM_RANGE( 0x1c00, 0x1fff ) AM_RAM
13001302
13011303//  AM_RANGE(0x200a, 0x200a) AM_WRITENOP
r14896r14897
14201422   AM_RANGE( 0x300000, 0x303fff ) AM_RAM
14211423   AM_RANGE( 0x49c000, 0x49c003 ) AM_WRITE(mgcs_magic_w )
14221424   AM_RANGE( 0x49c002, 0x49c003 ) AM_READ(mgcs_magic_r )
1423   AM_RANGE( 0xa02000, 0xa02fff ) AM_READWRITE(spriteram_lsb_r, spriteram_lsb_w ) AM_BASE(m_spriteram)
1425   AM_RANGE( 0xa02000, 0xa02fff ) AM_READWRITE(spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
14241426   AM_RANGE( 0xa03000, 0xa037ff ) AM_RAM_WRITE(mgcs_paletteram_w ) AM_SHARE("paletteram")
14251427   AM_RANGE( 0xa04020, 0xa04027 ) AM_DEVREAD8_LEGACY("ppi8255", ppi8255_r, 0x00ff )
14261428   AM_RANGE( 0xa04024, 0xa04025 ) AM_WRITE(video_disable_lsb_w )
r14896r14897
15171519static ADDRESS_MAP_START( sdmg2, AS_PROGRAM, 16, igs017_state )
15181520   AM_RANGE(0x000000, 0x07ffff) AM_ROM
15191521   AM_RANGE(0x1f0000, 0x1fffff) AM_RAM
1520   AM_RANGE(0x202000, 0x202fff) AM_READWRITE(spriteram_lsb_r, spriteram_lsb_w ) AM_BASE(m_spriteram)
1522   AM_RANGE(0x202000, 0x202fff) AM_READWRITE(spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
15211523   AM_RANGE(0x203000, 0x2037ff) AM_RAM_WRITE(sdmg2_paletteram_w ) AM_SHARE("paletteram")
15221524   AM_RANGE(0x204020, 0x204027) AM_DEVREAD8_LEGACY("ppi8255", ppi8255_r, 0x00ff )
15231525   AM_RANGE(0x204024, 0x204025) AM_WRITE(video_disable_lsb_w )
r14896r14897
16381640   AM_RANGE(0x600000, 0x603fff) AM_RAM
16391641   AM_RANGE(0x876000, 0x876003) AM_WRITE(mgdha_magic_w )
16401642   AM_RANGE(0x876002, 0x876003) AM_READ(mgdha_magic_r )
1641   AM_RANGE(0xa02000, 0xa02fff) AM_READWRITE(spriteram_lsb_r, spriteram_lsb_w ) AM_BASE(m_spriteram)
1643   AM_RANGE(0xa02000, 0xa02fff) AM_READWRITE(spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
16421644   AM_RANGE(0xa03000, 0xa037ff) AM_RAM_WRITE(sdmg2_paletteram_w ) AM_SHARE("paletteram")
16431645//  AM_RANGE(0xa04014, 0xa04015) // written with FF at boot
16441646   AM_RANGE(0xa04020, 0xa04027) AM_DEVREAD8_LEGACY("ppi8255", ppi8255_r, 0x00ff )
r14896r14897
17271729static ADDRESS_MAP_START( tjsb_io, AS_IO, 8, igs017_state )
17281730   AM_RANGE( 0x0000, 0x003f ) AM_RAM // internal regs
17291731
1730   AM_RANGE( 0x1000, 0x17ff ) AM_RAM AM_BASE(m_spriteram)
1732   AM_RANGE( 0x1000, 0x17ff ) AM_RAM AM_SHARE("spriteram")
17311733   AM_RANGE( 0x1800, 0x1bff ) AM_RAM_WRITE(tjsb_paletteram_w ) AM_SHARE("paletteram")
17321734   AM_RANGE( 0x1c00, 0x1fff ) AM_RAM
17331735
r14896r14897
18151817   AM_RANGE(0x500000, 0x503fff) AM_RAM
18161818   AM_RANGE(0x910000, 0x910003) AM_WRITE( lhzb2_magic_w )
18171819   AM_RANGE(0x910002, 0x910003) AM_READ( lhzb2_magic_r )
1818   AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_BASE( m_spriteram )
1820   AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
18191821   AM_RANGE(0xb03000, 0xb037ff) AM_RAM_WRITE( lhzb2a_paletteram_w ) AM_SHARE("paletteram")
18201822   AM_RANGE(0xb04020, 0xb04027) AM_DEVREAD8_LEGACY( "ppi8255", ppi8255_r, 0x00ff )
18211823   AM_RANGE(0xb04024, 0xb04025) AM_WRITE( video_disable_lsb_w )
18221824   AM_RANGE(0xb04028, 0xb04029) AM_WRITE( irq2_enable_w )
18231825   AM_RANGE(0xb0402a, 0xb0402b) AM_WRITE( irq1_enable_w )
1824   AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_BASE( m_fg_videoram )
1825   AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE( m_bg_videoram )
1826   AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_SHARE("fg_videoram")
1827   AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_SHARE("bg_videoram")
18261828   AM_RANGE(0xb10000, 0xb10001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
18271829ADDRESS_MAP_END
18281830
r14896r14897
19471949   AM_RANGE(0x000000, 0x07ffff) AM_ROM
19481950   AM_RANGE(0x500000, 0x503fff) AM_RAM
19491951//  AM_RANGE(0x910000, 0x910003) protection
1950   AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_BASE( m_spriteram )
1952   AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
19511953   AM_RANGE(0xb03000, 0xb037ff) AM_RAM_WRITE( lhzb2a_paletteram_w ) AM_SHARE("paletteram")
19521954   AM_RANGE(0xb04024, 0xb04025) AM_WRITE( video_disable_lsb_w )
19531955   AM_RANGE(0xb04028, 0xb04029) AM_WRITE( irq2_enable_w )
19541956   AM_RANGE(0xb0402a, 0xb0402b) AM_WRITE( irq1_enable_w )
1955   AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_BASE( m_fg_videoram )
1956   AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE( m_bg_videoram )
1957   AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_SHARE("fg_videoram")
1958   AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_SHARE("bg_videoram")
19571959   AM_RANGE(0xb10000, 0xb10001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
19581960   AM_RANGE(0xb12000, 0xb12001) AM_WRITE( lhzb2a_input_select_w )
19591961//  Inputs dynamically mapped at xx8000, protection at xx4000 (xx = f0 initially). xx written to xxc000
r14896r14897
20282030   AM_RANGE(0x100000, 0x103fff) AM_RAM
20292031   AM_RANGE(0x602000, 0x602003) AM_WRITE( slqz2_magic_w )
20302032   AM_RANGE(0x602002, 0x602003) AM_READ( slqz2_magic_r )
2031   AM_RANGE(0x902000, 0x902fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_BASE( m_spriteram )
2033   AM_RANGE(0x902000, 0x902fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
20322034   AM_RANGE(0x903000, 0x9037ff) AM_RAM_WRITE( slqz2_paletteram_w ) AM_SHARE("paletteram")
20332035   AM_RANGE(0x904020, 0x904027) AM_DEVREAD8_LEGACY( "ppi8255", ppi8255_r, 0x00ff )
20342036   AM_RANGE(0x904024, 0x904025) AM_WRITE( video_disable_lsb_w )
20352037   AM_RANGE(0x904028, 0x904029) AM_WRITE( irq2_enable_w )
20362038   AM_RANGE(0x90402a, 0x90402b) AM_WRITE( irq1_enable_w )
2037   AM_RANGE(0x908000, 0x90bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_BASE( m_fg_videoram )
2038   AM_RANGE(0x90c000, 0x90ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE( m_bg_videoram )
2039   AM_RANGE(0x908000, 0x90bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_SHARE("fg_videoram")
2040   AM_RANGE(0x90c000, 0x90ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_SHARE("bg_videoram")
20392041   AM_RANGE(0x910000, 0x910001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
20402042ADDRESS_MAP_END
20412043
src/mame/drivers/pushman.c
r14896r14897
3535{
3636   if (ACCESSING_BITS_8_15)
3737   {
38      flip_screen_set(machine(), data & 0x0200);
38      flip_screen_set(data & 0x0200);
3939      coin_counter_w(machine(), 0, data & 0x4000);
4040      coin_counter_w(machine(), 1, data & 0x8000);
4141   }
r14896r14897
4444WRITE16_MEMBER(pushman_state::pushman_control_w)
4545{
4646   if (ACCESSING_BITS_8_15)
47      soundlatch_w(space, 0, (data >> 8) & 0xff);
47      soundlatch_byte_w(space, 0, (data >> 8) & 0xff);
4848}
4949
5050READ16_MEMBER(pushman_state::pushman_68705_r)
r14896r14897
153153   AM_RANGE(0xfe8000, 0xfe8003) AM_WRITE(pushman_scroll_w)
154154   AM_RANGE(0xfe800e, 0xfe800f) AM_WRITENOP /* ? */
155155   AM_RANGE(0xfec000, 0xfec7ff) AM_RAM_WRITE(pushman_videoram_w) AM_BASE(m_videoram)
156   AM_RANGE(0xff8000, 0xff87ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
156   AM_RANGE(0xff8000, 0xff87ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
157157   AM_RANGE(0xffc000, 0xffffff) AM_RAM
158158ADDRESS_MAP_END
159159
r14896r14897
166166static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, pushman_state )
167167   AM_RANGE(0x0000, 0x7fff) AM_ROM
168168   AM_RANGE(0xc000, 0xc7ff) AM_RAM
169   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
169   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
170170ADDRESS_MAP_END
171171
172172static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, pushman_state )
r14896r14897
186186   AM_RANGE(0xe8000, 0xe8003) AM_WRITE(pushman_scroll_w)
187187   AM_RANGE(0xe800e, 0xe800f) AM_WRITENOP /* ? */
188188   AM_RANGE(0xec000, 0xec7ff) AM_RAM_WRITE(pushman_videoram_w) AM_BASE(m_videoram)
189   AM_RANGE(0xf8000, 0xf87ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
189   AM_RANGE(0xf8000, 0xf87ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
190190   AM_RANGE(0xfc000, 0xfffff) AM_RAM
191191ADDRESS_MAP_END
192192
src/mame/drivers/hyperspt.c
r14896r14897
4040   AM_RANGE(0x1481, 0x1481) AM_WRITE_LEGACY(konami_sh_irqtrigger_w)  /* cause interrupt on audio CPU */
4141   AM_RANGE(0x1483, 0x1484) AM_WRITE(hyperspt_coin_counter_w)
4242   AM_RANGE(0x1487, 0x1487) AM_WRITE(irq_mask_w)  /* Interrupt enable */
43   AM_RANGE(0x1500, 0x1500) AM_WRITE(soundlatch_w)
43   AM_RANGE(0x1500, 0x1500) AM_WRITE(soundlatch_byte_w)
4444   AM_RANGE(0x1600, 0x1600) AM_READ_PORT("DSW2")
4545   AM_RANGE(0x1680, 0x1680) AM_READ_PORT("SYSTEM")
4646   AM_RANGE(0x1681, 0x1681) AM_READ_PORT("P1_P2")
r14896r14897
6161   AM_RANGE(0x1481, 0x1481) AM_WRITE_LEGACY(konami_sh_irqtrigger_w)  /* cause interrupt on audio CPU */
6262   AM_RANGE(0x1483, 0x1484) AM_WRITE(hyperspt_coin_counter_w)
6363   AM_RANGE(0x1487, 0x1487) AM_WRITE(irq_mask_w)  /* Interrupt enable */
64   AM_RANGE(0x1500, 0x1500) AM_WRITE(soundlatch_w)
64   AM_RANGE(0x1500, 0x1500) AM_WRITE(soundlatch_byte_w)
6565   AM_RANGE(0x1600, 0x1600) AM_READ_PORT("DSW2")
6666   AM_RANGE(0x1680, 0x1680) AM_READ_PORT("SYSTEM")
6767   AM_RANGE(0x1681, 0x1681) AM_READ_PORT("P1")
r14896r14897
7777static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, hyperspt_state )
7878   AM_RANGE(0x0000, 0x3fff) AM_ROM
7979   AM_RANGE(0x4000, 0x4fff) AM_RAM
80   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
80   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
8181   AM_RANGE(0x8000, 0x8000) AM_READ_LEGACY(hyperspt_sh_timer_r)
8282   AM_RANGE(0xa000, 0xa000) AM_DEVWRITE_LEGACY("vlm", vlm5030_data_w) /* speech data */
8383   AM_RANGE(0xc000, 0xdfff) AM_DEVWRITE_LEGACY("vlm", hyperspt_sound_w)     /* speech and output control */
r14896r14897
8989static ADDRESS_MAP_START( soundb_map, AS_PROGRAM, 8, hyperspt_state )
9090   AM_RANGE(0x0000, 0x3fff) AM_ROM
9191   AM_RANGE(0x4000, 0x4fff) AM_RAM
92   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
92   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
9393   AM_RANGE(0x8000, 0x8000) AM_READ_LEGACY(hyperspt_sh_timer_r)
9494   AM_RANGE(0xa000, 0xa000) AM_NOP
9595   AM_RANGE(0xc000, 0xdfff) AM_DEVWRITE_LEGACY("hyprolyb_adpcm", hyprolyb_adpcm_w)     /* speech and output control */
src/mame/drivers/shanghai.c
r14896r14897
142142
143143static ADDRESS_MAP_START( shangha2_map, AS_PROGRAM, 16, shanghai_state )
144144   AM_RANGE(0x00000, 0x03fff) AM_RAM
145   AM_RANGE(0x04000, 0x041ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
145   AM_RANGE(0x04000, 0x041ff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
146146   AM_RANGE(0x80000, 0xfffff) AM_ROM
147147ADDRESS_MAP_END
148148
r14896r14897
181181   AM_RANGE(0x09012, 0x09013) AM_READ_PORT("P2")
182182   AM_RANGE(0x09014, 0x09015) AM_READ_PORT("SYSTEM")
183183   AM_RANGE(0x09016, 0x0901f) AM_WRITENOP // 0x9016 is set to 0 at the boot
184   AM_RANGE(0x0a000, 0x0a1ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
184   AM_RANGE(0x0a000, 0x0a1ff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
185185   AM_RANGE(0x0b010, 0x0b01f) AM_READWRITE_LEGACY(seibu_main_word_r, seibu_main_word_w)
186186   AM_RANGE(0x80000, 0xfffff) AM_ROM
187187ADDRESS_MAP_END
src/mame/drivers/namcos12.c
r14896r14897
10671067   int m_s12_setstate;
10681068   int m_s12_setnum;
10691069   int m_s12_settings[8];
1070   DECLARE_WRITE32_MEMBER(sharedram_w);
1071   DECLARE_READ32_MEMBER(sharedram_r);
1072   DECLARE_WRITE16_MEMBER(sharedram_sub_w);
1073   DECLARE_READ16_MEMBER(sharedram_sub_r);
1074   DECLARE_WRITE32_MEMBER(bankoffset_w);
1075   DECLARE_WRITE32_MEMBER(dmaoffset_w);
1076   DECLARE_WRITE32_MEMBER(s12_dma_bias_w);
1077   DECLARE_WRITE32_MEMBER(system11gun_w);
1078   DECLARE_READ32_MEMBER(system11gun_r);
1079   DECLARE_WRITE32_MEMBER(kcoff_w);
1080   DECLARE_WRITE32_MEMBER(kcon_w);
1081   DECLARE_WRITE32_MEMBER(tektagt_protection_1_w);
1082   DECLARE_READ32_MEMBER(tektagt_protection_1_r);
1083   DECLARE_WRITE32_MEMBER(tektagt_protection_2_w);
1084   DECLARE_READ32_MEMBER(tektagt_protection_2_r);
1085   DECLARE_READ32_MEMBER(tektagt_protection_3_r);
1086   DECLARE_READ8_MEMBER(s12_mcu_p8_r);
1087   DECLARE_READ8_MEMBER(s12_mcu_pa_r);
1088   DECLARE_WRITE8_MEMBER(s12_mcu_pa_w);
1089   DECLARE_READ8_MEMBER(s12_mcu_rtc_r);
1090   DECLARE_READ8_MEMBER(s12_mcu_portB_r);
1091   DECLARE_WRITE8_MEMBER(s12_mcu_portB_w);
1092   DECLARE_WRITE8_MEMBER(s12_mcu_settings_w);
1093   DECLARE_READ8_MEMBER(s12_mcu_gun_h_r);
1094   DECLARE_READ8_MEMBER(s12_mcu_gun_v_r);
10701095};
10711096
10721097INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
r14896r14897
10821107   }
10831108}
10841109
1085static WRITE32_HANDLER( sharedram_w )
1110WRITE32_MEMBER(namcos12_state::sharedram_w)
10861111{
1087   namcos12_state *state = space->machine().driver_data<namcos12_state>();
10881112
1089   verboselog( space->machine(), 1, "sharedram_w( %08x, %08x, %08x )\n", ( offset * 4 ), data, mem_mask );
1090   COMBINE_DATA( &state->m_sharedram[ offset ] );
1113   verboselog( machine(), 1, "sharedram_w( %08x, %08x, %08x )\n", ( offset * 4 ), data, mem_mask );
1114   COMBINE_DATA( &m_sharedram[ offset ] );
10911115}
10921116
1093static READ32_HANDLER( sharedram_r )
1117READ32_MEMBER(namcos12_state::sharedram_r)
10941118{
1095   namcos12_state *state = space->machine().driver_data<namcos12_state>();
10961119
1097   verboselog( space->machine(), 1, "sharedram_r( %08x, %08x ) %08x\n", ( offset * 4 ), mem_mask, state->m_sharedram[ offset ] );
1098   return state->m_sharedram[ offset ];
1120   verboselog( machine(), 1, "sharedram_r( %08x, %08x ) %08x\n", ( offset * 4 ), mem_mask, m_sharedram[ offset ] );
1121   return m_sharedram[ offset ];
10991122}
11001123
1101static WRITE16_HANDLER( sharedram_sub_w )
1124WRITE16_MEMBER(namcos12_state::sharedram_sub_w)
11021125{
1103   namcos12_state *state = space->machine().driver_data<namcos12_state>();
11041126
1105   UINT16 *shared16 = (UINT16 *)state->m_sharedram;
1127   UINT16 *shared16 = (UINT16 *)m_sharedram;
11061128
11071129   COMBINE_DATA(&shared16[BYTE_XOR_LE(offset)]);
11081130}
11091131
1110static READ16_HANDLER( sharedram_sub_r )
1132READ16_MEMBER(namcos12_state::sharedram_sub_r)
11111133{
1112   namcos12_state *state = space->machine().driver_data<namcos12_state>();
11131134
1114   UINT16 *shared16 = (UINT16 *)state->m_sharedram;
1135   UINT16 *shared16 = (UINT16 *)m_sharedram;
11151136
11161137   return shared16[BYTE_XOR_LE(offset)];
11171138}
11181139
1119static WRITE32_HANDLER( bankoffset_w )
1140WRITE32_MEMBER(namcos12_state::bankoffset_w)
11201141{
1121   namcos12_state *state = space->machine().driver_data<namcos12_state>();
11221142
11231143   // Golgo 13 has different banking (maybe the keycus controls it?)
1124   if( strcmp( space->machine().system().name, "golgo13" ) == 0 ||
1125      strcmp( space->machine().system().name, "g13knd" ) == 0 )
1144   if( strcmp( machine().system().name, "golgo13" ) == 0 ||
1145      strcmp( machine().system().name, "g13knd" ) == 0 )
11261146   {
11271147      if( ( data & 8 ) != 0 )
11281148      {
1129         state->m_n_bankoffset = ( data & 0x6 ) << 2;
1149         m_n_bankoffset = ( data & 0x6 ) << 2;
11301150      }
11311151      else
11321152      {
1133         state->m_n_bankoffset = ( state->m_n_bankoffset & ~0x7 ) | ( data & 0x7 );
1153         m_n_bankoffset = ( m_n_bankoffset & ~0x7 ) | ( data & 0x7 );
11341154      }
11351155   }
11361156   else
11371157   {
1138      state->m_n_bankoffset = data;
1158      m_n_bankoffset = data;
11391159   }
11401160
1141   memory_set_bank( space->machine(), "bank1", state->m_n_bankoffset );
1161   memory_set_bank( machine(), "bank1", m_n_bankoffset );
11421162
1143   verboselog( space->machine(), 1, "bankoffset_w( %08x, %08x, %08x ) %08x\n", offset, data, mem_mask, state->m_n_bankoffset );
1163   verboselog( machine(), 1, "bankoffset_w( %08x, %08x, %08x ) %08x\n", offset, data, mem_mask, m_n_bankoffset );
11441164}
11451165
1146static WRITE32_HANDLER( dmaoffset_w )
1166WRITE32_MEMBER(namcos12_state::dmaoffset_w)
11471167{
1148   namcos12_state *state = space->machine().driver_data<namcos12_state>();
11491168
11501169   if( ACCESSING_BITS_0_15 )
11511170   {
1152      state->m_n_dmaoffset = ( offset * 4 ) | ( data << 16 );
1171      m_n_dmaoffset = ( offset * 4 ) | ( data << 16 );
11531172   }
11541173   if( ACCESSING_BITS_16_31 )
11551174   {
1156      state->m_n_dmaoffset = ( ( offset * 4 ) + 2 ) | ( data & 0xffff0000 );
1175      m_n_dmaoffset = ( ( offset * 4 ) + 2 ) | ( data & 0xffff0000 );
11571176   }
1158   verboselog( space->machine(), 1, "dmaoffset_w( %08x, %08x, %08x ) %08x\n", offset, data, mem_mask, state->m_n_dmaoffset );
1177   verboselog( machine(), 1, "dmaoffset_w( %08x, %08x, %08x ) %08x\n", offset, data, mem_mask, m_n_dmaoffset );
11591178}
11601179
11611180static void namcos12_rom_read( namcos12_state *state, UINT32 n_address, INT32 n_size )
r14896r14897
12221241   irq1_line_pulse( state->machine().device( "sub" ) );
12231242}
12241243
1225static WRITE32_HANDLER( s12_dma_bias_w )
1244WRITE32_MEMBER(namcos12_state::s12_dma_bias_w)
12261245{
1227   namcos12_state *state = space->machine().driver_data<namcos12_state>();
12281246
1229   state->m_n_dmabias = data;
1247   m_n_dmabias = data;
12301248}
12311249
12321250static ADDRESS_MAP_START( namcos12_map, AS_PROGRAM, 32, namcos12_state )
12331251   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("share1") /* ram */
1234   AM_RANGE(0x1f000000, 0x1f000003) AM_READNOP AM_WRITE_LEGACY(bankoffset_w)         /* banking */
1235   AM_RANGE(0x1f080000, 0x1f083fff) AM_READWRITE_LEGACY(sharedram_r, sharedram_w) AM_BASE(m_sharedram) /* shared ram?? */
1252   AM_RANGE(0x1f000000, 0x1f000003) AM_READNOP AM_WRITE(bankoffset_w)         /* banking */
1253   AM_RANGE(0x1f080000, 0x1f083fff) AM_READWRITE(sharedram_r, sharedram_w) AM_BASE(m_sharedram) /* shared ram?? */
12361254   AM_RANGE(0x1f140000, 0x1f140fff) AM_DEVREADWRITE8_LEGACY("at28c16", at28c16_r, at28c16_w, 0x00ff00ff) /* eeprom */
12371255   AM_RANGE(0x1f1bff08, 0x1f1bff0f) AM_WRITENOP    /* ?? */
1238   AM_RANGE(0x1f700000, 0x1f70ffff) AM_WRITE_LEGACY(dmaoffset_w)  /* dma */
1239   AM_RANGE(0x1f801000, 0x1f801003) AM_WRITE_LEGACY(s12_dma_bias_w)
1256   AM_RANGE(0x1f700000, 0x1f70ffff) AM_WRITE(dmaoffset_w)  /* dma */
1257   AM_RANGE(0x1f801000, 0x1f801003) AM_WRITE(s12_dma_bias_w)
12401258   AM_RANGE(0x1fa00000, 0x1fbfffff) AM_ROMBANK("bank1") /* banked roms */
12411259   AM_RANGE(0x1fc00000, 0x1fffffff) AM_ROM AM_SHARE("share2") AM_REGION("user1", 0) /* bios */
12421260   AM_RANGE(0x80000000, 0x803fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
r14896r14897
12461264   AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP
12471265ADDRESS_MAP_END
12481266
1249static WRITE32_HANDLER( system11gun_w )
1267WRITE32_MEMBER(namcos12_state::system11gun_w)
12501268{
12511269   if( ACCESSING_BITS_0_15 )
12521270   {
r14896r14897
12631281      output_set_value("P2_Start_lamp", (~data & 0x04)>>2);
12641282
12651283
1266      verboselog( space->machine(), 1, "system11gun_w: outputs (%08x %08x)\n", data, mem_mask );
1284      verboselog( machine(), 1, "system11gun_w: outputs (%08x %08x)\n", data, mem_mask );
12671285   }
12681286   if( ACCESSING_BITS_16_31 )
12691287   {
1270      verboselog( space->machine(), 2, "system11gun_w: start reading (%08x %08x)\n", data, mem_mask );
1288      verboselog( machine(), 2, "system11gun_w: start reading (%08x %08x)\n", data, mem_mask );
12711289   }
12721290}
12731291
1274static READ32_HANDLER( system11gun_r )
1292READ32_MEMBER(namcos12_state::system11gun_r)
12751293{
12761294   UINT32 data = 0;
12771295   switch( offset )
12781296   {
12791297   case 0:
1280      data = input_port_read(space->machine(), "LIGHT0_X");
1298      data = input_port_read(machine(), "LIGHT0_X");
12811299      break;
12821300   case 1:
1283      data = ( input_port_read(space->machine(), "LIGHT0_Y") ) | ( ( input_port_read(space->machine(), "LIGHT0_Y") + 1 ) << 16 );
1301      data = ( input_port_read(machine(), "LIGHT0_Y") ) | ( ( input_port_read(machine(), "LIGHT0_Y") + 1 ) << 16 );
12841302      break;
12851303   case 2:
1286      data = input_port_read(space->machine(), "LIGHT1_X");
1304      data = input_port_read(machine(), "LIGHT1_X");
12871305      break;
12881306   case 3:
1289      data = ( input_port_read(space->machine(), "LIGHT1_Y") ) | ( ( input_port_read(space->machine(), "LIGHT1_Y") + 1 ) << 16 );
1307      data = ( input_port_read(machine(), "LIGHT1_Y") ) | ( ( input_port_read(machine(), "LIGHT1_Y") + 1 ) << 16 );
12901308      break;
12911309   }
1292   verboselog( space->machine(), 2, "system11gun_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
1310   verboselog( machine(), 2, "system11gun_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
12931311   return data;
12941312}
12951313
12961314static void system11gun_install( running_machine &machine )
12971315{
1298   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x1f788000, 0x1f788003, FUNC(system11gun_w) );
1299   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x1f780000, 0x1f78000f, FUNC(system11gun_r) );
1316   namcos12_state *state = machine.driver_data<namcos12_state>();
1317   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f788000, 0x1f788003, write32_delegate(FUNC(namcos12_state::system11gun_w),state));
1318   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler (0x1f780000, 0x1f78000f, read32_delegate(FUNC(namcos12_state::system11gun_r),state));
13001319}
13011320
1302static WRITE32_HANDLER( kcoff_w )
1321WRITE32_MEMBER(namcos12_state::kcoff_w)
13031322{
1304   memory_set_bankptr( space->machine(), "bank2", space->machine().region( "user1" )->base() + 0x20280 );
1323   memory_set_bankptr( machine(), "bank2", machine().region( "user1" )->base() + 0x20280 );
13051324}
13061325
1307static WRITE32_HANDLER( kcon_w )
1326WRITE32_MEMBER(namcos12_state::kcon_w)
13081327{
1309   namcos12_state *state = space->machine().driver_data<namcos12_state>();
13101328
1311   memory_set_bankptr( space->machine(), "bank2", state->m_kcram );
1329   memory_set_bankptr( machine(), "bank2", m_kcram );
13121330}
13131331
1314static WRITE32_HANDLER( tektagt_protection_1_w )
1332WRITE32_MEMBER(namcos12_state::tektagt_protection_1_w)
13151333{
1316   namcos12_state *state = space->machine().driver_data<namcos12_state>();
13171334
13181335   // Second dma offset or protection ref values write
1319   state->m_n_tektagdmaoffset = data;
1320   if(state->m_ttt_cnt != 2)
1321      state->m_ttt_val[state->m_ttt_cnt++] = data;
1336   m_n_tektagdmaoffset = data;
1337   if(m_ttt_cnt != 2)
1338      m_ttt_val[m_ttt_cnt++] = data;
13221339}
13231340
1324static READ32_HANDLER( tektagt_protection_1_r )
1341READ32_MEMBER(namcos12_state::tektagt_protection_1_r)
13251342{
13261343   // Reads are either ignored or bit 15 is tested for a busy flag
13271344   return 0x8000;
13281345}
13291346
1330static WRITE32_HANDLER( tektagt_protection_2_w )
1347WRITE32_MEMBER(namcos12_state::tektagt_protection_2_w)
13311348{
1332   namcos12_state *state = space->machine().driver_data<namcos12_state>();
13331349
13341350   // Writes are 0 or rand(), only used as a "start prot value write" trigger
1335   state->m_ttt_cnt = 0;
1351   m_ttt_cnt = 0;
13361352}
13371353
1338static READ32_HANDLER( tektagt_protection_2_r )
1354READ32_MEMBER(namcos12_state::tektagt_protection_2_r)
13391355{
1340   namcos12_state *state = space->machine().driver_data<namcos12_state>();
1341   UINT32 *ttt_val = state->m_ttt_val;
1356   UINT32 *ttt_val = m_ttt_val;
13421357   UINT32 data = 0;
13431358
13441359   if(((ttt_val[0] >> 16) & 0xff) == 0x6d)
r14896r14897
13591374   return data;
13601375}
13611376
1362static READ32_HANDLER( tektagt_protection_3_r )
1377READ32_MEMBER(namcos12_state::tektagt_protection_3_r)
13631378{
13641379   // Always ignored
13651380   return 0;
r14896r14897
13691384{
13701385   namcos12_state *state = machine.driver_data<namcos12_state>();
13711386   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1372   bankoffset_w(space,0,0,0xffffffff);
1387   state->bankoffset_w(*space,0,0,0xffffffff);
13731388   state->m_has_tektagt_dma = 0;
13741389
13751390   if( strcmp( machine.system().name, "tektagt" ) == 0 ||
r14896r14897
13801395      strcmp( machine.system().name, "tektagtja" ) == 0 )
13811396   {
13821397      state->m_has_tektagt_dma = 1;
1383      space->install_legacy_readwrite_handler(0x1fb00000, 0x1fb00003, FUNC(tektagt_protection_1_r), FUNC(tektagt_protection_1_w) );
1384      space->install_legacy_readwrite_handler(0x1fb80000, 0x1fb80003, FUNC(tektagt_protection_2_r), FUNC(tektagt_protection_2_w) );
1385      space->install_legacy_read_handler(0x1f700000, 0x1f700003, FUNC(tektagt_protection_3_r) );
1398      space->install_readwrite_handler(0x1fb00000, 0x1fb00003, read32_delegate(FUNC(namcos12_state::tektagt_protection_1_r),state), write32_delegate(FUNC(namcos12_state::tektagt_protection_1_w),state));
1399      space->install_readwrite_handler(0x1fb80000, 0x1fb80003, read32_delegate(FUNC(namcos12_state::tektagt_protection_2_r),state), write32_delegate(FUNC(namcos12_state::tektagt_protection_2_w),state));
1400      space->install_read_handler(0x1f700000, 0x1f700003, read32_delegate(FUNC(namcos12_state::tektagt_protection_3_r),state));
13861401   }
13871402
13881403   if( strcmp( machine.system().name, "tektagt" ) == 0 ||
r14896r14897
14091424   {
14101425      /* this is based on guesswork, it might not even be keycus. */
14111426      space->install_read_bank (0x1fc20280, 0x1fc2028b, "bank2" );
1412      space->install_legacy_write_handler(0x1f008000, 0x1f008003, FUNC(kcon_w) );
1413      space->install_legacy_write_handler(0x1f018000, 0x1f018003, FUNC(kcoff_w) );
1427      space->install_write_handler(0x1f008000, 0x1f008003, write32_delegate(FUNC(namcos12_state::kcon_w),state));
1428      space->install_write_handler(0x1f018000, 0x1f018003, write32_delegate(FUNC(namcos12_state::kcoff_w),state));
14141429
14151430      memset( state->m_kcram, 0, sizeof( state->m_kcram ) );
14161431      memory_set_bankptr( space->machine(), "bank2", state->m_kcram );
r14896r14897
14201435/* H8/3002 MCU stuff */
14211436static ADDRESS_MAP_START( s12h8rwmap, AS_PROGRAM, 16, namcos12_state )
14221437   AM_RANGE(0x000000, 0x07ffff) AM_ROM
1423   AM_RANGE(0x080000, 0x08ffff) AM_READWRITE_LEGACY(sharedram_sub_r, sharedram_sub_w )
1438   AM_RANGE(0x080000, 0x08ffff) AM_READWRITE(sharedram_sub_r, sharedram_sub_w )
14241439   AM_RANGE(0x280000, 0x287fff) AM_DEVREADWRITE("c352", c352_device, read, write)
14251440   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")
14261441   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")
r14896r14897
14281443   AM_RANGE(0x300030, 0x300031) AM_NOP   // most S12 bioses write here simply to generate a wait state.  there is no deeper meaning.
14291444ADDRESS_MAP_END
14301445
1431static READ8_HANDLER( s12_mcu_p8_r )
1446READ8_MEMBER(namcos12_state::s12_mcu_p8_r)
14321447{
14331448   return 0x02;
14341449}
r14896r14897
14371452// in System 12, bit 0 of H8/3002 port A is connected to it's chip enable
14381453// the actual I/O takes place through the H8/3002's serial port B.
14391454
1440static READ8_HANDLER( s12_mcu_pa_r )
1455READ8_MEMBER(namcos12_state::s12_mcu_pa_r)
14411456{
1442   namcos12_state *state = space->machine().driver_data<namcos12_state>();
14431457
1444   return state->m_s12_porta;
1458   return m_s12_porta;
14451459}
14461460
1447static WRITE8_HANDLER( s12_mcu_pa_w )
1461WRITE8_MEMBER(namcos12_state::s12_mcu_pa_w)
14481462{
1449   namcos12_state *state = space->machine().driver_data<namcos12_state>();
14501463
14511464   // bit 0 = chip enable for the RTC
14521465   // reset the state on the rising edge of the bit
1453   if ((!(state->m_s12_porta & 1)) && (data & 1))
1466   if ((!(m_s12_porta & 1)) && (data & 1))
14541467   {
1455      state->m_s12_rtcstate = 0;
1468      m_s12_rtcstate = 0;
14561469   }
14571470
1458   state->m_s12_porta = data;
1471   m_s12_porta = data;
14591472}
14601473
14611474INLINE UINT8 make_bcd(UINT8 data)
r14896r14897
14631476   return ((data / 10) << 4) | (data % 10);
14641477}
14651478
1466static READ8_HANDLER( s12_mcu_rtc_r )
1479READ8_MEMBER(namcos12_state::s12_mcu_rtc_r)
14671480{
1468   namcos12_state *state = space->machine().driver_data<namcos12_state>();
14691481   UINT8 ret = 0;
14701482   system_time systime;
14711483   static const int weekday[7] = { 7, 1, 2, 3, 4, 5, 6 };
14721484
1473   space->machine().current_datetime(systime);
1485   machine().current_datetime(systime);
14741486
1475   switch (state->m_s12_rtcstate)
1487   switch (m_s12_rtcstate)
14761488   {
14771489      case 0:
14781490         ret = make_bcd(systime.local_time.second);   // seconds (BCD, 0-59) in bits 0-6, bit 7 = battery low
r14896r14897
15001512         break;
15011513   }
15021514
1503   state->m_s12_rtcstate++;
1515   m_s12_rtcstate++;
15041516
15051517   return ret;
15061518}
15071519
1508static READ8_HANDLER( s12_mcu_portB_r )
1520READ8_MEMBER(namcos12_state::s12_mcu_portB_r)
15091521{
1510   namcos12_state *state = space->machine().driver_data<namcos12_state>();
15111522
15121523   // golgo13 won't boot if this doesn't toggle every read
1513   state->m_s12_lastpB ^= 0x80;
1514   return state->m_s12_lastpB;
1524   m_s12_lastpB ^= 0x80;
1525   return m_s12_lastpB;
15151526}
15161527
1517static WRITE8_HANDLER( s12_mcu_portB_w )
1528WRITE8_MEMBER(namcos12_state::s12_mcu_portB_w)
15181529{
1519   namcos12_state *state = space->machine().driver_data<namcos12_state>();
15201530
15211531   // bit 7 = chip enable for the video settings controller
15221532   if (data & 0x80)
15231533   {
1524      state->m_s12_setstate = 0;
1534      m_s12_setstate = 0;
15251535   }
15261536
1527   state->m_s12_lastpB = data;
1537   m_s12_lastpB = data;
15281538}
15291539
1530static WRITE8_HANDLER( s12_mcu_settings_w )
1540WRITE8_MEMBER(namcos12_state::s12_mcu_settings_w)
15311541{
1532   namcos12_state *state = space->machine().driver_data<namcos12_state>();
1533   int *s12_settings = state->m_s12_settings;
1542   int *s12_settings = m_s12_settings;
15341543
1535   if (state->m_s12_setstate)
1544   if (m_s12_setstate)
15361545   {
15371546      // data
1538      s12_settings[state->m_s12_setnum] = data;
1547      s12_settings[m_s12_setnum] = data;
15391548
1540      if (state->m_s12_setnum == 7)
1549      if (m_s12_setnum == 7)
15411550      {
15421551         logerror("S12 video settings: Contrast: %02x  R: %02x  G: %02x  B: %02x\n",
15431552            BITSWAP8(s12_settings[0], 0, 1, 2, 3, 4, 5, 6, 7),
r14896r14897
15481557   }
15491558   else
15501559   {   // setting number
1551      state->m_s12_setnum = (data >> 4)-1;
1560      m_s12_setnum = (data >> 4)-1;
15521561   }
15531562
1554   state->m_s12_setstate ^= 1;
1563   m_s12_setstate ^= 1;
15551564}
15561565
15571566/* Golgo 13 lightgun inputs
r14896r14897
15611570 * within the 16-bit word.
15621571 */
15631572
1564static READ8_HANDLER( s12_mcu_gun_h_r )
1573READ8_MEMBER(namcos12_state::s12_mcu_gun_h_r)
15651574{
1566   const input_port_config *port = space->machine().port("LIGHT0_X");
1575   const input_port_config *port = machine().port("LIGHT0_X");
15671576   if( port != NULL )
15681577   {
15691578      int rv = input_port_read_direct( port ) << 6;
r14896r14897
15801589   return 0;
15811590}
15821591
1583static READ8_HANDLER( s12_mcu_gun_v_r )
1592READ8_MEMBER(namcos12_state::s12_mcu_gun_v_r)
15841593{
1585   const input_port_config *port = space->machine().port("LIGHT0_Y");
1594   const input_port_config *port = machine().port("LIGHT0_Y");
15861595   if( port != NULL )
15871596   {
15881597      int rv = input_port_read_direct( port ) << 6;
r14896r14897
16011610
16021611static ADDRESS_MAP_START( s12h8iomap, AS_IO, 8, namcos12_state )
16031612   AM_RANGE(H8_PORT_7, H8_PORT_7) AM_READ_PORT("DSW")
1604   AM_RANGE(H8_PORT_8, H8_PORT_8) AM_READ_LEGACY(s12_mcu_p8_r ) AM_WRITENOP
1605   AM_RANGE(H8_PORT_A, H8_PORT_A) AM_READWRITE_LEGACY(s12_mcu_pa_r, s12_mcu_pa_w )
1606   AM_RANGE(H8_PORT_B, H8_PORT_B) AM_READWRITE_LEGACY(s12_mcu_portB_r, s12_mcu_portB_w )
1607   AM_RANGE(H8_SERIAL_1, H8_SERIAL_1) AM_READ_LEGACY(s12_mcu_rtc_r ) AM_WRITE_LEGACY(s12_mcu_settings_w )
1613   AM_RANGE(H8_PORT_8, H8_PORT_8) AM_READ(s12_mcu_p8_r ) AM_WRITENOP
1614   AM_RANGE(H8_PORT_A, H8_PORT_A) AM_READWRITE(s12_mcu_pa_r, s12_mcu_pa_w )
1615   AM_RANGE(H8_PORT_B, H8_PORT_B) AM_READWRITE(s12_mcu_portB_r, s12_mcu_portB_w )
1616   AM_RANGE(H8_SERIAL_1, H8_SERIAL_1) AM_READ(s12_mcu_rtc_r ) AM_WRITE(s12_mcu_settings_w )
16081617   AM_RANGE(H8_ADC_0_H, H8_ADC_0_L) AM_NOP
1609   AM_RANGE(H8_ADC_1_H, H8_ADC_1_L) AM_READ_LEGACY(s12_mcu_gun_h_r )   // golgo 13 gun X-axis
1610   AM_RANGE(H8_ADC_2_H, H8_ADC_2_L) AM_READ_LEGACY(s12_mcu_gun_v_r )   // golgo 13 gun Y-axis
1618   AM_RANGE(H8_ADC_1_H, H8_ADC_1_L) AM_READ(s12_mcu_gun_h_r )   // golgo 13 gun X-axis
1619   AM_RANGE(H8_ADC_2_H, H8_ADC_2_L) AM_READ(s12_mcu_gun_v_r )   // golgo 13 gun Y-axis
16111620   AM_RANGE(H8_ADC_3_H, H8_ADC_3_L) AM_NOP
16121621ADDRESS_MAP_END
16131622
src/mame/drivers/scramble.c
r14896r14897
4343   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
4444   AM_RANGE(0x4c00, 0x4fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w)   /* mirror address */
4545   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
46   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
47   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
46   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
47   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
4848   AM_RANGE(0x5080, 0x50ff) AM_RAM
4949   AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_nmi_enable_w)
5050   AM_RANGE(0x6802, 0x6802) AM_WRITE(galaxold_coin_counter_w)
r14896r14897
6565   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
6666   AM_RANGE(0x9400, 0x97ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w)
6767   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
68   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
69   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
68   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
69   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
7070   AM_RANGE(0x9880, 0x98ff) AM_RAM
7171
7272   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
r14896r14897
9696   AM_RANGE(0x7800, 0x7803) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
9797   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
9898   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
99   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
100   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
99   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
100   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
101101   AM_RANGE(0x9880, 0x98ff) AM_RAM
102102   AM_RANGE(0xa801, 0xa801) AM_WRITE(galaxold_nmi_enable_w)
103103   AM_RANGE(0xa802, 0xa802) AM_WRITE(galaxold_coin_counter_w)
r14896r14897
124124   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
125125   AM_RANGE(0x4c00, 0x4fff) AM_READ(galaxold_videoram_r)
126126   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
127   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
128   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
127   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
128   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
129129   AM_RANGE(0x5080, 0x50ff) AM_RAM
130130   AM_RANGE(0x6800, 0x6800) AM_WRITE(galaxold_coin_counter_1_w)
131131   AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_stars_enable_w)
r14896r14897
146146   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
147147   AM_RANGE(0x4c00, 0x4fff) AM_READ(galaxold_videoram_r)
148148   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
149   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
150   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
149   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
150   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
151151   AM_RANGE(0x5080, 0x50ff) AM_RAM
152152   AM_RANGE(0x6800, 0x6800) AM_WRITE(galaxold_coin_counter_1_w)
153153   AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_stars_enable_w)
r14896r14897
168168   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
169169   AM_RANGE(0x4c00, 0x4fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w)
170170   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
171   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
172   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
171   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
172   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
173173   AM_RANGE(0x5080, 0x50ff) AM_RAM
174174   AM_RANGE(0x6800, 0x6800) AM_WRITE(galaxold_coin_counter_1_w)
175175   AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_nmi_enable_w)
r14896r14897
188188   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
189189   AM_RANGE(0x4c00, 0x4fff) AM_READ(galaxold_videoram_r)
190190   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
191   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
192   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
191   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
192   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
193193   AM_RANGE(0x5080, 0x50ff) AM_RAM
194194   AM_RANGE(0x6000, 0x6000) AM_WRITE(galaxold_coin_counter_2_w)
195195   AM_RANGE(0x6002, 0x6002) AM_WRITE(galaxold_coin_counter_1_w)
r14896r14897
198198   AM_RANGE(0x6006, 0x6006) AM_WRITE(galaxold_gfxbank_w)
199199   AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_nmi_enable_w)
200200   AM_RANGE(0x7000, 0x7000) AM_WRITE(watchdog_reset_w)
201   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN0") AM_WRITE(soundlatch_w)
201   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN0") AM_WRITE(soundlatch_byte_w)
202202   AM_RANGE(0x8001, 0x8001) AM_READ_PORT("IN1")
203203   AM_RANGE(0x8002, 0x8002) AM_READ_PORT("IN2")
204204   AM_RANGE(0x8003, 0x8003) AM_READ_PORT("IN3")
205   AM_RANGE(0x9000, 0x9000) AM_WRITE_LEGACY(hotshock_sh_irqtrigger_w)
205   AM_RANGE(0x9000, 0x9000) AM_WRITE(hotshock_sh_irqtrigger_w)
206206ADDRESS_MAP_END
207207
208208
r14896r14897
210210   AM_RANGE(0x0000, 0x0fff) AM_ROM
211211   AM_RANGE(0x1210, 0x1213) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
212212   AM_RANGE(0x1400, 0x143f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
213   AM_RANGE(0x1440, 0x145f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
214   AM_RANGE(0x1460, 0x147f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
213   AM_RANGE(0x1440, 0x145f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
214   AM_RANGE(0x1460, 0x147f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
215215   AM_RANGE(0x1480, 0x14ff) AM_RAM
216216   AM_RANGE(0x1500, 0x1503) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)
217217   AM_RANGE(0x1606, 0x1606) AM_WRITE(galaxold_flip_screen_x_w)
r14896r14897
235235   AM_RANGE(0x4400, 0x47ff) AM_RAM
236236   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
237237   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
238   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
239   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
238   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
239   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
240240   AM_RANGE(0x5080, 0x50ff) AM_RAM
241241   AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_nmi_enable_w)
242242   AM_RANGE(0x6800, 0x6802) AM_WRITE(galaxold_gfxbank_w)
r14896r14897
254254   AM_RANGE(0x4000, 0x47ff) AM_RAM
255255   AM_RANGE(0x4800, 0x4bff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(m_videoram)
256256   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
257   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
258   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
257   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
258   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
259259   AM_RANGE(0x6004, 0x6004) AM_WRITE(hotshock_flip_screen_w)
260260   AM_RANGE(0x6800, 0x6800) AM_WRITE(galaxold_coin_counter_2_w)
261261   AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_nmi_enable_w)
r14896r14897
264264   AM_RANGE(0x6805, 0x6805) AM_WRITE(galaxold_coin_counter_1_w)
265265   AM_RANGE(0x6806, 0x6806) AM_WRITE(scrambold_background_red_w)
266266   AM_RANGE(0x6807, 0x6807) AM_WRITE(scrambold_background_green_w)
267   AM_RANGE(0x8000, 0x8000) AM_WRITE(soundlatch_w)
268   AM_RANGE(0x9000, 0x9000) AM_WRITE_LEGACY(hotshock_sh_irqtrigger_w)
267   AM_RANGE(0x8000, 0x8000) AM_WRITE(soundlatch_byte_w)
268   AM_RANGE(0x9000, 0x9000) AM_WRITE(hotshock_sh_irqtrigger_w)
269269   AM_RANGE(0x7000, 0x7000) AM_READ(watchdog_reset_r)
270270   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN0")
271271   AM_RANGE(0x8001, 0x8001) AM_READ_PORT("IN1")
r14896r14897
291291   AM_RANGE(0x80, 0x80) AM_DEVWRITE_LEGACY("8910.2", ay8910_address_w)
292292ADDRESS_MAP_END
293293
294static READ8_HANDLER( hncholms_prot_r )
294READ8_MEMBER(scramble_state::hncholms_prot_r)
295295{
296   if(cpu_get_pc(&space->device()) == 0x2b || cpu_get_pc(&space->device()) == 0xa27)
296   if(cpu_get_pc(&space.device()) == 0x2b || cpu_get_pc(&space.device()) == 0xa27)
297297      return 1;
298298   else
299299      return 0;
300300}
301301
302302static ADDRESS_MAP_START( hunchbks_readport, AS_IO, 8, scramble_state )
303   AM_RANGE(0x00, 0x00) AM_READ_LEGACY(hncholms_prot_r)
303   AM_RANGE(0x00, 0x00) AM_READ(hncholms_prot_r)
304304    AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
305305ADDRESS_MAP_END
306306
r14896r14897
11521152{
11531153   AY8910_LEGACY_OUTPUT,
11541154   AY8910_DEFAULT_LOADS,
1155   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
1155   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
11561156   DEVCB_HANDLER(scramble_portB_r),
11571157   DEVCB_NULL,
11581158   DEVCB_NULL
r14896r14897
12071207
12081208
12091209
1210static READ8_HANDLER(scramble_soundram_r)
1210READ8_MEMBER(scramble_state::scramble_soundram_r)
12111211{
1212   scramble_state *state = space->machine().driver_data<scramble_state>();
1213   return state->m_soundram[offset & 0x03ff];
1212   return m_soundram[offset & 0x03ff];
12141213}
12151214
1216static WRITE8_HANDLER(scramble_soundram_w)
1215WRITE8_MEMBER(scramble_state::scramble_soundram_w)
12171216{
1218   scramble_state *state = space->machine().driver_data<scramble_state>();
1219   state->m_soundram[offset & 0x03ff] = data;
1217   m_soundram[offset & 0x03ff] = data;
12201218}
12211219
12221220static ADDRESS_MAP_START( scramble_sound_map, AS_PROGRAM, 8, scramble_state )
12231221   AM_RANGE(0x0000, 0x2fff) AM_ROM
1224   AM_RANGE(0x8000, 0x8fff) AM_READWRITE_LEGACY(scramble_soundram_r, scramble_soundram_w)
1222   AM_RANGE(0x8000, 0x8fff) AM_READWRITE(scramble_soundram_r, scramble_soundram_w)
12251223   AM_RANGE(0x8000, 0x83ff) AM_WRITENOP AM_BASE(m_soundram)  /* only here to initialize pointer */
1226   AM_RANGE(0x9000, 0x9fff) AM_WRITE_LEGACY(scramble_filter_w)
1224   AM_RANGE(0x9000, 0x9fff) AM_WRITE(scramble_filter_w)
12271225ADDRESS_MAP_END
12281226
12291227static ADDRESS_MAP_START( scramble_sound_io_map, AS_IO, 8, scramble_state )
src/mame/drivers/taxidriv.c
r14896r14897
5555
5656   /* bit 2 toggles during gameplay */
5757
58   flip_screen_set(device->machine(), data & 8);
58   state->flip_screen_set(data & 8);
5959
6060//  popmessage("%02x",data&0x0f);
6161}
src/mame/drivers/avt.c
r14896r14897
422422   avt_state(const machine_config &mconfig, device_type type, const char *tag)
423423      : driver_device(mconfig, type, tag),
424424      m_maincpu(*this,"maincpu"),
425      m_crtc(*this, "crtc")
426      { }
425      m_crtc(*this, "crtc"),
426      m_videoram(*this, "videoram"),
427      m_colorram(*this, "colorram"){ }
427428
429   required_device<cpu_device> m_maincpu;
430   required_device<mc6845_device> m_crtc;
431   required_shared_ptr<UINT8> m_videoram;
432   required_shared_ptr<UINT8> m_colorram;
433
428434   DECLARE_WRITE8_MEMBER(avt_6845_address_w);
429435   DECLARE_WRITE8_MEMBER(avt_6845_data_w);
430436   DECLARE_READ8_MEMBER( avt_6845_data_r );
431437   DECLARE_WRITE8_MEMBER(avt_videoram_w);
432438   DECLARE_WRITE8_MEMBER(avt_colorram_w);
433439
434   UINT8 *m_videoram;
435   UINT8 *m_colorram;
436440   tilemap_t *m_bg_tilemap;
437441   UINT8 m_crtc_vreg[0x100],m_crtc_index;
438442
439   required_device<cpu_device> m_maincpu;
440   required_device<mc6845_device> m_crtc;
441443   DECLARE_WRITE8_MEMBER(debug_w);
442444};
443445
r14896r14897
466468
467469WRITE8_MEMBER( avt_state::avt_videoram_w )
468470{
469   m_videoram[offset] = data;
471   m_videoram.target()[offset] = data;
470472   m_bg_tilemap->mark_tile_dirty(offset);
471473}
472474
473475
474476WRITE8_MEMBER( avt_state::avt_colorram_w )
475477{
476   m_colorram[offset] = data;
478   m_colorram.target()[offset] = data;
477479   m_bg_tilemap->mark_tile_dirty(offset);
478480}
479481
r14896r14897
486488    xxxx ----   color code.
487489    ---- xxxx   seems unused.
488490*/
489   int attr = state->m_colorram[tile_index];
490   int code = state->m_videoram[tile_index] | ((attr & 1) << 8);
491   int attr = state->m_colorram.target()[tile_index];
492   int code = state->m_videoram.target()[tile_index] | ((attr & 1) << 8);
491493   int color = (attr & 0xf0)>>4;
492494
493495   SET_TILE_INFO( 0, code, color, 0);
r14896r14897
514516   {
515517      for(x=0;x<mc6845_h_display;x++)
516518      {
517         UINT16 tile = state->m_videoram[count] | ((state->m_colorram[count] & 1) << 8);
518         UINT8 color = (state->m_colorram[count] & 0xf0) >> 4;
519         UINT16 tile = state->m_videoram.target()[count] | ((state->m_colorram.target()[count] & 1) << 8);
520         UINT8 color = (state->m_colorram.target()[count] & 0xf0) >> 4;
519521
520522         drawgfx_opaque(bitmap,cliprect,gfx,tile,color,0,0,x*8,(y*8));
521523
r14896r14897
614616   AM_RANGE(0x0000, 0x5fff) AM_ROM
615617   AM_RANGE(0x6000, 0x7fff) AM_RAM
616618   AM_RANGE(0x8000, 0x9fff) AM_RAM // AM_SHARE("nvram")
617   AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(avt_videoram_w) AM_BASE(m_videoram)
618   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(avt_colorram_w) AM_BASE(m_colorram)
619   AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(avt_videoram_w) AM_SHARE("videoram")
620   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(avt_colorram_w) AM_SHARE("colorram")
619621ADDRESS_MAP_END
620622
621623static ADDRESS_MAP_START( avt_portmap, AS_IO, 8, avt_state )
src/mame/drivers/mole.c
r14896r14897
119119
120120WRITE8_MEMBER(mole_state::mole_flipscreen_w)
121121{
122   flip_screen_set(machine(), data & 0x01);
122   flip_screen_set(data & 0x01);
123123}
124124
125125static SCREEN_UPDATE_IND16( mole )
src/mame/drivers/missb2.c
r14896r14897
112112            x = sx + xc * 8;
113113            y = (sy + yc * 8) & 0xff;
114114
115            if (flip_screen_get(screen.machine()))
115            if (state->flip_screen())
116116            {
117117               x = 248 - x;
118118               y = 248 - y;
r14896r14897
164164   AM_RANGE(0xc000, 0xdcff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
165165   AM_RANGE(0xdd00, 0xdfff) AM_RAM AM_BASE_SIZE(m_objectram, m_objectram_size)
166166   AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE("share1")
167   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
167   AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
168168   AM_RANGE(0xfa00, 0xfa00) AM_WRITE(bublbobl_sound_command_w)
169169   AM_RANGE(0xfa03, 0xfa03) AM_WRITENOP // sound cpu reset
170170   AM_RANGE(0xfa80, 0xfa80) AM_WRITENOP
r14896r14897
201201   AM_RANGE(0x8000, 0x8fff) AM_RAM
202202   AM_RANGE(0x9000, 0x9000) AM_DEVREADWRITE("oki", okim6295_device, read, write)
203203   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ymsnd", ym3526_r, ym3526_w)
204   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_r) AM_WRITENOP // message for main cpu
204   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_byte_r) AM_WRITENOP // message for main cpu
205205   AM_RANGE(0xb001, 0xb001) AM_READNOP AM_WRITE(bublbobl_sh_nmi_enable_w)   // bit 0: message pending for main cpu, bit 1: message pending for sound cpu
206206   AM_RANGE(0xb002, 0xb002) AM_WRITE(bublbobl_sh_nmi_disable_w)
207207   AM_RANGE(0xe000, 0xefff) AM_ROM         // space for diagnostic ROM?
src/mame/drivers/pitnrun.c
r14896r14897
8383
8484WRITE8_MEMBER(pitnrun_state::pitnrun_hflip_w)
8585{
86   flip_screen_x_set(machine(), data);
86   flip_screen_x_set(data);
8787}
8888
8989WRITE8_MEMBER(pitnrun_state::pitnrun_vflip_w)
9090{
91   flip_screen_y_set(machine(), data);
91   flip_screen_y_set(data);
9292}
9393
9494static ADDRESS_MAP_START( pitnrun_map, AS_PROGRAM, 8, pitnrun_state )
r14896r14897
105105   AM_RANGE(0xb005, 0xb005) AM_WRITE(pitnrun_char_bank_select)
106106   AM_RANGE(0xb006, 0xb006) AM_WRITE(pitnrun_hflip_w)
107107   AM_RANGE(0xb007, 0xb007) AM_WRITE(pitnrun_vflip_w)
108   AM_RANGE(0xb800, 0xb800) AM_READ_PORT("INPUTS") AM_WRITE(soundlatch_w)
108   AM_RANGE(0xb800, 0xb800) AM_READ_PORT("INPUTS") AM_WRITE(soundlatch_byte_w)
109109   AM_RANGE(0xc800, 0xc801) AM_WRITE(pitnrun_scroll_w)
110110   AM_RANGE(0xc802, 0xc802) AM_WRITENOP/* VP(VF?)MCV - not used ?*/
111111   AM_RANGE(0xc804, 0xc804) AM_WRITE(pitnrun_mcu_data_w)
r14896r14897
124124
125125static ADDRESS_MAP_START( pitnrun_sound_io_map, AS_IO, 8, pitnrun_state )
126126   ADDRESS_MAP_GLOBAL_MASK(0xff)
127   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_w)
127   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_byte_w)
128128   AM_RANGE(0x8c, 0x8d) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
129129   AM_RANGE(0x8e, 0x8f) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
130130   AM_RANGE(0x8f, 0x8f) AM_DEVREAD_LEGACY("ay1", ay8910_r)
r14896r14897
216216{
217217   AY8910_LEGACY_OUTPUT,
218218   AY8910_DEFAULT_LOADS,
219   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
220   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
219   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
220   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
221221   DEVCB_NULL,
222222   DEVCB_NULL
223223};
src/mame/drivers/tehkanwc.c
r14896r14897
140140
141141WRITE8_MEMBER(tehkanwc_state::sound_command_w)
142142{
143   soundlatch_w(space, offset, data);
143   soundlatch_byte_w(space, offset, data);
144144   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
145145}
146146
r14896r14897
151151
152152WRITE8_MEMBER(tehkanwc_state::sound_answer_w)
153153{
154   soundlatch2_w(space, 0, data);
154   soundlatch2_byte_w(space, 0, data);
155155
156156   /* in Gridiron, the sound CPU goes in a tight loop after the self test, */
157157   /* probably waiting to be reset by a watchdog */
r14896r14897
219219   AM_RANGE(0xc800, 0xcfff) AM_RAM AM_SHARE("share1")
220220   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(tehkanwc_videoram_w) AM_SHARE("share2") AM_BASE(m_videoram)
221221   AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(tehkanwc_colorram_w) AM_SHARE("share3") AM_BASE(m_colorram)
222   AM_RANGE(0xd800, 0xddff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_be_w) AM_SHARE("share4") AM_SHARE("paletteram")
222   AM_RANGE(0xd800, 0xddff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_be_w) AM_SHARE("share4") AM_SHARE("paletteram")
223223   AM_RANGE(0xde00, 0xdfff) AM_RAM AM_SHARE("share5") /* unused part of the palette RAM, I think? Gridiron uses it */
224224   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(tehkanwc_videoram2_w) AM_SHARE("share6") AM_BASE(m_videoram2)
225225   AM_RANGE(0xe800, 0xebff) AM_RAM AM_SHARE("share7") AM_BASE_SIZE(m_spriteram, m_spriteram_size) /* sprites */
r14896r14897
232232   AM_RANGE(0xf810, 0xf811) AM_READWRITE(tehkanwc_track_1_r, tehkanwc_track_1_reset_w)   /* track 1 x/y */
233233   AM_RANGE(0xf812, 0xf812) AM_WRITE(gridiron_led1_w)
234234   AM_RANGE(0xf813, 0xf813) AM_READ_PORT("P2BUT")
235   AM_RANGE(0xf820, 0xf820) AM_READ(soundlatch2_r) AM_WRITE(sound_command_w)   /* answer from the sound CPU */
235   AM_RANGE(0xf820, 0xf820) AM_READ(soundlatch2_byte_r) AM_WRITE(sound_command_w)   /* answer from the sound CPU */
236236   AM_RANGE(0xf840, 0xf840) AM_READ_PORT("DSW1") AM_WRITE(sub_cpu_halt_w)
237237   AM_RANGE(0xf850, 0xf850) AM_READ_PORT("DSW2") AM_WRITENOP         /* ?? writes 0x00 or 0xff */
238238   AM_RANGE(0xf860, 0xf860) AM_READ(watchdog_reset_r) AM_WRITE(tehkanwc_flipscreen_x_w)
r14896r14897
245245   AM_RANGE(0xc800, 0xcfff) AM_RAM AM_SHARE("share1")
246246   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(tehkanwc_videoram_w) AM_SHARE("share2")
247247   AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(tehkanwc_colorram_w) AM_SHARE("share3")
248   AM_RANGE(0xd800, 0xddff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_be_w) AM_SHARE("share4") AM_SHARE("paletteram")
248   AM_RANGE(0xd800, 0xddff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_be_w) AM_SHARE("share4") AM_SHARE("paletteram")
249249   AM_RANGE(0xde00, 0xdfff) AM_RAM AM_SHARE("share5") /* unused part of the palette RAM, I think? Gridiron uses it */
250250   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(tehkanwc_videoram2_w) AM_SHARE("share6")
251251   AM_RANGE(0xe800, 0xebff) AM_RAM AM_SHARE("share7") /* sprites */
r14896r14897
260260   AM_RANGE(0x8001, 0x8001) AM_DEVWRITE_LEGACY("msm", msm_reset_w)/* MSM51xx reset */
261261   AM_RANGE(0x8002, 0x8002) AM_WRITENOP   /* ?? written in the IRQ handler */
262262   AM_RANGE(0x8003, 0x8003) AM_WRITENOP   /* ?? written in the NMI handler */
263   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r) AM_WRITE(sound_answer_w)
263   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r) AM_WRITE(sound_answer_w)
264264ADDRESS_MAP_END
265265
266266static ADDRESS_MAP_START( sound_port, AS_IO, 8, tehkanwc_state )
src/mame/drivers/liberatr.c
r14896r14897
140140#define MASTER_CLOCK 20000000 /* 20Mhz Main Clock Xtal */
141141
142142
143void liberatr_state::machine_start()
143void liberatr_state::machine_start_liberatr()
144144{
145145   atarigen_state::machine_start();
146146
r14896r14897
392392   MCFG_CPU_PERIODIC_INT(irq0_line_hold,4*60)
393393
394394   MCFG_ER2055_ADD("earom")
395   
396   MCFG_MACHINE_START_DRIVER(liberatr_state, machine_start_liberatr)
395397
396398   /* video hardware */
399   MCFG_VIDEO_START_DRIVER(liberatr_state, video_start_liberatr)
397400   MCFG_SCREEN_ADD("screen", RASTER)
398401   MCFG_SCREEN_REFRESH_RATE(60)
399402   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
src/mame/drivers/bionicc.c
r14896r14897
102102{
103103
104104   COMBINE_DATA(&m_soundcommand);
105   soundlatch_w(space, 0, m_soundcommand & 0xff);
105   soundlatch_byte_w(space, 0, m_soundcommand & 0xff);
106106}
107107
108108READ16_MEMBER(bionicc_state::hacked_soundcommand_r)
r14896r14897
164164static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, bionicc_state )
165165   AM_RANGE(0x0000, 0x7fff) AM_ROM
166166   AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
167   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
167   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
168168   AM_RANGE(0xc000, 0xc7ff) AM_RAM
169169ADDRESS_MAP_END
170170
src/mame/drivers/citycon.c
r14896r14897
1616
1717READ8_MEMBER(citycon_state::citycon_in_r)
1818{
19   return input_port_read(machine(), flip_screen_get(machine()) ? "P2" : "P1");
19   return input_port_read(machine(), flip_screen() ? "P2" : "P1");
2020}
2121
2222READ8_MEMBER(citycon_state::citycon_irq_ack_r)
r14896r14897
3333   AM_RANGE(0x2800, 0x28ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
3434   AM_RANGE(0x2800, 0x2fff) AM_NOP //0x2900-0x2fff cleared at post but unused
3535   AM_RANGE(0x3000, 0x3000) AM_READ(citycon_in_r) AM_WRITE(citycon_background_w)   /* player 1 & 2 inputs multiplexed */
36   AM_RANGE(0x3001, 0x3001) AM_READ_PORT("DSW1") AM_WRITE(soundlatch_w)
37   AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW2") AM_WRITE(soundlatch2_w)
36   AM_RANGE(0x3001, 0x3001) AM_READ_PORT("DSW1") AM_WRITE(soundlatch_byte_w)
37   AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW2") AM_WRITE(soundlatch2_byte_w)
3838   AM_RANGE(0x3004, 0x3005) AM_READNOP AM_WRITEONLY AM_BASE(m_scroll)
3939   AM_RANGE(0x3007, 0x3007) AM_READ(citycon_irq_ack_r)
40   AM_RANGE(0x3800, 0x3cff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
40   AM_RANGE(0x3800, 0x3cff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
4141   AM_RANGE(0x4000, 0xffff) AM_ROM
4242ADDRESS_MAP_END
4343
r14896r14897
176176   {
177177      AY8910_LEGACY_OUTPUT,
178178      AY8910_DEFAULT_LOADS,
179      DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
180      DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_r),
179      DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
180      DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_byte_r),
181181      DEVCB_NULL,
182182      DEVCB_NULL
183183   },
src/mame/drivers/dynadice.c
r14896r14897
4242{
4343public:
4444   dynadice_state(const machine_config &mconfig, device_type type, const char *tag)
45      : driver_device(mconfig, type, tag) { }
45      : driver_device(mconfig, type, tag) ,
46      m_videoram(*this, "videoram"){ }
4647
4748   /* memory pointers */
48   UINT8 * m_videoram;
49   required_shared_ptr<UINT8> m_videoram;
4950//  UINT8 *  m_nvram;     // currently this uses generic nvram handling
5051//  UINT8 *  m_paletteram;    // currently this uses generic palette handling
5152
r14896r14897
6263
6364WRITE8_MEMBER(dynadice_state::dynadice_videoram_w)
6465{
65   m_videoram[offset] = data;
66   m_videoram.target()[offset] = data;
6667   m_bg_tilemap->mark_tile_dirty(offset);
6768   m_top_tilemap->mark_all_dirty();
6869}
r14896r14897
9495
9596static ADDRESS_MAP_START( dynadice_map, AS_PROGRAM, 8, dynadice_state )
9697   AM_RANGE(0x0000, 0x1fff) AM_ROM
97   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(dynadice_videoram_w) AM_BASE(m_videoram)
98   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(dynadice_videoram_w) AM_SHARE("videoram")
9899   AM_RANGE(0x4000, 0x40ff) AM_RAM AM_SHARE("nvram")
99100ADDRESS_MAP_END
100101
r14896r14897
103104   AM_RANGE(0x51, 0x51) AM_READ_PORT("IN1")
104105   AM_RANGE(0x52, 0x52) AM_READ_PORT("DSW")
105106   AM_RANGE(0x62, 0x62) AM_WRITENOP
106   AM_RANGE(0x63, 0x63) AM_WRITE(soundlatch_w)
107   AM_RANGE(0x63, 0x63) AM_WRITE(soundlatch_byte_w)
107108   AM_RANGE(0x70, 0x77) AM_WRITENOP
108109ADDRESS_MAP_END
109110
r14896r14897
114115
115116static ADDRESS_MAP_START( dynadice_sound_io_map, AS_IO, 8, dynadice_state )
116117   ADDRESS_MAP_GLOBAL_MASK(0xff)
117   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
118   AM_RANGE(0x01, 0x01) AM_WRITE(soundlatch_clear_w)
118   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)
119   AM_RANGE(0x01, 0x01) AM_WRITE(soundlatch_clear_byte_w)
119120   AM_RANGE(0x02, 0x02) AM_WRITE(sound_data_w)
120121   AM_RANGE(0x03, 0x03) AM_DEVWRITE_LEGACY("aysnd", sound_control_w)
121122ADDRESS_MAP_END
r14896r14897
192193static TILE_GET_INFO( get_tile_info )
193194{
194195   dynadice_state *state = machine.driver_data<dynadice_state>();
195   int code = state->m_videoram[tile_index];
196   int code = state->m_videoram.target()[tile_index];
196197   SET_TILE_INFO(1, code, 0, 0);
197198}
198199
src/mame/drivers/playmark.c
r14896r14897
276276   AM_RANGE(0x71001a, 0x71001b) AM_READ_PORT("P4")
277277//  AM_RANGE(0x71001c, 0x71001d) AM_READ_LEGACY(playmark_snd_status???)
278278//  AM_RANGE(0x71001e, 0x71001f) AM_WRITENOP//playmark_snd_command_w },
279   AM_RANGE(0x780000, 0x780fff) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
279   AM_RANGE(0x780000, 0x780fff) AM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
280280   AM_RANGE(0xff0000, 0xffffff) AM_RAM
281281ADDRESS_MAP_END
282282
src/mame/drivers/jangou.c
r14896r14897
301301
302302WRITE8_MEMBER(jangou_state::sound_latch_w)
303303{
304   soundlatch_w(space, 0, data & 0xff);
304   soundlatch_byte_w(space, 0, data & 0xff);
305305   device_set_input_line(m_cpu_1, INPUT_LINE_NMI, ASSERT_LINE);
306306}
307307
308308READ8_MEMBER(jangou_state::sound_latch_r)
309309{
310310   device_set_input_line(m_cpu_1, INPUT_LINE_NMI, CLEAR_LINE);
311   return soundlatch_r(space, 0);
311   return soundlatch_byte_r(space, 0);
312312}
313313
314314/* Jangou HC-55516 CVSD */
src/mame/drivers/pgm.c
r14896r14897
276276   {
277277      if (PGMLOGERROR)
278278         logerror("SL 1 m68.w %02x (%06x) IRQ\n", data & 0xff, cpu_get_pc(&space.device()));
279      soundlatch_w(space, 0, data);
279      soundlatch_byte_w(space, 0, data);
280280      device_set_input_line(m_soundcpu, INPUT_LINE_NMI, PULSE_LINE );
281281   }
282282}
r14896r14897
285285{
286286   if (PGMLOGERROR)
287287      logerror("SL 3 z80.w %02x (%04x)\n", data, cpu_get_pc(&space.device()));
288   soundlatch3_w(space, 0, data);
288   soundlatch3_byte_w(space, 0, data);
289289}
290290
291291void pgm_sound_irq( device_t *device, int level )
r14896r14897
310310
311311ADDRESS_MAP_START( pgm_z80_io, AS_IO, 8, pgm_state )
312312   AM_RANGE(0x8000, 0x8003) AM_DEVREADWRITE_LEGACY("ics", ics2115_device::read, ics2115_device::write)
313   AM_RANGE(0x8100, 0x81ff) AM_READ(soundlatch3_r) AM_WRITE(z80_l3_w)
314   AM_RANGE(0x8200, 0x82ff) AM_READWRITE(soundlatch_r, soundlatch_w)
315   AM_RANGE(0x8400, 0x84ff) AM_READWRITE(soundlatch2_r, soundlatch2_w)
313   AM_RANGE(0x8100, 0x81ff) AM_READ(soundlatch3_byte_r) AM_WRITE(z80_l3_w)
314   AM_RANGE(0x8200, 0x82ff) AM_READWRITE(soundlatch_byte_r, soundlatch_byte_w)
315   AM_RANGE(0x8400, 0x84ff) AM_READWRITE(soundlatch2_byte_r, soundlatch2_byte_w)
316316ADDRESS_MAP_END
317317
318318/*** 68000 (main CPU) + variants for protection devices **********************/
r14896r14897
323323   AM_RANGE(0x800000, 0x81ffff) AM_RAM AM_MIRROR(0x0e0000) AM_BASE_LEGACY(&pgm_mainram) AM_SHARE("sram") /* Main Ram */
324324
325325   AM_RANGE(0x900000, 0x907fff) AM_MIRROR(0x0f8000) AM_READWRITE(pgm_videoram_r, pgm_videoram_w) AM_BASE(m_videoram) /* IGS023 VIDEO CHIP */
326   AM_RANGE(0xa00000, 0xa011ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
326   AM_RANGE(0xa00000, 0xa011ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
327327   AM_RANGE(0xb00000, 0xb0ffff) AM_RAM AM_BASE(m_videoregs) /* Video Regs inc. Zoom Table */
328328
329329   AM_RANGE(0xc00002, 0xc00003) AM_READ(soundlatch_word_r) AM_WRITE(m68k_l1_w)
r14896r14897
15081508   ROM_LOAD( "m0600.rom",    0x400000, 0x400000, CRC(3ada4fd6) SHA1(4c87adb25d31cbd41f04fbffe31f7bc37173da76) )
15091509ROM_END
15101510
1511
1512/* kovsh bootlegs, these still have the ARM! */
1513ROM_START( kovlsqh2 )
1514   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
1515   PGM_68K_BIOS
1516   ROM_LOAD16_WORD_SWAP( "lsqh2_prg.rom",0x100000, 0x400000, CRC(d71e3d50) SHA1(bda78648bc176b0ded74118a8e340ee661bb930d) )
1517
1518   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
1519   ROM_LOAD( "qhsg_prot.c51", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) )
1520
1521   ROM_REGION( 0xc00000, "tiles",  0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
1522   PGM_VIDEO_BIOS
1523   ROM_LOAD( "lsqh2_t01.rom",0x180000, 0x800000, CRC(d498d97f) SHA1(97a7b6d2ed1170449e7c2899448af7cbbca4c94f) )
1524   ROM_IGNORE( 0x800000 )   // second half identical
1525
1526   ROM_REGION( 0x3000000, "sprcol", 0 ) /* Sprite Colour Data */
1527   ROM_LOAD( "lsqh2_a01.rom", 0x0000000, 0x1000000, CRC(25ae3efd) SHA1(083d977602ddb5ad54fbdcba000cd4287de8d463) )
1528   ROM_LOAD( "lsqh2_a23.rom", 0x1000000, 0x1000000, CRC(7a779112) SHA1(0a7d36b3715063d8eac629b95a9bb3ecd8e54fca) )
1529   ROM_LOAD( "lsqh2_a45.rom", 0x2000000, 0x1000000, CRC(5d7de052) SHA1(7663b6cf09f65c4644661005a38f9aba84a32913) )
1530
1531   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
1532   ROM_LOAD( "lsqh2_b01.rom", 0x0000000, 0x1000000, CRC(df7ca696) SHA1(7af3d27957a39de7e4873867c9972c05af7e7964) )
1533
1534   ROM_REGION( 0xc00000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
1535   PGM_AUDIO_BIOS
1536   ROM_LOAD( "lsqh2_m01.rom",0x400000, 0x400000, CRC(01af1b65) SHA1(6cf523fa8f1e03f974771611bb9a4e08a4d4443f) )
1537   ROM_IGNORE( 0x400000 )   // 400000-7fffff empty
1538   ROM_CONTINUE( 0x800000, 0x400000 )
1539   ROM_IGNORE( 0x400000 )   // c00000-ffffff empty
1540ROM_END
1541
1542ROM_START( kovlsjb )
1543   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
1544   PGM_68K_BIOS
1545   ROM_LOAD16_WORD_SWAP( "lsjb_prg.rom", 0x100000, 0x400000, CRC(adf06b37) SHA1(be3c0af64de374046d28492ac49c01da1ec78e40) )
1546
1547   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
1548   ROM_LOAD( "qhsg_prot.c51", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) )
1549
1550   ROM_REGION( 0xc00000, "tiles",  0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
1551   PGM_VIDEO_BIOS
1552   ROM_LOAD( "lsqh2_t01.rom",0x180000, 0x800000, CRC(d498d97f) SHA1(97a7b6d2ed1170449e7c2899448af7cbbca4c94f) )
1553   ROM_IGNORE( 0x800000 )   // second half identical
1554
1555   ROM_REGION( 0x3000000, "sprcol", 0 ) /* Sprite Colour Data */
1556   ROM_LOAD( "lsqh2_a01.rom", 0x0000000, 0x1000000, CRC(25ae3efd) SHA1(083d977602ddb5ad54fbdcba000cd4287de8d463) )
1557   ROM_LOAD( "lsqh2_a23.rom", 0x1000000, 0x1000000, CRC(7a779112) SHA1(0a7d36b3715063d8eac629b95a9bb3ecd8e54fca) )
1558   ROM_LOAD( "lsqh2_a45.rom", 0x2000000, 0x1000000, CRC(5d7de052) SHA1(7663b6cf09f65c4644661005a38f9aba84a32913) )
1559
1560   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
1561   ROM_LOAD( "lsqh2_b01.rom", 0x0000000, 0x1000000, CRC(df7ca696) SHA1(7af3d27957a39de7e4873867c9972c05af7e7964) )
1562
1563   ROM_REGION( 0xc00000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
1564   PGM_AUDIO_BIOS
1565   ROM_LOAD( "lsqh2_m01.rom",0x400000, 0x400000, CRC(01af1b65) SHA1(6cf523fa8f1e03f974771611bb9a4e08a4d4443f) )
1566   ROM_IGNORE( 0x400000 )   // 400000-7fffff empty
1567   ROM_CONTINUE( 0x800000, 0x400000 )
1568   ROM_IGNORE( 0x400000 )   // c00000-ffffff empty
1569ROM_END
1570
1571ROM_START( kovlsjba )
1572   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
1573   PGM_68K_BIOS
1574   ROM_LOAD16_WORD_SWAP( "lsjba_prg.rom",0x100000, 0x400000, CRC(8b42f456) SHA1(48796e48f6f1a5f68442cf15a6b195095d443a35) )
1575
1576   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
1577   ROM_LOAD( "qhsg_prot.c51", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) )
1578
1579   ROM_REGION( 0xc00000, "tiles",  0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
1580   PGM_VIDEO_BIOS
1581   ROM_LOAD( "lsqh2_t01.rom",0x180000, 0x800000, CRC(d498d97f) SHA1(97a7b6d2ed1170449e7c2899448af7cbbca4c94f) )
1582   ROM_IGNORE( 0x800000 )   // second half identical
1583
1584   ROM_REGION( 0x3000000, "sprcol", 0 ) /* Sprite Colour Data */
1585   ROM_LOAD( "lsqh2_a01.rom", 0x0000000, 0x1000000, CRC(25ae3efd) SHA1(083d977602ddb5ad54fbdcba000cd4287de8d463) )
1586   ROM_LOAD( "lsqh2_a23.rom", 0x1000000, 0x1000000, CRC(7a779112) SHA1(0a7d36b3715063d8eac629b95a9bb3ecd8e54fca) )
1587   ROM_LOAD( "lsqh2_a45.rom", 0x2000000, 0x1000000, CRC(5d7de052) SHA1(7663b6cf09f65c4644661005a38f9aba84a32913) )
1588
1589   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
1590   ROM_LOAD( "lsqh2_b01.rom", 0x0000000, 0x1000000, CRC(df7ca696) SHA1(7af3d27957a39de7e4873867c9972c05af7e7964) )
1591
1592   ROM_REGION( 0xc00000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
1593   PGM_AUDIO_BIOS
1594   ROM_LOAD( "lsqh2_m01.rom",0x400000, 0x400000, CRC(01af1b65) SHA1(6cf523fa8f1e03f974771611bb9a4e08a4d4443f) )
1595   ROM_IGNORE( 0x400000 )   // 400000-7fffff empty
1596   ROM_CONTINUE( 0x800000, 0x400000 )
1597   ROM_IGNORE( 0x400000 )   // c00000-ffffff empty
1598ROM_END
1599
16001511ROM_START( kovqhsgs )
16011512   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
16021513   PGM_68K_BIOS
r14896r14897
16271538ROM_END
16281539
16291540
1630ROM_START( kovlsqh )
1631   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
1632   PGM_68K_BIOS
1633   ROM_LOAD16_WORD_SWAP( "lsqh_v200cn.rom", 0x100000, 0x400000, CRC(9935a27a) SHA1(3075935293172466c4bd997dcb67f864ae26493e) )
16341541
1635   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
1636   ROM_LOAD( "qhsg_prot.c51", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) )
1637
1638   ROM_REGION( 0xc00000, "tiles",  0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
1639   PGM_VIDEO_BIOS
1640   ROM_LOAD( "lsqh2_t01.rom",0x180000, 0x800000, CRC(d498d97f) SHA1(97a7b6d2ed1170449e7c2899448af7cbbca4c94f) )
1641   ROM_IGNORE( 0x800000 )   // second half identical
1642
1643   ROM_REGION( 0x3000000, "sprcol", 0 ) /* Sprite Colour Data */
1644   ROM_LOAD( "lsqh2_a01.rom", 0x0000000, 0x1000000, CRC(25ae3efd) SHA1(083d977602ddb5ad54fbdcba000cd4287de8d463) )
1645   ROM_LOAD( "lsqh2_a23.rom", 0x1000000, 0x1000000, CRC(7a779112) SHA1(0a7d36b3715063d8eac629b95a9bb3ecd8e54fca) )
1646   ROM_LOAD( "lsqh2_a45.rom", 0x2000000, 0x1000000, CRC(5d7de052) SHA1(7663b6cf09f65c4644661005a38f9aba84a32913) )
1647
1648   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
1649   ROM_LOAD( "lsqh2_b01.rom", 0x0000000, 0x1000000, CRC(df7ca696) SHA1(7af3d27957a39de7e4873867c9972c05af7e7964) )
1650
1651   ROM_REGION( 0xc00000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
1652   PGM_AUDIO_BIOS
1653   ROM_LOAD( "lsqh2_m01.rom",0x400000, 0x400000, CRC(01af1b65) SHA1(6cf523fa8f1e03f974771611bb9a4e08a4d4443f) )
1654   ROM_IGNORE( 0x400000 )   // 400000-7fffff empty
1655   ROM_CONTINUE( 0x800000, 0x400000 )
1656   ROM_IGNORE( 0x400000 )   // c00000-ffffff empty
1657ROM_END
1658
16591542/*
16601543
16611544p0701_v105.u2
r14896r14897
31683051   ROM_LOAD16_WORD_SWAP( "p0600h.rom",   0x100000, 0x400000, CRC(e251e8e4) SHA1(af5b7c81632a39e1450d932951bed634c76b84e8) )
31693052
31703053   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
3171   ROM_LOAD( "kovshp_igs027a.bin", 0x000000, 0x04000, NO_DUMP )
3054   ROM_LOAD( "kovsh_v100_china.asic", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) ) // this is the kovsh ARM rom, we intercept and modify protection calls
31723055
31733056   ROM_REGION( 0xc00000, "tiles", 0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
31743057   PGM_VIDEO_BIOS
r14896r14897
31893072   ROM_LOAD( "m0600.rom",    0x400000, 0x400000, CRC(3ada4fd6) SHA1(4c87adb25d31cbd41f04fbffe31f7bc37173da76) )
31903073ROM_END
31913074
3075
3076ROM_START( kovshxas )
3077   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3078   PGM_68K_BIOS
3079   ROM_LOAD16_WORD_SWAP( "de_p0609.322",   0x100000, 0x400000, CRC(3b7b627f) SHA1(b331148501f9349fbd5882fb3f184f6304e58646) )
3080
3081   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
3082   ROM_LOAD( "kovsh_v100_china.asic", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) ) // this is the kovsh ARM rom, we intercept and modify protection calls
3083
3084   ROM_REGION( 0xc00000, "tiles", 0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
3085   PGM_VIDEO_BIOS
3086   ROM_LOAD( "t0600.rom",    0x180000, 0x800000, CRC(4acc1ad6) SHA1(0668dbd5e856c2406910c6b7382548b37c631780) )
3087
3088   ROM_REGION( 0x2000000, "sprcol", 0 ) /* Sprite Colour Data */
3089   ROM_LOAD( "a0600.rom",    0x0000000, 0x0800000, CRC(d8167834) SHA1(fa55a99629d03b2ea253392352f70d2c8639a991) ) // FIXED BITS (xxxxxxxx1xxxxxxx)
3090   ROM_LOAD( "a0601.rom",    0x0800000, 0x0800000, CRC(ff7a4373) SHA1(7def9fca7513ad5a117da230bebd2e3c78679041) ) // FIXED BITS (xxxxxxxx1xxxxxxx)
3091   ROM_LOAD( "a0602.rom",    0x1000000, 0x0800000, CRC(e7a32959) SHA1(3d0ed684dc5b269238890836b2ce7ef46aa5265b) ) // FIXED BITS (xxxxxxxx1xxxxxxx)
3092   ROM_LOAD( "a0603xas.rom",    0x1800000, 0x0800000, CRC(7057b37e) SHA1(85a19f23303b4d581c4fa315b2c204af92fcb424) )
3093
3094   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
3095   ROM_LOAD( "b0600.rom",    0x0000000, 0x0800000, CRC(7d3cd059) SHA1(00cf994b63337e0e4ebe96453daf45f24192af1c) )
3096   ROM_LOAD( "b0601xas.rom",    0x0800000, 0x0800000, CRC(3784fb49) SHA1(7e85fe5b5fb8746f1321c03ad2350d2a58969d7a) )
3097
3098   ROM_REGION( 0x800000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
3099   PGM_AUDIO_BIOS
3100   ROM_LOAD( "m0600.rom",    0x400000, 0x400000, CRC(3ada4fd6) SHA1(4c87adb25d31cbd41f04fbffe31f7bc37173da76) )
3101ROM_END
3102
3103
3104ROM_START( kovlsqh )
3105   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3106   PGM_68K_BIOS
3107   ROM_LOAD16_WORD_SWAP( "lsqh_v200cn.rom", 0x100000, 0x400000, CRC(9935a27a) SHA1(3075935293172466c4bd997dcb67f864ae26493e) )
3108
3109   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
3110   ROM_LOAD( "kovsh_v100_china.asic", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) ) // this is the kovsh ARM rom, we intercept and modify protection calls
3111
3112   ROM_REGION( 0xc00000, "tiles",  0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
3113   PGM_VIDEO_BIOS
3114   ROM_LOAD( "lsqh2_t01.rom",0x180000, 0x800000, CRC(d498d97f) SHA1(97a7b6d2ed1170449e7c2899448af7cbbca4c94f) )
3115   ROM_IGNORE( 0x800000 )   // second half identical
3116
3117   ROM_REGION( 0x3000000, "sprcol", 0 ) /* Sprite Colour Data */
3118   ROM_LOAD( "lsqh2_a01.rom", 0x0000000, 0x1000000, CRC(25ae3efd) SHA1(083d977602ddb5ad54fbdcba000cd4287de8d463) )
3119   ROM_LOAD( "lsqh2_a23.rom", 0x1000000, 0x1000000, CRC(7a779112) SHA1(0a7d36b3715063d8eac629b95a9bb3ecd8e54fca) )
3120   ROM_LOAD( "lsqh2_a45.rom", 0x2000000, 0x1000000, CRC(5d7de052) SHA1(7663b6cf09f65c4644661005a38f9aba84a32913) )
3121
3122   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
3123   ROM_LOAD( "lsqh2_b01.rom", 0x0000000, 0x1000000, CRC(df7ca696) SHA1(7af3d27957a39de7e4873867c9972c05af7e7964) )
3124
3125   ROM_REGION( 0xc00000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
3126   PGM_AUDIO_BIOS
3127   ROM_LOAD( "lsqh2_m01.rom",0x400000, 0x400000, CRC(01af1b65) SHA1(6cf523fa8f1e03f974771611bb9a4e08a4d4443f) )
3128   ROM_IGNORE( 0x400000 )   // 400000-7fffff empty
3129   ROM_CONTINUE( 0x800000, 0x400000 )
3130   ROM_IGNORE( 0x400000 )   // c00000-ffffff empty
3131ROM_END
3132
3133ROM_START( kovlsqh2 )
3134   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3135   PGM_68K_BIOS
3136   ROM_LOAD16_WORD_SWAP( "lsqh2_prg.rom",0x100000, 0x400000, CRC(d71e3d50) SHA1(bda78648bc176b0ded74118a8e340ee661bb930d) )
3137
3138   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
3139   ROM_LOAD( "kovsh_v100_china.asic", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) ) // this is the kovsh ARM rom, we intercept and modify protection calls
3140
3141   ROM_REGION( 0xc00000, "tiles",  0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
3142   PGM_VIDEO_BIOS
3143   ROM_LOAD( "lsqh2_t01.rom",0x180000, 0x800000, CRC(d498d97f) SHA1(97a7b6d2ed1170449e7c2899448af7cbbca4c94f) )
3144   ROM_IGNORE( 0x800000 )   // second half identical
3145
3146   ROM_REGION( 0x3000000, "sprcol", 0 ) /* Sprite Colour Data */
3147   ROM_LOAD( "lsqh2_a01.rom", 0x0000000, 0x1000000, CRC(25ae3efd) SHA1(083d977602ddb5ad54fbdcba000cd4287de8d463) )
3148   ROM_LOAD( "lsqh2_a23.rom", 0x1000000, 0x1000000, CRC(7a779112) SHA1(0a7d36b3715063d8eac629b95a9bb3ecd8e54fca) )
3149   ROM_LOAD( "lsqh2_a45.rom", 0x2000000, 0x1000000, CRC(5d7de052) SHA1(7663b6cf09f65c4644661005a38f9aba84a32913) )
3150
3151   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
3152   ROM_LOAD( "lsqh2_b01.rom", 0x0000000, 0x1000000, CRC(df7ca696) SHA1(7af3d27957a39de7e4873867c9972c05af7e7964) )
3153
3154   ROM_REGION( 0xc00000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
3155   PGM_AUDIO_BIOS
3156   ROM_LOAD( "lsqh2_m01.rom",0x400000, 0x400000, CRC(01af1b65) SHA1(6cf523fa8f1e03f974771611bb9a4e08a4d4443f) )
3157   ROM_IGNORE( 0x400000 )   // 400000-7fffff empty
3158   ROM_CONTINUE( 0x800000, 0x400000 )
3159   ROM_IGNORE( 0x400000 )   // c00000-ffffff empty
3160ROM_END
3161
3162
3163ROM_START( kovlsjb )
3164   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3165   PGM_68K_BIOS
3166   ROM_LOAD16_WORD_SWAP( "lsjb_prg.rom", 0x100000, 0x400000, CRC(adf06b37) SHA1(be3c0af64de374046d28492ac49c01da1ec78e40) )
3167
3168   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
3169   ROM_LOAD( "kovsh_v100_china.asic", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) ) // this is the kovsh ARM rom, we intercept and modify protection calls
3170
3171   ROM_REGION( 0xc00000, "tiles",  0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
3172   PGM_VIDEO_BIOS
3173   ROM_LOAD( "lsqh2_t01.rom",0x180000, 0x800000, CRC(d498d97f) SHA1(97a7b6d2ed1170449e7c2899448af7cbbca4c94f) )
3174   ROM_IGNORE( 0x800000 )   // second half identical
3175
3176   ROM_REGION( 0x3000000, "sprcol", 0 ) /* Sprite Colour Data */
3177   ROM_LOAD( "lsqh2_a01.rom", 0x0000000, 0x1000000, CRC(25ae3efd) SHA1(083d977602ddb5ad54fbdcba000cd4287de8d463) )
3178   ROM_LOAD( "lsqh2_a23.rom", 0x1000000, 0x1000000, CRC(7a779112) SHA1(0a7d36b3715063d8eac629b95a9bb3ecd8e54fca) )
3179   ROM_LOAD( "lsqh2_a45.rom", 0x2000000, 0x1000000, CRC(5d7de052) SHA1(7663b6cf09f65c4644661005a38f9aba84a32913) )
3180
3181   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
3182   ROM_LOAD( "lsqh2_b01.rom", 0x0000000, 0x1000000, CRC(df7ca696) SHA1(7af3d27957a39de7e4873867c9972c05af7e7964) )
3183
3184   ROM_REGION( 0xc00000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
3185   PGM_AUDIO_BIOS
3186   ROM_LOAD( "lsqh2_m01.rom",0x400000, 0x400000, CRC(01af1b65) SHA1(6cf523fa8f1e03f974771611bb9a4e08a4d4443f) )
3187   ROM_IGNORE( 0x400000 )   // 400000-7fffff empty
3188   ROM_CONTINUE( 0x800000, 0x400000 )
3189   ROM_IGNORE( 0x400000 )   // c00000-ffffff empty
3190ROM_END
3191
3192ROM_START( kovlsjba )
3193   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3194   PGM_68K_BIOS
3195   ROM_LOAD16_WORD_SWAP( "lsjba_prg.rom",0x100000, 0x400000, CRC(8b42f456) SHA1(48796e48f6f1a5f68442cf15a6b195095d443a35) )
3196
3197   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
3198   ROM_LOAD( "kovsh_v100_china.asic", 0x000000, 0x04000, BAD_DUMP CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) ) // this is the kovsh ARM rom, we intercept and modify protection calls
3199
3200   ROM_REGION( 0xc00000, "tiles",  0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
3201   PGM_VIDEO_BIOS
3202   ROM_LOAD( "lsqh2_t01.rom",0x180000, 0x800000, CRC(d498d97f) SHA1(97a7b6d2ed1170449e7c2899448af7cbbca4c94f) )
3203   ROM_IGNORE( 0x800000 )   // second half identical
3204
3205   ROM_REGION( 0x3000000, "sprcol", 0 ) /* Sprite Colour Data */
3206   ROM_LOAD( "lsqh2_a01.rom", 0x0000000, 0x1000000, CRC(25ae3efd) SHA1(083d977602ddb5ad54fbdcba000cd4287de8d463) )
3207   ROM_LOAD( "lsqh2_a23.rom", 0x1000000, 0x1000000, CRC(7a779112) SHA1(0a7d36b3715063d8eac629b95a9bb3ecd8e54fca) )
3208   ROM_LOAD( "lsqh2_a45.rom", 0x2000000, 0x1000000, CRC(5d7de052) SHA1(7663b6cf09f65c4644661005a38f9aba84a32913) )
3209
3210   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
3211   ROM_LOAD( "lsqh2_b01.rom", 0x0000000, 0x1000000, CRC(df7ca696) SHA1(7af3d27957a39de7e4873867c9972c05af7e7964) )
3212
3213   ROM_REGION( 0xc00000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
3214   PGM_AUDIO_BIOS
3215   ROM_LOAD( "lsqh2_m01.rom",0x400000, 0x400000, CRC(01af1b65) SHA1(6cf523fa8f1e03f974771611bb9a4e08a4d4443f) )
3216   ROM_IGNORE( 0x400000 )   // 400000-7fffff empty
3217   ROM_CONTINUE( 0x800000, 0x400000 )
3218   ROM_IGNORE( 0x400000 )   // c00000-ffffff empty
3219ROM_END
3220
3221
31923222ROM_START( killbldp )
31933223   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
31943224   PGM_68K_BIOS
r14896r14897
37773807GAME( 2003, thegladpcb,   theglad,   pgm_arm_type3,     pgm,    theglad,    ROT0,   "IGS", "The Gladiator - Road of the Sword / Shen Jian (M68k label V100) (ARM label V100, ROM 02/25/03 SHEN JIAN) (JAMMA PCB)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */ // ARM time: 16:32:21
37783808
37793809
3780
3810// simulation doesn't seem 100%
37813811GAME( 2004, oldsplus,     pgm,       pgm_arm_type1_sim, oldsplus,     oldsplus,   ROT0,   "IGS", "Oriental Legend Special Plus / Xi You Shi E Zhuan Super Plus", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
37823812
3813// we use the kovsh ARM rom for this, itercepting commands and changing them to match it, doesn't seem 100% correct tho so I'm leaving it as NOT WORKING
3814// if the internal ROM can't be extracted (likely case, execute only area and NO chance of custom code execution at all due to lack of external ROM) then a reference simulator should probably be written based on the actual
3815// kovsh code, tweaked based on tests done with this specific board to catch any different behaviors.  These all seem to be for China only, they don't work as expected when set to other regions.
37833816GAME( 2004, kovshp,       pgm,       pgm_arm_type1,     kovsh,    kovshp,     ROT0,   "IGS", "Knights of Valour Super Heroes Plus / Sangoku Senki Super Heroes Plus (ver. 100)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
3784// these bootlegs are clones of this instead
3817// this bootleg is very close to kovshp
3818GAME( 2004, kovshxas,     kovshp,    pgm_arm_type1,     kovsh,   kovshxas,   ROT0,   "bootleg", "Knights of Valour: Aoshi Sanguo / Sangoku Senki: Aoshi Sanguo (ver. 202CN)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
3819// these should be bootlegs of kovshp, but have further command changes in their ARMs and have a lot of code shuffled around, bootlegs of a different revision?
37853820GAME( 2004, kovlsqh,      kovshp,    pgm_arm_type1,     kovsh,   kovlsqh2,   ROT0,   "bootleg", "Knights of Valour: Luan Shi Quan Huang / Sangoku Senki: Luan Shi Quan Huang (ver. 200CN)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
37863821GAME( 2004, kovlsqh2,     kovshp,    pgm_arm_type1,     kovsh,   kovlsqh2,   ROT0,   "bootleg", "Knights of Valour: Luan Shi Quan Huang 2 / Sangoku Senki: Luan Shi Quan Huang 2 (ver. 200CN)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
37873822GAME( 2004, kovlsjb,      kovshp,    pgm_arm_type1,     kovsh,   kovlsqh2,   ROT0,   "bootleg", "Knights of Valour: Luan Shi Jie Ba / Sangoku Senki: Luan Shi Jie Ba (ver. 200CN, set 1)", GAME_IMPERFECT_SOUND | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
src/mame/drivers/gameplan.c
r14896r14897
167167
168168static const via6522_interface via_2_interface =
169169{
170   DEVCB_NULL, DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),              /*inputs : A/B         */
170   DEVCB_NULL, DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),              /*inputs : A/B         */
171171   DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,                       /*inputs : CA/B1,CA/B2 */
172172   DEVCB_HANDLER(audio_cmd_w), DEVCB_NULL,                    /*outputs: A/B         */
173173   DEVCB_NULL, DEVCB_NULL, DEVCB_HANDLER(audio_trigger_w), DEVCB_HANDLER(audio_reset_w), /*outputs: CA/B1,CA/B2 */
r14896r14897
196196{
197197   gameplan_state *gameplan = device->machine().driver_data<gameplan_state>();
198198   address_space *space = device->machine().device("maincpu")->memory().space(AS_PROGRAM);
199   gameplan->soundlatch_w(*space, 0, data);
199   gameplan->soundlatch_byte_w(*space, 0, data);
200200}
201201
202202
src/mame/drivers/capbowl.c
r14896r14897
183183WRITE8_MEMBER(capbowl_state::capbowl_sndcmd_w)
184184{
185185   device_set_input_line(m_audiocpu, M6809_IRQ_LINE, HOLD_LINE);
186   soundlatch_w(space, offset, data);
186   soundlatch_byte_w(space, offset, data);
187187}
188188
189189
r14896r14897
264264   AM_RANGE(0x1000, 0x1001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
265265   AM_RANGE(0x2000, 0x2000) AM_WRITENOP            /* Not hooked up according to the schematics */
266266   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_LEGACY("dac", dac_w)
267   AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_r)
267   AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_byte_r)
268268   AM_RANGE(0x8000, 0xffff) AM_ROM
269269ADDRESS_MAP_END
270270
r14896r14897
318318   {
319319      AY8910_LEGACY_OUTPUT,
320320      AY8910_DEFAULT_LOADS,
321      DEVCB_DEVICE_HANDLER("ticket", ticket_dispenser_r),
321      DEVCB_DEVICE_MEMBER("ticket", ticket_dispenser_device, read),
322322      DEVCB_NULL,
323323      DEVCB_NULL,
324      DEVCB_DEVICE_HANDLER("ticket", ticket_dispenser_w),  /* Also a status LED. See memory map above */
324      DEVCB_DEVICE_MEMBER("ticket", ticket_dispenser_device, write),  /* Also a status LED. See memory map above */
325325   },
326326   firqhandler
327327};
r14896r14897
372372   MCFG_MACHINE_RESET(capbowl)
373373   MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", capbowl_state, init_nvram)
374374
375   MCFG_TICKET_DISPENSER_ADD("ticket", 100, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
375   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
376376
377377   /* video hardware */
378378   MCFG_VIDEO_START(capbowl)
src/mame/drivers/darius.c
r14896r14897
249249   AM_RANGE(0xd20000, 0xd20003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_yscroll_word_w)
250250   AM_RANGE(0xd40000, 0xd40003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_xscroll_word_w)
251251   AM_RANGE(0xd50000, 0xd50003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_ctrl_word_w)
252   AM_RANGE(0xd80000, 0xd80fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")/* palette */
252   AM_RANGE(0xd80000, 0xd80fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")/* palette */
253253   AM_RANGE(0xe00100, 0xe00fff) AM_RAM AM_SHARE("share1") AM_BASE_SIZE(m_spriteram, m_spriteram_size)
254254   AM_RANGE(0xe01000, 0xe02fff) AM_RAM AM_SHARE("share2")
255255   AM_RANGE(0xe08000, 0xe0ffff) AM_RAM_WRITE(darius_fg_layer_w) AM_SHARE("share3") AM_BASE(m_fg_ram)
r14896r14897
260260   AM_RANGE(0x000000, 0x03ffff) AM_ROM
261261   AM_RANGE(0x040000, 0x04ffff) AM_RAM            /* local RAM */
262262   AM_RANGE(0xc00000, 0xc0007f) AM_WRITE(darius_ioc_w)   /* only writes $c00050 (?) */
263   AM_RANGE(0xd80000, 0xd80fff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w)
263   AM_RANGE(0xd80000, 0xd80fff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w)
264264   AM_RANGE(0xe00100, 0xe00fff) AM_RAM AM_SHARE("share1")
265265   AM_RANGE(0xe01000, 0xe02fff) AM_RAM AM_SHARE("share2")
266266   AM_RANGE(0xe08000, 0xe0ffff) AM_RAM_WRITE(darius_fg_layer_w) AM_SHARE("share3")
src/mame/drivers/kinst.c
r14896r14897
140140{
141141public:
142142   kinst_state(const machine_config &mconfig, device_type type, const char *tag)
143      : driver_device(mconfig, type, tag) { }
143      : driver_device(mconfig, type, tag) ,
144      m_rambase(*this, "rambase"),
145      m_rambase2(*this, "rambase2"),
146      m_control(*this, "control"),
147      m_rombase(*this, "rombase"){ }
144148
145   UINT32 *m_rambase;
146   UINT32 *m_rambase2;
147   UINT32 *m_rombase;
149   required_shared_ptr<UINT32> m_rambase;
150   required_shared_ptr<UINT32> m_rambase2;
151   required_shared_ptr<UINT32> m_control;
152   required_shared_ptr<UINT32> m_rombase;
148153   UINT32 *m_video_base;
149   UINT32 *m_control;
150154   const UINT8 *m_control_map;
151155   DECLARE_READ32_MEMBER(kinst_control_r);
152156   DECLARE_WRITE32_MEMBER(kinst_control_w);
r14896r14897
172176   mips3drc_set_options(machine.device("maincpu"), MIPS3DRC_FASTEST_OPTIONS);
173177
174178   /* configure fast RAM regions for DRC */
175   mips3drc_add_fastram(machine.device("maincpu"), 0x08000000, 0x087fffff, FALSE, state->m_rambase2);
176   mips3drc_add_fastram(machine.device("maincpu"), 0x00000000, 0x0007ffff, FALSE, state->m_rambase);
177   mips3drc_add_fastram(machine.device("maincpu"), 0x1fc00000, 0x1fc7ffff, TRUE,  state->m_rombase);
179   mips3drc_add_fastram(machine.device("maincpu"), 0x08000000, 0x087fffff, FALSE, state->m_rambase2.target());
180   mips3drc_add_fastram(machine.device("maincpu"), 0x00000000, 0x0007ffff, FALSE, state->m_rambase.target());
181   mips3drc_add_fastram(machine.device("maincpu"), 0x1fc00000, 0x1fc7ffff, TRUE,  state->m_rombase.target());
178182}
179183
180184
r14896r14897
221225   }
222226
223227   /* set a safe base location for video */
224   state->m_video_base = &state->m_rambase[0x30000/4];
228   state->m_video_base = &state->m_rambase.target()[0x30000/4];
225229}
226230
227231
r14896r14897
329333
330334   /* apply shuffling */
331335   offset = m_control_map[offset / 2];
332   result = m_control[offset];
336   result = m_control.target()[offset];
333337
334338   switch (offset)
335339   {
r14896r14897
363367
364368   /* apply shuffling */
365369   offset = m_control_map[offset / 2];
366   olddata = m_control[offset];
367   COMBINE_DATA(&m_control[offset]);
370   olddata = m_control.target()[offset];
371   COMBINE_DATA(&m_control.target()[offset]);
368372
369373   switch (offset)
370374   {
371375      case 0:      /* $80 - VRAM buffer control */
372376         if (data & 4)
373            m_video_base = &m_rambase[0x58000/4];
377            m_video_base = &m_rambase.target()[0x58000/4];
374378         else
375            m_video_base = &m_rambase[0x30000/4];
379            m_video_base = &m_rambase.target()[0x30000/4];
376380         break;
377381
378382      case 1:      /* $88 - sound reset */
r14896r14897
380384         break;
381385
382386      case 2:      /* $90 - sound control */
383         if (!(olddata & 0x02) && (m_control[offset] & 0x02))
384            dcs_data_w(machine(), m_control[3]);
387         if (!(olddata & 0x02) && (m_control.target()[offset] & 0x02))
388            dcs_data_w(machine(), m_control.target()[3]);
385389         break;
386390
387391      case 3:      /* $98 - sound data */
r14896r14897
399403
400404static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32, kinst_state )
401405   ADDRESS_MAP_UNMAP_HIGH
402   AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_BASE(m_rambase)
403   AM_RANGE(0x08000000, 0x087fffff) AM_RAM AM_BASE(m_rambase2)
404   AM_RANGE(0x10000080, 0x100000ff) AM_READWRITE(kinst_control_r, kinst_control_w) AM_BASE(m_control)
406   AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_SHARE("rambase")
407   AM_RANGE(0x08000000, 0x087fffff) AM_RAM AM_SHARE("rambase2")
408   AM_RANGE(0x10000080, 0x100000ff) AM_READWRITE(kinst_control_r, kinst_control_w) AM_SHARE("control")
405409   AM_RANGE(0x10000100, 0x1000013f) AM_DEVREADWRITE_LEGACY("ide", kinst_ide_r, kinst_ide_w)
406410   AM_RANGE(0x10000170, 0x10000173) AM_DEVREADWRITE_LEGACY("ide", kinst_ide_extra_r, kinst_ide_extra_w)
407   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_BASE(m_rombase)
411   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("rombase")
408412ADDRESS_MAP_END
409413
410414
src/mame/drivers/sub.c
r14896r14897
116116{
117117public:
118118   sub_state(const machine_config &mconfig, device_type type, const char *tag)
119      : driver_device(mconfig, type, tag) { }
119      : driver_device(mconfig, type, tag) ,
120      m_attr(*this, "attr"),
121      m_vid(*this, "vid"),
122      m_spriteram(*this, "spriteram"),
123      m_spriteram2(*this, "spriteram2"),
124      m_scrolly(*this, "scrolly"){ }
120125
121   UINT8* m_vid;
122   UINT8* m_attr;
123   UINT8* m_scrolly;
124   UINT8* m_spriteram;
125   UINT8* m_spriteram2;
126   required_shared_ptr<UINT8> m_attr;
127   required_shared_ptr<UINT8> m_vid;
128   required_shared_ptr<UINT8> m_spriteram;
129   required_shared_ptr<UINT8> m_spriteram2;
130   required_shared_ptr<UINT8> m_scrolly;
126131   UINT8 m_nmi_en;
127132   DECLARE_WRITE8_MEMBER(subm_to_sound_w);
128133   DECLARE_WRITE8_MEMBER(nmi_mask_w);
r14896r14897
144149   {
145150      for (x=0;x<32;x++)
146151      {
147         UINT16 tile = state->m_vid[count];
152         UINT16 tile = state->m_vid.target()[count];
148153         UINT8 col;
149         UINT8 y_offs = state->m_scrolly[x];
154         UINT8 y_offs = state->m_scrolly.target()[x];
150155
151         tile += (state->m_attr[count]&0xe0)<<3;
152         col = (state->m_attr[count]&0x1f);
156         tile += (state->m_attr.target()[count]&0xe0)<<3;
157         col = (state->m_attr.target()[count]&0x1f);
153158
154159         drawgfx_opaque(bitmap,cliprect,gfx,tile,col+0x40,0,0,x*8,(y*8)-y_offs);
155160         drawgfx_opaque(bitmap,cliprect,gfx,tile,col+0x40,0,0,x*8,(y*8)-y_offs+256);
r14896r14897
170175    1 --cc cccc color
171176    */
172177   {
173      UINT8 *spriteram = state->m_spriteram;
174      UINT8 *spriteram_2 = state->m_spriteram2;
178      UINT8 *spriteram = state->m_spriteram.target();
179      UINT8 *spriteram_2 = state->m_spriteram2.target();
175180      UINT8 x,y,spr_offs,i,col,fx,fy;
176181
177182      for(i=0;i<0x40;i+=2)
r14896r14897
195200   {
196201      for (x=0;x<32;x++)
197202      {
198         UINT16 tile = state->m_vid[count];
203         UINT16 tile = state->m_vid.target()[count];
199204         UINT8 col;
200         UINT8 y_offs = state->m_scrolly[x];
205         UINT8 y_offs = state->m_scrolly.target()[x];
201206
202         tile += (state->m_attr[count]&0xe0)<<3;
203         col = (state->m_attr[count]&0x1f);
207         tile += (state->m_attr.target()[count]&0xe0)<<3;
208         col = (state->m_attr.target()[count]&0x1f);
204209
205210         if(x >= 28)
206211         {
r14896r14897
218223static ADDRESS_MAP_START( subm_map, AS_PROGRAM, 8, sub_state )
219224   AM_RANGE(0x0000, 0xafff) AM_ROM
220225   AM_RANGE(0xb000, 0xbfff) AM_RAM
221   AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE(m_attr)
222   AM_RANGE(0xc400, 0xc7ff) AM_RAM AM_BASE(m_vid)
223   AM_RANGE(0xd000, 0xd03f) AM_RAM AM_BASE(m_spriteram)
224   AM_RANGE(0xd800, 0xd83f) AM_RAM AM_BASE(m_spriteram2)
225   AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE(m_scrolly)
226   AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_SHARE("attr")
227   AM_RANGE(0xc400, 0xc7ff) AM_RAM AM_SHARE("vid")
228   AM_RANGE(0xd000, 0xd03f) AM_RAM AM_SHARE("spriteram")
229   AM_RANGE(0xd800, 0xd83f) AM_RAM AM_SHARE("spriteram2")
230   AM_RANGE(0xd840, 0xd85f) AM_RAM AM_SHARE("scrolly")
226231
227232   AM_RANGE(0xe000, 0xe000) AM_NOP
228233   AM_RANGE(0xe800, 0xe800) AM_NOP
r14896r14897
239244
240245WRITE8_MEMBER(sub_state::subm_to_sound_w)
241246{
242   soundlatch_w(space, 0, data & 0xff);
247   soundlatch_byte_w(space, 0, data & 0xff);
243248   cputag_set_input_line(machine(), "soundcpu", 0, HOLD_LINE);
244249}
245250
r14896r14897
251256
252257static ADDRESS_MAP_START( subm_io, AS_IO, 8, sub_state )
253258   ADDRESS_MAP_GLOBAL_MASK(0xff)
254   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_r) AM_WRITE(subm_to_sound_w) // to/from sound CPU
259   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r) AM_WRITE(subm_to_sound_w) // to/from sound CPU
255260ADDRESS_MAP_END
256261
257262static ADDRESS_MAP_START( subm_sound_map, AS_PROGRAM, 8, sub_state )
r14896r14897
262267
263268static ADDRESS_MAP_START( subm_sound_io, AS_IO, 8, sub_state )
264269   ADDRESS_MAP_GLOBAL_MASK(0xff)
265   AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_r, soundlatch2_w) // to/from main CPU
270   AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w) // to/from main CPU
266271   AM_RANGE(0x40, 0x41) AM_DEVREADWRITE_LEGACY("ay1", ay8910_r, ay8910_address_data_w)
267272   AM_RANGE(0x80, 0x81) AM_DEVREADWRITE_LEGACY("ay2", ay8910_r, ay8910_address_data_w)
268273ADDRESS_MAP_END
src/mame/drivers/cbasebal.c
r14896r14897
6969      break;
7070   case 1:
7171      if (offset < 0x800)
72         paletteram_xxxxBBBBRRRRGGGG_le_w(space, offset, data);
72         paletteram_xxxxBBBBRRRRGGGG_byte_le_w(space, offset, data);
7373      break;
7474   default:
7575      cbasebal_scrollram_w(space, offset, data);
src/mame/drivers/mpoker.c
r14896r14897
178178{
179179public:
180180   mpoker_state(const machine_config &mconfig, device_type type, const char *tag)
181      : driver_device(mconfig, type, tag) { }
181      : driver_device(mconfig, type, tag) ,
182      m_video(*this, "video"){ }
182183
183184   UINT8 m_output[8];
184   UINT8* m_video;
185   required_shared_ptr<UINT8> m_video;
185186   int m_mixdata;
186187   DECLARE_READ8_MEMBER(mixport_r);
187188   DECLARE_WRITE8_MEMBER(muxed_w);
r14896r14897
214215   {
215216      for (x=0;x<32;x++)
216217      {
217         UINT16 dat = state->m_video[count];
218         UINT16 col = state->m_video[count+0x400] & 0x7f;
218         UINT16 dat = state->m_video.target()[count];
219         UINT16 col = state->m_video.target()[count+0x400] & 0x7f;
219220         drawgfx_opaque(bitmap,cliprect,gfx,dat,col,0,0,x*16,y*16);
220221         count++;
221222      }
r14896r14897
474475   AM_RANGE(0x0000, 0x2fff) AM_ROM
475476//  AM_RANGE(0x0158, 0x0158) AM_WRITE (muxed_w)
476477   AM_RANGE(0x3800, 0x38ff) AM_RAM AM_SHARE("nvram")   /* NVRAM = 2x SCM5101E */
477   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(m_video)   /* 4x MM2114N-3 */
478   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_SHARE("video")   /* 4x MM2114N-3 */
478479   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("SW1")
479480   AM_RANGE(0x8001, 0x8001) AM_READ(mixport_r) /* DIP switch bank 2 + a sort of watchdog */
480481   AM_RANGE(0x8002, 0x8002) AM_READ_PORT("IN1")
src/mame/drivers/st0016.c
r14896r14897
6868   mux_port=data;
6969}
7070
71WRITE8_HANDLER(st0016_rom_bank_w)
71WRITE8_MEMBER(st0016_state::st0016_rom_bank_w)
7272{
73   memory_set_bankptr(space->machine(),  "bank1", space->machine().region("maincpu")->base() + (data* 0x4000) + 0x10000 );
73   memory_set_bankptr(machine(),  "bank1", machine().region("maincpu")->base() + (data* 0x4000) + 0x10000 );
7474   st0016_rom_bank=data;
7575}
7676
r14896r14897
8282   AM_RANGE(0xc2, 0xc2) AM_READ(mux_r) AM_WRITENOP
8383   AM_RANGE(0xc3, 0xc3) AM_READ_PORT("P2") AM_WRITENOP
8484   AM_RANGE(0xe0, 0xe0) AM_WRITENOP /* renju = $40, neratte = 0 */
85   AM_RANGE(0xe1, 0xe1) AM_WRITE_LEGACY(st0016_rom_bank_w)
85   AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
8686   AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
8787   AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
8888   AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
r14896r14897
147147   AM_RANGE(0xd2, 0xd2) AM_READ(mux_r) AM_WRITENOP
148148   AM_RANGE(0xd3, 0xd3) AM_READ_PORT("P2") AM_WRITENOP
149149   AM_RANGE(0xe0, 0xe0) AM_WRITENOP
150   AM_RANGE(0xe1, 0xe1) AM_WRITE_LEGACY(st0016_rom_bank_w)
150   AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
151151   AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
152152   AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
153153   AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
src/mame/drivers/cchasm.c
r14896r14897
3737   AM_RANGE(0x050000, 0x050001) AM_WRITE(cchasm_refresh_control_w)
3838   AM_RANGE(0x060000, 0x060001) AM_READ_PORT("DSW") AM_WRITE(cchasm_led_w)
3939   AM_RANGE(0x070000, 0x070001) AM_WRITE(watchdog_reset16_w)
40   AM_RANGE(0xf80000, 0xf800ff) AM_READWRITE_LEGACY(cchasm_io_r,cchasm_io_w)
40   AM_RANGE(0xf80000, 0xf800ff) AM_READWRITE(cchasm_io_r,cchasm_io_w)
4141   AM_RANGE(0xffb000, 0xffffff) AM_RAM AM_BASE(m_ram)
4242ADDRESS_MAP_END
4343
r14896r14897
5252   AM_RANGE(0x4000, 0x43ff) AM_RAM
5353   AM_RANGE(0x5000, 0x53ff) AM_RAM
5454   AM_RANGE(0x6000, 0x6001) AM_MIRROR(0xf9e) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
55   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0xf9e) AM_READ_LEGACY(cchasm_coin_sound_r)
55   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0xf9e) AM_READ(cchasm_coin_sound_r)
5656   AM_RANGE(0x6001, 0x6001) AM_MIRROR(0xf9e) AM_DEVREAD_LEGACY("ay1", ay8910_r)
5757   AM_RANGE(0x6020, 0x6021) AM_MIRROR(0xf9e) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
5858   AM_RANGE(0x6021, 0x6021) AM_MIRROR(0xf9e) AM_DEVREAD_LEGACY("ay2", ay8910_r)
59   AM_RANGE(0x6040, 0x6040) AM_MIRROR(0xf9e) AM_READWRITE(soundlatch_r, soundlatch3_w)
60   AM_RANGE(0x6041, 0x6041) AM_MIRROR(0xf9e) AM_READWRITE_LEGACY(cchasm_soundlatch2_r, cchasm_soundlatch4_w)
61   AM_RANGE(0x6061, 0x6061) AM_MIRROR(0xf9e) AM_WRITE_LEGACY(cchasm_reset_coin_flag_w)
59   AM_RANGE(0x6040, 0x6040) AM_MIRROR(0xf9e) AM_READWRITE(soundlatch_byte_r, soundlatch3_byte_w)
60   AM_RANGE(0x6041, 0x6041) AM_MIRROR(0xf9e) AM_READWRITE(cchasm_soundlatch2_r, cchasm_soundlatch4_w)
61   AM_RANGE(0x6061, 0x6061) AM_MIRROR(0xf9e) AM_WRITE(cchasm_reset_coin_flag_w)
6262   AM_RANGE(0x7041, 0x7041) AM_NOP // TODO
6363ADDRESS_MAP_END
6464
src/mame/drivers/sbasketb.c
r14896r14897
7979   AM_RANGE(0x3c81, 0x3c81) AM_WRITE(irq_mask_w)
8080   AM_RANGE(0x3c83, 0x3c84) AM_WRITE(sbasketb_coin_counter_w)
8181   AM_RANGE(0x3c85, 0x3c85) AM_WRITEONLY AM_BASE(m_spriteram_select)
82   AM_RANGE(0x3d00, 0x3d00) AM_WRITE(soundlatch_w)
82   AM_RANGE(0x3d00, 0x3d00) AM_WRITE(soundlatch_byte_w)
8383   AM_RANGE(0x3d80, 0x3d80) AM_WRITE(sbasketb_sh_irqtrigger_w)
8484   AM_RANGE(0x3e00, 0x3e00) AM_READ_PORT("SYSTEM")
8585   AM_RANGE(0x3e01, 0x3e01) AM_READ_PORT("P1")
r14896r14897
9494static ADDRESS_MAP_START( sbasketb_sound_map, AS_PROGRAM, 8, sbasketb_state )
9595   AM_RANGE(0x0000, 0x1fff) AM_ROM
9696   AM_RANGE(0x4000, 0x43ff) AM_RAM
97   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
97   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
9898   AM_RANGE(0x8000, 0x8000) AM_READ_LEGACY(hyperspt_sh_timer_r)
9999   AM_RANGE(0xa000, 0xa000) AM_DEVWRITE_LEGACY("vlm", vlm5030_data_w) /* speech data */
100100   AM_RANGE(0xc000, 0xdfff) AM_DEVWRITE_LEGACY("vlm", hyperspt_sound_w)     /* speech and output controll */
src/mame/drivers/skyarmy.c
r14896r14897
3333{
3434public:
3535   skyarmy_state(const machine_config &mconfig, device_type type, const char *tag)
36      : driver_device(mconfig, type, tag) { }
36      : driver_device(mconfig, type, tag) ,
37      m_videoram(*this, "videoram"),
38      m_colorram(*this, "colorram"),
39      m_spriteram(*this, "spriteram"),
40      m_scrollram(*this, "scrollram"){ }
3741
38   UINT8 *m_spriteram;
39   UINT8 *m_videoram;
40   UINT8 *m_colorram;
41   UINT8 *m_scrollram;
42   required_shared_ptr<UINT8> m_videoram;
43   required_shared_ptr<UINT8> m_colorram;
44   required_shared_ptr<UINT8> m_spriteram;
45   required_shared_ptr<UINT8> m_scrollram;
4246   tilemap_t* m_tilemap;
4347   int m_nmi;
4448   DECLARE_WRITE8_MEMBER(skyarmy_flip_screen_x_w);
r14896r14897
5054
5155WRITE8_MEMBER(skyarmy_state::skyarmy_flip_screen_x_w)
5256{
53   flip_screen_x_set(machine(), data & 0x01);
57   flip_screen_x_set(data & 0x01);
5458}
5559
5660WRITE8_MEMBER(skyarmy_state::skyarmy_flip_screen_y_w)
5761{
58   flip_screen_y_set(machine(), data & 0x01);
62   flip_screen_y_set(data & 0x01);
5963}
6064
6165static TILE_GET_INFO( get_skyarmy_tile_info )
6266{
6367   skyarmy_state *state = machine.driver_data<skyarmy_state>();
64   int code = state->m_videoram[tile_index];
65   int attr = BITSWAP8(state->m_colorram[tile_index], 7, 6, 5, 4, 3, 0, 1, 2) & 7;
68   int code = state->m_videoram.target()[tile_index];
69   int attr = BITSWAP8(state->m_colorram.target()[tile_index], 7, 6, 5, 4, 3, 0, 1, 2) & 7;
6670
6771   SET_TILE_INFO( 0, code, attr, 0);
6872}
r14896r14897
7074WRITE8_MEMBER(skyarmy_state::skyarmy_videoram_w)
7175{
7276
73   m_videoram[offset] = data;
77   m_videoram.target()[offset] = data;
7478   m_tilemap->mark_tile_dirty(offset);
7579}
7680
7781WRITE8_MEMBER(skyarmy_state::skyarmy_colorram_w)
7882{
7983
80   m_colorram[offset] = data;
84   m_colorram.target()[offset] = data;
8185   m_tilemap->mark_tile_dirty(offset);
8286}
8387
r14896r14897
121125static SCREEN_UPDATE_IND16( skyarmy )
122126{
123127   skyarmy_state *state = screen.machine().driver_data<skyarmy_state>();
124   UINT8 *spriteram = state->m_spriteram;
128   UINT8 *spriteram = state->m_spriteram.target();
125129   int sx, sy, flipx, flipy, offs,pal;
126130   int i;
127131
128132   for(i=0;i<0x20;i++)
129      state->m_tilemap->set_scrolly(i,state->m_scrollram[i]);
133      state->m_tilemap->set_scrolly(i,state->m_scrollram.target()[i]);
130134
131135   state->m_tilemap->draw(bitmap, cliprect, 0,0);
132136
r14896r14897
167171static ADDRESS_MAP_START( skyarmy_map, AS_PROGRAM, 8, skyarmy_state )
168172   AM_RANGE(0x0000, 0x7fff) AM_ROM
169173   AM_RANGE(0x8000, 0x87ff) AM_RAM
170   AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(skyarmy_videoram_w) AM_BASE(m_videoram) /* Video RAM */
171   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(skyarmy_colorram_w) AM_BASE(m_colorram) /* Color RAM */
172   AM_RANGE(0x9800, 0x983f) AM_RAM AM_BASE(m_spriteram) /* Sprites */
173   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_scrollram)  /* Scroll RAM */
174   AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(skyarmy_videoram_w) AM_SHARE("videoram") /* Video RAM */
175   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(skyarmy_colorram_w) AM_SHARE("colorram") /* Color RAM */
176   AM_RANGE(0x9800, 0x983f) AM_RAM AM_SHARE("spriteram") /* Sprites */
177   AM_RANGE(0x9840, 0x985f) AM_RAM AM_SHARE("scrollram")  /* Scroll RAM */
174178   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("DSW")
175179   AM_RANGE(0xa001, 0xa001) AM_READ_PORT("P1")
176180   AM_RANGE(0xa002, 0xa002) AM_READ_PORT("P2")
src/mame/drivers/suprgolf.c
r14896r14897
3030{
3131public:
3232   suprgolf_state(const machine_config &mconfig, device_type type, const char *tag)
33      : driver_device(mconfig, type, tag) { }
33      : driver_device(mconfig, type, tag) ,
34      m_videoram(*this, "videoram"){ }
3435
3536   tilemap_t *m_tilemap;
36   UINT8 *m_videoram;
37   required_shared_ptr<UINT8> m_videoram;
3738   UINT8 *m_paletteram;
3839   UINT8 *m_bg_vram;
3940   UINT16 *m_bg_fb;
r14896r14897
5960static TILE_GET_INFO( get_tile_info )
6061{
6162   suprgolf_state *state = machine.driver_data<suprgolf_state>();
62   int code = state->m_videoram[tile_index*2]+256*(state->m_videoram[tile_index*2+1]);
63   int color = state->m_videoram[tile_index*2+0x800] & 0x7f;
63   int code = state->m_videoram.target()[tile_index*2]+256*(state->m_videoram.target()[tile_index*2+1]);
64   int color = state->m_videoram.target()[tile_index*2+0x800] & 0x7f;
6465
6566   SET_TILE_INFO(
6667      0,
r14896r14897
133134   if (m_palette_switch)
134135      return m_paletteram[offset];
135136   else
136      return m_videoram[offset];
137      return m_videoram.target()[offset];
137138}
138139
139140WRITE8_MEMBER(suprgolf_state::suprgolf_videoram_w)
r14896r14897
154155   }
155156   else
156157   {
157      m_videoram[offset] = data;
158      m_videoram.target()[offset] = data;
158159      m_tilemap->mark_tile_dirty((offset & 0x7fe) >> 1);
159160   }
160161}
r14896r14897
266267   memory_set_bankptr(device->machine(), "bank2", region_base + (data&0x3f ) * 0x4000);
267268
268269   state->m_msm_nmi_mask = data & 0x40;
269   flip_screen_set(device->machine(), data & 0x80);
270   state->flip_screen_set(data & 0x80);
270271}
271272
272273WRITE8_MEMBER(suprgolf_state::rom2_bank_select_w)
r14896r14897
306307   AM_RANGE(0x4000, 0x4000) AM_WRITE(rom2_bank_select_w )
307308   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2")
308309   AM_RANGE(0xc000, 0xdfff) AM_READWRITE(suprgolf_bg_vram_r, suprgolf_bg_vram_w ) // banked background vram
309   AM_RANGE(0xe000, 0xefff) AM_READWRITE(suprgolf_videoram_r, suprgolf_videoram_w ) AM_BASE(m_videoram) //foreground vram + paletteram
310   AM_RANGE(0xe000, 0xefff) AM_READWRITE(suprgolf_videoram_r, suprgolf_videoram_w ) AM_SHARE("videoram") //foreground vram + paletteram
310311   AM_RANGE(0xf000, 0xf000) AM_WRITE(suprgolf_pen_w )
311312   AM_RANGE(0xf800, 0xffff) AM_RAM
312313ADDRESS_MAP_END
src/mame/drivers/ksayakyu.c
r14896r14897
8787WRITE8_MEMBER(ksayakyu_state::latch_w)
8888{
8989   m_sound_status &= ~0x80;
90   soundlatch_w(space, 0, data | 0x80);
90   soundlatch_byte_w(space, 0, data | 0x80);
9191}
9292
9393READ8_MEMBER(ksayakyu_state::sound_status_r)
r14896r14897
9898WRITE8_MEMBER(ksayakyu_state::tomaincpu_w)
9999{
100100   m_sound_status |= 0x80;
101   soundlatch_w(space, 0, data);
101   soundlatch_byte_w(space, 0, data);
102102}
103103
104104static ADDRESS_MAP_START( maincpu_map, AS_PROGRAM, 8, ksayakyu_state )
r14896r14897
188188{
189189   AY8910_LEGACY_OUTPUT,
190190   AY8910_DEFAULT_LOADS,
191   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
191   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
192192   DEVCB_NULL,
193193   DEVCB_NULL,
194194   DEVCB_HANDLER(dummy1_w)
src/mame/drivers/himesiki.c
r14896r14897
9999
100100WRITE8_MEMBER(himesiki_state::himesiki_sound_w)
101101{
102   soundlatch_w(space, offset, data);
102   soundlatch_byte_w(space, offset, data);
103103   device_set_input_line(m_subcpu, INPUT_LINE_NMI, PULSE_LINE);
104104}
105105
r14896r14897
109109   AM_RANGE(0x0000, 0x7fff) AM_ROM
110110   AM_RANGE(0x8000, 0x9fff) AM_RAM
111111   AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE(m_spriteram)
112   AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
112   AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
113113   AM_RANGE(0xb000, 0xbfff) AM_RAM_WRITE(himesiki_bg_ram_w) AM_BASE(m_bg_ram)
114114   AM_RANGE(0xc000, 0xffff) AM_ROMBANK("bank1")
115115ADDRESS_MAP_END
r14896r14897
137137static ADDRESS_MAP_START( himesiki_iom1, AS_IO, 8, himesiki_state )
138138   ADDRESS_MAP_GLOBAL_MASK(0xff)
139139   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ym2203", ym2203_r, ym2203_w)
140   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r)
140   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_byte_r)
141141ADDRESS_MAP_END
142142
143143/****************************************************************************/
src/mame/drivers/snesb.c
r14896r14897
22
33 Arcade games (hacks of console games) running on SNES harware.
44
5 Driver (based on nss.c ) by Tomasz Slanina  analog[at]op.pl
5 Driver (based on nss.c) by Tomasz Slanina  analog[at]op.pl
66
77    Supported games:
88    - Killer Instinct
99    - Final Fight 2
10    - Sonic Blast Man 2
1110    - Iron (bootleg of Iron Commando)
1211    - Ghost Chaser Densei
12    - Sonic Blast Man 2
1313    - Gundam Wing: Endless Duel
1414
1515    Not dumped:
r14896r14897
1717
1818TODO:
1919
20 - ffight2b -  dipswitches ($7eadd7 ?)
21 - sblast2b -  dipswicthes
22 - kiinstb -   fix gfx glitches, missing texts
20 - all games : (re)add PORT_DIPLOCATION
21 - kiinstb  : fix gfx glitches, missing texts
22 - ffight2b : fix starting credits (RAM - mainly 0x7eadce where credits are stored - is filled with 0x55, so you are awarded 55 credits on a hard reset)
23 - sblast2b : dipswicthes
24 - denseib  :  fix gfx glitches, missing texts
2325
26***************************************************************************
2427
28  Killer Instinct PCB Info:
29  --------------------------
30
31    PQFP 100(?)pin chip marked "SP-BE0"
32    PQFP 100(?)pin chip marked "SP-BH0"
33    PQFP 100(?)pin chip marked "SP-AF0"
34    Lattice pLSI 1024-60LJ B604S03
35    6116 SRAM    x2
36    AS7C256 SRAM x8
37    jumper pack (12)
38    dsw8         x2
39    Xtal 24.576 MHz
40    Xtal 21.47727 MHz
41    volume pot
42    27c801       x4
43    two empty eprom sockets
44
45    It's SNES version of KI with few mods (removed copyright messages,
46    extra code for coin input, etc).
47
48    256 bytes of RAM (mapped to reserved area) are shared with some
49    device (probably Lattice PLD) used for handle coin inputs and dips
50
51    Data lines of eproms are bitswapped.
52
53***************************************************************************
54
2555  Final Fight 2 PCB layout:
2656  ------------------------
2757
r14896r14897
5585 |               |---|              JAMMA                 |---|               |
5686 |---------------|   |------------------------------------|   |---------------|
5787
58  Killer Instinct PCB Info:
59  --------------------------
60
61    PQFP 100(?)pin chip marked "SP-BE0"
62    PQFP 100(?)pin chip marked "SP-BH0"
63    PQFP 100(?)pin chip marked "SP-AF0"
64    Lattice pLSI 1024-60LJ B604S03
65    6116 SRAM    x2
66    AS7C256 SRAM x8
67    jumper pack (12)
68    dsw8         x2
69    Xtal 24.576 MHz
70    Xtal 21.47727 MHz
71    volume pot
72    27c801       x4
73    two empty eprom sockets
74
75    It's SNES version of KI with few mods (removed copyright messages,
76    extra code for coin input, etc).
77
78    256 bytes of RAM ( mapped to reserved area) are shared with some
79    device (probably Lattice PLD) used for handle coin inputs and dips
80
81    Data lines of eproms are bitswapped.
82
8388***************************************************************************
8489
8590Iron PCB (same as Final Fight 2?)
r14896r14897
131136|                 |     || | | | | | | | | | | | | | | | | | | | | | | |     |                 |
132137|_________________|     |______________________________________________|     |_________________|
133138
134
135139***************************************************************************/
136140
137141
r14896r14897
151155      : snes_state(mconfig, type, tag) { }
152156
153157   INT8 *m_shared_ram;
154   UINT8 m_ffight2b_coins;
155   INT32 m_oldinput;
156   INT32 m_oldcoin;
157158   UINT8 m_cnt;
159   DECLARE_READ8_MEMBER(sharedram_r);
160   DECLARE_WRITE8_MEMBER(sharedram_w);
161   DECLARE_READ8_MEMBER(sb2b_75bd37_r);
162   DECLARE_READ8_MEMBER(sb2b_6a6xxx_r);
163   DECLARE_READ8_MEMBER(sb2b_7xxx_r);
164   DECLARE_READ8_MEMBER(snesb_dsw1_r);
165   DECLARE_READ8_MEMBER(snesb_dsw2_r);
166   DECLARE_READ8_MEMBER(snesb_coin_r);
158167};
159168
160169
161
162static READ8_HANDLER(sharedram_r)
170/* Killer Instinct */
171READ8_MEMBER(snesb_state::sharedram_r)
163172{
164   snesb_state *state = space->machine().driver_data<snesb_state>();
165   INT32 coincnt;
166   INT32 input = input_port_read(space->machine(), "COIN");
167
168   if(input&3)
169   {
170      if( ((input&1)==1)&&((state->m_oldinput&1)==0))   {state->m_shared_ram[0]++;}
171
172      coincnt=state->m_shared_ram[0];
173
174      if(coincnt>99){coincnt=99;}
175
176      state->m_shared_ram[0xb]=(coincnt/10)+'0';
177      state->m_shared_ram[0xa]=(coincnt%10)+'0';
178   }
179   state->m_oldinput=input;
180   return state->m_shared_ram[offset];
173   return m_shared_ram[offset];
181174}
182175
183static WRITE8_HANDLER(sharedram_w)
176WRITE8_MEMBER(snesb_state::sharedram_w)
184177{
185   snesb_state *state = space->machine().driver_data<snesb_state>();
186   state->m_shared_ram[offset]=data;
178   m_shared_ram[offset]=data;
187179}
188180
189static READ8_HANDLER(ffight2b_coin_r)
181/* Sonic Blast Man 2 Special Turbo */
182READ8_MEMBER(snesb_state::sb2b_75bd37_r)
190183{
191   snesb_state *state = space->machine().driver_data<snesb_state>();
192   INT32 input = input_port_read(space->machine(), "COIN");
193
194   if( ((input&1)==1)&&((state->m_oldcoin&1)==0))
195   {
196      INT32 coin_cnt=(state->m_ffight2b_coins&0xf)+10*(state->m_ffight2b_coins>>4);
197      if(++coin_cnt>99) coin_cnt=99;
198      state->m_ffight2b_coins=(coin_cnt%10)|((coin_cnt/10)<<4);
199   }
200   state->m_oldcoin=input;
201   return state->m_ffight2b_coins;
202}
203
204/* Sonic blast man 2 turbo */
205
206static READ8_HANDLER(sb2b_75bd37_r)
207{
208   snesb_state *state = space->machine().driver_data<snesb_state>();
209184   /* protection check */
210   return ++state->m_cnt;
185   return ++m_cnt;
211186}
212187
213static READ8_HANDLER(sb2b_6a6xxx_r)
188READ8_MEMBER(snesb_state::sb2b_6a6xxx_r)
214189{
215190   /* protection checks */
216191   switch(offset)
r14896r14897
223198      case 0xfb7:   return 0x47;
224199   }
225200
226   logerror("Unknown protection read read %x @ %x\n",offset, cpu_get_pc(&space->device()));
201   logerror("Unknown protection read read %x @ %x\n",offset, cpu_get_pc(&space.device()));
227202
228203   return 0;
229204}
230205
231static READ8_HANDLER(sb2b_770071_r)
206READ8_MEMBER(snesb_state::sb2b_7xxx_r)
232207{
233   return input_port_read(space->machine(), "DSW");
234}
235
236static READ8_HANDLER(sb2b_770079_r)
237{
238   return input_port_read(space->machine(), "COIN");
239}
240
241static READ8_HANDLER(sb2b_7xxx_r)
242{
243208   return snes_ram[0xc07000 + offset];
244209}
245210
246/* Iron */
247211
248static READ8_HANDLER(iron_770071_r)
212/* Generic read handlers for Dip Switches and coins inputs */
213READ8_MEMBER(snesb_state::snesb_dsw1_r)
249214{
250   return input_port_read(space->machine(), "DSW1");
215   return input_port_read(machine(), "DSW1");
251216}
252217
253static READ8_HANDLER(iron_770073_r)
218READ8_MEMBER(snesb_state::snesb_dsw2_r)
254219{
255   return input_port_read(space->machine(), "DSW2");
220   return input_port_read(machine(), "DSW2");
256221}
257222
258static READ8_HANDLER(iron_770079_r)
223READ8_MEMBER(snesb_state::snesb_coin_r)
259224{
260   return input_port_read(space->machine(), "COIN");
225   return input_port_read(machine(), "COIN");
261226}
262227
263228
264/* Denseib */
265
266static READ8_HANDLER(denseib_770071_r)
267{
268   return input_port_read(space->machine(), "DSW1");
269}
270
271static READ8_HANDLER(denseib_770079_r)
272{
273   return input_port_read(space->machine(), "COIN");
274}
275
276
277
278229static ADDRESS_MAP_START( snesb_map, AS_PROGRAM, 8, snesb_state )
279230   AM_RANGE(0x000000, 0x2fffff) AM_READWRITE_LEGACY(snes_r_bank1, snes_w_bank1)   /* I/O and ROM (repeats for each bank) */
280231   AM_RANGE(0x300000, 0x3fffff) AM_READWRITE_LEGACY(snes_r_bank2, snes_w_bank2)   /* I/O and ROM (repeats for each bank) */
r14896r14897
400351INPUT_PORTS_END
401352
402353
354/* verified from 5A22 code */
403355static INPUT_PORTS_START( kinstb )
404356   PORT_INCLUDE(snes_common)
405357
406   PORT_START("DSW")
358   PORT_START("DSW1")
359   PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Difficulty ) )
360   PORT_DIPSETTING(    0x00, "0 (Easiest)" )               /* "EASY" (0 star) */
361   PORT_DIPSETTING(    0x01, "1" )                         /* (1 star) */
362   PORT_DIPSETTING(    0x02, "2" )                         /* (2 stars) */
363   PORT_DIPSETTING(    0x03, "3" )                         /* (3 stars) */
364   PORT_DIPSETTING(    0x04, "4" )                         /* (4 stars) */
365   PORT_DIPSETTING(    0x05, "5" )                         /* "HARD" (5 stars) */
366   PORT_DIPSETTING(    0x06, "6" )                         /* undefined */
367   PORT_DIPSETTING(    0x07, "7" )                         /* undefined */
368   PORT_DIPSETTING(    0x08, "8" )                         /* undefined */
369   PORT_DIPSETTING(    0x09, "9" )                         /* undefined */
370   PORT_DIPSETTING(    0x0a, "10" )                        /* undefined */
371   PORT_DIPSETTING(    0x0b, "11" )                        /* undefined */
372   PORT_DIPSETTING(    0x0c, "12" )                        /* undefined */
373   PORT_DIPSETTING(    0x0d, "13" )                        /* undefined */
374   PORT_DIPSETTING(    0x0e, "14" )                        /* undefined */
375   PORT_DIPSETTING(    0x0f, "15 (Hardest)" )              /* undefined */
376   PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
377   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
378   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
379   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
407380
381   PORT_START("DSW2")
382   PORT_DIPNAME( 0x0f, 0x01, DEF_STR( Coinage ) )
383   PORT_DIPSETTING(    0x0f, "15 Coins/1 Credit" )
384   PORT_DIPSETTING(    0x0e, "14 Coins/1 Credit" )
385   PORT_DIPSETTING(    0x0d, "13 Coins/1 Credit" )
386   PORT_DIPSETTING(    0x0c, "12 Coins/1 Credit" )
387   PORT_DIPSETTING(    0x0b, "11 Coins/1 Credit" )
388   PORT_DIPSETTING(    0x0a, "10 Coins/1 Credit" )
389   PORT_DIPSETTING(    0x09, DEF_STR( 9C_1C ) )
390   PORT_DIPSETTING(    0x08, DEF_STR( 8C_1C ) )
391   PORT_DIPSETTING(    0x07, DEF_STR( 7C_1C ) )
392   PORT_DIPSETTING(    0x06, DEF_STR( 6C_1C ) )
393   PORT_DIPSETTING(    0x05, DEF_STR( 5C_1C ) )
394   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
395   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
396   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
397   PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
398   PORT_DIPSETTING(    0x00, DEF_STR( 1C_2C ) )
399   PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
400   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
401   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
402   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
403
408404   PORT_START("COIN")
409   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
410   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
411
405   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
406   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
412407INPUT_PORTS_END
413408
414
409/* verified from 5A22 code */
415410static INPUT_PORTS_START( ffight2b )
416411   PORT_INCLUDE(snes_common)
417412
418   PORT_START("DSW")
419   PORT_DIPNAME( 0x01, 0x01, "Player Bonus" ) PORT_DIPLOCATION("SW1:1")
420   PORT_DIPSETTING(    0x01, DEF_STR( No ) )
421   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
422   PORT_DIPNAME( 0x06, 0x04, "Game Level" ) PORT_DIPLOCATION("SW1:2,3")
423   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
413   PORT_START("DSW1")
414   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
415   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
416   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
417   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
418   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
419//   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )            /* duplicate setting */
420   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
421   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
422   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
423   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) )
424   PORT_DIPSETTING(    0x18, "1" )
425   PORT_DIPSETTING(    0x10, "2" )
426   PORT_DIPSETTING(    0x08, "3" )
427   PORT_DIPSETTING(    0x00, "4" )
428   PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )       /* "GAME LEVEL" */
429   PORT_DIPSETTING(    0x60, DEF_STR( Easy ) )
430   PORT_DIPSETTING(    0x40, DEF_STR( Normal ) )
431   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
432   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )          /* "EXPERT" */
433   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Bonus_Life ) )
434   PORT_DIPSETTING(    0x00, "100k 300k 200k+" )
435   PORT_DIPSETTING(    0x80, DEF_STR( None ) )
436
437   PORT_START("DSW2")
438   PORT_DIPUNUSED( 0x01, IP_ACTIVE_LOW )
439   PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW )
440   PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW )
441   PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW )
442   PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
443   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
444   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
445   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
446   
447   PORT_START("COIN")
448   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
449   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
450INPUT_PORTS_END
451
452/* verified from 5A22 code */
453static INPUT_PORTS_START( iron )
454   PORT_INCLUDE(snes_common)
455
456   PORT_START("DSW1")
457   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
458   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
459   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
460   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
461   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
462//   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )            /* duplicate setting */
463   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
464   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
465   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
466   PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
467   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
468   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
469   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
470
471   PORT_START("DSW2")
472   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )       /* "LEVEL" */
473   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
474   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )           /* "MEDIUM" */
424475   PORT_DIPSETTING(    0x02, DEF_STR( Hard ) )
476   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )             /* duplicate setting */
477   PORT_DIPNAME( 0x04, 0x04, "Suffered Damages" )          /* code at 0x(8)082d0 */
425478   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
426   PORT_DIPSETTING(    0x06, DEF_STR( Easy ) )
427   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:4,5")
428   PORT_DIPSETTING(    0x00, "4" )
429   PORT_DIPSETTING(    0x08, "3" )
430   PORT_DIPSETTING(    0x10, "2" )
431   PORT_DIPSETTING(    0x18, "1" )
432   PORT_DIPNAME( 0xe0, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:6,7,8")
433   PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
434   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
435   PORT_DIPSETTING(    0x60, DEF_STR( 2C_1C ) )
436   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
437   /*  PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) ) */
438   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
439   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
440   PORT_DIPSETTING(    0x80, DEF_STR( 1C_4C ) )
479   PORT_DIPSETTING(    0x00, "More" )
480   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) )            /* table at 0x(8)3ffda (4 * 1 word) gives 02 03 04 05 (add 1) but extra LSRA before TAY at 0x(8)3ffcf */
481   PORT_DIPSETTING(    0x18, "3" )
482   PORT_DIPSETTING(    0x08, "4" )
483   PORT_DIPSETTING(    0x10, "769 (Bug)" )
484   PORT_DIPSETTING(    0x00, "1025 (Bug)" )
485   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
486   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
487   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
488   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
489   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
441490
442491   PORT_START("COIN")
443   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
444   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
492   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
493   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
445494INPUT_PORTS_END
446495
447
448static INPUT_PORTS_START( sblast2b )
496/* verified from 5A22 code */
497static INPUT_PORTS_START( denseib )
449498   PORT_INCLUDE(snes_common)
450499
451   PORT_START("DSW")
452   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW1:1" )
453   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW1:2" )
454   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW1:3" )
455   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW1:4" )
456   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW1:5" )
457   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW1:6" )
458   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW1:7" )
459   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW1:8" )
500   PORT_START("DSW1")
501   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
502   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
503   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
504   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
505   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
506//   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )            /* duplicate setting */
507   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
508   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
509   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
510   PORT_DIPNAME( 0x18, 0x10, DEF_STR( Difficulty ) )       /* "RANK" */
511   PORT_DIPSETTING(    0x18, DEF_STR( Easy ) )
512   PORT_DIPSETTING(    0x10, DEF_STR( Normal ) )
513   PORT_DIPSETTING(    0x08, DEF_STR( Hard ) )
514//   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )             /* duplicate setting */
515   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
516   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
517   PORT_DIPNAME( 0x80, 0x00, "Mode" )
518   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
519   PORT_DIPSETTING(    0x80, "Battle" )
460520
521   PORT_START("DSW2")
522   PORT_DIPNAME( 0x07, 0x07, "Suffered Damages" )          /* code at 0x(8)0f810 */
523   PORT_DIPSETTING(    0x07, DEF_STR( Normal ) )
524   PORT_DIPSETTING(    0x06, "x1.5" )
525   PORT_DIPSETTING(    0x05, "x2.5" )
526   PORT_DIPSETTING(    0x04, "x3.5" )
527   PORT_DIPSETTING(    0x03, "x4.5" )
528   PORT_DIPSETTING(    0x02, "x5.5" )
529   PORT_DIPSETTING(    0x01, "x6.5" )
530   PORT_DIPSETTING(    0x00, "x7.5" )
531   PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
532   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
533   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
534   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
535
461536   PORT_START("COIN")
462537   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
463538   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
464
465539INPUT_PORTS_END
466540
467
468static INPUT_PORTS_START( iron )
541/* verified from 5A22 code */
542static INPUT_PORTS_START( sblast2b )
469543   PORT_INCLUDE(snes_common)
470544
471545   PORT_START("DSW1")
472   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW1:1" )
473   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW1:2" )
474   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW1:3" )
475   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW1:4" )
476   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW1:5" )
477   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW1:6" )
478   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW1:7" )
479   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW1:8" )
546   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
547   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
548   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
549   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
550   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
551//   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )            /* duplicate setting */
552   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
553   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
554   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
555   PORT_DIPNAME( 0x38, 0x38, DEF_STR( Difficulty ) )       /* "LEVEL" */
556   PORT_DIPSETTING(    0x38, "0 (Easiest)" )               /* "NORMAL" */
557   PORT_DIPSETTING(    0x30, "1" )                         /* "HARD" */
558   PORT_DIPSETTING(    0x28, "2" )                         /* undefined */
559   PORT_DIPSETTING(    0x20, "3" )                         /* undefined */
560   PORT_DIPSETTING(    0x18, "4" )                         /* undefined */
561   PORT_DIPSETTING(    0x10, "5" )                         /* undefined */
562   PORT_DIPSETTING(    0x08, "6" )                         /* undefined */
563   PORT_DIPSETTING(    0x00, "7 (Hardest)" )               /* undefined */
564   PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Lives ) )
565   PORT_DIPSETTING(    0xc0, "1" )
566   PORT_DIPSETTING(    0x80, "2" )
567   PORT_DIPSETTING(    0x40, "3" )
568   PORT_DIPSETTING(    0x00, "4" )
480569
481570   PORT_START("DSW2")
482   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW2:1" )
483   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW2:2" )
484   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW2:3" )
485   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW2:4" )
486   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW2:5" )
487   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW2:6" )
488   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW2:7" )
489   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW2:8" )
571   PORT_DIPNAME( 0x0f, 0x04, "Power" )
572   PORT_DIPSETTING(    0x07, "0" )
573   PORT_DIPSETTING(    0x06, "1" )
574   PORT_DIPSETTING(    0x05, "2" )
575   PORT_DIPSETTING(    0x04, "3" )
576   PORT_DIPSETTING(    0x03, "4" )
577   PORT_DIPSETTING(    0x02, "5" )
578   PORT_DIPSETTING(    0x01, "6" )
579   PORT_DIPSETTING(    0x00, "7" )
580   PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
581   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
582   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
583   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
490584
491585   PORT_START("COIN")
492586   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
493587   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
494588INPUT_PORTS_END
495589
496static INPUT_PORTS_START( denseib )
590
591static INPUT_PORTS_START( endless )
497592   PORT_INCLUDE(snes_common)
498593
499594   PORT_START("DSW1")
500   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW1:1" )
501   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW1:2" )
502   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW1:3" )
503   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW1:4" )
504   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW1:5" )
505   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW1:6" )
506   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW1:7" )
507   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW1:8" )
595   PORT_DIPUNKNOWN( 0x01, IP_ACTIVE_LOW )
596   PORT_DIPUNKNOWN( 0x02, IP_ACTIVE_LOW )
597   PORT_DIPUNKNOWN( 0x04, IP_ACTIVE_LOW )
598   PORT_DIPUNKNOWN( 0x08, IP_ACTIVE_LOW )
599   PORT_DIPUNKNOWN( 0x10, IP_ACTIVE_LOW )
600   PORT_DIPUNKNOWN( 0x20, IP_ACTIVE_LOW )
601   PORT_DIPUNKNOWN( 0x40, IP_ACTIVE_LOW )
602   PORT_DIPUNKNOWN( 0x80, IP_ACTIVE_LOW )
508603
604   PORT_START("DSW2")
605   PORT_DIPUNKNOWN( 0x01, IP_ACTIVE_LOW )
606   PORT_DIPUNKNOWN( 0x02, IP_ACTIVE_LOW )
607   PORT_DIPUNKNOWN( 0x04, IP_ACTIVE_LOW )
608   PORT_DIPUNKNOWN( 0x08, IP_ACTIVE_LOW )
609   PORT_DIPUNKNOWN( 0x10, IP_ACTIVE_LOW )
610   PORT_DIPUNKNOWN( 0x20, IP_ACTIVE_LOW )
611   PORT_DIPUNKNOWN( 0x40, IP_ACTIVE_LOW )
612   PORT_DIPUNKNOWN( 0x80, IP_ACTIVE_LOW )
613
509614   PORT_START("COIN")
510615   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
511616   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
r14896r14897
553658   }
554659
555660   state->m_shared_ram = auto_alloc_array(machine, INT8, 0x100);
556   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x781000, 0x7810ff, FUNC(sharedram_r), FUNC(sharedram_w));
661   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x781000, 0x7810ff, read8_delegate(FUNC(snesb_state::sharedram_r),state), write8_delegate(FUNC(snesb_state::sharedram_w),state));
557662
663   /* extra inputs */
664   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),state));
665   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),state));
666   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),state));
667
558668   DRIVER_INIT_CALL(snes_hirom);
559669}
560670
561671static DRIVER_INIT( ffight2b )
562672{
563   snesb_state *state = machine.driver_data<snesb_state>();
564673   INT32 i;
565674   UINT8 *rom = machine.region("user3")->base();
566675
r14896r14897
590699      }
591700   }
592701
593   /* boot vector */
702   /* boot vector */
594703   rom[0x7ffd] = 0x89;
595704   rom[0x7ffc] = 0x54;
596705
597   state->m_ffight2b_coins = 0;
598   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x7eadce, 0x7eadce, FUNC(ffight2b_coin_r));
706   /* extra inputs */
707   snesb_state *state = machine.driver_data<snesb_state>();
708   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),state));
709   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),state));
710   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),state));
599711
600712   DRIVER_INIT_CALL(snes);
601713}
602714
715static DRIVER_INIT( iron )
716{
717   INT32 i;
718   UINT8 *rom = machine.region("user3")->base();
603719
720   for (i = 0; i < 0x140000; i++)
721   {
722      if(i < 0x80000)
723      {
724         rom[i] = BITSWAP8(rom[i]^0xff,2,7,1,6,3,0,5,4);
725      }
726      else
727      {
728         rom[i] = BITSWAP8(rom[i],6,3,0,5,1,4,7,2);
729      }
730   }
731
732   /* extra inputs */
733   snesb_state *state = machine.driver_data<snesb_state>();
734   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),state));
735   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),state));
736   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),state));
737
738   DRIVER_INIT_CALL(snes);
739}
740
741static DRIVER_INIT( denseib )
742{
743   UINT8 *rom = machine.region("user3")->base();
744   INT32 i;
745
746   for (i = 0; i < 0x200000; i++)
747   {
748      rom[i] = rom[i] ^ 0xff;
749      switch (i >> 16)
750      {
751         case 0x00: rom[i] = BITSWAP8(rom[i],1,7,0,6,3,4,5,2); break;
752         case 0x01: rom[i] = BITSWAP8(rom[i],3,4,7,2,0,6,5,1); break;
753         case 0x02: rom[i] = BITSWAP8(rom[i],5,4,2,1,7,0,6,3); break;
754         case 0x03: rom[i] = BITSWAP8(rom[i],0,1,3,7,2,6,5,4); break;
755
756         default:   rom[i] = BITSWAP8(rom[i],4,5,1,0,2,3,7,6); break;
757      }
758   }
759
760   /* boot vector */
761   rom[0xfffc] = 0x40;
762   rom[0xfffd] = 0xf7;
763
764   /* extra inputs */
765   snesb_state *state = machine.driver_data<snesb_state>();
766   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),state));
767   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),state));
768   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),state));
769
770   DRIVER_INIT_CALL(snes_hirom);
771}
772
604773static const UINT8 data_substitution0[] = {0x88,0x02,0x2a,0x08,0x28,0xaa,0x8a,0x0a,0xa2,0x00,0x80,0xa0,0x22,0xa8,0x82,0x20,};
605774static const UINT8 data_substitution1[] = {0x44,0x01,0x51,0x40,0x50,0x55,0x45,0x41,0x15,0x00,0x04,0x14,0x11,0x54,0x05,0x10,};
606775static const UINT8 address_substitution_low[] =
r14896r14897
654823   dst[0xfffd] = 0x7a;
655824
656825   /*  protection checks */
657   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x75bd37, 0x75bd37, FUNC(sb2b_75bd37_r));
658   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x6a6000, 0x6a6fff, FUNC(sb2b_6a6xxx_r));
826   snesb_state *state = machine.driver_data<snesb_state>();
827   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x75bd37, 0x75bd37, read8_delegate(FUNC(snesb_state::sb2b_75bd37_r),state));
828   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6a6000, 0x6a6fff, read8_delegate(FUNC(snesb_state::sb2b_6a6xxx_r),state));
659829
660   /* extra inputs */
661   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770071, 0x770071, FUNC(sb2b_770071_r));
662   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770079, 0x770079, FUNC(sb2b_770079_r));
663
664830   /* handler to read boot code */
665   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x007000, 0x007fff, FUNC(sb2b_7xxx_r));
831   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x007000, 0x007fff, read8_delegate(FUNC(snesb_state::sb2b_7xxx_r),state));
666832
667   DRIVER_INIT_CALL(snes_hirom);
668}
669
670static DRIVER_INIT( iron )
671{
672   INT32 i;
673   UINT8 *rom = machine.region("user3")->base();
674
675   for (i = 0; i < 0x140000; i++)
676   {
677      if(i < 0x80000)
678      {
679         rom[i] = BITSWAP8(rom[i]^0xff,2,7,1,6,3,0,5,4);
680      }
681      else
682      {
683         rom[i] = BITSWAP8(rom[i],6,3,0,5,1,4,7,2);
684      }
685   }
686
687833   /* extra inputs */
688   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770071, 0x770071, FUNC(iron_770071_r));
689   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770073, 0x770073, FUNC(iron_770073_r));
690   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770079, 0x770079, FUNC(iron_770079_r));
834   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),state));
835   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),state));
836   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),state));
691837
692   DRIVER_INIT_CALL(snes);
838   DRIVER_INIT_CALL(snes_hirom);
693839}
694840
695841static DRIVER_INIT( endless )
r14896r14897
706852   DRIVER_INIT_CALL(snes);
707853}
708854
709static DRIVER_INIT( denseib )
710{
711   UINT8 *rom = machine.region("user3")->base();
712   INT32 i;
713855
714   for (i = 0; i < 0x200000; i++)
715   {
716      rom[i] = rom[i] ^ 0xff;
717      switch (i >> 16)
718      {
719         case 0x00: rom[i] = BITSWAP8(rom[i],1,7,0,6,3,4,5,2); break;
720         case 0x01: rom[i] = BITSWAP8(rom[i],3,4,7,2,0,6,5,1); break;
721         case 0x02: rom[i] = BITSWAP8(rom[i],5,4,2,1,7,0,6,3); break;
722         case 0x03: rom[i] = BITSWAP8(rom[i],0,1,3,7,2,6,5,4); break;
723
724         default:   rom[i] = BITSWAP8(rom[i],4,5,1,0,2,3,7,6); break;
725      }
726   }
727
728   /*  boot vector */
729   rom[0xfffc] = 0x40;
730   rom[0xfffd] = 0xf7;
731
732   /* extra inputs */
733   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770071, 0x770071, FUNC(denseib_770071_r));
734   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770079, 0x770079, FUNC(denseib_770079_r));
735
736   DRIVER_INIT_CALL(snes_hirom);
737}
738
739
740856ROM_START( kinstb )
741857   ROM_REGION( 0x400000, "user3", 0 )
742858   ROM_LOAD( "1.u14", 0x000000, 0x100000, CRC(70889919) SHA1(1451714cbdacb7f6ced2bc7afa478ad7264cf3b7) )
r14896r14897
750866   ROM_REGION(0x800,           "user6", ROMREGION_ERASEFF)
751867ROM_END
752868
753ROM_START( endless )
754   ROM_REGION( 0x400000, "user3", 0 )
755   ROM_LOAD( "endlessduel.unknownposition1", 0x000000, 0x80000, CRC(e49acd29) SHA1(ac137261fe7a7691738ac812bea9591256eb9038) )
756   ROM_LOAD( "endlessduel.unknownposition2", 0x080000, 0x80000, CRC(ad2052f9) SHA1(d61382e3d93eb0bff45fb534cec0ce5ae3626165) )
757   ROM_LOAD( "endlessduel.unknownposition3", 0x100000, 0x80000, CRC(30d06d7a) SHA1(17c617d94abb10c3bdf9d51013b116f4ef4debe8) )
758   ROM_LOAD( "endlessduel.unknownposition4", 0x180000, 0x80000, CRC(9a9493ad) SHA1(82ee4fce9cc2014cb8404fd43eebb7941cdb9ac1) )
759
760   ROM_REGION(0x100,           "user5", 0)
761   ROM_LOAD("spc700.rom", 0, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) )
762
763   ROM_REGION(0x800,           "user6", ROMREGION_ERASEFF)
764ROM_END
765
766869ROM_START( ffight2b )
767870   ROM_REGION( 0x400000, "user3", 0 )
768871   ROM_LOAD( "ff2_3.u6", 0x000000, 0x008000, CRC(343bf582) SHA1(cc6b7219bb2fe61f0b377b606ad28b0e5a78be0b) )
r14896r14897
817920   ROM_REGION(0x800,           "user6", ROMREGION_ERASEFF)
818921ROM_END
819922
923ROM_START( denseib )
924   ROM_REGION( 0x200000, "user3", ROMREGION_ERASEFF )
925   ROM_LOAD( "dj.u14", 0x000000, 0x0080000, CRC(487ded13) SHA1(624edce30fe2f2d750bcb49c609ceb511b2279b1) )
926   ROM_LOAD( "dj.u15", 0x080000, 0x0080000, CRC(5932a440) SHA1(6048372268a097b08d9f56ad30f083267d798165) )
927   ROM_LOAD( "dj.u16", 0x100000, 0x0080000, CRC(7cb71fd7) SHA1(7673e9dcaabe804e2d637e67eabca1683dad4245) )
928   ROM_LOAD( "dj.u17", 0x180000, 0x0080000, CRC(de29dd89) SHA1(441aefbc7ee64515ee66431ef504e76dc8dc5ca3) )
929
930   ROM_REGION(0x100,           "user5", 0)
931   ROM_LOAD("spc700.rom", 0, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) )
932
933   ROM_REGION(0x800,           "user6", ROMREGION_ERASEFF)
934ROM_END
935
820936ROM_START( sblast2b )
821937   ROM_REGION( 0x180000, "user3", ROMREGION_ERASEFF )
822938
r14896r14897
832948
833949ROM_END
834950
835ROM_START( denseib )
836   ROM_REGION( 0x200000, "user3", ROMREGION_ERASEFF )
837   ROM_LOAD( "dj.u14", 0x000000, 0x0080000, CRC(487ded13) SHA1(624edce30fe2f2d750bcb49c609ceb511b2279b1) )
838   ROM_LOAD( "dj.u15", 0x080000, 0x0080000, CRC(5932a440) SHA1(6048372268a097b08d9f56ad30f083267d798165) )
839   ROM_LOAD( "dj.u16", 0x100000, 0x0080000, CRC(7cb71fd7) SHA1(7673e9dcaabe804e2d637e67eabca1683dad4245) )
840   ROM_LOAD( "dj.u17", 0x180000, 0x0080000, CRC(de29dd89) SHA1(441aefbc7ee64515ee66431ef504e76dc8dc5ca3) )
951ROM_START( endless )
952   ROM_REGION( 0x400000, "user3", 0 )
953   ROM_LOAD( "endlessduel.unknownposition1", 0x000000, 0x80000, CRC(e49acd29) SHA1(ac137261fe7a7691738ac812bea9591256eb9038) )
954   ROM_LOAD( "endlessduel.unknownposition2", 0x080000, 0x80000, CRC(ad2052f9) SHA1(d61382e3d93eb0bff45fb534cec0ce5ae3626165) )
955   ROM_LOAD( "endlessduel.unknownposition3", 0x100000, 0x80000, CRC(30d06d7a) SHA1(17c617d94abb10c3bdf9d51013b116f4ef4debe8) )
956   ROM_LOAD( "endlessduel.unknownposition4", 0x180000, 0x80000, CRC(9a9493ad) SHA1(82ee4fce9cc2014cb8404fd43eebb7941cdb9ac1) )
841957
842958   ROM_REGION(0x100,           "user5", 0)
843959   ROM_LOAD("spc700.rom", 0, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) )
r14896r14897
848964
849965GAME( 199?, kinstb,       0,     kinstb,        kinstb,    kinstb,       ROT0, "bootleg",  "Killer Instinct (SNES bootleg)",                 GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
850966GAME( 1996, ffight2b,     0,     kinstb,        ffight2b,  ffight2b,     ROT0, "bootleg",  "Final Fight 2 (SNES bootleg)",                   GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
851GAME( 1997, sblast2b,     0,     kinstb,        sblast2b,  sblast2b,     ROT0, "bootleg",  "Sonic Blast Man 2 Special Turbo (SNES bootleg)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS)
852967GAME( 1996, iron,         0,     kinstb,        iron,      iron,         ROT0, "bootleg",  "Iron (SNES bootleg)",                            GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
853968GAME( 1996, denseib,      0,     kinstb,        denseib,   denseib,      ROT0, "bootleg",  "Ghost Chaser Densei (SNES bootleg)",             GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
854GAME( 1996, endless,      0,     kinstb,        iron,      endless,      ROT0, "bootleg",  "Gundam Wing: Endless Duel (SNES bootleg)",       GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
969GAME( 1997, sblast2b,     0,     kinstb,        sblast2b,  sblast2b,     ROT0, "bootleg",  "Sonic Blast Man 2 Special Turbo (SNES bootleg)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS)
970GAME( 1996, endless,      0,     kinstb,        endless,   endless,      ROT0, "bootleg",  "Gundam Wing: Endless Duel (SNES bootleg)",       GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/pcxt.c
r14896r14897
9191   device_t   *m_pic8259_2;
9292   device_t   *m_dma8237_1;
9393   device_t   *m_dma8237_2;
94   DECLARE_READ8_MEMBER(disk_iobank_r);
95   DECLARE_WRITE8_MEMBER(disk_iobank_w);
96   DECLARE_READ8_MEMBER(fdc765_status_r);
97   DECLARE_READ8_MEMBER(fdc765_data_r);
98   DECLARE_WRITE8_MEMBER(fdc765_data_w);
99   DECLARE_WRITE8_MEMBER(drive_selection_w);
100   DECLARE_READ8_MEMBER(pc_dma_read_byte);
101   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
102   DECLARE_READ8_MEMBER(dma_page_select_r);
103   DECLARE_WRITE8_MEMBER(dma_page_select_w);
104   DECLARE_WRITE8_MEMBER(tetriskr_bg_bank_w);
94105};
95106
96107static SCREEN_UPDATE_RGB32( tetriskr )
r14896r14897
132143}
133144
134145
135static READ8_HANDLER( disk_iobank_r )
146READ8_MEMBER(pcxt_state::disk_iobank_r)
136147{
137   pcxt_state *state = space->machine().driver_data<pcxt_state>();
138   //printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,cpu_get_pc(&space->device()));
139   //if(offset == 0) return input_port_read(space->machine(), "DSW");
140   if(offset == 1) return input_port_read(space->machine(), "IN1");
148   //printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,cpu_get_pc(&space.device()));
149   //if(offset == 0) return input_port_read(machine(), "DSW");
150   if(offset == 1) return input_port_read(machine(), "IN1");
141151
142   return state->m_disk_data[offset];
152   return m_disk_data[offset];
143153}
144154
145static WRITE8_HANDLER( disk_iobank_w )
155WRITE8_MEMBER(pcxt_state::disk_iobank_w)
146156{
147   pcxt_state *state = space->machine().driver_data<pcxt_state>();
148157/*
149158    BIOS does a single out $0310,$F0 on reset
150159
r14896r14897
175184   }
176185   else
177186   {
178      if((state->m_lastvalue == 0xF0) && (data == 0xF2))
187      if((m_lastvalue == 0xF0) && (data == 0xF2))
179188         newbank = 0;
180      else if ((state->m_lastvalue == 0xF1) && (data == 0xF2))
189      else if ((m_lastvalue == 0xF1) && (data == 0xF2))
181190         newbank = 1;
182      else if ((state->m_lastvalue == 0xF0) && (data == 0xF3))
191      else if ((m_lastvalue == 0xF0) && (data == 0xF3))
183192         newbank = 2;
184      else if ((state->m_lastvalue == 0xF1) && (data == 0xF3))
193      else if ((m_lastvalue == 0xF1) && (data == 0xF3))
185194         newbank = 3;
186195   }
187196
188197//  printf("newbank = %d\n", newbank);
189198
190   if (newbank != state->m_bank)
199   if (newbank != m_bank)
191200   {
192      state->m_bank = newbank;
193      memory_set_bankptr(space->machine(),  "bank1",space->machine().region("game_prg")->base() + 0x10000 * state->m_bank );
201      m_bank = newbank;
202      memory_set_bankptr(machine(),  "bank1",machine().region("game_prg")->base() + 0x10000 * m_bank );
194203   }
195204
196   state->m_lastvalue = data;
205   m_lastvalue = data;
197206
198   state->m_disk_data[offset] = data;
207   m_disk_data[offset] = data;
199208}
200209
201210/*********************************
r14896r14897
359368#define FDC_WRITE 0x40
360369#define FDC_READ 0x00 /*~0x40*/
361370
362static READ8_HANDLER( fdc765_status_r )
371READ8_MEMBER(pcxt_state::fdc765_status_r)
363372{
364   pcxt_state *state = space->machine().driver_data<pcxt_state>();
365373   UINT8 tmp;
366//  popmessage("Read FDC status @ PC=%05x",cpu_get_pc(&space->device()));
367   tmp = state->m_status | 0x80;
368   state->m_clr_status++;
369   if(state->m_clr_status == 0x10)
374//  popmessage("Read FDC status @ PC=%05x",cpu_get_pc(&space.device()));
375   tmp = m_status | 0x80;
376   m_clr_status++;
377   if(m_clr_status == 0x10)
370378   {
371      state->m_status = 0;
372      state->m_clr_status = 0;
379      m_status = 0;
380      m_clr_status = 0;
373381   }
374382   return tmp;
375383}
376384
377static READ8_HANDLER( fdc765_data_r )
385READ8_MEMBER(pcxt_state::fdc765_data_r)
378386{
379   pcxt_state *state = space->machine().driver_data<pcxt_state>();
380   state->m_status = (FDC_READ);
387   m_status = (FDC_READ);
381388   return 0xc0;
382389}
383390
384static WRITE8_HANDLER( fdc765_data_w )
391WRITE8_MEMBER(pcxt_state::fdc765_data_w)
385392{
386   pcxt_state *state = space->machine().driver_data<pcxt_state>();
387   state->m_status = (FDC_WRITE);
393   m_status = (FDC_WRITE);
388394}
389395
390396
391static WRITE8_HANDLER( drive_selection_w )
397WRITE8_MEMBER(pcxt_state::drive_selection_w)
392398{
393//  pcxt_state *state = space->machine().driver_data<pcxt_state>();
394399
395400   /* TODO: properly hook-up upd765 FDC there */
396   pic8259_ir6_w(space->machine().device("pic8259_1"), 1);
401   pic8259_ir6_w(machine().device("pic8259_1"), 1);
397402}
398403
399404/******************
r14896r14897
410415}
411416
412417
413static READ8_HANDLER( pc_dma_read_byte )
418READ8_MEMBER(pcxt_state::pc_dma_read_byte)
414419{
415   pcxt_state *state = space->machine().driver_data<pcxt_state>();
416   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
420   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
417421      & 0xFF0000;
418422
419   return space->read_byte(page_offset + offset);
423   return space.read_byte(page_offset + offset);
420424}
421425
422426
423static WRITE8_HANDLER( pc_dma_write_byte )
427WRITE8_MEMBER(pcxt_state::pc_dma_write_byte)
424428{
425   pcxt_state *state = space->machine().driver_data<pcxt_state>();
426   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
429   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
427430      & 0xFF0000;
428431
429   space->write_byte(page_offset + offset, data);
432   space.write_byte(page_offset + offset, data);
430433}
431434
432static READ8_HANDLER(dma_page_select_r)
435READ8_MEMBER(pcxt_state::dma_page_select_r)
433436{
434   pcxt_state *state = space->machine().driver_data<pcxt_state>();
435   UINT8 data = state->m_at_pages[offset % 0x10];
437   UINT8 data = m_at_pages[offset % 0x10];
436438
437439   switch(offset % 8) {
438440   case 1:
439      data = state->m_dma_offset[(offset / 8) & 1][2];
441      data = m_dma_offset[(offset / 8) & 1][2];
440442      break;
441443   case 2:
442      data = state->m_dma_offset[(offset / 8) & 1][3];
444      data = m_dma_offset[(offset / 8) & 1][3];
443445      break;
444446   case 3:
445      data = state->m_dma_offset[(offset / 8) & 1][1];
447      data = m_dma_offset[(offset / 8) & 1][1];
446448      break;
447449   case 7:
448      data = state->m_dma_offset[(offset / 8) & 1][0];
450      data = m_dma_offset[(offset / 8) & 1][0];
449451      break;
450452   }
451453   return data;
452454}
453455
454456
455static WRITE8_HANDLER(dma_page_select_w)
457WRITE8_MEMBER(pcxt_state::dma_page_select_w)
456458{
457   pcxt_state *state = space->machine().driver_data<pcxt_state>();
458   state->m_at_pages[offset % 0x10] = data;
459   m_at_pages[offset % 0x10] = data;
459460
460461   switch(offset % 8) {
461462   case 1:
462      state->m_dma_offset[(offset / 8) & 1][2] = data;
463      m_dma_offset[(offset / 8) & 1][2] = data;
463464      break;
464465   case 2:
465      state->m_dma_offset[(offset / 8) & 1][3] = data;
466      m_dma_offset[(offset / 8) & 1][3] = data;
466467      break;
467468   case 3:
468      state->m_dma_offset[(offset / 8) & 1][1] = data;
469      m_dma_offset[(offset / 8) & 1][1] = data;
469470      break;
470471   case 7:
471      state->m_dma_offset[(offset / 8) & 1][0] = data;
472      m_dma_offset[(offset / 8) & 1][0] = data;
472473      break;
473474   }
474475}
r14896r14897
488489{
489490   DEVCB_LINE(pc_dma_hrq_changed),
490491   DEVCB_NULL,
491   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
492   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
492   DEVCB_DRIVER_MEMBER(pcxt_state, pc_dma_read_byte),
493   DEVCB_DRIVER_MEMBER(pcxt_state, pc_dma_write_byte),
493494   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
494495   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
495496   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
549550   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)  //PPI 8255
550551   AM_RANGE(0x0064, 0x0066) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)  //PPI 8255
551552   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE("rtc", mc146818_device, read, write)
552   AM_RANGE(0x0080, 0x0087) AM_READWRITE_LEGACY(dma_page_select_r,dma_page_select_w)
553   AM_RANGE(0x0080, 0x0087) AM_READWRITE(dma_page_select_r,dma_page_select_w)
553554   AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE_LEGACY("pic8259_2", pic8259_r, pic8259_w )
554555   AM_RANGE(0x0278, 0x027f) AM_RAM //printer (parallel) port latch
555556   AM_RANGE(0x02f8, 0x02ff) AM_RAM //Modem port
556557   AM_RANGE(0x0378, 0x037f) AM_RAM //printer (parallel) port
557558   AM_RANGE(0x03bc, 0x03bf) AM_RAM //printer port
558   AM_RANGE(0x03f2, 0x03f2) AM_WRITE_LEGACY(drive_selection_w)
559   AM_RANGE(0x03f4, 0x03f4) AM_READ_LEGACY(fdc765_status_r) //765 Floppy Disk Controller (FDC) Status
560   AM_RANGE(0x03f5, 0x03f5) AM_READWRITE_LEGACY(fdc765_data_r,fdc765_data_w)//FDC Data
559   AM_RANGE(0x03f2, 0x03f2) AM_WRITE(drive_selection_w)
560   AM_RANGE(0x03f4, 0x03f4) AM_READ(fdc765_status_r) //765 Floppy Disk Controller (FDC) Status
561   AM_RANGE(0x03f5, 0x03f5) AM_READWRITE(fdc765_data_r,fdc765_data_w)//FDC Data
561562   AM_RANGE(0x03f8, 0x03ff) AM_RAM //rs232c (serial) port
562563ADDRESS_MAP_END
563564
r14896r14897
566567   AM_IMPORT_FROM( pcxt_io_common )
567568//  AM_RANGE(0x0200, 0x020f) AM_RAM //game port
568569   AM_RANGE(0x0201, 0x0201) AM_READ_PORT("COIN") //game port
569   AM_RANGE(0x0310, 0x0311) AM_READWRITE_LEGACY(disk_iobank_r,disk_iobank_w) //Prototyping card
570   AM_RANGE(0x0310, 0x0311) AM_READWRITE(disk_iobank_r,disk_iobank_w) //Prototyping card
570571   AM_RANGE(0x0312, 0x0312) AM_READ_PORT("IN0") //Prototyping card,read only
571572ADDRESS_MAP_END
572573
573static WRITE8_HANDLER( tetriskr_bg_bank_w )
574WRITE8_MEMBER(pcxt_state::tetriskr_bg_bank_w)
574575{
575   pcxt_state *state = space->machine().driver_data<pcxt_state>();
576576
577   state->m_bg_bank = (data & 0x0f) ^ 8;
577   m_bg_bank = (data & 0x0f) ^ 8;
578578}
579579
580580static ADDRESS_MAP_START( tetriskr_io, AS_IO, 8, pcxt_state )
581581   ADDRESS_MAP_GLOBAL_MASK(0x3ff)
582582   AM_IMPORT_FROM( pcxt_io_common )
583583   AM_RANGE(0x0200, 0x020f) AM_RAM //game port
584   AM_RANGE(0x03c0, 0x03c0) AM_WRITE_LEGACY(tetriskr_bg_bank_w)
584   AM_RANGE(0x03c0, 0x03c0) AM_WRITE(tetriskr_bg_bank_w)
585585   AM_RANGE(0x03c8, 0x03c8) AM_READ_PORT("IN0")
586586   AM_RANGE(0x03c9, 0x03c9) AM_READ_PORT("IN1")
587587//  AM_RANGE(0x03ce, 0x03ce) AM_READ_PORT("IN1") //read then discarded?
src/mame/drivers/mcatadv.c
r14896r14897
147147WRITE16_MEMBER(mcatadv_state::mcat_soundlatch_w)
148148{
149149
150   soundlatch_w(space, 0, data);
150   soundlatch_byte_w(space, 0, data);
151151   device_set_input_line(m_soundcpu, INPUT_LINE_NMI, PULSE_LINE);
152152}
153153
r14896r14897
183183   AM_RANGE(0x400000, 0x401fff) AM_RAM_WRITE(mcatadv_videoram1_w) AM_BASE(m_videoram1) // Tilemap 0
184184   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(mcatadv_videoram2_w) AM_BASE(m_videoram2) // Tilemap 1
185185
186   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")
186   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")
187187   AM_RANGE(0x602000, 0x602fff) AM_RAM // Bigger than needs to be?
188188
189189   AM_RANGE(0x700000, 0x707fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size) // Sprites, two halves for double buffering
r14896r14897
220220
221221static ADDRESS_MAP_START( mcatadv_sound_io_map, AS_IO, 8, mcatadv_state )
222222   ADDRESS_MAP_GLOBAL_MASK(0xff)
223   AM_RANGE(0x80, 0x80) AM_READWRITE(soundlatch_r, soundlatch2_w)
223   AM_RANGE(0x80, 0x80) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w)
224224ADDRESS_MAP_END
225225
226226
r14896r14897
235235   AM_RANGE(0x00, 0x03) AM_DEVWRITE_LEGACY("ymsnd", ym2610_w)
236236   AM_RANGE(0x04, 0x07) AM_DEVREAD_LEGACY("ymsnd", ym2610_r)
237237   AM_RANGE(0x40, 0x40) AM_WRITE(mcatadv_sound_bw_w)
238   AM_RANGE(0x80, 0x80) AM_READWRITE(soundlatch_r, soundlatch2_w)
238   AM_RANGE(0x80, 0x80) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w)
239239ADDRESS_MAP_END
240240
241241/*** Inputs ***/
src/mame/drivers/toaplan2.c
r14896r14897
863863   if (ACCESSING_BITS_0_7)
864864   {
865865
866      soundlatch_w(space, offset, data & 0xff);
866      soundlatch_byte_w(space, offset, data & 0xff);
867867      device_set_input_line(m_sub_cpu, 0, HOLD_LINE);
868868   }
869869}
r14896r14897
921921   if (ACCESSING_BITS_0_7)
922922   {
923923
924      soundlatch_w(space, offset, data & 0xff);
924      soundlatch_byte_w(space, offset, data & 0xff);
925925      device_set_input_line(m_sub_cpu, INPUT_LINE_NMI, ASSERT_LINE);
926926   }
927927}
r14896r14897
932932   if (ACCESSING_BITS_0_7)
933933   {
934934
935      soundlatch2_w(space, offset, data & 0xff);
935      soundlatch2_byte_w(space, offset, data & 0xff);
936936      device_set_input_line(m_sub_cpu, INPUT_LINE_NMI, ASSERT_LINE);
937937   }
938938}
r14896r14897
10271027   AM_RANGE(0x000000, 0x01ffff) AM_ROM
10281028   AM_RANGE(0x020000, 0x03ffff) AM_ROM                  // extra for Whoopee
10291029   AM_RANGE(0x080000, 0x082fff) AM_RAM
1030   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1030   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
10311031   AM_RANGE(0x140000, 0x14000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
10321032   AM_RANGE(0x180000, 0x180001) AM_READ_PORT("DSWA")
10331033   AM_RANGE(0x180010, 0x180011) AM_READ_PORT("DSWB")
r14896r14897
10441044   AM_RANGE(0x000000, 0x03ffff) AM_ROM
10451045   AM_RANGE(0x040000, 0x040001) AM_READ(ghox_p2_h_analog_r)
10461046   AM_RANGE(0x080000, 0x083fff) AM_RAM
1047   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1047   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
10481048   AM_RANGE(0x100000, 0x100001) AM_READ(ghox_p1_h_analog_r)
10491049   AM_RANGE(0x140000, 0x14000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
10501050   AM_RANGE(0x180000, 0x180001) AM_READWRITE(ghox_mcu_r, ghox_mcu_w)   // really part of shared RAM
r14896r14897
10681068   AM_RANGE(0x20001c, 0x20001d) AM_WRITE(toaplan2_v25_coin_word_w)   // Coin count/lock + v25 reset line
10691069   AM_RANGE(0x210000, 0x21ffff) AM_READWRITE(shared_ram_r, shared_ram_w )
10701070   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1071   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1071   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
10721072   AM_RANGE(0x500000, 0x50000d) AM_DEVREADWRITE_LEGACY("gp9001vdp1", gp9001_vdp_r, gp9001_vdp_w)
10731073   AM_RANGE(0x700000, 0x700001) AM_READ(video_count_r)         // test bit 8
10741074ADDRESS_MAP_END
r14896r14897
10831083   AM_RANGE(0x208018, 0x208019) AM_READ_PORT("SYS")
10841084   AM_RANGE(0x20801c, 0x20801d) AM_WRITE(toaplan2_coin_word_w)
10851085   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1086   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1086   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
10871087   AM_RANGE(0x700000, 0x700001) AM_READ(video_count_r)         // test bit 8
10881088ADDRESS_MAP_END
10891089
r14896r14897
11051105   AM_RANGE(0x200028, 0x200029) AM_DEVWRITE_LEGACY("oki1", oki_bankswitch_w)
11061106   AM_RANGE(0x20002c, 0x20002d) AM_READ(video_count_r)
11071107   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1108   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1108   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
11091109ADDRESS_MAP_END
11101110
11111111
r14896r14897
11131113   AM_RANGE(0x000000, 0x07ffff) AM_ROM
11141114   AM_RANGE(0x100000, 0x10ffff) AM_RAM
11151115   AM_RANGE(0x200000, 0x20000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1116   AM_RANGE(0x300000, 0x300fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1116   AM_RANGE(0x300000, 0x300fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
11171117   AM_RANGE(0x400000, 0x401fff) AM_RAM_WRITE(toaplan2_txvideoram16_w) AM_BASE_SIZE(m_txvideoram16, m_tx_vram_size)
11181118   AM_RANGE(0x402000, 0x4021ff) AM_RAM_WRITE(toaplan2_txvideoram16_offs_w) AM_BASE_SIZE(m_txvideoram16_offs, m_tx_offs_vram_size)
11191119   AM_RANGE(0x402200, 0x402fff) AM_RAM
r14896r14897
11361136static ADDRESS_MAP_START( pipibibs_68k_mem, AS_PROGRAM, 16, toaplan2_state )
11371137   AM_RANGE(0x000000, 0x03ffff) AM_ROM
11381138   AM_RANGE(0x080000, 0x082fff) AM_RAM
1139   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1139   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
11401140   AM_RANGE(0x140000, 0x14000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
11411141   AM_RANGE(0x190000, 0x190fff) AM_READWRITE(shared_ram_r, shared_ram_w)
11421142   AM_RANGE(0x19c01c, 0x19c01d) AM_WRITE(toaplan2_coin_word_w)
r14896r14897
11541154   AM_RANGE(0x080000, 0x082fff) AM_RAM
11551155   AM_RANGE(0x083000, 0x0837ff) AM_DEVREADWRITE_LEGACY("gp9001vdp0", pipibibi_bootleg_spriteram16_r, pipibibi_bootleg_spriteram16_w)   // SpriteRAM
11561156   AM_RANGE(0x083800, 0x087fff) AM_RAM            // SpriteRAM (unused)
1157   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1157   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
11581158   AM_RANGE(0x120000, 0x120fff) AM_RAM            // Copy of SpriteRAM ?
11591159//  AM_RANGE(0x13f000, 0x13f001) AM_WRITENOP        // ???
11601160   AM_RANGE(0x180000, 0x182fff) AM_DEVREADWRITE_LEGACY("gp9001vdp0", pipibibi_bootleg_videoram16_r, pipibibi_bootleg_videoram16_w)   // TileRAM
r14896r14897
11811181   AM_RANGE(0x20001c, 0x20001d) AM_WRITE(toaplan2_coin_word_w)
11821182   AM_RANGE(0x280000, 0x28ffff) AM_READWRITE(shared_ram_r, shared_ram_w )
11831183   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1184   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1184   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
11851185   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(toaplan2_txvideoram16_w) AM_BASE_SIZE(m_txvideoram16, m_tx_vram_size)
11861186   AM_RANGE(0x502000, 0x5021ff) AM_RAM_WRITE(toaplan2_txvideoram16_offs_w) AM_BASE_SIZE(m_txvideoram16_offs, m_tx_offs_vram_size)
11871187   AM_RANGE(0x503000, 0x5031ff) AM_RAM_WRITE(toaplan2_txscrollram16_w) AM_BASE_SIZE(m_txscrollram16, m_tx_scroll_vram_size)
r14896r14897
12031203   AM_RANGE(0x200018, 0x200019) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
12041204   AM_RANGE(0x20001c, 0x20001d) AM_READ_PORT("DSWA")
12051205   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1206   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1206   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
12071207   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(toaplan2_txvideoram16_w) AM_BASE_SIZE(m_txvideoram16, m_tx_vram_size)
12081208   AM_RANGE(0x502000, 0x5021ff) AM_RAM_WRITE(toaplan2_txvideoram16_offs_w) AM_BASE_SIZE(m_txvideoram16_offs, m_tx_offs_vram_size)
12091209   AM_RANGE(0x503000, 0x5031ff) AM_RAM_WRITE(toaplan2_txscrollram16_w) AM_BASE_SIZE(m_txscrollram16, m_tx_scroll_vram_size)
r14896r14897
12221222   AM_RANGE(0x20001c, 0x20001d) AM_WRITE(toaplan2_v25_coin_word_w)   // Coin count/lock + v25 reset line
12231223   AM_RANGE(0x210000, 0x21ffff) AM_READWRITE(shared_ram_r, shared_ram_w )
12241224   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1225   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1225   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
12261226   AM_RANGE(0x700000, 0x700001) AM_READ(video_count_r)
12271227ADDRESS_MAP_END
12281228
r14896r14897
12361236   AM_RANGE(0x20001c, 0x20001d) AM_WRITE(toaplan2_v25_coin_word_w)   // Coin count/lock + v25 reset line
12371237   AM_RANGE(0x210000, 0x21ffff) AM_READWRITE(shared_ram_r, shared_ram_w )
12381238   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1239   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1239   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
12401240   AM_RANGE(0x500000, 0x50000d) AM_DEVREADWRITE_LEGACY("gp9001vdp1", gp9001_vdp_r, gp9001_vdp_w)
12411241   AM_RANGE(0x700000, 0x700001) AM_READ(video_count_r)
12421242ADDRESS_MAP_END
r14896r14897
12461246   AM_RANGE(0x000000, 0x07ffff) AM_ROM
12471247   AM_RANGE(0x100000, 0x10ffff) AM_RAM
12481248   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1249   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1249   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
12501250   AM_RANGE(0x500000, 0x500003) AM_DEVREADWRITE8_LEGACY("ymsnd", ym2151_r, ym2151_w, 0x00ff)
12511251   AM_RANGE(0x600000, 0x600001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
12521252   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("JMPR")
r14896r14897
12751275   AM_RANGE(0x21c034, 0x21c035) AM_READ_PORT("JMPR")
12761276   AM_RANGE(0x21c03c, 0x21c03d) AM_READ(video_count_r)
12771277   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1278   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1278   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
12791279   AM_RANGE(0x401000, 0x4017ff) AM_RAM                     // Unused palette RAM
12801280   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(toaplan2_txvideoram16_w) AM_BASE_SIZE(m_txvideoram16, m_tx_vram_size)
12811281   AM_RANGE(0x502000, 0x5021ff) AM_RAM_WRITE(toaplan2_txvideoram16_offs_w) AM_BASE_SIZE(m_txvideoram16_offs, m_tx_offs_vram_size)
r14896r14897
12991299   AM_RANGE(0x21c034, 0x21c035) AM_READ_PORT("JMPR")
13001300   AM_RANGE(0x21c03c, 0x21c03d) AM_READ(video_count_r)
13011301   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1302   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1302   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
13031303   AM_RANGE(0x401000, 0x4017ff) AM_RAM                     // Unused palette RAM
13041304   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(toaplan2_txvideoram16_w) AM_BASE_SIZE(m_txvideoram16, m_tx_vram_size)
13051305   AM_RANGE(0x502000, 0x5021ff) AM_RAM_WRITE(toaplan2_txvideoram16_offs_w) AM_BASE_SIZE(m_txvideoram16_offs, m_tx_offs_vram_size)
r14896r14897
13221322   AM_RANGE(0x21c034, 0x21c035) AM_READ_PORT("JMPR")
13231323   AM_RANGE(0x21c03c, 0x21c03d) AM_READ(video_count_r)
13241324   AM_RANGE(0x300000, 0x30000d) AM_DEVREADWRITE_LEGACY("gp9001vdp0", gp9001_vdp_r, gp9001_vdp_w)
1325   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1325   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
13261326   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(toaplan2_txvideoram16_w) AM_BASE_SIZE(m_txvideoram16, m_tx_vram_size)
13271327   AM_RANGE(0x502000, 0x5021ff) AM_RAM_WRITE(toaplan2_txvideoram16_offs_w) AM_BASE_SIZE(m_txvideoram16_offs, m_tx_offs_vram_size)
13281328   AM_RANGE(0x502200, 0x502fff) AM_RAM
r14896r14897
13361336   AM_RANGE(0x000000, 0x1fffff) AM_ROM
13371337   // actually 200000 - 20ffff is probably all main RAM, and the text and palette RAM are written via DMA
13381338   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(toaplan2_txvideoram16_w) AM_BASE_SIZE(m_txvideoram16, m_tx_vram_size)
1339   AM_RANGE(0x202000, 0x202fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") AM_SIZE(m_paletteram_size)
1339   AM_RANGE(0x202000, 0x202fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") AM_SIZE(m_paletteram_size)
13401340   AM_RANGE(0x203000, 0x2031ff) AM_RAM_WRITE(toaplan2_txvideoram16_offs_w) AM_BASE_SIZE(m_txvideoram16_offs, m_tx_offs_vram_size)
13411341   AM_RANGE(0x203200, 0x2033ff) AM_RAM_WRITE(toaplan2_txscrollram16_w) AM_BASE_SIZE(m_txscrollram16, m_tx_scroll_vram_size)
13421342   AM_RANGE(0x203400, 0x207fff) AM_RAM AM_BASE_SIZE(m_mainram16, m_mainram_overlap_size)
r14896r14897
13661366   AM_RANGE(0x000000, 0x1fffff) AM_ROM
13671367   // actually 200000 - 20ffff is probably all main RAM, and the text and palette RAM are written via DMA
13681368   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(toaplan2_txvideoram16_w) AM_BASE_SIZE(m_txvideoram16, m_tx_vram_size)
1369   AM_RANGE(0x202000, 0x202fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") AM_SIZE(m_paletteram_size)
1369   AM_RANGE(0x202000, 0x202fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") AM_SIZE(m_paletteram_size)
13701370   AM_RANGE(0x203000, 0x2031ff) AM_RAM_WRITE(toaplan2_txvideoram16_offs_w) AM_BASE_SIZE(m_txvideoram16_offs, m_tx_offs_vram_size)
13711371   AM_RANGE(0x203200, 0x2033ff) AM_RAM_WRITE(toaplan2_txscrollram16_w) AM_BASE_SIZE(m_txscrollram16, m_tx_scroll_vram_size)
13721372   AM_RANGE(0x203400, 0x207fff) AM_RAM AM_BASE_SIZE(m_mainram16, m_mainram_overlap_size)
r14896r14897
14181418   AM_RANGE(0xe006, 0xe008) AM_WRITE(raizing_oki_bankswitch_w)
14191419   AM_RANGE(0xe00a, 0xe00a) AM_WRITE(raizing_z80_bankswitch_w)
14201420   AM_RANGE(0xe00c, 0xe00c) AM_WRITE(bgaregga_E00C_w)
1421   AM_RANGE(0xe01c, 0xe01c) AM_READ(soundlatch_r)
1421   AM_RANGE(0xe01c, 0xe01c) AM_READ(soundlatch_byte_r)
14221422   AM_RANGE(0xe01d, 0xe01d) AM_READ(bgaregga_E01D_r)
14231423ADDRESS_MAP_END
14241424
r14896r14897
14321432
14331433static ADDRESS_MAP_START( batrider_sound_z80_port, AS_IO, 8, toaplan2_state )
14341434   ADDRESS_MAP_GLOBAL_MASK(0xff)
1435   AM_RANGE(0x40, 0x40) AM_WRITE(soundlatch3_w)
1436   AM_RANGE(0x42, 0x42) AM_WRITE(soundlatch4_w)
1435   AM_RANGE(0x40, 0x40) AM_WRITE(soundlatch3_byte_w)
1436   AM_RANGE(0x42, 0x42) AM_WRITE(soundlatch4_byte_w)
14371437   AM_RANGE(0x44, 0x44) AM_WRITE(batrider_sndirq_w)
14381438   AM_RANGE(0x46, 0x46) AM_WRITE(batrider_clear_nmi_w)
1439   AM_RANGE(0x48, 0x48) AM_READ(soundlatch_r)
1440   AM_RANGE(0x4a, 0x4a) AM_READ(soundlatch2_r)
1439   AM_RANGE(0x48, 0x48) AM_READ(soundlatch_byte_r)
1440   AM_RANGE(0x4a, 0x4a) AM_READ(soundlatch2_byte_r)
14411441   AM_RANGE(0x80, 0x81) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
14421442   AM_RANGE(0x82, 0x82) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
14431443   AM_RANGE(0x84, 0x84) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
r14896r14897
14541454
14551455static ADDRESS_MAP_START( bbakraid_sound_z80_port, AS_IO, 8, toaplan2_state )
14561456   ADDRESS_MAP_GLOBAL_MASK(0xff)
1457   AM_RANGE(0x40, 0x40) AM_WRITE(soundlatch3_w)
1458   AM_RANGE(0x42, 0x42) AM_WRITE(soundlatch4_w)
1457   AM_RANGE(0x40, 0x40) AM_WRITE(soundlatch3_byte_w)
1458   AM_RANGE(0x42, 0x42) AM_WRITE(soundlatch4_byte_w)
14591459   AM_RANGE(0x44, 0x44) AM_WRITE(batrider_sndirq_w)
14601460   AM_RANGE(0x46, 0x46) AM_WRITE(batrider_clear_nmi_w)
1461   AM_RANGE(0x48, 0x48) AM_READ(soundlatch_r)
1462   AM_RANGE(0x4a, 0x4a) AM_READ(soundlatch2_r)
1461   AM_RANGE(0x48, 0x48) AM_READ(soundlatch_byte_r)
1462   AM_RANGE(0x4a, 0x4a) AM_READ(soundlatch2_byte_r)
14631463   AM_RANGE(0x80, 0x81) AM_DEVREADWRITE_LEGACY("ymz", ymz280b_r, ymz280b_w)
14641464ADDRESS_MAP_END
14651465
src/mame/drivers/cinemat.c
r14896r14897
131131WRITE8_MEMBER(cinemat_state::mux_select_w)
132132{
133133   m_mux_select = data;
134   cinemat_sound_control_w(&space, 0x07, data);
134   cinemat_sound_control_w(space, 0x07, data);
135135}
136136
137137
r14896r14897
323323
324324   AM_RANGE(0x05, 0x05) AM_WRITE(coin_reset_w)
325325   AM_RANGE(0x06, 0x06) AM_WRITE(cinemat_vector_control_w)
326   AM_RANGE(0x00, 0x07) AM_WRITE_LEGACY(cinemat_sound_control_w)
326   AM_RANGE(0x00, 0x07) AM_WRITE(cinemat_sound_control_w)
327327ADDRESS_MAP_END
328328
329329
src/mame/drivers/jailbrek.c
r14896r14897
9797
9898   m_nmi_enable = data & 0x01;
9999   m_irq_enable = data & 0x02;
100   flip_screen_set(machine(), data & 0x08);
100   flip_screen_set(data & 0x08);
101101}
102102
103103static INTERRUPT_GEN( jb_interrupt )
src/mame/drivers/gaelco.c
r14896r14897
3636
3737   if (ACCESSING_BITS_0_7)
3838   {
39      soundlatch_w(space, 0, data & 0xff);
39      soundlatch_byte_w(space, 0, data & 0xff);
4040      device_set_input_line(m_audiocpu, M6809_FIRQ_LINE, HOLD_LINE);
4141   }
4242}
r14896r14897
122122   AM_RANGE(0x102000, 0x103fff) AM_RAM                                             /* Screen RAM */
123123   AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE(m_vregs)                     /* Video Registers */
124124//  AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w)                                                 /* INT 6 ACK/Watchdog timer */
125   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
125   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
126126   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(m_spriteram)                        /* Sprite RAM */
127127   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW1")
128128   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW2")
r14896r14897
139139   AM_RANGE(0x0800, 0x0801) AM_DEVREADWRITE("oki", okim6295_device, read, write)   /* OKI6295 */
140140//  AM_RANGE(0x0900, 0x0900) AM_WRITENOP                                    /* enable sound output? */
141141   AM_RANGE(0x0a00, 0x0a01) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)      /* YM3812 */
142   AM_RANGE(0x0b00, 0x0b00) AM_READ(soundlatch_r)                     /* Sound latch */
142   AM_RANGE(0x0b00, 0x0b00) AM_READ(soundlatch_byte_r)                     /* Sound latch */
143143   AM_RANGE(0x0c00, 0xffff) AM_ROM                                 /* ROM */
144144ADDRESS_MAP_END
145145
r14896r14897
149149   AM_RANGE(0x102000, 0x103fff) AM_RAM                                             /* Screen RAM */
150150   AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE(m_vregs)                     /* Video Registers */
151151//  AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w)                                                 /* INT 6 ACK/Watchdog timer */
152   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
152   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
153153   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(m_spriteram)                        /* Sprite RAM */
154154   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2")
155155   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
r14896r14897
166166   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(gaelco_encrypted_w) AM_BASE(m_screen)            /* Screen RAM */
167167   AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE(m_vregs)                     /* Video Registers */
168168//  AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w)                                                 /* INT 6 ACK/Watchdog timer */
169   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
169   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
170170   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(m_spriteram)                        /* Sprite RAM */
171171   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2")
172172   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
r14896r14897
183183   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(thoop_encrypted_w) AM_BASE(m_screen)            /* Screen RAM */
184184   AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE(m_vregs)                     /* Video Registers */
185185//  AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w)                                                     /* INT 6 ACK/Watchdog timer */
186   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")      /* Palette */
186   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")      /* Palette */
187187   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(m_spriteram)                        /* Sprite RAM */
188188   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2")
189189   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
src/mame/drivers/wecleman.c
r14896r14897
556556
557557static ADDRESS_MAP_START( wecleman_sub_map, AS_PROGRAM, 16, wecleman_state )
558558   AM_RANGE(0x000000, 0x00ffff) AM_ROM   // ROM
559   AM_RANGE(0x060000, 0x060fff) AM_RAM AM_BASE(m_roadram) AM_SIZE(m_roadram_size)   // Road
559   AM_RANGE(0x060000, 0x060fff) AM_RAM AM_BASE_SIZE(m_roadram,m_roadram_size)   // Road
560560   AM_RANGE(0x070000, 0x073fff) AM_RAM AM_SHARE("share1")   // RAM (Shared with main CPU)
561561ADDRESS_MAP_END
562562
r14896r14897
567567
568568static ADDRESS_MAP_START( hotchase_sub_map, AS_PROGRAM, 16, wecleman_state )
569569   AM_RANGE(0x000000, 0x01ffff) AM_ROM   // ROM
570   AM_RANGE(0x020000, 0x020fff) AM_RAM AM_BASE(m_roadram) AM_SIZE(m_roadram_size)   // Road
570   AM_RANGE(0x020000, 0x020fff) AM_RAM AM_BASE_SIZE(m_roadram,m_roadram_size)   // Road
571571   AM_RANGE(0x040000, 0x043fff) AM_RAM AM_SHARE("share1") // Shared with main CPU
572572   AM_RANGE(0x060000, 0x060fff) AM_RAM // a table, presumably road related
573573   AM_RANGE(0x061000, 0x06101f) AM_RAM // road vregs?
r14896r14897
583583{
584584   if (ACCESSING_BITS_0_7)
585585   {
586      soundlatch_w(space, 0, data & 0xFF);
586      soundlatch_byte_w(space, 0, data & 0xFF);
587587      cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
588588   }
589589}
r14896r14897
627627   AM_RANGE(0x9000, 0x9000) AM_READ(multiply_r)   // Protection
628628   AM_RANGE(0x9000, 0x9001) AM_WRITE(multiply_w)   // Protection
629629   AM_RANGE(0x9006, 0x9006) AM_WRITENOP   // ?
630   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)   // From main CPU
630   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)   // From main CPU
631631   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("konami", k007232_r, k007232_w)   // K007232 (Reading offset 5/b triggers the sample)
632632   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
633633   AM_RANGE(0xf000, 0xf000) AM_DEVWRITE_LEGACY("konami", wecleman_K00723216_bank_w)   // Samples banking
r14896r14897
643643{
644644   if (ACCESSING_BITS_0_7)
645645   {
646      soundlatch_w(space, 0, data & 0xFF);
646      soundlatch_byte_w(space, 0, data & 0xFF);
647647      cputag_set_input_line(machine(), "audiocpu", M6809_IRQ_LINE, HOLD_LINE);
648648   }
649649}
r14896r14897
720720   AM_RANGE(0x3000, 0x300d) AM_DEVREADWRITE_LEGACY("konami3", hotchase_k007232_r, hotchase_k007232_w)
721721   AM_RANGE(0x4000, 0x4007) AM_WRITE(hotchase_sound_control_w)   // Sound volume, banking, etc.
722722   AM_RANGE(0x5000, 0x5000) AM_WRITENOP   // ? (written with 0 on IRQ, 1 on FIRQ)
723   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)   // From main CPU (Read on IRQ)
723   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)   // From main CPU (Read on IRQ)
724724   AM_RANGE(0x7000, 0x7000) AM_WRITENOP   // Command acknowledge ?
725725   AM_RANGE(0x8000, 0xffff) AM_ROM
726726ADDRESS_MAP_END
src/mame/drivers/kas89.c
r14896r14897
377377
378378   else
379379   {
380      soundlatch_w(space, 0, data);
380      soundlatch_byte_w(space, 0, data);
381381      device_set_input_line(m_audiocpu, 0, ASSERT_LINE );
382382   }
383383}
r14896r14897
576576static ADDRESS_MAP_START( audio_io, AS_IO, 8, kas89_state )
577577   ADDRESS_MAP_GLOBAL_MASK(0xff)
578578   AM_RANGE(0x00, 0x00) AM_WRITE(int_ack_w)   // comm out (1st Z80). seems to write here the value previously read through soundlatch (port 0x02).
579   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
579   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_byte_r)
580580   AM_RANGE(0x04, 0x04) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
581581   AM_RANGE(0x04, 0x05) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_address_w)
582582ADDRESS_MAP_END
src/mame/drivers/crbaloon.c
r14896r14897
5353static void pc3092_update(running_machine &machine)
5454{
5555   crbaloon_state *state = machine.driver_data<crbaloon_state>();
56   flip_screen_set(machine, (state->m_pc3092_data[1] & 0x01) ? TRUE : FALSE);
56   state->flip_screen_set((state->m_pc3092_data[1] & 0x01) ? TRUE : FALSE);
5757}
5858
5959
src/mame/drivers/dmndrby.c
r14896r14897
6060{
6161public:
6262   dmndrby_state(const machine_config &mconfig, device_type type, const char *tag)
63      : driver_device(mconfig, type, tag) { }
63      : driver_device(mconfig, type, tag) ,
64      m_scroll_ram(*this, "scroll_ram"),
65      m_sprite_ram(*this, "sprite_ram"),
66      m_dderby_vidchars(*this, "dderby_vidchars"),
67      m_dderby_vidattribs(*this, "dderby_vidattribs"){ }
6468
65   UINT8* m_dderby_vidchars;
66   UINT8* m_scroll_ram;
67   UINT8* m_dderby_vidattribs;
68   UINT8* m_sprite_ram;
69   required_shared_ptr<UINT8> m_scroll_ram;
70   required_shared_ptr<UINT8> m_sprite_ram;
71   required_shared_ptr<UINT8> m_dderby_vidchars;
72   required_shared_ptr<UINT8> m_dderby_vidattribs;
6973   UINT8 *m_racetrack_tilemap_rom;
7074   tilemap_t *m_racetrack_tilemap;
7175   UINT8 m_io_port[8];
r14896r14897
7882
7983WRITE8_MEMBER(dmndrby_state::dderby_sound_w)
8084{
81   soundlatch_w(space,0,data);
85   soundlatch_byte_w(space,0,data);
8286   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
8387}
8488
r14896r14897
128132   AM_RANGE(0xca01, 0xca01) AM_WRITENOP //watchdog
129133   AM_RANGE(0xca02, 0xca02) AM_RAM_WRITE(dderby_sound_w)
130134   AM_RANGE(0xca03, 0xca03) AM_WRITENOP//(timer_irq_w) //???
131   AM_RANGE(0xcc00, 0xcc05) AM_RAM AM_BASE(m_scroll_ram)
132   AM_RANGE(0xce08, 0xce1f) AM_RAM AM_BASE(m_sprite_ram) // horse sprites
133   AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_BASE(m_dderby_vidchars) // char ram
134   AM_RANGE(0xd400, 0xd7ff) AM_RAM AM_BASE(m_dderby_vidattribs) // colours/ attrib ram
135   AM_RANGE(0xcc00, 0xcc05) AM_RAM AM_SHARE("scroll_ram")
136   AM_RANGE(0xce08, 0xce1f) AM_RAM AM_SHARE("sprite_ram") // horse sprites
137   AM_RANGE(0xd000, 0xd3ff) AM_RAM AM_SHARE("dderby_vidchars") // char ram
138   AM_RANGE(0xd400, 0xd7ff) AM_RAM AM_SHARE("dderby_vidattribs") // colours/ attrib ram
135139ADDRESS_MAP_END
136140
137141static ADDRESS_MAP_START( dderby_sound_map, AS_PROGRAM, 8, dmndrby_state )
138142   AM_RANGE(0x0000, 0x0fff) AM_ROM
139143   AM_RANGE(0x1000, 0x1000) AM_RAM //???
140144   AM_RANGE(0x4000, 0x4001) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
141   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r)
145   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r)
142146   AM_RANGE(0x4001, 0x4001) AM_DEVREAD_LEGACY("ay1", ay8910_r)
143147   AM_RANGE(0x6000, 0x67ff) AM_RAM
144148ADDRESS_MAP_END
r14896r14897
358362can we draw it with the tilemap? maybe not, the layout is a litle strange
359363
360364*/
361//  base = state->m_scroll_ram[0];
365//  base = state->m_scroll_ram.target()[0];
362366
363   off=0x1900-(state->m_bg*0x100)+(state->m_scroll_ram[1])*0x100;
364   scrolly = 0xff-(state->m_scroll_ram[0]);
365   if(state->m_scroll_ram[1]==0xff) off=0x1800;
367   off=0x1900-(state->m_bg*0x100)+(state->m_scroll_ram.target()[1])*0x100;
368   scrolly = 0xff-(state->m_scroll_ram.target()[0]);
369   if(state->m_scroll_ram.target()[1]==0xff) off=0x1800;
366370   for(x=0;x<16;x++) {
367371      for(y=0;y<16;y++) {
368372         int chr = state->m_racetrack_tilemap_rom[off];
r14896r14897
394398      int a=0;
395399      int b=0;
396400      int base = count*4;
397      int sprx=state->m_sprite_ram[base+3];
398      int spry=state->m_sprite_ram[base+2];
399      //state->m_sprite_ram[base+1];
400      int col = (state->m_sprite_ram[base+1]&0x1f);
401      int anim = (state->m_sprite_ram[base]&0x3)*0x40; // animation frame - probably wrong but seems right
402      int horse = (state->m_sprite_ram[base+1]&0x7)*8+7;  // horse label from 1 - 6
401      int sprx=state->m_sprite_ram.target()[base+3];
402      int spry=state->m_sprite_ram.target()[base+2];
403      //state->m_sprite_ram.target()[base+1];
404      int col = (state->m_sprite_ram.target()[base+1]&0x1f);
405      int anim = (state->m_sprite_ram.target()[base]&0x3)*0x40; // animation frame - probably wrong but seems right
406      int horse = (state->m_sprite_ram.target()[base+1]&0x7)*8+7;  // horse label from 1 - 6
403407
404408      for (a=0;a<8 ;a++)
405409      {
r14896r14897
422426      for(x=0;x<32;x++)
423427      {
424428         int tileno,bank,color;
425         tileno=state->m_dderby_vidchars[count];
426         bank=(state->m_dderby_vidattribs[count]&0x20)>>5;
429         tileno=state->m_dderby_vidchars.target()[count];
430         bank=(state->m_dderby_vidattribs.target()[count]&0x20)>>5;
427431         tileno|=(bank<<8);
428         color=((state->m_dderby_vidattribs[count])&0x1f);
432         color=((state->m_dderby_vidattribs.target()[count])&0x1f);
429433
430434         drawgfx_transpen(bitmap,cliprect,gfx,tileno,color,0,0,x*8,y*8,(tileno == 0x38) ? 0 : -1);
431435
src/mame/drivers/portrait.c
r14896r14897
122122   AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(portrait_fgvideo_write) AM_BASE(m_fgvideoram)
123123   AM_RANGE(0x9000, 0x91ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
124124   AM_RANGE(0x9200, 0x97ff) AM_RAM
125   AM_RANGE(0xa000, 0xa000) AM_WRITE(soundlatch_w)
125   AM_RANGE(0xa000, 0xa000) AM_WRITE(soundlatch_byte_w)
126126   AM_RANGE(0xa010, 0xa010) AM_WRITENOP // ?
127127   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("DSW1")
128128   AM_RANGE(0xa004, 0xa004) AM_READ_PORT("DSW2")
src/mame/drivers/munchmo.c
r14896r14897
6161WRITE8_MEMBER(munchmo_state::mnchmobl_soundlatch_w)
6262{
6363
64   soundlatch_w(space, 0, data);
64   soundlatch_byte_w(space, 0, data);
6565   device_set_input_line(m_audiocpu, 0, HOLD_LINE );
6666}
6767
r14896r14897
110110/* memory map provided thru schematics */
111111static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, munchmo_state )
112112   AM_RANGE(0x0000, 0x1fff) AM_ROM
113   AM_RANGE(0x2000, 0x3fff) AM_READ(soundlatch_r)
113   AM_RANGE(0x2000, 0x3fff) AM_READ(soundlatch_byte_r)
114114   AM_RANGE(0x4000, 0x4fff) AM_DEVWRITE_LEGACY("ay1", ay8910_data_w)
115115   AM_RANGE(0x5000, 0x5fff) AM_DEVWRITE_LEGACY("ay1", ay8910_address_w)
116116   AM_RANGE(0x6000, 0x6fff) AM_DEVWRITE_LEGACY("ay2", ay8910_data_w)
src/mame/drivers/lastduel.c
r14896r14897
127127WRITE16_MEMBER(lastduel_state::lastduel_sound_w)
128128{
129129   if (ACCESSING_BITS_0_7)
130      soundlatch_w(space, 0, data & 0xff);
130      soundlatch_byte_w(space, 0, data & 0xff);
131131}
132132
133133/******************************************************************************/
r14896r14897
170170   AM_RANGE(0xe000, 0xe7ff) AM_RAM
171171   AM_RANGE(0xe800, 0xe801) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r,ym2203_w)
172172   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r,ym2203_w)
173   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
173   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
174174ADDRESS_MAP_END
175175
176176WRITE8_MEMBER(lastduel_state::mg_bankswitch_w)
r14896r14897
185185   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r,ym2203_w)
186186   AM_RANGE(0xf002, 0xf003) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r,ym2203_w)
187187   AM_RANGE(0xf004, 0xf004) AM_DEVWRITE("oki", okim6295_device, write)
188   AM_RANGE(0xf006, 0xf006) AM_READ(soundlatch_r)
188   AM_RANGE(0xf006, 0xf006) AM_READ(soundlatch_byte_r)
189189   AM_RANGE(0xf00a, 0xf00a) AM_WRITE(mg_bankswitch_w)
190190ADDRESS_MAP_END
191191
src/mame/drivers/cmmb.c
r14896r14897
4949{
5050public:
5151   cmmb_state(const machine_config &mconfig, device_type type, const char *tag)
52      : driver_device(mconfig, type, tag) { }
52      : driver_device(mconfig, type, tag) ,
53      m_videoram(*this, "videoram"){ }
5354
54   UINT8 *m_videoram;
55   required_shared_ptr<UINT8> m_videoram;
5556   UINT8 m_irq_mask;
5657   DECLARE_READ8_MEMBER(cmmb_charram_r);
5758   DECLARE_WRITE8_MEMBER(cmmb_charram_w);
r14896r14897
7071static SCREEN_UPDATE_IND16( cmmb )
7172{
7273   cmmb_state *state = screen.machine().driver_data<cmmb_state>();
73   UINT8 *videoram = state->m_videoram;
74   UINT8 *videoram = state->m_videoram.target();
7475   const gfx_element *gfx = screen.machine().gfx[0];
7576   int count = 0x00000;
7677
r14896r14897
116117WRITE8_MEMBER(cmmb_state::cmmb_paletteram_w)
117118{
118119    /* RGB output is inverted */
119    paletteram_RRRGGGBB_w(space,offset,~data);
120    paletteram_RRRGGGBB_byte_w(space,offset,~data);
120121}
121122
122123READ8_MEMBER(cmmb_state::cmmb_input_r)
r14896r14897
176177   ADDRESS_MAP_GLOBAL_MASK(0xffff)
177178   AM_RANGE(0x0000, 0x01ff) AM_RAM /* zero page address */
178179//  AM_RANGE(0x13c0, 0x13ff) AM_RAM //spriteram
179   AM_RANGE(0x1000, 0x13ff) AM_RAM AM_BASE(m_videoram)
180   AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("videoram")
180181   AM_RANGE(0x2480, 0x249f) AM_RAM_WRITE(cmmb_paletteram_w) AM_SHARE("paletteram")
181182   AM_RANGE(0x4000, 0x400f) AM_READWRITE(cmmb_input_r,cmmb_output_w) //i/o
182183   AM_RANGE(0x4900, 0x4900) AM_READ(kludge_r)
src/mame/drivers/drgnmst.c
r14896r14897
199199   AM_RANGE(0x800180, 0x800181) AM_WRITE(drgnmst_snd_command_w)
200200   AM_RANGE(0x800188, 0x800189) AM_WRITE(drgnmst_snd_flag_w)
201201   AM_RANGE(0x8001e0, 0x8001e1) AM_WRITENOP
202   AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
202   AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
203203   AM_RANGE(0x904000, 0x907fff) AM_RAM_WRITE(drgnmst_md_videoram_w) AM_BASE(m_md_videoram)
204204   AM_RANGE(0x908000, 0x90bfff) AM_RAM_WRITE(drgnmst_bg_videoram_w) AM_BASE(m_bg_videoram)
205205   AM_RANGE(0x90c000, 0x90ffff) AM_RAM_WRITE(drgnmst_fg_videoram_w) AM_BASE(m_fg_videoram)
src/mame/drivers/boxer.c
r14896r14897
2424{
2525public:
2626   boxer_state(const machine_config &mconfig, device_type type, const char *tag)
27      : driver_device(mconfig, type, tag) { }
27      : driver_device(mconfig, type, tag) ,
28      m_tile_ram(*this, "tile_ram"),
29      m_sprite_ram(*this, "sprite_ram"){ }
2830
2931   /* memory pointers */
30   UINT8 * m_tile_ram;
31   UINT8 * m_sprite_ram;
32   required_shared_ptr<UINT8> m_tile_ram;
33   required_shared_ptr<UINT8> m_sprite_ram;
3234
3335   /* misc */
3436   UINT8 m_pot_state;
r14896r14897
128130
129131      int i, j;
130132
131      int x = 196 - state->m_sprite_ram[0 + 2 * n];
132      int y = 192 - state->m_sprite_ram[1 + 2 * n];
133      int x = 196 - state->m_sprite_ram.target()[0 + 2 * n];
134      int y = 192 - state->m_sprite_ram.target()[1 + 2 * n];
133135
134      int l = state->m_sprite_ram[4 + 2 * n] & 15;
135      int r = state->m_sprite_ram[5 + 2 * n] & 15;
136      int l = state->m_sprite_ram.target()[4 + 2 * n] & 15;
137      int r = state->m_sprite_ram.target()[5 + 2 * n] & 15;
136138
137139      for (i = 0; i < 8; i++)
138140      {
r14896r14897
176178   {
177179      for (j = 0; j < 32; j++)
178180      {
179         UINT8 code = state->m_tile_ram[32 * i + j];
181         UINT8 code = state->m_tile_ram.target()[32 * i + j];
180182
181183         drawgfx_transpen(bitmap, cliprect,
182184            screen.machine().gfx[2],
r14896r14897
297299static ADDRESS_MAP_START( boxer_map, AS_PROGRAM, 8, boxer_state )
298300   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
299301   AM_RANGE(0x0000, 0x01ff) AM_RAM
300   AM_RANGE(0x0200, 0x03ff) AM_RAM AM_BASE(m_tile_ram)
302   AM_RANGE(0x0200, 0x03ff) AM_RAM AM_SHARE("tile_ram")
301303   AM_RANGE(0x0800, 0x08ff) AM_READ(boxer_input_r)
302304   AM_RANGE(0x1000, 0x17ff) AM_READ(boxer_misc_r)
303305   AM_RANGE(0x1800, 0x1800) AM_WRITE(boxer_pot_w)
r14896r14897
306308   AM_RANGE(0x1b00, 0x1bff) AM_WRITE(boxer_crowd_w)
307309   AM_RANGE(0x1c00, 0x1cff) AM_WRITE(boxer_irq_reset_w)
308310   AM_RANGE(0x1d00, 0x1dff) AM_WRITE(boxer_bell_w)
309   AM_RANGE(0x1e00, 0x1eff) AM_WRITEONLY AM_BASE(m_sprite_ram)
311   AM_RANGE(0x1e00, 0x1eff) AM_WRITEONLY AM_SHARE("sprite_ram")
310312   AM_RANGE(0x1f00, 0x1fff) AM_WRITE(watchdog_reset_w)
311313   AM_RANGE(0x3000, 0x3fff) AM_ROM
312314ADDRESS_MAP_END
src/mame/drivers/roul.c
r14896r14897
166166
167167WRITE8_MEMBER(roul_state::sound_latch_w)
168168{
169   soundlatch_w(space, 0, data & 0xff);
169   soundlatch_byte_w(space, 0, data & 0xff);
170170   cputag_set_input_line(machine(), "soundcpu", 0, HOLD_LINE);
171171}
172172
r14896r14897
202202
203203static ADDRESS_MAP_START( sound_cpu_io_map, AS_IO, 8, roul_state )
204204   ADDRESS_MAP_GLOBAL_MASK(0xff)
205   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
205   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)
206206   AM_RANGE(0x00, 0x01) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
207207ADDRESS_MAP_END
208208
src/mame/drivers/freekick.c
r14896r14897
4646{
4747   /* flip Y/X could be the other way round... */
4848   if (offset)
49      flip_screen_y_set(machine(), ~data & 1);
49      flip_screen_y_set(~data & 1);
5050   else
51      flip_screen_x_set(machine(), ~data & 1);
51      flip_screen_x_set(~data & 1);
5252}
5353
5454WRITE8_MEMBER(freekick_state::coin_w)
src/mame/drivers/xybots.c
r14896r14897
6464 *
6565 *************************************/
6666
67static READ16_HANDLER( special_port1_r )
67READ16_MEMBER(xybots_state::special_port1_r)
6868{
69   xybots_state *state = space->machine().driver_data<xybots_state>();
70   int result = input_port_read(space->machine(), "FFE200");
69   int result = input_port_read(machine(), "FFE200");
7170
72   if (state->m_cpu_to_sound_ready) result ^= 0x0200;
73   result ^= state->m_h256 ^= 0x0400;
71   if (m_cpu_to_sound_ready) result ^= 0x0200;
72   result ^= m_h256 ^= 0x0400;
7473   return result;
7574}
7675
r14896r14897
9291   AM_RANGE(0xff9000, 0xffadff) AM_MIRROR(0x7f8000) AM_RAM
9392   AM_RANGE(0xffae00, 0xffafff) AM_MIRROR(0x7f8000) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
9493   AM_RANGE(0xffb000, 0xffbfff) AM_MIRROR(0x7f8000) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_BASE(m_playfield)
95   AM_RANGE(0xffc000, 0xffc7ff) AM_MIRROR(0x7f8800) AM_RAM_WRITE(paletteram16_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
94   AM_RANGE(0xffc000, 0xffc7ff) AM_MIRROR(0x7f8800) AM_RAM_WRITE(paletteram_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
9695   AM_RANGE(0xffd000, 0xffdfff) AM_MIRROR(0x7f8000) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
9796   AM_RANGE(0xffe000, 0xffe0ff) AM_MIRROR(0x7f8000) AM_READ_LEGACY(atarigen_sound_r)
9897   AM_RANGE(0xffe100, 0xffe1ff) AM_MIRROR(0x7f8000) AM_READ_PORT("FFE100")
99   AM_RANGE(0xffe200, 0xffe2ff) AM_MIRROR(0x7f8000) AM_READ_LEGACY(special_port1_r)
98   AM_RANGE(0xffe200, 0xffe2ff) AM_MIRROR(0x7f8000) AM_READ(special_port1_r)
10099   AM_RANGE(0xffe800, 0xffe8ff) AM_MIRROR(0x7f8000) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
101100   AM_RANGE(0xffe900, 0xffe9ff) AM_MIRROR(0x7f8000) AM_WRITE_LEGACY(atarigen_sound_w)
102101   AM_RANGE(0xffea00, 0xffeaff) AM_MIRROR(0x7f8000) AM_WRITE(watchdog_reset16_w)
src/mame/drivers/speglsht.c
r14896r14897
146146static ADDRESS_MAP_START( st0016_io, AS_IO, 8, speglsht_state )
147147   ADDRESS_MAP_GLOBAL_MASK(0xff)
148148   AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
149   AM_RANGE(0xe1, 0xe1) AM_WRITE_LEGACY(st0016_rom_bank_w)
149   AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
150150   AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
151151   AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
152152   AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
src/mame/drivers/magicfly.c
r14896r14897
421421{
422422public:
423423   magicfly_state(const machine_config &mconfig, device_type type, const char *tag)
424      : driver_device(mconfig, type, tag) { }
424      : driver_device(mconfig, type, tag) ,
425      m_videoram(*this, "videoram"),
426      m_colorram(*this, "colorram"){ }
425427
426   UINT8 *m_videoram;
427   UINT8 *m_colorram;
428   required_shared_ptr<UINT8> m_videoram;
429   required_shared_ptr<UINT8> m_colorram;
428430   tilemap_t *m_bg_tilemap;
429431   int m_input_selector;
430432   DECLARE_WRITE8_MEMBER(magicfly_videoram_w);
r14896r14897
441443
442444WRITE8_MEMBER(magicfly_state::magicfly_videoram_w)
443445{
444   m_videoram[offset] = data;
446   m_videoram.target()[offset] = data;
445447   m_bg_tilemap->mark_tile_dirty(offset);
446448}
447449
448450WRITE8_MEMBER(magicfly_state::magicfly_colorram_w)
449451{
450   m_colorram[offset] = data;
452   m_colorram.target()[offset] = data;
451453   m_bg_tilemap->mark_tile_dirty(offset);
452454}
453455
r14896r14897
463465    x--- ----   Mirrored from bit 3. The code check this one to boot the game.
464466
465467*/
466   int attr = state->m_colorram[tile_index];
467   int code = state->m_videoram[tile_index];
468   int attr = state->m_colorram.target()[tile_index];
469   int code = state->m_videoram.target()[tile_index];
468470   int bank = (attr & 0x10) >> 4;   /* bit 4 switch the gfx banks */
469471   int color = attr & 0x07;         /* bits 0-2 for color */
470472
471473    /* Seems that bit 7 is mirrored from bit 3 to have a normal boot */
472474    /* Boot only check the first color RAM offset */
473475
474   state->m_colorram[0] = state->m_colorram[0] | ((state->m_colorram[0] & 0x08) << 4);   /* only for 1st offset */
475   //state->m_colorram[tile_index] = attr | ((attr & 0x08) << 4);         /* for the whole color RAM */
476   state->m_colorram.target()[0] = state->m_colorram.target()[0] | ((state->m_colorram.target()[0] & 0x08) << 4);   /* only for 1st offset */
477   //state->m_colorram.target()[tile_index] = attr | ((attr & 0x08) << 4);         /* for the whole color RAM */
476478
477479   SET_TILE_INFO(bank, code, color, 0);
478480}
r14896r14897
495497    x--- ----   Mirrored from bit 2. The code check this one to boot the game.
496498
497499*/
498   int attr = state->m_colorram[tile_index];
499   int code = state->m_videoram[tile_index];
500   int attr = state->m_colorram.target()[tile_index];
501   int code = state->m_videoram.target()[tile_index];
500502   int bank = (attr & 0x10) >> 4;    /* bit 4 switch the gfx banks */
501503   int color = attr & 0x07;          /* bits 0-2 for color */
502504
503505    /* Seems that bit 7 is mirrored from bit 2 to have a normal boot */
504506    /* Boot only check the first color RAM offset */
505507
506   state->m_colorram[0] = state->m_colorram[0] | ((state->m_colorram[0] & 0x04) << 5);   /* only for 1st offset */
507   //state->m_colorram[tile_index] = attr | ((attr & 0x04) << 5);         /* for the whole color RAM */
508   state->m_colorram.target()[0] = state->m_colorram.target()[0] | ((state->m_colorram.target()[0] & 0x04) << 5);   /* only for 1st offset */
509   //state->m_colorram.target()[tile_index] = attr | ((attr & 0x04) << 5);         /* for the whole color RAM */
508510
509511   SET_TILE_INFO(bank, code, color, 0);
510512}
r14896r14897
597599   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")    /* MK48Z02B NVRAM */
598600   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE("crtc", mc6845_device, address_w)
599601   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
600   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(magicfly_videoram_w) AM_BASE(m_videoram)   /* HM6116LP #1 (2K x 8) RAM (only 1st half used) */
601   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(magicfly_colorram_w) AM_BASE(m_colorram)   /* HM6116LP #2 (2K x 8) RAM (only 1st half used) */
602   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(magicfly_videoram_w) AM_SHARE("videoram")   /* HM6116LP #1 (2K x 8) RAM (only 1st half used) */
603   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(magicfly_colorram_w) AM_SHARE("colorram")   /* HM6116LP #2 (2K x 8) RAM (only 1st half used) */
602604   AM_RANGE(0x2800, 0x2800) AM_READ(mux_port_r)   /* multiplexed input port */
603605   AM_RANGE(0x3000, 0x3000) AM_WRITE(mux_port_w)   /* output port */
604606   AM_RANGE(0xc000, 0xffff) AM_ROM               /* ROM space */
src/mame/drivers/wgp.c
r14896r14897
656656   AM_RANGE(0x502000, 0x517fff) AM_READWRITE(wgp_pivram_word_r, wgp_pivram_word_w) AM_BASE(m_pivram) /* piv tilemaps */
657657   AM_RANGE(0x520000, 0x52001f) AM_READWRITE(wgp_piv_ctrl_word_r, wgp_piv_ctrl_word_w) AM_BASE(m_piv_ctrlram)
658658   AM_RANGE(0x600000, 0x600003) AM_WRITE(rotate_port_w)   /* rotation control ? */
659   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
659   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
660660ADDRESS_MAP_END
661661
662662static ADDRESS_MAP_START( cpu2_map, AS_PROGRAM, 16   /* LAN areas not mapped... */, wgp_state )
src/mame/drivers/welltris.c
r14896r14897
334334   {
335335
336336      m_pending_command = 1;
337      soundlatch_w(space, 0, data & 0xff);
337      soundlatch_byte_w(space, 0, data & 0xff);
338338      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
339339   }
340340}
r14896r14897
358358   AM_RANGE(0xff8000, 0xffbfff) AM_RAM                        /* work */
359359   AM_RANGE(0xffc000, 0xffc3ff) AM_RAM_WRITE(welltris_spriteram_w) AM_BASE(m_spriteram)         /* Sprite */
360360   AM_RANGE(0xffd000, 0xffdfff) AM_RAM_WRITE(welltris_charvideoram_w) AM_BASE(m_charvideoram)      /* Char */
361   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   /* Palette */
361   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   /* Palette */
362362   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("P1")               /* Bottom Controls */
363363   AM_RANGE(0xfff000, 0xfff001) AM_WRITE(welltris_palette_bank_w)
364364   AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("P2")               /* Top Controls */
r14896r14897
385385   ADDRESS_MAP_GLOBAL_MASK(0xff)
386386   AM_RANGE(0x00, 0x00) AM_WRITE(welltris_sh_bankswitch_w)
387387   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
388   AM_RANGE(0x10, 0x10) AM_READ(soundlatch_r)
388   AM_RANGE(0x10, 0x10) AM_READ(soundlatch_byte_r)
389389   AM_RANGE(0x18, 0x18) AM_WRITE(pending_command_clear_w)
390390ADDRESS_MAP_END
391391
src/mame/drivers/aquarium.c
r14896r14897
6262{
6363//  popmessage("sound write %04x",data);
6464
65   soundlatch_w(space, 1, data & 0xff);
65   soundlatch_byte_w(space, 1, data & 0xff);
6666   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE );
6767}
6868
r14896r14897
109109   AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(aquarium_bak_videoram_w) AM_BASE(m_bak_videoram)
110110   AM_RANGE(0xc02000, 0xc03fff) AM_RAM_WRITE(aquarium_txt_videoram_w) AM_BASE(m_txt_videoram)
111111   AM_RANGE(0xc80000, 0xc81fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
112   AM_RANGE(0xd00000, 0xd00fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
112   AM_RANGE(0xd00000, 0xd00fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
113113   AM_RANGE(0xd80014, 0xd8001f) AM_WRITEONLY AM_BASE(m_scroll)
114114   AM_RANGE(0xd80068, 0xd80069) AM_WRITENOP      /* probably not used */
115115   AM_RANGE(0xd80080, 0xd80081) AM_READ_PORT("DSW")
r14896r14897
131131   ADDRESS_MAP_GLOBAL_MASK(0xff)
132132   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
133133   AM_RANGE(0x02, 0x02) AM_READWRITE(aquarium_oki_r, aquarium_oki_w)
134   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r)
134   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_byte_r)
135135   AM_RANGE(0x06, 0x06) AM_WRITE(aquarium_snd_ack_w)
136136   AM_RANGE(0x08, 0x08) AM_WRITE(aquarium_z80_bank_w)
137137ADDRESS_MAP_END
src/mame/drivers/metro.c
r14896r14897
352352   switch (ioline)
353353   {
354354      case UPD7810_RXD:   /* read the RxD line */
355         data = driver_state->soundlatch_r(*space, 0);
355         data = driver_state->soundlatch_byte_r(*space, 0);
356356         state = data & 1;
357         driver_state->soundlatch_w(*space, 0, data >> 1);
357         driver_state->soundlatch_byte_w(*space, 0, data >> 1);
358358         break;
359359      default:
360360         logerror("upd7810 ioline %d not handled\n", ioline);
r14896r14897
368368
369369   if (ACCESSING_BITS_0_7)
370370   {
371      soundlatch_w(space, 0, data & 0xff);
371      soundlatch_byte_w(space, 0, data & 0xff);
372372      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
373373      device_spin_until_interrupt(&space.device());
374374      m_busy_sndcpu = 1;
r14896r14897
882882   AM_RANGE(0x620000, 0x63ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
883883   AM_RANGE(0x640000, 0x65ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
884884   AM_RANGE(0x660000, 0x66ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
885   AM_RANGE(0x670000, 0x673fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
885   AM_RANGE(0x670000, 0x673fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
886886   AM_RANGE(0x674000, 0x674fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
887887   AM_RANGE(0x678000, 0x6787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
888888   AM_RANGE(0x678840, 0x67884d) AM_WRITE(metro_blitter_w) AM_BASE(m_blitter_regs)   // Tiles Blitter
r14896r14897
913913   AM_RANGE(0x120000, 0x13ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
914914   AM_RANGE(0x140000, 0x15ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
915915   AM_RANGE(0x160000, 0x16ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
916   AM_RANGE(0x170000, 0x173fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
916   AM_RANGE(0x170000, 0x173fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
917917   AM_RANGE(0x174000, 0x174fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
918918   AM_RANGE(0x178000, 0x1787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
919919   AM_RANGE(0x178840, 0x17884d) AM_WRITE(metro_blitter_w) AM_BASE(m_blitter_regs)   // Tiles Blitter
r14896r14897
952952   AM_RANGE(0xe20000, 0xe3ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
953953   AM_RANGE(0xe40000, 0xe5ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
954954   AM_RANGE(0xe60000, 0xe6ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
955   AM_RANGE(0xe70000, 0xe73fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
955   AM_RANGE(0xe70000, 0xe73fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
956956   AM_RANGE(0xe74000, 0xe74fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
957957   AM_RANGE(0xe78000, 0xe787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
958958   AM_RANGE(0xe78840, 0xe7884d) AM_WRITE(metro_blitter_w) AM_BASE(m_blitter_regs)   // Tiles Blitter
r14896r14897
978978   AM_RANGE(0x120000, 0x13ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
979979   AM_RANGE(0x140000, 0x15ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
980980   AM_RANGE(0x160000, 0x16ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
981   AM_RANGE(0x170000, 0x173fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
981   AM_RANGE(0x170000, 0x173fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
982982   AM_RANGE(0x174000, 0x174fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
983983   AM_RANGE(0x178000, 0x1787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
984984   AM_RANGE(0x178840, 0x17884d) AM_WRITE(metro_blitter_w) AM_BASE(m_blitter_regs)   // Tiles Blitter
r14896r14897
10141014   AM_RANGE(0x120000, 0x13ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
10151015   AM_RANGE(0x140000, 0x15ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
10161016   AM_RANGE(0x160000, 0x16ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1017   AM_RANGE(0x170000, 0x173fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1017   AM_RANGE(0x170000, 0x173fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
10181018   AM_RANGE(0x174000, 0x174fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
10191019   AM_RANGE(0x178000, 0x1787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
10201020   AM_RANGE(0x178840, 0x17884d) AM_WRITE(metro_blitter_w) AM_BASE(m_blitter_regs)   // Tiles Blitter
r14896r14897
10481048   AM_RANGE(0x420000, 0x43ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
10491049   AM_RANGE(0x440000, 0x45ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
10501050   AM_RANGE(0x460000, 0x46ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1051   AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1051   AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
10521052   AM_RANGE(0x474000, 0x474fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
10531053   AM_RANGE(0x478000, 0x4787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
10541054   AM_RANGE(0x478840, 0x47884d) AM_WRITE(metro_blitter_w) AM_BASE(m_blitter_regs)   // Tiles Blitter
r14896r14897
10811081   AM_RANGE(0x820000, 0x83ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
10821082   AM_RANGE(0x840000, 0x85ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
10831083   AM_RANGE(0x860000, 0x86ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1084   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1084   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
10851085   AM_RANGE(0x874000, 0x874fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
10861086   AM_RANGE(0x878000, 0x8787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
10871087   AM_RANGE(0x878840, 0x87884d) AM_WRITE(metro_blitter_w) AM_BASE(m_blitter_regs)   // Tiles Blitter
r14896r14897
11321132   AM_RANGE(0x40000a, 0x40000b) AM_READ_PORT("DSW1")                        //
11331133   AM_RANGE(0x40000c, 0x40000d) AM_READ_PORT("IN2")                        //
11341134   AM_RANGE(0x860000, 0x86ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1135   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1135   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
11361136   AM_RANGE(0x874000, 0x874fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
11371137   AM_RANGE(0x875000, 0x875fff) AM_READWRITE(karatour_vram_0_r, karatour_vram_0_w)         // Layer 0 (Part of)
11381138   AM_RANGE(0x876000, 0x876fff) AM_READWRITE(karatour_vram_1_r, karatour_vram_1_w)         // Layer 1 (Part of)
r14896r14897
11621162   AM_RANGE(0x000000, 0x07ffff) AM_ROM                              // ROM
11631163   AM_RANGE(0x7fc000, 0x7fffff) AM_RAM                              // RAM
11641164   AM_RANGE(0x860000, 0x86ffff) AM_READ(metro_bankedrom_r)                  // Banked ROM
1165   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1165   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
11661166   AM_RANGE(0x874000, 0x874fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)            // Sprites
11671167   AM_RANGE(0x875000, 0x875fff) AM_READWRITE(karatour_vram_0_r, karatour_vram_0_w)      // Layer 0 (Part of)
11681168   AM_RANGE(0x876000, 0x876fff) AM_READWRITE(karatour_vram_1_r, karatour_vram_1_w)      // Layer 1 (Part of)
r14896r14897
11971197   AM_RANGE(0x820000, 0x83ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
11981198   AM_RANGE(0x840000, 0x85ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
11991199   AM_RANGE(0x860000, 0x86ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1200   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1200   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
12011201   AM_RANGE(0x874000, 0x874fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
12021202   AM_RANGE(0x878000, 0x8787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
12031203   AM_RANGE(0x878800, 0x878813) AM_WRITEONLY AM_BASE(m_videoregs)         // Video Registers
r14896r14897
12371237   AM_RANGE(0x8a0000, 0x8bffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
12381238   AM_RANGE(0x8c0000, 0x8dffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
12391239   AM_RANGE(0x8e0000, 0x8effff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1240   AM_RANGE(0x8f0000, 0x8f3fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1240   AM_RANGE(0x8f0000, 0x8f3fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
12411241   AM_RANGE(0x8f4000, 0x8f4fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
12421242   AM_RANGE(0x8f8000, 0x8f87ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
12431243   AM_RANGE(0x8f8800, 0x8f8813) AM_WRITEONLY AM_BASE(m_videoregs)         // Video Registers
r14896r14897
13311331   AM_RANGE(0x220000, 0x23ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
13321332   AM_RANGE(0x240000, 0x25ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
13331333   AM_RANGE(0x260000, 0x26ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1334   AM_RANGE(0x270000, 0x273fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1334   AM_RANGE(0x270000, 0x273fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
13351335   AM_RANGE(0x274000, 0x274fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
13361336   AM_RANGE(0x278000, 0x2787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
13371337   AM_RANGE(0x27880e, 0x27880f) AM_RAM AM_BASE(m_screenctrl)            // Screen Control
r14896r14897
13681368   AM_RANGE(0x620000, 0x63ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
13691369   AM_RANGE(0x640000, 0x65ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
13701370   AM_RANGE(0x660000, 0x66ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1371   AM_RANGE(0x670000, 0x673fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1371   AM_RANGE(0x670000, 0x673fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
13721372   AM_RANGE(0x674000, 0x674fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
13731373   AM_RANGE(0x675000, 0x675fff) AM_RAM                                 // Sprites?
13741374   AM_RANGE(0x678000, 0x6787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
r14896r14897
14401440   AM_RANGE(0x220000, 0x23ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
14411441   AM_RANGE(0x240000, 0x25ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
14421442   AM_RANGE(0x260000, 0x26ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1443   AM_RANGE(0x270000, 0x273fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1443   AM_RANGE(0x270000, 0x273fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
14441444   AM_RANGE(0x274000, 0x274fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
14451445   AM_RANGE(0x278000, 0x2787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
14461446   AM_RANGE(0x278810, 0x27881f) AM_WRITEONLY AM_BASE(m_irq_levels)         // IRQ Levels
r14896r14897
14781478   AM_RANGE(0x440000, 0x45ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
14791479   AM_RANGE(0x460000, 0x46ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
14801480   AM_RANGE(0x460000, 0x46ffff) AM_WRITENOP                              // DSW Selection
1481   AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1481   AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
14821482   AM_RANGE(0x474000, 0x474fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
14831483   AM_RANGE(0x478000, 0x4787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
14841484   AM_RANGE(0x47880e, 0x47880f) AM_WRITEONLY AM_BASE(m_screenctrl)         // Screen Control
r14896r14897
15171517   AM_RANGE(0x420000, 0x43ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
15181518   AM_RANGE(0x440000, 0x45ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
15191519   AM_RANGE(0x460000, 0x46ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1520   AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1520   AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
15211521   AM_RANGE(0x474000, 0x474fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
15221522   AM_RANGE(0x478000, 0x4787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
15231523   AM_RANGE(0x478800, 0x478813) AM_RAM AM_BASE(m_videoregs)            // Video Registers
r14896r14897
15531553   AM_RANGE(0xc20000, 0xc3ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
15541554   AM_RANGE(0xc40000, 0xc5ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
15551555   AM_RANGE(0xc60000, 0xc6ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1556   AM_RANGE(0xc70000, 0xc73fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1556   AM_RANGE(0xc70000, 0xc73fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
15571557   AM_RANGE(0xc74000, 0xc74fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
15581558   AM_RANGE(0xc78000, 0xc787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
15591559   AM_RANGE(0xc78800, 0xc78813) AM_WRITEONLY AM_BASE(m_videoregs)         // Video Registers
r14896r14897
15861586   AM_RANGE(0x820000, 0x83ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
15871587   AM_RANGE(0x840000, 0x85ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
15881588   AM_RANGE(0x860000, 0x86ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1589   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1589   AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
15901590   AM_RANGE(0x874000, 0x874fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
15911591   AM_RANGE(0x878000, 0x8787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
15921592   AM_RANGE(0x878800, 0x878813) AM_WRITEONLY AM_BASE(m_videoregs)         // Video Registers
r14896r14897
16221622   AM_RANGE(0xc20000, 0xc3ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
16231623   AM_RANGE(0xc40000, 0xc5ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
16241624   AM_RANGE(0xc60000, 0xc6ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1625   AM_RANGE(0xc70000, 0xc73fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1625   AM_RANGE(0xc70000, 0xc73fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
16261626   AM_RANGE(0xc74000, 0xc74fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
16271627   AM_RANGE(0xc78000, 0xc787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
16281628   AM_RANGE(0xc78840, 0xc7884d) AM_WRITE(metro_blitter_w) AM_BASE(m_blitter_regs)   // Tiles Blitter
r14896r14897
16551655   AM_RANGE(0xc20000, 0xc3ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
16561656   AM_RANGE(0xc40000, 0xc5ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
16571657   AM_RANGE(0xc60000, 0xc6ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1658   AM_RANGE(0xc70000, 0xc73fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1658   AM_RANGE(0xc70000, 0xc73fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
16591659   AM_RANGE(0xc74000, 0xc74fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
16601660   AM_RANGE(0xc78000, 0xc787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
16611661   AM_RANGE(0xc78840, 0xc7884d) AM_WRITE(metro_blitter_w) AM_BASE(m_blitter_regs)   // Tiles Blitter
r14896r14897
16861686WRITE16_MEMBER(metro_state::blzntrnd_sound_w)
16871687{
16881688
1689   soundlatch_w(space, offset, data >> 8);
1689   soundlatch_byte_w(space, offset, data >> 8);
16901690   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
16911691}
16921692
r14896r14897
17191719static ADDRESS_MAP_START( blzntrnd_sound_io_map, AS_IO, 8, metro_state )
17201720   ADDRESS_MAP_GLOBAL_MASK(0xff)
17211721   AM_RANGE(0x00, 0x00) AM_WRITE(blzntrnd_sh_bankswitch_w)
1722   AM_RANGE(0x40, 0x40) AM_READ(soundlatch_r) AM_WRITENOP
1722   AM_RANGE(0x40, 0x40) AM_READ(soundlatch_byte_r) AM_WRITENOP
17231723   AM_RANGE(0x80, 0x83) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r,ym2610_w)
17241724ADDRESS_MAP_END
17251725
r14896r14897
17321732   AM_RANGE(0x240000, 0x25ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
17331733   AM_RANGE(0x260000, 0x26ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
17341734   AM_RANGE(0x260000, 0x26ffff) AM_WRITENOP                              // ??????
1735   AM_RANGE(0x270000, 0x273fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1735   AM_RANGE(0x270000, 0x273fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
17361736   AM_RANGE(0x274000, 0x274fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
17371737   AM_RANGE(0x278000, 0x2787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
17381738   AM_RANGE(0x278860, 0x27886b) AM_WRITE(metro_window_w) AM_BASE(m_window)      // Tilemap Window
r14896r14897
17741774   AM_RANGE(0x400000, 0x41ffff) AM_RAM_WRITE(metro_vram_0_w) AM_BASE(m_vram_0)   // Layer 0
17751775   AM_RANGE(0x420000, 0x43ffff) AM_RAM_WRITE(metro_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
17761776   AM_RANGE(0x440000, 0x45ffff) AM_RAM_WRITE(metro_vram_2_w) AM_BASE(m_vram_2)   // Layer 2
1777   AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1777   AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
17781778   AM_RANGE(0x474000, 0x474fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
17791779   AM_RANGE(0x478000, 0x4787ff) AM_RAM AM_BASE_SIZE(m_tiletable, m_tiletable_size)   // Tiles Set
17801780   AM_RANGE(0x47880e, 0x47880f) AM_WRITEONLY AM_BASE(m_screenctrl)         // Screen Control
r14896r14897
18611861   AM_RANGE(0x760000, 0x76ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
18621862
18631863//  AM_RANGE(0x772000, 0x773fff) AM_RAM
1864   AM_RANGE(0x770000, 0x773fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1864   AM_RANGE(0x770000, 0x773fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
18651865
18661866   AM_RANGE(0x775000, 0x775fff) AM_RAM_WRITE(vram_0_clr_w)
18671867   AM_RANGE(0x776000, 0x776fff) AM_RAM_WRITE(vram_1_clr_w)
src/mame/drivers/gal3.c
r14896r14897
137137{
138138public:
139139   gal3_state(const machine_config &mconfig, device_type type, const char *tag)
140      : driver_device(mconfig, type, tag) { }
140      : driver_device(mconfig, type, tag) ,
141      m_nvmem(*this, "nvmem"),
142      m_rsoSharedRAM(*this, "rsoSharedRAM"){ }
141143
142144   UINT32 *m_mpSharedRAM0;
143145   //UINT32 *m_mpSharedRAM1;
144   UINT32 *m_nvmem;
145   size_t m_nvmem_size;
146   required_shared_ptr<UINT32> m_nvmem;
146147   UINT16 m_namcos21_video_enable;
147   UINT16 *m_rsoSharedRAM;
148   required_shared_ptr<UINT16> m_rsoSharedRAM;
148149   UINT32 m_led_mst;
149150   UINT32 m_led_slv;
150151   DECLARE_READ32_MEMBER(led_mst_r);
r14896r14897
253254   UINT8 data[4];
254255   if( read_or_write )
255256   {
256      for( i=0; i<state->m_nvmem_size/4; i++ )
257      for( i=0; i<state->m_nvmem.bytes()/4; i++ )
257258      {
258         UINT32 dword = state->m_nvmem[i];
259         UINT32 dword = state->m_nvmem.target()[i];
259260         data[0] = dword>>24;
260261         data[1] = (dword&0x00ff0000)>>16;
261262         data[2] = (dword&0x0000ff00)>>8;
r14896r14897
267268   {
268269      if( file )
269270      {
270         for( i=0; i<state->m_nvmem_size/4; i++ )
271         for( i=0; i<state->m_nvmem.bytes()/4; i++ )
271272         {
272273            file->read( data, 4 );
273            state->m_nvmem[i] = (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|data[3];
274            state->m_nvmem.target()[i] = (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|data[3];
274275         }
275276      }
276277      else
277278      {
278279         /* fill in the default values */
279         memset( state->m_nvmem, 0x00, state->m_nvmem_size );
280         memset( state->m_nvmem, 0x00, state->m_nvmem.bytes() );
280281      }
281282   }
282283}
r14896r14897
342343    Check @$009a==1 to start DEMO
343344    HACK*/
344345   offset *= 2;
345   return (m_rsoSharedRAM[offset]<<16)|m_rsoSharedRAM[offset+1];
346   return (m_rsoSharedRAM.target()[offset]<<16)|m_rsoSharedRAM.target()[offset+1];
346347}
347348
348349WRITE32_MEMBER(gal3_state::rso_w)
349350{
350351   UINT32 v;
351352   offset *= 2;
352   v = (m_rsoSharedRAM[offset]<<16)|m_rsoSharedRAM[offset+1];
353   v = (m_rsoSharedRAM.target()[offset]<<16)|m_rsoSharedRAM.target()[offset+1];
353354   COMBINE_DATA( &v );
354   m_rsoSharedRAM[offset+0] = v>>16;
355   m_rsoSharedRAM[offset+1] = v&0xffff;
355   m_rsoSharedRAM.target()[offset+0] = v>>16;
356   m_rsoSharedRAM.target()[offset+1] = v&0xffff;
356357}
357358
358359
359360static ADDRESS_MAP_START( cpu_mst_map, AS_PROGRAM, 32, gal3_state )
360361   AM_RANGE(0x00000000, 0x001fffff) AM_ROM
361   AM_RANGE(0x20000000, 0x20001fff) AM_RAM AM_BASE(m_nvmem) AM_SIZE(m_nvmem_size)   //NVRAM
362   AM_RANGE(0x20000000, 0x20001fff) AM_RAM AM_SHARE("nvmem")   //NVRAM
362363/// AM_RANGE(0x40000000, 0x4000ffff) AM_WRITE_LEGACY() //
363364   AM_RANGE(0x44000000, 0x44000003) AM_READ_PORT("DSW_CPU_mst"   )
364365   AM_RANGE(0x44800000, 0x44800003) AM_READ(led_mst_r) AM_WRITE(led_mst_w)   //LEDs
r14896r14897
435436   AM_RANGE(0x2c3800, 0x2c3801) AM_RAM //?
436437   AM_RANGE(0x2c4000, 0x2c4001) AM_RAM //?
437438
438   AM_RANGE(0x300000, 0x300fff) AM_RAM AM_BASE(m_rsoSharedRAM)   //shared RAM
439   AM_RANGE(0x300000, 0x300fff) AM_RAM AM_SHARE("rsoSharedRAM")   //shared RAM
439440
440441   AM_RANGE(0x400000, 0x400017) AM_RAM //MC68681?
441442   AM_RANGE(0x480000, 0x480017) AM_RAM //?
src/mame/drivers/nightgal.c
r14896r14897
3131{
3232public:
3333   nightgal_state(const machine_config &mconfig, device_type type, const char *tag)
34      : driver_device(mconfig, type, tag) { }
34      : driver_device(mconfig, type, tag) ,
35      m_comms_ram(*this, "comms_ram"){ }
3536
3637   /* video-related */
3738   UINT8 m_blit_raw_data[3];
r14896r14897
4445   UINT8 m_z80_latch;
4546   UINT8 m_mux_data;
4647
47   UINT8 *m_comms_ram;
48   required_shared_ptr<UINT8> m_comms_ram;
4849
4950   /* devices */
5051   device_t *m_maincpu;
r14896r14897
378379READ8_MEMBER(nightgal_state::royalqn_comm_r)
379380{
380381
381   return (m_comms_ram[offset] & 0x80) | (0x7f); //bits 6-0 are undefined, presumably open bus
382   return (m_comms_ram.target()[offset] & 0x80) | (0x7f); //bits 6-0 are undefined, presumably open bus
382383}
383384
384385WRITE8_MEMBER(nightgal_state::royalqn_comm_w)
385386{
386387
387   m_comms_ram[offset] = data & 0x80;
388   m_comms_ram.target()[offset] = data & 0x80;
388389}
389390
390391#ifdef UNUSED_CODE
r14896r14897
509510static ADDRESS_MAP_START( sexygal_map, AS_PROGRAM, 8, nightgal_state )
510511   AM_RANGE(0x0000, 0x7fff) AM_ROM
511512   AM_RANGE(0x8000, 0xbfff) AM_RAM //???
512   AM_RANGE(0xe000, 0xefff) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_BASE(m_comms_ram)
513   AM_RANGE(0xe000, 0xefff) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_SHARE("comms_ram")
513514   AM_RANGE(0xf000, 0xffff) AM_RAM
514515ADDRESS_MAP_END
515516
r14896r14897
533534   AM_RANGE(0x00a0, 0x00af) AM_WRITE(blit_true_vregs_w)
534535   AM_RANGE(0x00b0, 0x00b0) AM_WRITENOP // bltflip register
535536
536   AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_BASE(m_comms_ram)
537   AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_SHARE("comms_ram")
537538   AM_RANGE(0xc000, 0xffff) AM_ROM AM_WRITENOP
538539ADDRESS_MAP_END
539540
r14896r14897
544545static ADDRESS_MAP_START( royalqn_map, AS_PROGRAM, 8, nightgal_state )
545546   AM_RANGE(0x0000, 0x7fff) AM_ROM
546547   AM_RANGE(0x8000, 0xbfff) AM_NOP
547   AM_RANGE(0xc000, 0xdfff) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_BASE(m_comms_ram)
548   AM_RANGE(0xc000, 0xdfff) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_SHARE("comms_ram")
548549   AM_RANGE(0xe000, 0xffff) AM_RAM
549550ADDRESS_MAP_END
550551
src/mame/drivers/rgum.c
r14896r14897
2323{
2424public:
2525   rgum_state(const machine_config &mconfig, device_type type, const char *tag)
26      : driver_device(mconfig, type, tag) { }
26      : driver_device(mconfig, type, tag) ,
27      m_vram(*this, "vram"),
28      m_cram(*this, "cram"){ }
2729
28   UINT8 *m_vram;
29   UINT8 *m_cram;
30   required_shared_ptr<UINT8> m_vram;
31   required_shared_ptr<UINT8> m_cram;
3032   UINT8 m_hbeat;
3133   DECLARE_CUSTOM_INPUT_MEMBER(rgum_heartbeat_r);
3234};
r14896r14897
4850   {
4951      for(x=0;x<66;x++)
5052      {
51         int tile = state->m_vram[count] | ((state->m_cram[count] & 0xf) <<8);
53         int tile = state->m_vram.target()[count] | ((state->m_cram.target()[count] & 0xf) <<8);
5254
5355         drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*8);
5456
r14896r14897
7375
7476   AM_RANGE(0x3000, 0x3003) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)
7577
76   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(m_vram)
77   AM_RANGE(0x5000, 0x57ff) AM_RAM AM_BASE(m_cram)
78   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_SHARE("vram")
79   AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE("cram")
7880
7981   AM_RANGE(0x8000, 0xffff) AM_ROM
8082ADDRESS_MAP_END
src/mame/drivers/surpratk.c
r14896r14897
4747   if (m_videobank & 0x02)
4848   {
4949      if (m_videobank & 0x04)
50         paletteram_xBBBBBGGGGGRRRRR_be_w(space,offset + 0x0800,data);
50         paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space,offset + 0x0800,data);
5151      else
52         paletteram_xBBBBBGGGGGRRRRR_be_w(space,offset,data);
52         paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space,offset,data);
5353   }
5454   else if (m_videobank & 0x01)
5555      k053245_w(m_k053244, offset, data);
src/mame/drivers/zaccaria.c
r14896r14897
184184
185185WRITE8_MEMBER(zaccaria_state::sound_command_w)
186186{
187   soundlatch_w(space, 0, data);
187   soundlatch_byte_w(space, 0, data);
188188   cputag_set_input_line(machine(), "audio2", 0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
189189}
190190
r14896r14897
192192{
193193   pia6821_device *pia0 = machine().device<pia6821_device>("pia0");
194194   pia0->ca1_w(data & 0x80);
195   soundlatch2_w(space, 0, data);
195   soundlatch2_byte_w(space, 0, data);
196196}
197197
198198static WRITE8_DEVICE_HANDLER( mc1408_data_w )
r14896r14897
330330   AM_RANGE(0x0090, 0x0093) AM_DEVREADWRITE("pia1", pia6821_device, read, write) AM_MIRROR(0x8F6C)
331331   AM_RANGE(0x1000, 0x1000) AM_DEVWRITE_LEGACY("dac2", mc1408_data_w) AM_MIRROR(0x83FF) /* MC1408 */
332332   AM_RANGE(0x1400, 0x1400) AM_WRITE(sound1_command_w) AM_MIRROR(0xC3FF)
333   AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r) AM_MIRROR(0xC3FF)
333   AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_byte_r) AM_MIRROR(0xC3FF)
334334   AM_RANGE(0x2000, 0x2fff) AM_ROM AM_MIRROR(0x8000) // rom 8 with A12 low
335335   AM_RANGE(0x3000, 0x3fff) AM_ROM AM_MIRROR(0x8000) // rom 7 with A12 low
336336   AM_RANGE(0x6000, 0x6fff) AM_ROM AM_MIRROR(0x8000) // rom 8 with A12 high
r14896r14897
531531   AY8910_LEGACY_OUTPUT,
532532   AY8910_DEFAULT_LOADS,
533533   DEVCB_NULL,
534   DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_r),
534   DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_byte_r),
535535   DEVCB_HANDLER(ay8910_port0a_w),
536536   DEVCB_NULL
537537};
src/mame/drivers/speedbal.c
r14896r14897
6060{
6161   coin_counter_w(machine(), 0, data & 0x80);
6262   coin_counter_w(machine(), 1, data & 0x40);
63   flip_screen_set(machine(), data & 8); // also changes data & 0x10 at the same time too (flipx and flipy?)
63   flip_screen_set(data & 8); // also changes data & 0x10 at the same time too (flipx and flipy?)
6464   /* unknown: (data & 0x10) and (data & 4) */
6565}
6666
r14896r14897
6969   AM_RANGE(0xdc00, 0xdfff) AM_RAM AM_SHARE("share1") // shared with SOUND
7070   AM_RANGE(0xe000, 0xe1ff) AM_RAM_WRITE(speedbal_background_videoram_w) AM_BASE(m_background_videoram)
7171   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(speedbal_foreground_videoram_w) AM_BASE(m_foreground_videoram)
72   AM_RANGE(0xf000, 0xf5ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
72   AM_RANGE(0xf000, 0xf5ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
7373   AM_RANGE(0xf600, 0xfeff) AM_RAM AM_SHARE("nvram")
7474   AM_RANGE(0xff00, 0xffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
7575ADDRESS_MAP_END
src/mame/drivers/attckufo.c
r14896r14897
5252   attckufo_state(const machine_config &mconfig, device_type type, const char *tag)
5353      : driver_device(mconfig, type, tag),
5454        m_maincpu(*this, "maincpu"),
55        m_mos6560(*this, "mos6560") { }
55        m_mos6560(*this, "mos6560") ,
56      m_mainram(*this, "mainram"),
57      m_tileram(*this, "tileram"){ }
5658
57   /* memory pointers */
58   UINT8 *      m_mainram;
59   UINT8 *      m_tileram;
60
6159   /* devices */
6260   required_device<cpu_device> m_maincpu;
6361   required_device<mos6560_device> m_mos6560;
62
63   /* memory pointers */
64   required_shared_ptr<UINT8> m_mainram;
65   required_shared_ptr<UINT8> m_tileram;
66
6467   DECLARE_READ8_MEMBER(attckufo_io_r);
6568   DECLARE_WRITE8_MEMBER(attckufo_io_w);
6669};
r14896r14897
121124
122125static ADDRESS_MAP_START( cpu_map, AS_PROGRAM, 8, attckufo_state )
123126   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
124   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE(m_mainram)
127   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("mainram")
125128   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE_LEGACY("mos6560", mos6560_port_r, mos6560_port_w)
126129   AM_RANGE(0x1400, 0x1403) AM_READWRITE(attckufo_io_r, attckufo_io_w)
127   AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_BASE(m_tileram)
130   AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_SHARE("tileram")
128131   AM_RANGE(0x2000, 0x3fff) AM_ROM
129132ADDRESS_MAP_END
130133
src/mame/drivers/jongkyo.c
r14896r14897
3636{
3737public:
3838   jongkyo_state(const machine_config &mconfig, device_type type, const char *tag)
39      : driver_device(mconfig, type, tag) { }
39      : driver_device(mconfig, type, tag) ,
40      m_videoram(*this, "videoram"){ }
4041
4142   /* misc */
4243   UINT8    m_rom_bank;
4344   UINT8    m_mux_data;
4445
4546   /* memory pointers */
46   UINT8 * m_videoram;
47   required_shared_ptr<UINT8> m_videoram;
4748   UINT8    m_videoram2[0x4000];
4849   DECLARE_WRITE8_MEMBER(bank_select_w);
4950   DECLARE_WRITE8_MEMBER(mux_w);
r14896r14897
8990
9091
9192
92         data1 = state->m_videoram[0x4000 + x / 4 + y * 64];
93         data2 = state->m_videoram[x / 4 + y * 64];
93         data1 = state->m_videoram.target()[0x4000 + x / 4 + y * 64];
94         data2 = state->m_videoram.target()[x / 4 + y * 64];
9495
9596         for (b = 0; b < 4; ++b)
9697         {
r14896r14897
224225   AM_RANGE(0x4000, 0x6bff) AM_ROM // fixed rom
225226   AM_RANGE(0x6c00, 0x6fff) AM_ROMBANK("bank1")   // banked (8 banks)
226227   AM_RANGE(0x7000, 0x77ff) AM_RAM
227   AM_RANGE(0x8000, 0xffff) AM_RAM AM_BASE(m_videoram)
228   AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("videoram")
228229ADDRESS_MAP_END
229230
230231
src/mame/drivers/littlerb.c
r14896r14897
7777      : driver_device(mconfig, type, tag),
7878        m_maincpu(*this, "maincpu"),
7979        m_dacl(*this, "dacl"),
80         m_dacr(*this, "dacr")
81      { }
80         m_dacr(*this, "dacr"),
81      m_region4(*this, "region4"){ }
8282
83   required_device<cpu_device> m_maincpu;
84   required_device<dac_device> m_dacl;
85   required_device<dac_device> m_dacr;
86   required_shared_ptr<UINT16> m_region4;
8387   UINT16 m_vdp_address_low;
8488   UINT16 m_vdp_address_high;
8589   UINT16 m_vdp_writemode;
r14896r14897
8892   UINT32 m_write_address_laststart;
8993   UINT32 m_write_address_lastend;
9094
91   UINT16* m_region4;
9295   UINT8 m_paldac[3][0x100];
9396   int m_paldac_select;
9497   int m_paldac_offset;
r14896r14897
97100   UINT8 m_sound_index_l,m_sound_index_r;
98101   UINT16 m_sound_pointer_l,m_sound_pointer_r;
99102
100   required_device<cpu_device> m_maincpu;
101   required_device<dac_device> m_dacl;
102   required_device<dac_device> m_dacr;
103103   DECLARE_WRITE16_MEMBER(region4_w);
104104   DECLARE_READ16_MEMBER(buffer_status_r);
105105   DECLARE_READ16_MEMBER(littlerb_vdp_r);
r14896r14897
112112
113113WRITE16_MEMBER(littlerb_state::region4_w)
114114{
115   COMBINE_DATA(&m_region4[offset]);
115   COMBINE_DATA(&m_region4.target()[offset]);
116116}
117117
118118READ16_MEMBER(littlerb_state::buffer_status_r)
r14896r14897
133133
134134   AM_RANGE(0x1ff80804, 0x1ff80805) AM_DEVREAD("^", littlerb_state, buffer_status_r)
135135   // most gfx end up here including the sprite list
136   AM_RANGE(0x1ff80000, 0x1fffffff) AM_RAM AM_DEVWRITE("^", littlerb_state, region4_w)  AM_BASE(m_region4)
136   AM_RANGE(0x1ff80000, 0x1fffffff) AM_RAM AM_DEVWRITE("^", littlerb_state, region4_w)  AM_SHARE("region4")
137137ADDRESS_MAP_END
138138
139139static ADDRESS_MAP_START( ramdac_map, AS_0, 8, littlerb_state )
r14896r14897
472472   littlerb_state *state = screen.machine().driver_data<littlerb_state>();
473473   int x,y,offs;
474474   int xsize,ysize;
475   UINT16* spriteregion = &state->m_region4[0x400];
475   UINT16* spriteregion = &state->m_region4.target()[0x400];
476476   bitmap.fill(get_black_pen(screen.machine()), cliprect);
477477   //printf("frame\n");
478478   /* the spriteram format is something like this .. */
src/mame/drivers/tagteam.c
r14896r14897
3232
3333WRITE8_MEMBER(tagteam_state::sound_command_w)
3434{
35   soundlatch_w(space, offset, data);
35   soundlatch_byte_w(space, offset, data);
3636   cputag_set_input_line(machine(), "audiocpu", M6502_IRQ_LINE, HOLD_LINE);
3737}
3838
r14896r14897
6868   AM_RANGE(0x2002, 0x2003) AM_DEVWRITE_LEGACY("ay2", ay8910_data_address_w)
6969   AM_RANGE(0x2004, 0x2004) AM_DEVWRITE_LEGACY("dac", dac_w)
7070   AM_RANGE(0x2005, 0x2005) AM_WRITE(sound_nmi_mask_w)
71   AM_RANGE(0x2007, 0x2007) AM_READ(soundlatch_r)
71   AM_RANGE(0x2007, 0x2007) AM_READ(soundlatch_byte_r)
7272   AM_RANGE(0x4000, 0xffff) AM_ROM
7373ADDRESS_MAP_END
7474
src/mame/drivers/namcos23.c
r14896r14897
13191319{
13201320public:
13211321   namcos23_state(const machine_config &mconfig, device_type type, const char *tag)
1322      : driver_device(mconfig, type, tag) { }
1322      : driver_device(mconfig, type, tag) ,
1323      m_shared_ram(*this, "shared_ram"),
1324      m_charram(*this, "charram"),
1325      m_textram(*this, "textram"),
1326      m_gmen_sh2_shared(*this, "gmen_sh2_shared"){ }
13231327
13241328   c361_t m_c361;
13251329   c417_t m_c417;
r14896r14897
13291333   render_t m_render;
13301334
13311335   tilemap_t *m_bgtilemap;
1332   UINT32 *m_textram;
1333   UINT32 *m_shared_ram;
1334   UINT32 *m_gmen_sh2_shared;
1335   UINT32 *m_charram;
1336   required_shared_ptr<UINT32> m_shared_ram;
1337   required_shared_ptr<UINT32> m_charram;
1338   required_shared_ptr<UINT32> m_textram;
1339   required_shared_ptr<UINT32> m_gmen_sh2_shared;
13361340   UINT8 m_jvssense;
13371341   INT32 m_has_jvsio;
13381342   bool m_ctl_vbl_active;
r14896r14897
14501454
14511455WRITE32_MEMBER(namcos23_state::namcos23_textram_w)
14521456{
1453   COMBINE_DATA( &m_textram[offset] );
1457   COMBINE_DATA( &m_textram.target()[offset] );
14541458   m_bgtilemap->mark_tile_dirty(offset*2);
14551459   m_bgtilemap->mark_tile_dirty((offset*2)+1);
14561460}
14571461
14581462WRITE32_MEMBER(namcos23_state::s23_txtchar_w)
14591463{
1460   COMBINE_DATA(&m_charram[offset]);
1464   COMBINE_DATA(&m_charram.target()[offset]);
14611465   gfx_element_mark_dirty(machine().gfx[0], offset/32);
14621466}
14631467
r14896r14897
18581862
18591863READ32_MEMBER(namcos23_state::gorgon_sharedram_r)
18601864{
1861   return m_shared_ram[offset];
1865   return m_shared_ram.target()[offset];
18621866}
18631867
18641868WRITE32_MEMBER(namcos23_state::gorgon_sharedram_w)
18651869{
1866   COMBINE_DATA(&m_shared_ram[offset]);
1870   COMBINE_DATA(&m_shared_ram.target()[offset]);
18671871
18681872   // hack for final furlong
18691873   if ((offset == 0x6000/4) && (data == 0) && (mem_mask == 0xff000000))
r14896r14897
23932397static VIDEO_START( ss23 )
23942398{
23952399   namcos23_state *state = machine.driver_data<namcos23_state>();
2396   gfx_element_set_source(machine.gfx[0], (UINT8 *)state->m_charram);
2400   gfx_element_set_source(machine.gfx[0], (UINT8 *)state->m_charram.target());
23972401   state->m_bgtilemap = tilemap_create(machine, TextTilemapGetInfo, tilemap_scan_rows, 16, 16, 64, 64);
23982402   state->m_bgtilemap->set_transparent_pen(0xf);
23992403
r14896r14897
24522456   AM_RANGE(0x00000000, 0x003fffff) AM_RAM
24532457   AM_RANGE(0x01000000, 0x010000ff) AM_READWRITE(p3d_r, p3d_w )
24542458   AM_RANGE(0x02000000, 0x0200000f) AM_READWRITE16(s23_c417_r, s23_c417_w, 0xffffffff )
2455   AM_RANGE(0x04400000, 0x0440ffff) AM_READWRITE(gorgon_sharedram_r, gorgon_sharedram_w ) AM_BASE(m_shared_ram)
2459   AM_RANGE(0x04400000, 0x0440ffff) AM_READWRITE(gorgon_sharedram_r, gorgon_sharedram_w ) AM_SHARE("shared_ram")
24562460
24572461   AM_RANGE(0x04c3ff08, 0x04c3ff0b) AM_WRITE(s23_mcuen_w )
24582462   AM_RANGE(0x04c3ff0c, 0x04c3ff0f) AM_RAM
r14896r14897
24612465
24622466   AM_RANGE(0x06108000, 0x061087ff) AM_RAM      // GAMMA (C404-3S)
24632467   AM_RANGE(0x06110000, 0x0613ffff) AM_RAM_WRITE(namcos23_paletteram_w ) AM_SHARE("paletteram")
2464   AM_RANGE(0x06400000, 0x06403fff) AM_RAM_WRITE(s23_txtchar_w ) AM_BASE(m_charram)   // text layer characters
2468   AM_RANGE(0x06400000, 0x06403fff) AM_RAM_WRITE(s23_txtchar_w ) AM_SHARE("charram")   // text layer characters
24652469   AM_RANGE(0x06404000, 0x0641dfff) AM_RAM
2466   AM_RANGE(0x0641e000, 0x0641ffff) AM_RAM_WRITE(namcos23_textram_w ) AM_BASE(m_textram)
2470   AM_RANGE(0x0641e000, 0x0641ffff) AM_RAM_WRITE(namcos23_textram_w ) AM_SHARE("textram")
24672471
24682472   AM_RANGE(0x08000000, 0x087fffff) AM_ROM AM_REGION("data", 0)   // data ROMs
24692473
r14896r14897
24832487   AM_RANGE(0x00000000, 0x00ffffff) AM_RAM
24842488   AM_RANGE(0x01000000, 0x010000ff) AM_READWRITE(p3d_r, p3d_w )
24852489   AM_RANGE(0x02000000, 0x0200000f) AM_READWRITE16(s23_c417_r, s23_c417_w, 0xffffffff )
2486   AM_RANGE(0x04400000, 0x0440ffff) AM_RAM AM_BASE(m_shared_ram)
2490   AM_RANGE(0x04400000, 0x0440ffff) AM_RAM AM_SHARE("shared_ram")
24872491   AM_RANGE(0x04c3ff08, 0x04c3ff0b) AM_WRITE(s23_mcuen_w )
24882492   AM_RANGE(0x04c3ff0c, 0x04c3ff0f) AM_RAM
24892493   AM_RANGE(0x06000000, 0x0600ffff) AM_RAM AM_SHARE("nvram") // Backup
24902494   AM_RANGE(0x06200000, 0x06203fff) AM_RAM                             // C422
24912495   AM_RANGE(0x06400000, 0x0640000f) AM_READWRITE16(s23_c422_r, s23_c422_w, 0xffffffff ) // C422 registers
2492   AM_RANGE(0x06800000, 0x06807fff) AM_RAM_WRITE(s23_txtchar_w ) AM_BASE(m_charram) // text layer characters (shown as CGRAM in POST)
2496   AM_RANGE(0x06800000, 0x06807fff) AM_RAM_WRITE(s23_txtchar_w ) AM_SHARE("charram") // text layer characters (shown as CGRAM in POST)
24932497   AM_RANGE(0x06804000, 0x0681dfff) AM_RAM
2494   AM_RANGE(0x0681e000, 0x0681ffff) AM_RAM_WRITE(namcos23_textram_w ) AM_BASE(m_textram)
2498   AM_RANGE(0x0681e000, 0x0681ffff) AM_RAM_WRITE(namcos23_textram_w ) AM_SHARE("textram")
24952499   AM_RANGE(0x06820000, 0x0682000f) AM_READWRITE16(s23_c361_r, s23_c361_w, 0xffffffff ) // C361
24962500   AM_RANGE(0x06a08000, 0x06a087ff) AM_RAM // Blending control & GAMMA (C404)
24972501   AM_RANGE(0x06a10000, 0x06a3ffff) AM_RAM_WRITE(namcos23_paletteram_w ) AM_SHARE("paletteram")
r14896r14897
25142518
25152519READ32_MEMBER(namcos23_state::sh2_shared_r)
25162520{
2517   return m_gmen_sh2_shared[offset];
2521   return m_gmen_sh2_shared.target()[offset];
25182522}
25192523
25202524WRITE32_MEMBER(namcos23_state::sh2_shared_w)
25212525{
2522   COMBINE_DATA(&m_gmen_sh2_shared[offset]);
2526   COMBINE_DATA(&m_gmen_sh2_shared.target()[offset]);
25232527}
25242528
25252529static ADDRESS_MAP_START( gmen_mips_map, AS_PROGRAM, 32, namcos23_state )
r14896r14897
25302534
25312535
25322536static ADDRESS_MAP_START( gmen_sh2_map, AS_PROGRAM, 32, namcos23_state )
2533   AM_RANGE( 0x00000000, 0x00007fff ) AM_RAM AM_BASE(m_gmen_sh2_shared)
2537   AM_RANGE( 0x00000000, 0x00007fff ) AM_RAM AM_SHARE("gmen_sh2_shared")
25342538   AM_RANGE( 0x04000000, 0x043fffff ) AM_RAM   // SH-2 main work RAM
25352539ADDRESS_MAP_END
25362540
r14896r14897
25422546
25432547WRITE16_MEMBER(namcos23_state::sharedram_sub_w)
25442548{
2545   UINT16 *shared16 = (UINT16 *)m_shared_ram;
2549   UINT16 *shared16 = (UINT16 *)m_shared_ram.target();
25462550
25472551   // fake that an I/O board is connected for games w/o a dump or that aren't properly communicating with it yet
25482552   if (!m_has_jvsio)
r14896r14897
25582562
25592563READ16_MEMBER(namcos23_state::sharedram_sub_r)
25602564{
2561   UINT16 *shared16 = (UINT16 *)m_shared_ram;
2565   UINT16 *shared16 = (UINT16 *)m_shared_ram.target();
25622566
25632567   return shared16[BYTE_XOR_BE(offset)];
25642568}
src/mame/drivers/commando.c
r14896r14897
5757   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2")
5858   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1")
5959   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
60   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
60   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_byte_w)
6161   AM_RANGE(0xc804, 0xc804) AM_WRITE(commando_c804_w)
6262   AM_RANGE(0xc808, 0xc809) AM_WRITE(commando_scrollx_w)
6363   AM_RANGE(0xc80a, 0xc80b) AM_WRITE(commando_scrolly_w)
r14896r14897
7373static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, commando_state )
7474   AM_RANGE(0x0000, 0x3fff) AM_ROM
7575   AM_RANGE(0x4000, 0x47ff) AM_RAM
76   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
76   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
7777   AM_RANGE(0x8000, 0x8001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
7878   AM_RANGE(0x8002, 0x8003) AM_DEVWRITE_LEGACY("ym2", ym2203_w)
7979ADDRESS_MAP_END
src/mame/drivers/atarisy2.c
r14896r14897
272272}
273273
274274
275static WRITE16_HANDLER( int0_ack_w )
275WRITE16_MEMBER(atarisy2_state::int0_ack_w)
276276{
277277   /* reset sound IRQ */
278   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
279   state->m_p2portrd_state = 0;
280   atarigen_update_interrupts(space->machine());
278   m_p2portrd_state = 0;
279   atarigen_update_interrupts(machine());
281280}
282281
283282
284static WRITE16_HANDLER( int1_ack_w )
283WRITE16_MEMBER(atarisy2_state::int1_ack_w)
285284{
286285   /* reset sound CPU */
287286   if (ACCESSING_BITS_0_7)
288      cputag_set_input_line(space->machine(), "soundcpu", INPUT_LINE_RESET, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
287      cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_RESET, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
289288}
290289
291290
r14896r14897
296295}
297296
298297
299static WRITE16_HANDLER( int_enable_w )
298WRITE16_MEMBER(atarisy2_state::int_enable_w)
300299{
301300   if (offset == 0 && ACCESSING_BITS_0_7)
302      space->machine().scheduler().synchronize(FUNC(delayed_int_enable_w), data);
301      machine().scheduler().synchronize(FUNC(delayed_int_enable_w), data);
303302}
304303
305304
r14896r14897
310309 *
311310 *************************************/
312311
313static WRITE16_HANDLER( bankselect_w )
312WRITE16_MEMBER(atarisy2_state::bankselect_w)
314313{
315314   static const int bankoffset[64] =
316315   {
r14896r14897
332331      0x8e000, 0x86000, 0x7e000, 0x76000
333332   };
334333
335   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
336   int newword = state->m_bankselect[offset];
334   int newword = m_bankselect[offset];
337335   UINT8 *base;
338336
339337   COMBINE_DATA(&newword);
340   state->m_bankselect[offset] = newword;
338   m_bankselect[offset] = newword;
341339
342   base = &space->machine().region("maincpu")->base()[bankoffset[(newword >> 10) & 0x3f]];
343   memcpy(offset ? state->m_rombank2 : state->m_rombank1, base, 0x2000);
340   base = &machine().region("maincpu")->base()[bankoffset[(newword >> 10) & 0x3f]];
341   memcpy(offset ? m_rombank2 : m_rombank1, base, 0x2000);
344342}
345343
346344
r14896r14897
349347   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
350348   atarisy2_state *state = machine.driver_data<atarisy2_state>();
351349
352   bankselect_w(space, 0, state->m_bankselect[0], 0xffff);
353   bankselect_w(space, 1, state->m_bankselect[1], 0xffff);
350   state->bankselect_w(*space, 0, state->m_bankselect[0], 0xffff);
351   state->bankselect_w(*space, 1, state->m_bankselect[1], 0xffff);
354352}
355353
356354
r14896r14897
361359 *
362360 *************************************/
363361
364static READ16_HANDLER( switch_r )
362READ16_MEMBER(atarisy2_state::switch_r)
365363{
366   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
367   int result = input_port_read(space->machine(), "1800") | (input_port_read(space->machine(), "1801") << 8);
364   int result = input_port_read(machine(), "1800") | (input_port_read(machine(), "1801") << 8);
368365
369   if (state->m_cpu_to_sound_ready) result ^= 0x20;
370   if (state->m_sound_to_cpu_ready) result ^= 0x10;
366   if (m_cpu_to_sound_ready) result ^= 0x20;
367   if (m_sound_to_cpu_ready) result ^= 0x10;
371368
372369   return result;
373370}
374371
375372
376static READ8_HANDLER( switch_6502_r )
373READ8_MEMBER(atarisy2_state::switch_6502_r)
377374{
378   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
379   int result = input_port_read(space->machine(), "1840");
375   int result = input_port_read(machine(), "1840");
380376
381   if (state->m_cpu_to_sound_ready) result |= 0x01;
382   if (state->m_sound_to_cpu_ready) result |= 0x02;
383   if ((state->m_has_tms5220) && (tms5220_readyq_r(space->machine().device("tms")) == 0))
377   if (m_cpu_to_sound_ready) result |= 0x01;
378   if (m_sound_to_cpu_ready) result |= 0x02;
379   if ((m_has_tms5220) && (tms5220_readyq_r(machine().device("tms")) == 0))
384380      result &= ~0x04;
385   if (!(input_port_read(space->machine(), "1801") & 0x80)) result |= 0x10;
381   if (!(input_port_read(machine(), "1801") & 0x80)) result |= 0x10;
386382
387383   return result;
388384}
389385
390386
391static WRITE8_HANDLER( switch_6502_w )
387WRITE8_MEMBER(atarisy2_state::switch_6502_w)
392388{
393   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
394389
395   if (state->m_has_tms5220)
390   if (m_has_tms5220)
396391   {
397392      data = 12 | ((data >> 5) & 1);
398      tms5220_set_frequency(space->machine().device("tms"), MASTER_CLOCK/4 / (16 - data) / 2);
393      tms5220_set_frequency(machine().device("tms"), MASTER_CLOCK/4 / (16 - data) / 2);
399394   }
400395}
401396
r14896r14897
407402 *
408403 *************************************/
409404
410static WRITE16_HANDLER( adc_strobe_w )
405WRITE16_MEMBER(atarisy2_state::adc_strobe_w)
411406{
412   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
413   state->m_which_adc = offset & 3;
407   m_which_adc = offset & 3;
414408}
415409
416410
417static READ16_HANDLER( adc_r )
411READ16_MEMBER(atarisy2_state::adc_r)
418412{
419413   static const char *const adcnames[] = { "ADC0", "ADC1", "ADC2", "ADC3" };
420   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
421414
422   if (state->m_which_adc < state->m_pedal_count)
423      return ~input_port_read(space->machine(), adcnames[state->m_which_adc]);
415   if (m_which_adc < m_pedal_count)
416      return ~input_port_read(machine(), adcnames[m_which_adc]);
424417
425   return input_port_read(space->machine(), adcnames[state->m_which_adc]) | 0xff00;
418   return input_port_read(machine(), adcnames[m_which_adc]) | 0xff00;
426419}
427420
428421
429static READ8_HANDLER( leta_r )
422READ8_MEMBER(atarisy2_state::leta_r)
430423{
431424   static const char *const letanames[] = { "LETA0", "LETA1", "LETA2", "LETA3" };
432   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
433425
434    if (offset <= 1 && state->m_pedal_count == -1)   /* 720 */
426    if (offset <= 1 && m_pedal_count == -1)   /* 720 */
435427   {
436      switch (input_port_read(space->machine(), "SELECT"))
428      switch (input_port_read(machine(), "SELECT"))
437429      {
438430         case 0:   /* Real */
439431            break;
r14896r14897
441433         case 1:   /* Fake Joystick */
442434         /* special thanks to MAME Analog+ for the mapping code */
443435         {
444            int analogx = input_port_read(space->machine(), "FAKE_JOY_X") - 128;
445            int analogy = input_port_read(space->machine(), "FAKE_JOY_Y") - 128;
436            int analogx = input_port_read(machine(), "FAKE_JOY_X") - 128;
437            int analogy = input_port_read(machine(), "FAKE_JOY_Y") - 128;
446438            double angle;
447439
448440            /* if the joystick is centered, leave the rest of this alone */
449            angle = state->m_joy_last_angle;
441            angle = m_joy_last_angle;
450442            if (analogx < -32 || analogx > 32 || analogy < -32 || analogy > 32)
451443               angle = atan2((double)analogx, (double)analogy) * 360 / (2 * M_PI);
452444
453445            /* detect when we pass the 0 point in either direction */
454            if (state->m_joy_last_angle < -90 && angle > 90)
455               state->m_joy_rotations--;
456            else if (state->m_joy_last_angle > 90 && angle < -90)
457               state->m_joy_rotations++;
458            state->m_joy_last_angle = angle;
446            if (m_joy_last_angle < -90 && angle > 90)
447               m_joy_rotations--;
448            else if (m_joy_last_angle > 90 && angle < -90)
449               m_joy_rotations++;
450            m_joy_last_angle = angle;
459451
460452            /* make offset 0 return 0xff when the controller blocks one of two gaps */
461453            /* this is not accurate, as a counter should count up/down 2 counts as it passes through each gap */
r14896r14897
473465            else
474466            {
475467               /* take the rotations * 144 plus the current angle */
476               return (state->m_joy_rotations * 144 + (int)(angle * 144.0 / 360.0)) & 0xff;
468               return (m_joy_rotations * 144 + (int)(angle * 144.0 / 360.0)) & 0xff;
477469            }
478470         }
479471
r14896r14897
481473         {
482474            INT32  diff;
483475            UINT32 temp;
484            UINT32 rotate_count = input_port_read(space->machine(), "FAKE_SPINNER") & 0xffff;
476            UINT32 rotate_count = input_port_read(machine(), "FAKE_SPINNER") & 0xffff;
485477            /* rotate_count behaves the same as the real LEAT1 Rotate encoder
486478                 * we use it to generate the LETA0 Center encoder count
487479                 */
488480
489            if (rotate_count != state->m_spin_last_rotate_count)
481            if (rotate_count != m_spin_last_rotate_count)
490482            {
491483               /* see if count rolled between 0xffff and 0x0000 */
492               if ((state->m_spin_last_rotate_count > 0xc000) && (rotate_count < 0x03ff))
484               if ((m_spin_last_rotate_count > 0xc000) && (rotate_count < 0x03ff))
493485               {
494                  temp = 0xffff - state->m_spin_last_rotate_count;
486                  temp = 0xffff - m_spin_last_rotate_count;
495487                  diff = rotate_count + temp + 1;
496488               }
497               else if ((rotate_count > 0xc000) && (state->m_spin_last_rotate_count < 0x03ff))
489               else if ((rotate_count > 0xc000) && (m_spin_last_rotate_count < 0x03ff))
498490               {
499491                  temp = 0xffff - rotate_count;
500                  diff = state->m_spin_last_rotate_count - temp - 1;
492                  diff = m_spin_last_rotate_count - temp - 1;
501493               }
502494               else
503495               {
504                  temp = rotate_count - state->m_spin_last_rotate_count;
496                  temp = rotate_count - m_spin_last_rotate_count;
505497                  diff = temp;
506498               }
507499
508               state->m_spin_last_rotate_count = rotate_count;
500               m_spin_last_rotate_count = rotate_count;
509501
510502               /* you may not like this, but it is the easiest way to accurately fake the center count */
511503               /* diff is never a big number anyways */
r14896r14897
513505               {
514506                  for (int i = 0; i > diff; i--)
515507                  {
516                     state->m_spin_pos--;
517                     if (state->m_spin_pos < 0)
518                        state->m_spin_pos = 143;
508                     m_spin_pos--;
509                     if (m_spin_pos < 0)
510                        m_spin_pos = 143;
519511                     else
520                        switch (state->m_spin_pos)
512                        switch (m_spin_pos)
521513                        {
522514                           case 2:
523515                           case 3:
524516                           case 141:
525517                           case 142:
526                              state->m_spin_center_count--;
518                              m_spin_center_count--;
527519                        }
528520                  }
529521               }
r14896r14897
531523               {
532524                  for (int i = 0; i < diff; i++)
533525                  {
534                     state->m_spin_pos++;
535                     if (state->m_spin_pos > 143)
536                        state->m_spin_pos = 0;
526                     m_spin_pos++;
527                     if (m_spin_pos > 143)
528                        m_spin_pos = 0;
537529                     else
538                        switch (state->m_spin_pos)
530                        switch (m_spin_pos)
539531                        {
540532                           case 2:
541533                           case 3:
542534                           case 141:
543535                           case 142:
544                              state->m_spin_center_count++;
536                              m_spin_center_count++;
545537                        }
546538                  }
547539               }
548540            }
549541
550542            if (offset == 0)
551               return state->m_spin_center_count & 0xff;
543               return m_spin_center_count & 0xff;
552544            else
553545               /* offset == 1 */
554546               return rotate_count & 0xff;
r14896r14897
559551            return 0xff;
560552      }
561553   }
562   return input_port_read(space->machine(), letanames[offset]);
554   return input_port_read(machine(), letanames[offset]);
563555}
564556
565557
r14896r14897
656648    important.  So it would be nice to add it in properly.
657649*/
658650
659static WRITE8_HANDLER( mixer_w )
651WRITE8_MEMBER(atarisy2_state::mixer_w)
660652{
661653   double rbott, rtop, gain;
662654
r14896r14897
669661   if (!(data & 0x02)) rbott += 1.0/47;
670662   if (!(data & 0x04)) rbott += 1.0/22;
671663   gain = (rbott == 0) ? 1.0 : ((1.0/rbott) / (rtop + (1.0/rbott)));
672   atarigen_set_ym2151_vol(space->machine(), gain * 100);
664   atarigen_set_ym2151_vol(machine(), gain * 100);
673665
674666   /* bits 3-4 control the volume of the POKEYs, using 47k and 100k resistors */
675667   rtop = 1.0/(1.0/100 + 1.0/100);
r14896r14897
677669   if (!(data & 0x08)) rbott += 1.0/47;
678670   if (!(data & 0x10)) rbott += 1.0/22;
679671   gain = (rbott == 0) ? 1.0 : ((1.0/rbott) / (rtop + (1.0/rbott)));
680   atarigen_set_pokey_vol(space->machine(), gain * 100);
672   atarigen_set_pokey_vol(machine(), gain * 100);
681673
682674   /* bits 5-7 control the volume of the TMS5220, using 22k, 47k, and 100k resistors */
683675   rtop = 1.0/(1.0/100 + 1.0/100);
r14896r14897
686678   if (!(data & 0x40)) rbott += 1.0/47;
687679   if (!(data & 0x80)) rbott += 1.0/22;
688680   gain = (rbott == 0) ? 1.0 : ((1.0/rbott) / (rtop + (1.0/rbott)));
689   atarigen_set_tms5220_vol(space->machine(), gain * 100);
681   atarigen_set_tms5220_vol(machine(), gain * 100);
690682}
691683
692684
693static WRITE8_HANDLER( sound_reset_w )
685WRITE8_MEMBER(atarisy2_state::sound_reset_w)
694686{
695   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
696687
697688   /* if no change, do nothing */
698   if ((data & 1) == state->m_sound_reset_state)
689   if ((data & 1) == m_sound_reset_state)
699690      return;
700   state->m_sound_reset_state = data & 1;
691   m_sound_reset_state = data & 1;
701692
702693   /* only track the 0 -> 1 transition */
703   if (state->m_sound_reset_state == 0)
694   if (m_sound_reset_state == 0)
704695      return;
705696
706697   /* a large number of signals are reset when this happens */
707   atarigen_sound_io_reset(space->machine().device("soundcpu"));
708   devtag_reset(space->machine(), "ymsnd");
709   if (state->m_has_tms5220)
698   atarigen_sound_io_reset(machine().device("soundcpu"));
699   devtag_reset(machine(), "ymsnd");
700   if (m_has_tms5220)
710701   {
711      devtag_reset(space->machine(), "tms"); // technically what happens is the tms5220 gets a long stream of 0xFF written to it when sound_reset_state is 0 which halts the chip after a few frames, but this works just as well, even if it isn't exactly true to hardware... The hardware may not have worked either, the resistors to pull input to 0xFF are fighting against the ls263 gate holding the latched value to be sent to the chip.
702      devtag_reset(machine(), "tms"); // technically what happens is the tms5220 gets a long stream of 0xFF written to it when sound_reset_state is 0 which halts the chip after a few frames, but this works just as well, even if it isn't exactly true to hardware... The hardware may not have worked either, the resistors to pull input to 0xFF are fighting against the ls263 gate holding the latched value to be sent to the chip.
712703   }
713704   mixer_w(space, 0, 0);
714705}
715706
716707
717static READ16_HANDLER( sound_r )
708READ16_MEMBER(atarisy2_state::sound_r)
718709{
719   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
720710
721711   /* clear the p2portwr state on a p1portrd */
722   state->m_p2portwr_state = 0;
723   atarigen_update_interrupts(space->machine());
712   m_p2portwr_state = 0;
713   atarigen_update_interrupts(machine());
724714
725715   /* handle it normally otherwise */
726   return atarigen_sound_r(space,offset,0xffff);
716   return atarigen_sound_r(&space,offset,0xffff);
727717}
728718
729719
730static WRITE8_HANDLER( sound_6502_w )
720WRITE8_MEMBER(atarisy2_state::sound_6502_w)
731721{
732   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
733722
734723   /* clock the state through */
735   state->m_p2portwr_state = (state->m_interrupt_enable & 2) != 0;
736   atarigen_update_interrupts(space->machine());
724   m_p2portwr_state = (m_interrupt_enable & 2) != 0;
725   atarigen_update_interrupts(machine());
737726
738727   /* handle it normally otherwise */
739   atarigen_6502_sound_w(space, offset, data);
728   atarigen_6502_sound_w(&space, offset, data);
740729}
741730
742731
743static READ8_HANDLER( sound_6502_r )
732READ8_MEMBER(atarisy2_state::sound_6502_r)
744733{
745   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
746734
747735   /* clock the state through */
748   state->m_p2portrd_state = (state->m_interrupt_enable & 1) != 0;
749   atarigen_update_interrupts(space->machine());
736   m_p2portrd_state = (m_interrupt_enable & 1) != 0;
737   atarigen_update_interrupts(machine());
750738
751739   /* handle it normally otherwise */
752   return atarigen_6502_sound_r(space, offset);
740   return atarigen_6502_sound_r(&space, offset);
753741}
754742
755743
r14896r14897
760748 *
761749 *************************************/
762750
763static WRITE8_HANDLER( tms5220_w )
751WRITE8_MEMBER(atarisy2_state::tms5220_w)
764752{
765   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
766   if (state->m_has_tms5220)
753   if (m_has_tms5220)
767754   {
768      tms5220_data_w(space->machine().device("tms"), 0, data);
755      tms5220_data_w(machine().device("tms"), 0, data);
769756   }
770757}
771758
772static WRITE8_HANDLER( tms5220_strobe_w )
759WRITE8_MEMBER(atarisy2_state::tms5220_strobe_w)
773760{
774   atarisy2_state *state = space->machine().driver_data<atarisy2_state>();
775   if (state->m_has_tms5220)
761   if (m_has_tms5220)
776762   {
777      tms5220_wsq_w(space->machine().device("tms"), 1-(offset & 1));
763      tms5220_wsq_w(machine().device("tms"), 1-(offset & 1));
778764   }
779765}
780766
r14896r14897
784770 *
785771 *************************************/
786772
787static WRITE8_HANDLER( coincount_w )
773WRITE8_MEMBER(atarisy2_state::coincount_w)
788774{
789   coin_counter_w(space->machine(), 0, (data >> 0) & 1);
790   coin_counter_w(space->machine(), 1, (data >> 1) & 1);
775   coin_counter_w(machine(), 0, (data >> 0) & 1);
776   coin_counter_w(machine(), 1, (data >> 1) & 1);
791777}
792778
793779
r14896r14897
802788static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarisy2_state )
803789   AM_RANGE(0x0000, 0x0fff) AM_RAM
804790   AM_RANGE(0x1000, 0x11ff) AM_MIRROR(0x0200) AM_RAM_WRITE_LEGACY(atarisy2_paletteram_w) AM_SHARE("paletteram")
805   AM_RANGE(0x1400, 0x1403) AM_MIRROR(0x007c) AM_READWRITE_LEGACY(adc_r, bankselect_w) AM_BASE(m_bankselect)
806   AM_RANGE(0x1480, 0x1487) AM_MIRROR(0x0078) AM_WRITE_LEGACY(adc_strobe_w)
807   AM_RANGE(0x1580, 0x1581) AM_MIRROR(0x001e) AM_WRITE_LEGACY(int0_ack_w)
808   AM_RANGE(0x15a0, 0x15a1) AM_MIRROR(0x001e) AM_WRITE_LEGACY(int1_ack_w)
791   AM_RANGE(0x1400, 0x1403) AM_MIRROR(0x007c) AM_READWRITE(adc_r, bankselect_w) AM_BASE(m_bankselect)
792   AM_RANGE(0x1480, 0x1487) AM_MIRROR(0x0078) AM_WRITE(adc_strobe_w)
793   AM_RANGE(0x1580, 0x1581) AM_MIRROR(0x001e) AM_WRITE(int0_ack_w)
794   AM_RANGE(0x15a0, 0x15a1) AM_MIRROR(0x001e) AM_WRITE(int1_ack_w)
809795   AM_RANGE(0x15c0, 0x15c1) AM_MIRROR(0x001e) AM_WRITE_LEGACY(atarigen_scanline_int_ack_w)
810796   AM_RANGE(0x15e0, 0x15e1) AM_MIRROR(0x001e) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
811   AM_RANGE(0x1600, 0x1601) AM_MIRROR(0x007e) AM_WRITE_LEGACY(int_enable_w)
797   AM_RANGE(0x1600, 0x1601) AM_MIRROR(0x007e) AM_WRITE(int_enable_w)
812798   AM_RANGE(0x1680, 0x1681) AM_MIRROR(0x007e) AM_WRITE_LEGACY(atarigen_sound_w)
813799   AM_RANGE(0x1700, 0x1701) AM_MIRROR(0x007e) AM_WRITE_LEGACY(atarisy2_xscroll_w) AM_BASE(m_xscroll)
814800   AM_RANGE(0x1780, 0x1781) AM_MIRROR(0x007e) AM_WRITE_LEGACY(atarisy2_yscroll_w) AM_BASE(m_yscroll)
815   AM_RANGE(0x1800, 0x1801) AM_MIRROR(0x03fe) AM_READ_LEGACY(switch_r) AM_WRITE(watchdog_reset16_w)
816   AM_RANGE(0x1c00, 0x1c01) AM_MIRROR(0x03fe) AM_READ_LEGACY(sound_r)
801   AM_RANGE(0x1800, 0x1801) AM_MIRROR(0x03fe) AM_READ(switch_r) AM_WRITE(watchdog_reset16_w)
802   AM_RANGE(0x1c00, 0x1c01) AM_MIRROR(0x03fe) AM_READ(sound_r)
817803   AM_RANGE(0x2000, 0x3fff) AM_READWRITE_LEGACY(atarisy2_videoram_r, atarisy2_videoram_w)
818804   AM_RANGE(0x4000, 0x5fff) AM_ROM AM_BASE(m_rombank1)
819805   AM_RANGE(0x6000, 0x7fff) AM_ROM AM_BASE(m_rombank2)
r14896r14897
834820   AM_RANGE(0x0000, 0x0fff) AM_MIRROR(0x2000) AM_RAM
835821   AM_RANGE(0x1000, 0x17ff) AM_MIRROR(0x2000) AM_RAM AM_SHARE("eeprom")
836822   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x2780) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
837   AM_RANGE(0x1810, 0x1813) AM_MIRROR(0x278c) AM_READ_LEGACY(leta_r)
823   AM_RANGE(0x1810, 0x1813) AM_MIRROR(0x278c) AM_READ(leta_r)
838824   AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x2780) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
839   AM_RANGE(0x1840, 0x1840) AM_MIRROR(0x278f) AM_READ_LEGACY(switch_6502_r)
825   AM_RANGE(0x1840, 0x1840) AM_MIRROR(0x278f) AM_READ(switch_6502_r)
840826   AM_RANGE(0x1850, 0x1851) AM_MIRROR(0x278e) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
841   AM_RANGE(0x1860, 0x1860) AM_MIRROR(0x278f) AM_READ_LEGACY(sound_6502_r)
842   AM_RANGE(0x1870, 0x1870) AM_MIRROR(0x2781) AM_WRITE_LEGACY(tms5220_w)
843   AM_RANGE(0x1872, 0x1873) AM_MIRROR(0x2780) AM_WRITE_LEGACY(tms5220_strobe_w)
844   AM_RANGE(0x1874, 0x1874) AM_MIRROR(0x2781) AM_WRITE_LEGACY(sound_6502_w)
845   AM_RANGE(0x1876, 0x1876) AM_MIRROR(0x2781) AM_WRITE_LEGACY(coincount_w)
827   AM_RANGE(0x1860, 0x1860) AM_MIRROR(0x278f) AM_READ(sound_6502_r)
828   AM_RANGE(0x1870, 0x1870) AM_MIRROR(0x2781) AM_WRITE(tms5220_w)
829   AM_RANGE(0x1872, 0x1873) AM_MIRROR(0x2780) AM_WRITE(tms5220_strobe_w)
830   AM_RANGE(0x1874, 0x1874) AM_MIRROR(0x2781) AM_WRITE(sound_6502_w)
831   AM_RANGE(0x1876, 0x1876) AM_MIRROR(0x2781) AM_WRITE(coincount_w)
846832   AM_RANGE(0x1878, 0x1878) AM_MIRROR(0x2781) AM_WRITE_LEGACY(atarigen_6502_irq_ack_w)
847   AM_RANGE(0x187a, 0x187a) AM_MIRROR(0x2781) AM_WRITE_LEGACY(mixer_w)
848   AM_RANGE(0x187c, 0x187c) AM_MIRROR(0x2781) AM_WRITE_LEGACY(switch_6502_w)
849   AM_RANGE(0x187e, 0x187e) AM_MIRROR(0x2781) AM_WRITE_LEGACY(sound_reset_w)
833   AM_RANGE(0x187a, 0x187a) AM_MIRROR(0x2781) AM_WRITE(mixer_w)
834   AM_RANGE(0x187c, 0x187c) AM_MIRROR(0x2781) AM_WRITE(switch_6502_w)
835   AM_RANGE(0x187e, 0x187e) AM_MIRROR(0x2781) AM_WRITE(sound_reset_w)
850836   AM_RANGE(0x4000, 0xffff) AM_ROM
851837ADDRESS_MAP_END
852838
src/mame/drivers/ninjakd2.c
r14896r14897
217217   cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_RESET, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
218218
219219   // bit 7 flips screen
220   flip_screen_set(machine(), data & 0x80);
220   flip_screen_set(data & 0x80);
221221
222222   // other bits unused
223223}
r14896r14897
397397   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("PAD2")
398398   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DIPSW1")
399399   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DIPSW2")
400   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_w)
400   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w)
401401   AM_RANGE(0xc201, 0xc201) AM_WRITE(ninjakd2_soundreset_w)   // sound reset + flip screen
402402   AM_RANGE(0xc202, 0xc202) AM_WRITE(ninjakd2_bankselect_w)
403403   AM_RANGE(0xc203, 0xc203) AM_WRITE(ninjakd2_sprite_overdraw_w)
404404   AM_RANGE(0xc208, 0xc20c) AM_WRITE(ninjakd2_bg_ctrl_w)   // scroll + enable
405   AM_RANGE(0xc800, 0xcdff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
405   AM_RANGE(0xc800, 0xcdff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
406406   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(ninjakd2_fgvideoram_w) AM_BASE(m_fg_videoram)
407407   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(ninjakd2_bgvideoram_w) AM_BASE(m_bg_videoram)
408408   AM_RANGE(0xe000, 0xf9ff) AM_RAM
r14896r14897
417417   AM_RANGE(0xda00, 0xdfff) AM_RAM AM_BASE(m_spriteram)
418418   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(ninjakd2_bgvideoram_w) AM_BASE(m_bg_videoram)
419419   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(ninjakd2_fgvideoram_w) AM_BASE(m_fg_videoram)
420   AM_RANGE(0xf000, 0xf5ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
420   AM_RANGE(0xf000, 0xf5ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
421421   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("KEYCOIN")
422422   AM_RANGE(0xf801, 0xf801) AM_READ_PORT("PAD1")
423423   AM_RANGE(0xf802, 0xf802) AM_READ_PORT("PAD2")
424424   AM_RANGE(0xf803, 0xf803) AM_READ_PORT("DIPSW1")
425425   AM_RANGE(0xf804, 0xf804) AM_READ_PORT("DIPSW2")
426   AM_RANGE(0xfa00, 0xfa00) AM_WRITE(soundlatch_w)
426   AM_RANGE(0xfa00, 0xfa00) AM_WRITE(soundlatch_byte_w)
427427   AM_RANGE(0xfa01, 0xfa01) AM_WRITE(ninjakd2_soundreset_w)
428428   AM_RANGE(0xfa02, 0xfa02) AM_WRITE(ninjakd2_bankselect_w)
429429   AM_RANGE(0xfa03, 0xfa03) AM_WRITE(ninjakd2_sprite_overdraw_w)
r14896r14897
434434static ADDRESS_MAP_START( robokid_main_cpu, AS_PROGRAM, 8, ninjakd2_state )
435435   AM_RANGE(0x0000, 0x7fff) AM_ROM
436436   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
437   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
437   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
438438   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(ninjakd2_fgvideoram_w) AM_BASE(m_fg_videoram)
439439   AM_RANGE(0xd000, 0xd3ff) AM_READWRITE(robokid_bg2_videoram_r, robokid_bg2_videoram_w)   // banked
440440   AM_RANGE(0xd400, 0xd7ff) AM_READWRITE(robokid_bg1_videoram_r, robokid_bg1_videoram_w)   // banked
r14896r14897
444444   AM_RANGE(0xdc02, 0xdc02) AM_READ_PORT("PAD2")
445445   AM_RANGE(0xdc03, 0xdc03) AM_READ_PORT("DIPSW1")
446446   AM_RANGE(0xdc04, 0xdc04) AM_READ_PORT("DIPSW2")
447   AM_RANGE(0xdc00, 0xdc00) AM_WRITE(soundlatch_w)
447   AM_RANGE(0xdc00, 0xdc00) AM_WRITE(soundlatch_byte_w)
448448   AM_RANGE(0xdc01, 0xdc01) AM_WRITE(ninjakd2_soundreset_w)   // sound reset + flip screen
449449   AM_RANGE(0xdc02, 0xdc02) AM_WRITE(robokid_bankselect_w)
450450   AM_RANGE(0xdc03, 0xdc03) AM_WRITE(ninjakd2_sprite_overdraw_w)
r14896r14897
464464   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
465465   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("KEYCOIN")
466466   AM_RANGE(0xc001, 0xc003) AM_READ(omegaf_io_protection_r)
467   AM_RANGE(0xc000, 0xc000) AM_WRITE(soundlatch_w)
467   AM_RANGE(0xc000, 0xc000) AM_WRITE(soundlatch_byte_w)
468468   AM_RANGE(0xc001, 0xc001) AM_WRITE(ninjakd2_soundreset_w)   // sound reset + flip screen
469469   AM_RANGE(0xc002, 0xc002) AM_WRITE(robokid_bankselect_w)
470470   AM_RANGE(0xc003, 0xc003) AM_WRITE(ninjakd2_sprite_overdraw_w)
r14896r14897
480480   AM_RANGE(0xc800, 0xcbff) AM_READWRITE(robokid_bg1_videoram_r, robokid_bg1_videoram_w)   // banked
481481   AM_RANGE(0xcc00, 0xcfff) AM_READWRITE(robokid_bg2_videoram_r, robokid_bg2_videoram_w)   // banked
482482   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(ninjakd2_fgvideoram_w) AM_BASE(m_fg_videoram)
483   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
483   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
484484   AM_RANGE(0xe000, 0xf9ff) AM_RAM
485485   AM_RANGE(0xfa00, 0xffff) AM_RAM AM_BASE(m_spriteram)
486486ADDRESS_MAP_END
r14896r14897
490490   AM_RANGE(0x0000, 0x7fff) AM_ROM
491491   AM_RANGE(0x8000, 0xbfff) AM_ROM
492492   AM_RANGE(0xc000, 0xc7ff) AM_RAM
493   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
493   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
494494   AM_RANGE(0xf000, 0xf000) AM_WRITE(ninjakd2_pcm_play_w)
495495ADDRESS_MAP_END
496496
src/mame/drivers/yunsung8.c
r14896r14897
7777   ADDRESS_MAP_GLOBAL_MASK(0xff)
7878   AM_RANGE(0x00, 0x00) AM_READ_PORT("SYSTEM") AM_WRITE(yunsung8_videobank_w)   // video RAM bank
7979   AM_RANGE(0x01, 0x01) AM_READ_PORT("P1") AM_WRITE(yunsung8_bankswitch_w)   // ROM Bank + Layers Enable
80   AM_RANGE(0x02, 0x02) AM_READ_PORT("P2") AM_WRITE(soundlatch_w)   // To Sound CPU
80   AM_RANGE(0x02, 0x02) AM_READ_PORT("P2") AM_WRITE(soundlatch_byte_w)   // To Sound CPU
8181   AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1")
8282   AM_RANGE(0x04, 0x04) AM_READ_PORT("DSW2")
8383   AM_RANGE(0x06, 0x06) AM_WRITE(yunsung8_flipscreen_w)   // Flip Screen
r14896r14897
120120   AM_RANGE(0xe400, 0xe400) AM_WRITE(yunsung8_adpcm_w)
121121   AM_RANGE(0xec00, 0xec01) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w)
122122   AM_RANGE(0xf000, 0xf7ff) AM_RAM
123   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)   // From Main CPU
123   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)   // From Main CPU
124124ADDRESS_MAP_END
125125
126126
src/mame/drivers/spacefb.c
r14896r14897
184184   spacefb_state *state = machine.driver_data<spacefb_state>();
185185   /* the 3 output ports are cleared on reset */
186186   state->spacefb_port_0_w(*space, 0, 0);
187   spacefb_port_1_w(space, 0, 0);
187   state->spacefb_port_1_w(*space, 0, 0);
188188   state->spacefb_port_2_w(*space, 0, 0);
189189
190190   start_interrupt_timer(machine);
r14896r14897
201201static ADDRESS_MAP_START( spacefb_main_map, AS_PROGRAM, 8, spacefb_state )
202202   AM_RANGE(0x0000, 0x3fff) AM_ROM
203203   AM_RANGE(0x4000, 0x7fff) AM_NOP
204   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x3c00) AM_RAM AM_BASE(m_videoram) AM_SIZE(m_videoram_size)
204   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x3c00) AM_RAM AM_BASE_SIZE(m_videoram,m_videoram_size)
205205   AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3000) AM_RAM
206206   AM_RANGE(0xc800, 0xcfff) AM_MIRROR(0x3000) AM_NOP
207207ADDRESS_MAP_END
r14896r14897
229229   AM_RANGE(0x04, 0x07) AM_READNOP  /* yes, this is correct (1-of-8 decoder) */
230230
231231   AM_RANGE(0x00, 0x00) AM_MIRROR(0x04) AM_WRITE(spacefb_port_0_w)
232   AM_RANGE(0x01, 0x01) AM_MIRROR(0x04) AM_WRITE_LEGACY(spacefb_port_1_w)
232   AM_RANGE(0x01, 0x01) AM_MIRROR(0x04) AM_WRITE(spacefb_port_1_w)
233233   AM_RANGE(0x02, 0x02) AM_MIRROR(0x04) AM_WRITE(spacefb_port_2_w)
234234   AM_RANGE(0x03, 0x03) AM_MIRROR(0x04) AM_WRITENOP
235235ADDRESS_MAP_END
r14896r14897
237237
238238static ADDRESS_MAP_START( spacefb_audio_io_map, AS_IO, 8, spacefb_state )
239239   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE_LEGACY("dac", dac_w)
240   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ_LEGACY(spacefb_audio_p2_r)
241   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ_LEGACY(spacefb_audio_t0_r)
242   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ_LEGACY(spacefb_audio_t1_r)
240   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(spacefb_audio_p2_r)
241   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(spacefb_audio_t0_r)
242   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(spacefb_audio_t1_r)
243243ADDRESS_MAP_END
244244
245245
src/mame/drivers/warpwarp.c
r14896r14897
158158   res = input_port_read_safe(machine(), portnames[offset], 0);
159159   if (offset == 3)
160160   {
161      res = input_port_read(machine(), (flip_screen_get(machine()) & 1) ? "IN2" : "IN1");   // read player 2 input in cocktail mode
161      res = input_port_read(machine(), (flip_screen() & 1) ? "IN2" : "IN1");   // read player 2 input in cocktail mode
162162      if (m_handle_joystick)
163163      {
164164         /* map digital two-way joystick to two fixed VOLIN values */
r14896r14897
220220            cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
221221         break;
222222      case 7:
223         flip_screen_set(machine(), data & 1);
223         flip_screen_set(data & 1);
224224         break;
225225   }
226226}
r14896r14897
246246   warpwarp_state *state = device->machine().driver_data<warpwarp_state>();
247247   int res;
248248
249   res = input_port_read(device->machine(), (flip_screen_get(device->machine()) & 1) ? "VOLIN2" : "VOLIN1");
249   res = input_port_read(device->machine(), (state->flip_screen() & 1) ? "VOLIN2" : "VOLIN1");
250250   if (state->m_handle_joystick)
251251   {
252252      if (res & 1) return 0x0f;
r14896r14897
305305            cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
306306         break;
307307      case 7:
308         flip_screen_set(machine(), data & 1);
308         flip_screen_set(data & 1);
309309         break;
310310   }
311311}
src/mame/drivers/jaguar.c
r14896r14897
358358public:
359359   cojag_state(const machine_config &mconfig, device_type type, const char *tag)
360360      : driver_device(mconfig, type, tag),
361        m_nvram(*this, "nvram") { }
361        m_nvram(*this, "nvram") ,
362      m_rom_base(*this, "robase"){ }
362363
363364   required_shared_ptr<UINT32>   m_nvram;
364365   cpu_device *m_main_cpu;
365366   UINT32 m_misc_control_data;
366367   UINT8 m_eeprom_enable;
367   UINT32 *m_rom_base;
368   required_shared_ptr<UINT32> m_rom_base;
368369   UINT32 *m_gpu_jump_address;
369370   UINT8 m_gpu_command_pending;
370371   UINT32 m_gpu_spin_pc;
r14896r14897
373374   UINT64 m_main_speedup_last_cycles;
374375   UINT64 m_main_speedup_max_cycles;
375376   UINT32 *m_main_gpu_wait;
377   DECLARE_WRITE32_MEMBER(jaguar_eeprom_w);
378   DECLARE_READ32_MEMBER(jaguar_eeprom_clk);
379   DECLARE_READ32_MEMBER(jaguar_eeprom_cs);
380   DECLARE_READ32_MEMBER(misc_control_r);
381   DECLARE_WRITE32_MEMBER(misc_control_w);
382   DECLARE_READ32_MEMBER(gpuctrl_r);
383   DECLARE_WRITE32_MEMBER(gpuctrl_w);
384   DECLARE_READ32_MEMBER(dspctrl_r);
385   DECLARE_WRITE32_MEMBER(dspctrl_w);
386   DECLARE_READ32_MEMBER(jaguar_wave_rom_r);
387   DECLARE_READ32_MEMBER(joystick_r);
388   DECLARE_WRITE32_MEMBER(joystick_w);
389   DECLARE_WRITE32_MEMBER(latch_w);
390   DECLARE_READ32_MEMBER(eeprom_data_r);
391   DECLARE_WRITE32_MEMBER(eeprom_enable_w);
392   DECLARE_WRITE32_MEMBER(eeprom_data_w);
393   DECLARE_WRITE32_MEMBER(gpu_jump_w);
394   DECLARE_READ32_MEMBER(gpu_jump_r);
395   DECLARE_READ32_MEMBER(cojagr3k_main_speedup_r);
396   DECLARE_READ32_MEMBER(main_gpu_wait_r);
397   DECLARE_WRITE32_MEMBER(area51_main_speedup_w);
398   DECLARE_WRITE32_MEMBER(area51mx_main_speedup_w);
399   DECLARE_READ16_MEMBER(gpuctrl_r16);
400   DECLARE_WRITE16_MEMBER(gpuctrl_w16);
401   DECLARE_READ16_MEMBER(jaguar_blitter_r16);
402   DECLARE_WRITE16_MEMBER(jaguar_blitter_w16);
403   DECLARE_READ16_MEMBER(jaguar_serial_r16);
404   DECLARE_WRITE16_MEMBER(jaguar_serial_w16);
405   DECLARE_READ16_MEMBER(dspctrl_r16);
406   DECLARE_WRITE16_MEMBER(dspctrl_w16);
407   DECLARE_READ16_MEMBER(jaguar_eeprom_cs16);
408   DECLARE_READ16_MEMBER(jaguar_eeprom_clk16);
409   DECLARE_WRITE16_MEMBER(jaguar_eeprom_w16);
410   DECLARE_READ16_MEMBER(joystick_r16);
411   DECLARE_WRITE16_MEMBER(joystick_w16);
412   DECLARE_READ32_MEMBER(jaguar_shared_ram_r);
413   DECLARE_WRITE32_MEMBER(jaguar_shared_ram_w);
414   DECLARE_READ32_MEMBER(jaguar_rom_base_r);
415   DECLARE_WRITE32_MEMBER(jaguar_rom_base_w);
416   DECLARE_READ32_MEMBER(jaguar_cart_base_r);
417   DECLARE_WRITE32_MEMBER(jaguar_cart_base_w);
418   DECLARE_READ32_MEMBER(high_rom_base_r);
419   DECLARE_WRITE32_MEMBER(high_rom_base_w);
420   DECLARE_READ32_MEMBER(jaguar_dsp_ram_r);
421   DECLARE_WRITE32_MEMBER(jaguar_dsp_ram_w);
422   DECLARE_READ32_MEMBER(jaguar_gpu_clut_r);
423   DECLARE_WRITE32_MEMBER(jaguar_gpu_clut_w);
424   DECLARE_READ32_MEMBER(jaguar_gpu_ram_r);
425   DECLARE_WRITE32_MEMBER(jaguar_gpu_ram_w);
426   DECLARE_READ16_MEMBER(jaguar_shared_ram_r16);
427   DECLARE_WRITE16_MEMBER(jaguar_shared_ram_w16);
428   DECLARE_READ16_MEMBER(jaguar_rom_base_r16);
429   DECLARE_WRITE16_MEMBER(jaguar_rom_base_w16);
430   DECLARE_READ16_MEMBER(jaguar_cart_base_r16);
431   DECLARE_WRITE16_MEMBER(jaguar_cart_base_w16);
432   DECLARE_READ16_MEMBER(high_rom_base_r16);
433   DECLARE_WRITE16_MEMBER(high_rom_base_w16);
434   DECLARE_READ16_MEMBER(jaguar_dsp_ram_r16);
435   DECLARE_WRITE16_MEMBER(jaguar_dsp_ram_w16);
436   DECLARE_READ16_MEMBER(jaguar_gpu_clut_r16);
437   DECLARE_WRITE16_MEMBER(jaguar_gpu_clut_w16);
438   DECLARE_READ16_MEMBER(jaguar_gpu_ram_r16);
439   DECLARE_WRITE16_MEMBER(jaguar_gpu_ram_w16);
376440};
377441
378442
r14896r14897
581645    }
582646}
583647*/
584static WRITE32_HANDLER( jaguar_eeprom_w )
648WRITE32_MEMBER(cojag_state::jaguar_eeprom_w)
585649{
586   eeprom_device *eeprom = space->machine().device<eeprom_device>("eeprom");
650   eeprom_device *eeprom = machine().device<eeprom_device>("eeprom");
587651   eeprom_bit_count++;
588652   if (eeprom_bit_count != 9)      /* kill extra bit at end of address */
589653   {
r14896r14897
592656   }
593657}
594658
595static READ32_HANDLER( jaguar_eeprom_clk )
659READ32_MEMBER(cojag_state::jaguar_eeprom_clk)
596660{
597   eeprom_device *eeprom = space->machine().device<eeprom_device>("eeprom");
661   eeprom_device *eeprom = machine().device<eeprom_device>("eeprom");
598662   eeprom->set_clock_line(PULSE_LINE);   /* get next bit when reading */
599663   return 0;
600664}
601665
602static READ32_HANDLER( jaguar_eeprom_cs )
666READ32_MEMBER(cojag_state::jaguar_eeprom_cs)
603667{
604   eeprom_device *eeprom = space->machine().device<eeprom_device>("eeprom");
668   eeprom_device *eeprom = machine().device<eeprom_device>("eeprom");
605669   eeprom->set_cs_line(ASSERT_LINE);   /* must do at end of an operation */
606670   eeprom->set_cs_line(CLEAR_LINE);      /* enable chip for next operation */
607671   eeprom->write_bit(1);         /* write a start bit */
r14896r14897
618682 *
619683 *************************************/
620684
621static READ32_HANDLER( misc_control_r )
685READ32_MEMBER(cojag_state::misc_control_r)
622686{
623   cojag_state *state = space->machine().driver_data<cojag_state>();
624687   /*  D7    = board reset (low)
625688        D6    = audio must & reset (high)
626689        D5    = volume control data (invert on write)
r14896r14897
628691        D3-D1 = audio bank 2-0
629692        D0    = shared memory select (0=XBUS) */
630693
631   return state->m_misc_control_data ^ 0x20;
694   return m_misc_control_data ^ 0x20;
632695}
633696
634697
635static WRITE32_HANDLER( misc_control_w )
698WRITE32_MEMBER(cojag_state::misc_control_w)
636699{
637   cojag_state *state = space->machine().driver_data<cojag_state>();
638   logerror("%08X:misc_control_w(%02X)\n", cpu_get_previouspc(&space->device()), data);
700   logerror("%08X:misc_control_w(%02X)\n", cpu_get_previouspc(&space.device()), data);
639701
640702   /*  D7    = board reset (low)
641703        D6    = audio must & reset (high)
r14896r14897
648710   if (!(data & 0x80))
649711   {
650712      /* clear any spinuntil stuff */
651      jaguar_gpu_resume(space->machine());
652      jaguar_dsp_resume(space->machine());
713      jaguar_gpu_resume(machine());
714      jaguar_dsp_resume(machine());
653715
654716      /* halt the CPUs */
655      jaguargpu_ctrl_w(space->machine().device("gpu"), G_CTRL, 0, 0xffffffff);
656      jaguardsp_ctrl_w(space->machine().device("audiocpu"), D_CTRL, 0, 0xffffffff);
717      jaguargpu_ctrl_w(machine().device("gpu"), G_CTRL, 0, 0xffffffff);
718      jaguardsp_ctrl_w(machine().device("audiocpu"), D_CTRL, 0, 0xffffffff);
657719   }
658720
659721   /* adjust banking */
660   if (space->machine().region("user2")->base())
722   if (machine().region("user2")->base())
661723   {
662      memory_set_bank(space->machine(), "bank2", (data >> 1) & 7);
663      memory_set_bank(space->machine(), "bank9", (data >> 1) & 7);
724      memory_set_bank(machine(), "bank2", (data >> 1) & 7);
725      memory_set_bank(machine(), "bank9", (data >> 1) & 7);
664726   }
665727
666   COMBINE_DATA(&state->m_misc_control_data);
728   COMBINE_DATA(&m_misc_control_data);
667729}
668730
669731
r14896r14897
674736 *************************************/
675737
676738// shouldn't the DSPs be doing this calc, why is this needed for Jaguar?
677static READ32_HANDLER( gpuctrl_r )
739READ32_MEMBER(cojag_state::gpuctrl_r)
678740{
679   UINT32 result = jaguargpu_ctrl_r(space->machine().device("gpu"), offset);
741   UINT32 result = jaguargpu_ctrl_r(machine().device("gpu"), offset);
680742
681743   if (is_jaguar)
682744   {
r14896r14897
691753}
692754
693755
694static WRITE32_HANDLER( gpuctrl_w )
756WRITE32_MEMBER(cojag_state::gpuctrl_w)
695757{
696758   if (is_jaguar)
697759      if ((!protection_check) && (offset == 5) && (data == 1)) protection_check++;
698760
699   jaguargpu_ctrl_w(space->machine().device("gpu"), offset, data, mem_mask);
761   jaguargpu_ctrl_w(machine().device("gpu"), offset, data, mem_mask);
700762}
701763
702764
r14896r14897
707769 *
708770 *************************************/
709771
710static READ32_HANDLER( dspctrl_r )
772READ32_MEMBER(cojag_state::dspctrl_r)
711773{
712   return jaguardsp_ctrl_r(space->machine().device("audiocpu"), offset);
774   return jaguardsp_ctrl_r(machine().device("audiocpu"), offset);
713775}
714776
715777
716static WRITE32_HANDLER( dspctrl_w )
778WRITE32_MEMBER(cojag_state::dspctrl_w)
717779{
718   jaguardsp_ctrl_w(space->machine().device("audiocpu"), offset, data, mem_mask);
780   jaguardsp_ctrl_w(machine().device("audiocpu"), offset, data, mem_mask);
719781}
720782
721783
722static READ32_HANDLER( jaguar_wave_rom_r )
784READ32_MEMBER(cojag_state::jaguar_wave_rom_r)
723785{
724786   return jaguar_wave_rom[offset];
725787}
r14896r14897
734796 *
735797 *************************************/
736798
737static READ32_HANDLER( joystick_r )
799READ32_MEMBER(cojag_state::joystick_r)
738800{
739801   UINT16 joystick_result = 0xfffe;
740802   UINT16 joybuts_result = 0xffef;
r14896r14897
763825   {
764826      if ((joystick_data & (0x10000 << i)) == 0)
765827      {
766         joystick_result &= input_port_read(space->machine(), keynames[0][i]);
767         joybuts_result &= input_port_read(space->machine(), keynames[1][i]);
828         joystick_result &= input_port_read(machine(), keynames[0][i]);
829         joybuts_result &= input_port_read(machine(), keynames[1][i]);
768830      }
769831   }
770832
771   joystick_result |= space->machine().device<eeprom_device>("eeprom")->read_bit();
772   joybuts_result |= (input_port_read(space->machine(), "CONFIG") & 0x10);
833   joystick_result |= machine().device<eeprom_device>("eeprom")->read_bit();
834   joybuts_result |= (input_port_read(machine(), "CONFIG") & 0x10);
773835
774836   return (joystick_result << 16) | joybuts_result;
775837}
776838
777static WRITE32_HANDLER( joystick_w )
839WRITE32_MEMBER(cojag_state::joystick_w)
778840{
779841   /*
780842     *   16        12         8         4         0
r14896r14897
832894 *
833895 *************************************/
834896
835static WRITE32_HANDLER( latch_w )
897WRITE32_MEMBER(cojag_state::latch_w)
836898{
837   logerror("%08X:latch_w(%X)\n", cpu_get_previouspc(&space->device()), data);
899   logerror("%08X:latch_w(%X)\n", cpu_get_previouspc(&space.device()), data);
838900
839901   /* adjust banking */
840   if (space->machine().region("user2")->base())
902   if (machine().region("user2")->base())
841903   {
842904      if (cojag_is_r3000)
843         memory_set_bank(space->machine(), "bank1", data & 1);
844      memory_set_bank(space->machine(), "bank8", data & 1);
905         memory_set_bank(machine(), "bank1", data & 1);
906      memory_set_bank(machine(), "bank8", data & 1);
845907   }
846908}
847909
r14896r14897
853915 *
854916 *************************************/
855917
856static READ32_HANDLER( eeprom_data_r )
918READ32_MEMBER(cojag_state::eeprom_data_r)
857919{
858   cojag_state *state = space->machine().driver_data<cojag_state>();
859920   if (cojag_is_r3000)
860      return state->m_nvram[offset] | 0xffffff00;
921      return m_nvram.target()[offset] | 0xffffff00;
861922   else
862      return state->m_nvram[offset] | 0x00ffffff;
923      return m_nvram.target()[offset] | 0x00ffffff;
863924}
864925
865926
866static WRITE32_HANDLER( eeprom_enable_w )
927WRITE32_MEMBER(cojag_state::eeprom_enable_w)
867928{
868   cojag_state *state = space->machine().driver_data<cojag_state>();
869   state->m_eeprom_enable = 1;
929   m_eeprom_enable = 1;
870930}
871931
872932
873static WRITE32_HANDLER( eeprom_data_w )
933WRITE32_MEMBER(cojag_state::eeprom_data_w)
874934{
875   cojag_state *state = space->machine().driver_data<cojag_state>();
876//  if (state->m_eeprom_enable)
935//  if (m_eeprom_enable)
877936   {
878937      if (cojag_is_r3000)
879         state->m_nvram[offset] = data & 0x000000ff;
938         m_nvram.target()[offset] = data & 0x000000ff;
880939      else
881         state->m_nvram[offset] = data & 0xff000000;
940         m_nvram.target()[offset] = data & 0xff000000;
882941   }
883942//  else
884//      logerror("%08X:error writing to disabled EEPROM\n", cpu_get_previouspc(&space->device()));
885   state->m_eeprom_enable = 0;
943//      logerror("%08X:error writing to disabled EEPROM\n", cpu_get_previouspc(&space.device()));
944   m_eeprom_enable = 0;
886945}
887946
888947
r14896r14897
924983}
925984
926985
927static WRITE32_HANDLER( gpu_jump_w )
986WRITE32_MEMBER(cojag_state::gpu_jump_w)
928987{
929   cojag_state *state = space->machine().driver_data<cojag_state>();
930988   /* update the data in memory */
931   COMBINE_DATA(state->m_gpu_jump_address);
932   logerror("%08X:GPU jump address = %08X\n", cpu_get_previouspc(&space->device()), *state->m_gpu_jump_address);
989   COMBINE_DATA(m_gpu_jump_address);
990   logerror("%08X:GPU jump address = %08X\n", cpu_get_previouspc(&space.device()), *m_gpu_jump_address);
933991
934992   /* if the GPU is suspended, release it now */
935   jaguar_gpu_resume(space->machine());
993   jaguar_gpu_resume(machine());
936994
937995   /* start the sync timer going, and note that there is a command pending */
938   space->machine().scheduler().synchronize(FUNC(gpu_sync_timer));
939   state->m_gpu_command_pending = 1;
996   machine().scheduler().synchronize(FUNC(gpu_sync_timer));
997   m_gpu_command_pending = 1;
940998}
941999
9421000
943static READ32_HANDLER( gpu_jump_r )
1001READ32_MEMBER(cojag_state::gpu_jump_r)
9441002{
945   cojag_state *state = space->machine().driver_data<cojag_state>();
9461003   /* if the current GPU command is just pointing back to the spin loop, and */
9471004   /* we're reading it from the spin loop, we can optimize */
948   if (*state->m_gpu_jump_address == state->m_gpu_spin_pc && cpu_get_previouspc(&space->device()) == state->m_gpu_spin_pc)
1005   if (*m_gpu_jump_address == m_gpu_spin_pc && cpu_get_previouspc(&space.device()) == m_gpu_spin_pc)
9491006   {
9501007#if ENABLE_SPEEDUP_HACKS
9511008      /* spin if we're allowed */
952      if (jaguar_hacks_enabled) jaguar_gpu_suspend(space->machine());
1009      if (jaguar_hacks_enabled) jaguar_gpu_suspend(machine());
9531010#endif
9541011
9551012      /* no command is pending */
956      state->m_gpu_command_pending = 0;
1013      m_gpu_command_pending = 0;
9571014   }
9581015
9591016   /* return the current value */
960   return *state->m_gpu_jump_address;
1017   return *m_gpu_jump_address;
9611018}
9621019
9631020
r14896r14897
9821039#if ENABLE_SPEEDUP_HACKS
9831040
9841041
985static READ32_HANDLER( cojagr3k_main_speedup_r )
1042READ32_MEMBER(cojag_state::cojagr3k_main_speedup_r)
9861043{
987   cojag_state *state = space->machine().driver_data<cojag_state>();
988   UINT64 curcycles = state->m_main_cpu->total_cycles();
1044   UINT64 curcycles = m_main_cpu->total_cycles();
9891045
9901046   /* if it's been less than main_speedup_max_cycles cycles since the last time */
991   if (curcycles - state->m_main_speedup_last_cycles < state->m_main_speedup_max_cycles)
1047   if (curcycles - m_main_speedup_last_cycles < m_main_speedup_max_cycles)
9921048   {
9931049      /* increment the count; if we hit 5, we can spin until an interrupt comes */
994      if (state->m_main_speedup_hits++ > 5)
1050      if (m_main_speedup_hits++ > 5)
9951051      {
996         device_spin_until_interrupt(&space->device());
997         state->m_main_speedup_hits = 0;
1052         device_spin_until_interrupt(&space.device());
1053         m_main_speedup_hits = 0;
9981054      }
9991055   }
10001056
10011057   /* if it's been more than main_speedup_max_cycles cycles, reset our count */
10021058   else
1003      state->m_main_speedup_hits = 0;
1059      m_main_speedup_hits = 0;
10041060
10051061   /* remember the last cycle count */
1006   state->m_main_speedup_last_cycles = curcycles;
1062   m_main_speedup_last_cycles = curcycles;
10071063
10081064   /* return the real value */
1009   return *state->m_main_speedup;
1065   return *m_main_speedup;
10101066}
10111067
10121068#endif
r14896r14897
10311087#if ENABLE_SPEEDUP_HACKS
10321088
10331089
1034static READ32_HANDLER( main_gpu_wait_r )
1090READ32_MEMBER(cojag_state::main_gpu_wait_r)
10351091{
1036   cojag_state *state = space->machine().driver_data<cojag_state>();
1037   if (state->m_gpu_command_pending)
1038      device_spin_until_interrupt(&space->device());
1039   return *state->m_main_gpu_wait;
1092   if (m_gpu_command_pending)
1093      device_spin_until_interrupt(&space.device());
1094   return *m_main_gpu_wait;
10401095}
10411096
10421097#endif
r14896r14897
10581113
10591114#if ENABLE_SPEEDUP_HACKS
10601115
1061static WRITE32_HANDLER( area51_main_speedup_w )
1116WRITE32_MEMBER(cojag_state::area51_main_speedup_w)
10621117{
1063   cojag_state *state = space->machine().driver_data<cojag_state>();
1064   UINT64 curcycles = state->m_main_cpu->total_cycles();
1118   UINT64 curcycles = m_main_cpu->total_cycles();
10651119
10661120   /* store the data */
1067   COMBINE_DATA(state->m_main_speedup);
1121   COMBINE_DATA(m_main_speedup);
10681122
10691123   /* if it's been less than 400 cycles since the last time */
1070   if (*state->m_main_speedup == 0 && curcycles - state->m_main_speedup_last_cycles < 400)
1124   if (*m_main_speedup == 0 && curcycles - m_main_speedup_last_cycles < 400)
10711125   {
10721126      /* increment the count; if we hit 5, we can spin until an interrupt comes */
1073      if (state->m_main_speedup_hits++ > 5)
1127      if (m_main_speedup_hits++ > 5)
10741128      {
1075         device_spin_until_interrupt(&space->device());
1076         state->m_main_speedup_hits = 0;
1129         device_spin_until_interrupt(&space.device());
1130         m_main_speedup_hits = 0;
10771131      }
10781132   }
10791133
10801134   /* if it's been more than 400 cycles, reset our count */
10811135   else
1082      state->m_main_speedup_hits = 0;
1136      m_main_speedup_hits = 0;
10831137
10841138   /* remember the last cycle count */
1085   state->m_main_speedup_last_cycles = curcycles;
1139   m_main_speedup_last_cycles = curcycles;
10861140}
10871141
10881142
r14896r14897
10931147    against 0 must handle that explicitly.
10941148*/
10951149
1096static WRITE32_HANDLER( area51mx_main_speedup_w )
1150WRITE32_MEMBER(cojag_state::area51mx_main_speedup_w)
10971151{
1098   cojag_state *state = space->machine().driver_data<cojag_state>();
1099   UINT64 curcycles = state->m_main_cpu->total_cycles();
1152   UINT64 curcycles = m_main_cpu->total_cycles();
11001153
11011154   /* store the data */
1102   COMBINE_DATA(&state->m_main_speedup[offset]);
1155   COMBINE_DATA(&m_main_speedup[offset]);
11031156
11041157   /* if it's been less than 450 cycles since the last time */
1105   if (((state->m_main_speedup[0] << 16) | (state->m_main_speedup[1] >> 16)) == 0 && curcycles - state->m_main_speedup_last_cycles < 450)
1158   if (((m_main_speedup[0] << 16) | (m_main_speedup[1] >> 16)) == 0 && curcycles - m_main_speedup_last_cycles < 450)
11061159   {
11071160      /* increment the count; if we hit 5, we can spin until an interrupt comes */
1108      if (state->m_main_speedup_hits++ > 10)
1161      if (m_main_speedup_hits++ > 10)
11091162      {
1110         device_spin_until_interrupt(&space->device());
1111         state->m_main_speedup_hits = 0;
1163         device_spin_until_interrupt(&space.device());
1164         m_main_speedup_hits = 0;
11121165      }
11131166   }
11141167
11151168   /* if it's been more than 450 cycles, reset our count */
11161169   else
1117      state->m_main_speedup_hits = 0;
1170      m_main_speedup_hits = 0;
11181171
11191172   /* remember the last cycle count */
1120   state->m_main_speedup_last_cycles = curcycles;
1173   m_main_speedup_last_cycles = curcycles;
11211174}
11221175
11231176#endif
r14896r14897
11361189// surely these should be 16-bit natively if the standard Jaguar is driven by a plain 68k?
11371190// all these trampolines are not good for performance ;-)
11381191
1139static READ16_HANDLER( gpuctrl_r16 )  { if (!(offset&1)) { return gpuctrl_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return gpuctrl_r(space, offset>>1, mem_mask); } }
1140static WRITE16_HANDLER( gpuctrl_w16 ) { if (!(offset&1)) { gpuctrl_w(space, offset>>1, data << 16, mem_mask << 16); } else { gpuctrl_w(space, offset>>1, data, mem_mask); } }
1141static READ16_HANDLER( jaguar_blitter_r16 )  { if (!(offset&1)) { return jaguar_blitter_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_blitter_r(space, offset>>1, mem_mask); } }
1142static WRITE16_HANDLER( jaguar_blitter_w16 ) { if (!(offset&1)) { jaguar_blitter_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_blitter_w(space, offset>>1, data, mem_mask); } }
1143static READ16_HANDLER( jaguar_serial_r16 )  { if (!(offset&1)) { return jaguar_serial_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_serial_r(space, offset>>1, mem_mask); } }
1144static WRITE16_HANDLER( jaguar_serial_w16 ) { if (!(offset&1)) { jaguar_serial_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_serial_w(space, offset>>1, data, mem_mask); } }
1145static READ16_HANDLER( dspctrl_r16 )  { if (!(offset&1)) { return dspctrl_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return dspctrl_r(space, offset>>1, mem_mask); } }
1146static WRITE16_HANDLER( dspctrl_w16 ) { if (!(offset&1)) { dspctrl_w(space, offset>>1, data << 16, mem_mask << 16); } else { dspctrl_w(space, offset>>1, data, mem_mask); } }
1147static READ16_HANDLER( jaguar_eeprom_cs16 )  { if (!(offset&1)) { return jaguar_eeprom_cs(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_eeprom_cs(space, offset>>1, mem_mask); } }
1148static READ16_HANDLER( jaguar_eeprom_clk16 )  { if (!(offset&1)) { return jaguar_eeprom_clk(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_eeprom_clk(space, offset>>1, mem_mask); } }
1149static WRITE16_HANDLER( jaguar_eeprom_w16 ) { if (!(offset&1)) { jaguar_eeprom_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_eeprom_w(space, offset>>1, data, mem_mask); } }
1150static READ16_HANDLER( joystick_r16 )  { if (!(offset&1)) { return joystick_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return joystick_r(space, offset>>1, mem_mask); } }
1151static WRITE16_HANDLER( joystick_w16 ) { if (!(offset&1)) { joystick_w(space, offset>>1, data << 16, mem_mask << 16); } else { joystick_w(space, offset>>1, data, mem_mask); } }
1192READ16_MEMBER(cojag_state::gpuctrl_r16){ if (!(offset&1)) { return gpuctrl_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return gpuctrl_r(space, offset>>1, mem_mask); } }
1193WRITE16_MEMBER(cojag_state::gpuctrl_w16){ if (!(offset&1)) { gpuctrl_w(space, offset>>1, data << 16, mem_mask << 16); } else { gpuctrl_w(space, offset>>1, data, mem_mask); } }
1194READ16_MEMBER(cojag_state::jaguar_blitter_r16){ if (!(offset&1)) { return jaguar_blitter_r(&space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_blitter_r(&space, offset>>1, mem_mask); } }
1195WRITE16_MEMBER(cojag_state::jaguar_blitter_w16){ if (!(offset&1)) { jaguar_blitter_w(&space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_blitter_w(&space, offset>>1, data, mem_mask); } }
1196READ16_MEMBER(cojag_state::jaguar_serial_r16){ if (!(offset&1)) { return jaguar_serial_r(&space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_serial_r(&space, offset>>1, mem_mask); } }
1197WRITE16_MEMBER(cojag_state::jaguar_serial_w16){ if (!(offset&1)) { jaguar_serial_w(&space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_serial_w(&space, offset>>1, data, mem_mask); } }
1198READ16_MEMBER(cojag_state::dspctrl_r16){ if (!(offset&1)) { return dspctrl_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return dspctrl_r(space, offset>>1, mem_mask); } }
1199WRITE16_MEMBER(cojag_state::dspctrl_w16){ if (!(offset&1)) { dspctrl_w(space, offset>>1, data << 16, mem_mask << 16); } else { dspctrl_w(space, offset>>1, data, mem_mask); } }
1200READ16_MEMBER(cojag_state::jaguar_eeprom_cs16){ if (!(offset&1)) { return jaguar_eeprom_cs(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_eeprom_cs(space, offset>>1, mem_mask); } }
1201READ16_MEMBER(cojag_state::jaguar_eeprom_clk16){ if (!(offset&1)) { return jaguar_eeprom_clk(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_eeprom_clk(space, offset>>1, mem_mask); } }
1202WRITE16_MEMBER(cojag_state::jaguar_eeprom_w16){ if (!(offset&1)) { jaguar_eeprom_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_eeprom_w(space, offset>>1, data, mem_mask); } }
1203READ16_MEMBER(cojag_state::joystick_r16){ if (!(offset&1)) { return joystick_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return joystick_r(space, offset>>1, mem_mask); } }
1204WRITE16_MEMBER(cojag_state::joystick_w16){ if (!(offset&1)) { joystick_w(space, offset>>1, data << 16, mem_mask << 16); } else { joystick_w(space, offset>>1, data, mem_mask); } }
11521205
1153static READ32_HANDLER( jaguar_shared_ram_r ) { return jaguar_shared_ram[offset]; }
1154static WRITE32_HANDLER( jaguar_shared_ram_w ) {   COMBINE_DATA(&jaguar_shared_ram[offset]); }
1155static READ32_HANDLER( jaguar_rom_base_r ) { return rom_base[offset]; }
1156static WRITE32_HANDLER( jaguar_rom_base_w ) { /*ROM!*/ }
1157static READ32_HANDLER( jaguar_cart_base_r ) { return cart_base[offset]; }
1158static WRITE32_HANDLER( jaguar_cart_base_w ) { /*ROM!*/ }
1159static READ32_HANDLER( high_rom_base_r ) { return high_rom_base[offset]; }
1160static WRITE32_HANDLER( high_rom_base_w ) { /*ROM!*/ }
1161static READ32_HANDLER( jaguar_dsp_ram_r ) {   return jaguar_dsp_ram[offset]; }
1162static WRITE32_HANDLER( jaguar_dsp_ram_w ) { COMBINE_DATA(&jaguar_dsp_ram[offset]); }
1163static READ32_HANDLER( jaguar_gpu_clut_r ) { return jaguar_gpu_clut[offset]; }
1164static WRITE32_HANDLER( jaguar_gpu_clut_w ) { COMBINE_DATA(&jaguar_gpu_clut[offset]); }
1165static READ32_HANDLER( jaguar_gpu_ram_r ) { return jaguar_gpu_ram[offset]; }
1166static WRITE32_HANDLER( jaguar_gpu_ram_w ) { COMBINE_DATA(&jaguar_gpu_ram[offset]); }
1206READ32_MEMBER(cojag_state::jaguar_shared_ram_r){ return jaguar_shared_ram[offset]; }
1207WRITE32_MEMBER(cojag_state::jaguar_shared_ram_w){   COMBINE_DATA(&jaguar_shared_ram[offset]); }
1208READ32_MEMBER(cojag_state::jaguar_rom_base_r){ return rom_base[offset]; }
1209WRITE32_MEMBER(cojag_state::jaguar_rom_base_w){ /*ROM!*/ }
1210READ32_MEMBER(cojag_state::jaguar_cart_base_r){ return cart_base[offset]; }
1211WRITE32_MEMBER(cojag_state::jaguar_cart_base_w){ /*ROM!*/ }
1212READ32_MEMBER(cojag_state::high_rom_base_r){ return high_rom_base[offset]; }
1213WRITE32_MEMBER(cojag_state::high_rom_base_w){ /*ROM!*/ }
1214READ32_MEMBER(cojag_state::jaguar_dsp_ram_r){   return jaguar_dsp_ram[offset]; }
1215WRITE32_MEMBER(cojag_state::jaguar_dsp_ram_w){ COMBINE_DATA(&jaguar_dsp_ram[offset]); }
1216READ32_MEMBER(cojag_state::jaguar_gpu_clut_r){ return jaguar_gpu_clut[offset]; }
1217WRITE32_MEMBER(cojag_state::jaguar_gpu_clut_w){ COMBINE_DATA(&jaguar_gpu_clut[offset]); }
1218READ32_MEMBER(cojag_state::jaguar_gpu_ram_r){ return jaguar_gpu_ram[offset]; }
1219WRITE32_MEMBER(cojag_state::jaguar_gpu_ram_w){ COMBINE_DATA(&jaguar_gpu_ram[offset]); }
11671220
1168static READ16_HANDLER( jaguar_shared_ram_r16 )  { if (!(offset&1)) { return jaguar_shared_ram_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_shared_ram_r(space, offset>>1, mem_mask); } }
1169static WRITE16_HANDLER( jaguar_shared_ram_w16 ) { if (!(offset&1)) { jaguar_shared_ram_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_shared_ram_w(space, offset>>1, data, mem_mask); } }
1170static READ16_HANDLER( jaguar_rom_base_r16 )  { if (!(offset&1)) { return jaguar_rom_base_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_rom_base_r(space, offset>>1, mem_mask); } }
1171static WRITE16_HANDLER( jaguar_rom_base_w16 ) { if (!(offset&1)) { jaguar_rom_base_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_rom_base_w(space, offset>>1, data, mem_mask); } }
1172static READ16_HANDLER( jaguar_cart_base_r16 )  { if (!(offset&1)) { return jaguar_cart_base_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_cart_base_r(space, offset>>1, mem_mask); } }
1173static WRITE16_HANDLER( jaguar_cart_base_w16 ) { if (!(offset&1)) { jaguar_cart_base_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_cart_base_w(space, offset>>1, data, mem_mask); } }
1174static READ16_HANDLER( high_rom_base_r16 )  { if (!(offset&1)) { return high_rom_base_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return high_rom_base_r(space, offset>>1, mem_mask); } }
1175static WRITE16_HANDLER( high_rom_base_w16 ) { if (!(offset&1)) { high_rom_base_w(space, offset>>1, data << 16, mem_mask << 16); } else { high_rom_base_w(space, offset>>1, data, mem_mask); } }
1221READ16_MEMBER(cojag_state::jaguar_shared_ram_r16){ if (!(offset&1)) { return jaguar_shared_ram_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_shared_ram_r(space, offset>>1, mem_mask); } }
1222WRITE16_MEMBER(cojag_state::jaguar_shared_ram_w16){ if (!(offset&1)) { jaguar_shared_ram_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_shared_ram_w(space, offset>>1, data, mem_mask); } }
1223READ16_MEMBER(cojag_state::jaguar_rom_base_r16){ if (!(offset&1)) { return jaguar_rom_base_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_rom_base_r(space, offset>>1, mem_mask); } }
1224WRITE16_MEMBER(cojag_state::jaguar_rom_base_w16){ if (!(offset&1)) { jaguar_rom_base_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_rom_base_w(space, offset>>1, data, mem_mask); } }
1225READ16_MEMBER(cojag_state::jaguar_cart_base_r16){ if (!(offset&1)) { return jaguar_cart_base_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_cart_base_r(space, offset>>1, mem_mask); } }
1226WRITE16_MEMBER(cojag_state::jaguar_cart_base_w16){ if (!(offset&1)) { jaguar_cart_base_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_cart_base_w(space, offset>>1, data, mem_mask); } }
1227READ16_MEMBER(cojag_state::high_rom_base_r16){ if (!(offset&1)) { return high_rom_base_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return high_rom_base_r(space, offset>>1, mem_mask); } }
1228WRITE16_MEMBER(cojag_state::high_rom_base_w16){ if (!(offset&1)) { high_rom_base_w(space, offset>>1, data << 16, mem_mask << 16); } else { high_rom_base_w(space, offset>>1, data, mem_mask); } }
11761229
1177static READ16_HANDLER( jaguar_dsp_ram_r16 )  { if (!(offset&1)) { return jaguar_dsp_ram_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_dsp_ram_r(space, offset>>1, mem_mask); } }
1178static WRITE16_HANDLER( jaguar_dsp_ram_w16 ) { if (!(offset&1)) { jaguar_dsp_ram_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_dsp_ram_w(space, offset>>1, data, mem_mask); } }
1179static READ16_HANDLER( jaguar_gpu_clut_r16 )  { if (!(offset&1)) { return jaguar_gpu_clut_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_gpu_clut_r(space, offset>>1, mem_mask); } }
1180static WRITE16_HANDLER( jaguar_gpu_clut_w16 ) { if (!(offset&1)) { jaguar_gpu_clut_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_gpu_clut_w(space, offset>>1, data, mem_mask); } }
1181static READ16_HANDLER( jaguar_gpu_ram_r16 )  { if (!(offset&1)) { return jaguar_gpu_ram_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_gpu_ram_r(space, offset>>1, mem_mask); } }
1182static WRITE16_HANDLER( jaguar_gpu_ram_w16 ) { if (!(offset&1)) { jaguar_gpu_ram_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_gpu_ram_w(space, offset>>1, data, mem_mask); } }
1230READ16_MEMBER(cojag_state::jaguar_dsp_ram_r16){ if (!(offset&1)) { return jaguar_dsp_ram_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_dsp_ram_r(space, offset>>1, mem_mask); } }
1231WRITE16_MEMBER(cojag_state::jaguar_dsp_ram_w16){ if (!(offset&1)) { jaguar_dsp_ram_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_dsp_ram_w(space, offset>>1, data, mem_mask); } }
1232READ16_MEMBER(cojag_state::jaguar_gpu_clut_r16){ if (!(offset&1)) { return jaguar_gpu_clut_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_gpu_clut_r(space, offset>>1, mem_mask); } }
1233WRITE16_MEMBER(cojag_state::jaguar_gpu_clut_w16){ if (!(offset&1)) { jaguar_gpu_clut_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_gpu_clut_w(space, offset>>1, data, mem_mask); } }
1234READ16_MEMBER(cojag_state::jaguar_gpu_ram_r16){ if (!(offset&1)) { return jaguar_gpu_ram_r(space, offset>>1, mem_mask<<16) >> 16;  } else { return jaguar_gpu_ram_r(space, offset>>1, mem_mask); } }
1235WRITE16_MEMBER(cojag_state::jaguar_gpu_ram_w16){ if (!(offset&1)) { jaguar_gpu_ram_w(space, offset>>1, data << 16, mem_mask << 16); } else { jaguar_gpu_ram_w(space, offset>>1, data, mem_mask); } }
11831236
11841237static ADDRESS_MAP_START( jaguar_map, AS_PROGRAM, 16, cojag_state )
11851238   ADDRESS_MAP_GLOBAL_MASK(0xffffff)
1186   AM_RANGE(0x000000, 0x1fffff) AM_MIRROR(0x200000) AM_READWRITE_LEGACY(jaguar_shared_ram_r16, jaguar_shared_ram_w16 );
1187   AM_RANGE(0x800000, 0xdfffff) AM_READWRITE_LEGACY(jaguar_cart_base_r16, jaguar_cart_base_w16 )
1188   AM_RANGE(0xe00000, 0xe1ffff) AM_READWRITE_LEGACY(jaguar_rom_base_r16, jaguar_rom_base_w16 )
1239   AM_RANGE(0x000000, 0x1fffff) AM_MIRROR(0x200000) AM_READWRITE(jaguar_shared_ram_r16, jaguar_shared_ram_w16 );
1240   AM_RANGE(0x800000, 0xdfffff) AM_READWRITE(jaguar_cart_base_r16, jaguar_cart_base_w16 )
1241   AM_RANGE(0xe00000, 0xe1ffff) AM_READWRITE(jaguar_rom_base_r16, jaguar_rom_base_w16 )
11891242   AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE_LEGACY(jaguar_tom_regs_r, jaguar_tom_regs_w) // might be reversed endian of the others..
1190   AM_RANGE(0xf00400, 0xf005ff) AM_MIRROR(0x000200) AM_READWRITE_LEGACY(jaguar_gpu_clut_r16, jaguar_gpu_clut_w16 )
1191   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE_LEGACY(gpuctrl_r16, gpuctrl_w16)
1192   AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE_LEGACY(jaguar_blitter_r16, jaguar_blitter_w16)
1193   AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_READWRITE_LEGACY(jaguar_gpu_ram_r16, jaguar_gpu_ram_w16 )
1243   AM_RANGE(0xf00400, 0xf005ff) AM_MIRROR(0x000200) AM_READWRITE(jaguar_gpu_clut_r16, jaguar_gpu_clut_w16 )
1244   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r16, gpuctrl_w16)
1245   AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE(jaguar_blitter_r16, jaguar_blitter_w16)
1246   AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_READWRITE(jaguar_gpu_ram_r16, jaguar_gpu_ram_w16 )
11941247   AM_RANGE(0xf10000, 0xf103ff) AM_READWRITE_LEGACY(jaguar_jerry_regs_r, jaguar_jerry_regs_w) // might be reversed endian of the others..
1195   AM_RANGE(0xf14000, 0xf14003) AM_READWRITE_LEGACY(joystick_r16, joystick_w16)
1196   AM_RANGE(0xf14800, 0xf14803) AM_READWRITE_LEGACY(jaguar_eeprom_clk16,jaguar_eeprom_w16)   // GPI00
1197   AM_RANGE(0xf15000, 0xf15003) AM_READ_LEGACY(jaguar_eeprom_cs16)            // GPI01
1198   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE_LEGACY(dspctrl_r16, dspctrl_w16)
1199   AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE_LEGACY(jaguar_serial_r16, jaguar_serial_w16)
1200   AM_RANGE(0xf1b000, 0xf1cfff) AM_READWRITE_LEGACY(jaguar_dsp_ram_r16, jaguar_dsp_ram_w16)
1201   AM_RANGE(0xf1d000, 0xf1dfff) AM_READWRITE_LEGACY(high_rom_base_r16, high_rom_base_w16 )
1248   AM_RANGE(0xf14000, 0xf14003) AM_READWRITE(joystick_r16, joystick_w16)
1249   AM_RANGE(0xf14800, 0xf14803) AM_READWRITE(jaguar_eeprom_clk16,jaguar_eeprom_w16)   // GPI00
1250   AM_RANGE(0xf15000, 0xf15003) AM_READ(jaguar_eeprom_cs16)            // GPI01
1251   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE(dspctrl_r16, dspctrl_w16)
1252   AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE(jaguar_serial_r16, jaguar_serial_w16)
1253   AM_RANGE(0xf1b000, 0xf1cfff) AM_READWRITE(jaguar_dsp_ram_r16, jaguar_dsp_ram_w16)
1254   AM_RANGE(0xf1d000, 0xf1dfff) AM_READWRITE(high_rom_base_r16, high_rom_base_w16 )
12021255ADDRESS_MAP_END
12031256
12041257
r14896r14897
12161269   AM_RANGE(0x04e00000, 0x04e003ff) AM_DEVREADWRITE_LEGACY("ide", ide_controller32_r, ide_controller32_w)
12171270   AM_RANGE(0x04f00000, 0x04f003ff) AM_READWRITE_LEGACY(jaguar_tom_regs32_r, jaguar_tom_regs32_w)
12181271   AM_RANGE(0x04f00400, 0x04f007ff) AM_RAM AM_BASE_LEGACY(&jaguar_gpu_clut) AM_SHARE("share2")
1219   AM_RANGE(0x04f02100, 0x04f021ff) AM_READWRITE_LEGACY(gpuctrl_r, gpuctrl_w)
1272   AM_RANGE(0x04f02100, 0x04f021ff) AM_READWRITE(gpuctrl_r, gpuctrl_w)
12201273   AM_RANGE(0x04f02200, 0x04f022ff) AM_READWRITE_LEGACY(jaguar_blitter_r, jaguar_blitter_w)
12211274   AM_RANGE(0x04f03000, 0x04f03fff) AM_MIRROR(0x00008000) AM_RAM AM_BASE_LEGACY(&jaguar_gpu_ram) AM_SHARE("share3")
12221275   AM_RANGE(0x04f10000, 0x04f103ff) AM_READWRITE_LEGACY(jaguar_jerry_regs32_r, jaguar_jerry_regs32_w)
12231276   AM_RANGE(0x04f16000, 0x04f1600b) AM_READ_LEGACY(cojag_gun_input_r)   // GPI02
12241277   AM_RANGE(0x04f17000, 0x04f17003) AM_READ_PORT("SYSTEM")      // GPI03
1225   AM_RANGE(0x04f17800, 0x04f17803) AM_WRITE_LEGACY(latch_w)         // GPI04
1278   AM_RANGE(0x04f17800, 0x04f17803) AM_WRITE(latch_w)         // GPI04
12261279   AM_RANGE(0x04f17c00, 0x04f17c03) AM_READ_PORT("P1_P2")      // GPI05
1227   AM_RANGE(0x04f1a100, 0x04f1a13f) AM_READWRITE_LEGACY(dspctrl_r, dspctrl_w)
1280   AM_RANGE(0x04f1a100, 0x04f1a13f) AM_READWRITE(dspctrl_r, dspctrl_w)
12281281   AM_RANGE(0x04f1a140, 0x04f1a17f) AM_READWRITE_LEGACY(jaguar_serial_r, jaguar_serial_w)
12291282   AM_RANGE(0x04f1b000, 0x04f1cfff) AM_RAM AM_BASE_LEGACY(&jaguar_dsp_ram) AM_SHARE("share4")
12301283
1231   AM_RANGE(0x06000000, 0x06000003) AM_READWRITE_LEGACY(misc_control_r, misc_control_w)
1284   AM_RANGE(0x06000000, 0x06000003) AM_READWRITE(misc_control_r, misc_control_w)
12321285   AM_RANGE(0x10000000, 0x1007ffff) AM_RAM
12331286   AM_RANGE(0x12000000, 0x120fffff) AM_RAM      // tested in self-test only?
12341287   AM_RANGE(0x14000004, 0x14000007) AM_WRITE(watchdog_reset32_w)
1235   AM_RANGE(0x16000000, 0x16000003) AM_WRITE_LEGACY(eeprom_enable_w)
1236   AM_RANGE(0x18000000, 0x18001fff) AM_READWRITE_LEGACY(eeprom_data_r, eeprom_data_w) AM_SHARE("nvram")
1237   AM_RANGE(0x1fc00000, 0x1fdfffff) AM_ROM AM_REGION("user1", 0) AM_BASE(m_rom_base)
1288   AM_RANGE(0x16000000, 0x16000003) AM_WRITE(eeprom_enable_w)
1289   AM_RANGE(0x18000000, 0x18001fff) AM_READWRITE(eeprom_data_r, eeprom_data_w) AM_SHARE("nvram")
1290   AM_RANGE(0x1fc00000, 0x1fdfffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("robase")
12381291ADDRESS_MAP_END
12391292
12401293
12411294static ADDRESS_MAP_START( m68020_map, AS_PROGRAM, 32, cojag_state )
12421295   AM_RANGE(0x000000, 0x7fffff) AM_RAM AM_BASE_LEGACY(&jaguar_shared_ram) AM_SHARE("share1")
1243   AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("user1", 0) AM_BASE(m_rom_base)
1296   AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("robase")
12441297   AM_RANGE(0xa00000, 0xa1ffff) AM_RAM
1245   AM_RANGE(0xa20000, 0xa21fff) AM_READWRITE_LEGACY(eeprom_data_r, eeprom_data_w) AM_SHARE("nvram")
1298   AM_RANGE(0xa20000, 0xa21fff) AM_READWRITE(eeprom_data_r, eeprom_data_w) AM_SHARE("nvram")
12461299   AM_RANGE(0xa30000, 0xa30003) AM_WRITE(watchdog_reset32_w)
1247   AM_RANGE(0xa40000, 0xa40003) AM_WRITE_LEGACY(eeprom_enable_w)
1248   AM_RANGE(0xb70000, 0xb70003) AM_READWRITE_LEGACY(misc_control_r, misc_control_w)
1300   AM_RANGE(0xa40000, 0xa40003) AM_WRITE(eeprom_enable_w)
1301   AM_RANGE(0xb70000, 0xb70003) AM_READWRITE(misc_control_r, misc_control_w)
12491302   AM_RANGE(0xc00000, 0xdfffff) AM_ROMBANK("bank2")
12501303   AM_RANGE(0xe00000, 0xe003ff) AM_DEVREADWRITE_LEGACY("ide",  ide_controller32_r, ide_controller32_w)
12511304   AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE_LEGACY(jaguar_tom_regs32_r, jaguar_tom_regs32_w)
12521305   AM_RANGE(0xf00400, 0xf007ff) AM_RAM AM_BASE_LEGACY(&jaguar_gpu_clut) AM_SHARE("share2")
1253   AM_RANGE(0xf02100, 0xf021ff) AM_READWRITE_LEGACY(gpuctrl_r, gpuctrl_w)
1306   AM_RANGE(0xf02100, 0xf021ff) AM_READWRITE(gpuctrl_r, gpuctrl_w)
12541307   AM_RANGE(0xf02200, 0xf022ff) AM_READWRITE_LEGACY(jaguar_blitter_r, jaguar_blitter_w)
12551308   AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_RAM AM_BASE_LEGACY(&jaguar_gpu_ram) AM_SHARE("share3")
12561309   AM_RANGE(0xf10000, 0xf103ff) AM_READWRITE_LEGACY(jaguar_jerry_regs32_r, jaguar_jerry_regs32_w)
12571310   AM_RANGE(0xf16000, 0xf1600b) AM_READ_LEGACY(cojag_gun_input_r)   // GPI02
12581311   AM_RANGE(0xf17000, 0xf17003) AM_READ_PORT("SYSTEM")      // GPI03
1259//  AM_RANGE(0xf17800, 0xf17803) AM_WRITE_LEGACY(latch_w)          // GPI04
1312//  AM_RANGE(0xf17800, 0xf17803) AM_WRITE(latch_w)          // GPI04
12601313   AM_RANGE(0xf17c00, 0xf17c03) AM_READ_PORT("P1_P2")      // GPI05
1261   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE_LEGACY(dspctrl_r, dspctrl_w)
1314   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE(dspctrl_r, dspctrl_w)
12621315   AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE_LEGACY(jaguar_serial_r, jaguar_serial_w)
12631316   AM_RANGE(0xf1b000, 0xf1cfff) AM_RAM AM_BASE_LEGACY(&jaguar_dsp_ram) AM_SHARE("share4")
12641317ADDRESS_MAP_END
r14896r14897
12781331   AM_RANGE(0xe00000, 0xe003ff) AM_DEVREADWRITE_LEGACY("ide", ide_controller32_r, ide_controller32_w)
12791332   AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE_LEGACY(jaguar_tom_regs32_r, jaguar_tom_regs32_w)
12801333   AM_RANGE(0xf00400, 0xf007ff) AM_RAM AM_SHARE("share2")
1281   AM_RANGE(0xf02100, 0xf021ff) AM_READWRITE_LEGACY(gpuctrl_r, gpuctrl_w)
1334   AM_RANGE(0xf02100, 0xf021ff) AM_READWRITE(gpuctrl_r, gpuctrl_w)
12821335   AM_RANGE(0xf02200, 0xf022ff) AM_READWRITE_LEGACY(jaguar_blitter_r, jaguar_blitter_w)
12831336   AM_RANGE(0xf03000, 0xf03fff) AM_RAM AM_SHARE("share3")
12841337   AM_RANGE(0xf10000, 0xf103ff) AM_READWRITE_LEGACY(jaguar_jerry_regs32_r, jaguar_jerry_regs32_w)
r14896r14897
12971350   AM_RANGE(0x800000, 0xbfffff) AM_ROMBANK("bank8")
12981351   AM_RANGE(0xc00000, 0xdfffff) AM_ROMBANK("bank9")
12991352   AM_RANGE(0xf10000, 0xf103ff) AM_READWRITE_LEGACY(jaguar_jerry_regs32_r, jaguar_jerry_regs32_w)
1300   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE_LEGACY(dspctrl_r, dspctrl_w)
1353   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE(dspctrl_r, dspctrl_w)
13011354   AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE_LEGACY(jaguar_serial_r, jaguar_serial_w)
13021355   AM_RANGE(0xf1b000, 0xf1cfff) AM_RAM AM_SHARE("share4")
1303   AM_RANGE(0xf1d000, 0xf1dfff) AM_READ_LEGACY(jaguar_wave_rom_r) AM_BASE_LEGACY(&jaguar_wave_rom)
1356   AM_RANGE(0xf1d000, 0xf1dfff) AM_READ(jaguar_wave_rom_r) AM_BASE_LEGACY(&jaguar_wave_rom)
13041357ADDRESS_MAP_END
13051358
13061359/* ToDo, these maps SHOULD be merged with the ones above */
r14896r14897
13121365   AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_BASE_LEGACY(&rom_base) AM_SIZE_LEGACY(&rom_size)  AM_SHARE("share16") AM_REGION("maincpu", 0xe00000)
13131366   AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE_LEGACY(jaguar_tom_regs32_r, jaguar_tom_regs32_w)
13141367   AM_RANGE(0xf00400, 0xf005ff) AM_BASE_LEGACY(&jaguar_gpu_clut) AM_MIRROR(0x000200) AM_RAM AM_SHARE("share2")
1315   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE_LEGACY(gpuctrl_r, gpuctrl_w)
1368   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w)
13161369   AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE_LEGACY(jaguar_blitter_r, jaguar_blitter_w)
13171370   AM_RANGE(0xf03000, 0xf03fff) AM_BASE_LEGACY(&jaguar_gpu_ram) AM_MIRROR(0x008000) AM_RAM AM_SHARE("share3")
13181371   AM_RANGE(0xf10000, 0xf103ff) AM_READWRITE_LEGACY(jaguar_jerry_regs32_r, jaguar_jerry_regs32_w)
1319   AM_RANGE(0xf14000, 0xf14003) AM_READWRITE_LEGACY(joystick_r, joystick_w)
1320   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE_LEGACY(dspctrl_r, dspctrl_w)
1372   AM_RANGE(0xf14000, 0xf14003) AM_READWRITE(joystick_r, joystick_w)
1373   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE(dspctrl_r, dspctrl_w)
13211374   AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE_LEGACY(jaguar_serial_r, jaguar_serial_w)
13221375   AM_RANGE(0xf1b000, 0xf1cfff) AM_BASE_LEGACY(&jaguar_dsp_ram) AM_RAM AM_SHARE("share4")
13231376   AM_RANGE(0xf1d000, 0xf1dfff) AM_ROM AM_BASE_LEGACY(&high_rom_base) AM_REGION("maincpu", 0xf1d000)
r14896r14897
13301383   AM_RANGE(0xe00000, 0xe1ffff) AM_ROM AM_SHARE("share16") AM_REGION("maincpu", 0xe00000)
13311384   AM_RANGE(0xf00000, 0xf003ff) AM_READWRITE_LEGACY(jaguar_tom_regs32_r, jaguar_tom_regs32_w)
13321385   AM_RANGE(0xf00400, 0xf005ff) AM_MIRROR(0x000200) AM_RAM AM_SHARE("share2")
1333   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE_LEGACY(gpuctrl_r, gpuctrl_w)
1386   AM_RANGE(0xf02100, 0xf021ff) AM_MIRROR(0x008000) AM_READWRITE(gpuctrl_r, gpuctrl_w)
13341387   AM_RANGE(0xf02200, 0xf022ff) AM_MIRROR(0x008000) AM_READWRITE_LEGACY(jaguar_blitter_r, jaguar_blitter_w)
13351388   AM_RANGE(0xf03000, 0xf03fff) AM_MIRROR(0x008000) AM_RAM AM_SHARE("share3")
13361389   AM_RANGE(0xf10000, 0xf103ff) AM_READWRITE_LEGACY(jaguar_jerry_regs32_r, jaguar_jerry_regs32_w)
1337   AM_RANGE(0xf14000, 0xf14003) AM_READWRITE_LEGACY(joystick_r, joystick_w)
1338   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE_LEGACY(dspctrl_r, dspctrl_w)
1390   AM_RANGE(0xf14000, 0xf14003) AM_READWRITE(joystick_r, joystick_w)
1391   AM_RANGE(0xf1a100, 0xf1a13f) AM_READWRITE(dspctrl_r, dspctrl_w)
13391392   AM_RANGE(0xf1a140, 0xf1a17f) AM_READWRITE_LEGACY(jaguar_serial_r, jaguar_serial_w)
13401393   AM_RANGE(0xf1b000, 0xf1cfff) AM_RAM AM_SHARE("share4")
13411394   AM_RANGE(0xf1d000, 0xf1dfff) AM_ROM AM_REGION("maincpu", 0xf1d000)
r14896r14897
23012354
23022355   /* install synchronization hooks for GPU */
23032356   if (cojag_is_r3000)
2304      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, FUNC(gpu_jump_w));
2357      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, write32_delegate(FUNC(cojag_state::gpu_jump_w),state));
23052358   else
2306      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, FUNC(gpu_jump_w));
2307   machine.device("gpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, FUNC(gpu_jump_r));
2359      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, write32_delegate(FUNC(cojag_state::gpu_jump_w),state));
2360   machine.device("gpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, read32_delegate(FUNC(cojag_state::gpu_jump_r),state));
23082361   state->m_gpu_jump_address = &jaguar_gpu_ram[gpu_jump_offs/4];
23092362   state->m_gpu_spin_pc = 0xf03000 + spin_pc;
23102363
r14896r14897
23232376      cojag_state *state = machine.driver_data<cojag_state>();
23242377
23252378      /* install speedup for main CPU */
2326      state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa02030, 0xa02033, FUNC(area51_main_speedup_w));
2379      state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xa02030, 0xa02033, write32_delegate(FUNC(cojag_state::area51_main_speedup_w),state));
23272380   }
23282381#endif
23292382}
r14896r14897
23402393
23412394      /* install speedup for main CPU */
23422395      state->m_main_speedup_max_cycles = 120;
2343      state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x100062e8, 0x100062eb, FUNC(cojagr3k_main_speedup_r));
2396      state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x100062e8, 0x100062eb, read32_delegate(FUNC(cojag_state::cojagr3k_main_speedup_r),state));
23442397   }
23452398#endif
23462399}
r14896r14897
23522405   cojag_common_init(machine, 0x0c0, 0x09e);
23532406
23542407   /* patch the protection */
2355   state->m_rom_base[0x220/4] = 0x03e00008;
2408   state->m_rom_base.target()[0x220/4] = 0x03e00008;
23562409
23572410#if ENABLE_SPEEDUP_HACKS
23582411   /* install speedup for main CPU */
23592412   state->m_main_speedup_max_cycles = 120;
2360   state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1000865c, 0x1000865f, FUNC(cojagr3k_main_speedup_r));
2413   state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x1000865c, 0x1000865f, read32_delegate(FUNC(cojag_state::cojagr3k_main_speedup_r),state));
23612414#endif
23622415}
23632416
r14896r14897
23692422   cojag_common_init(machine, 0x0c0, 0x09e);
23702423
23712424   /* patch the protection */
2372   state->m_rom_base[0x418/4] = 0x4e754e75;
2425   state->m_rom_base.target()[0x418/4] = 0x4e754e75;
23732426
23742427#if ENABLE_SPEEDUP_HACKS
23752428   /* install speedup for main CPU */
2376   state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa19550, 0xa19557, FUNC(area51mx_main_speedup_w));
2429   state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xa19550, 0xa19557, write32_delegate(FUNC(cojag_state::area51mx_main_speedup_w),state));
23772430#endif
23782431}
23792432
r14896r14897
23852438   cojag_common_init(machine, 0x0c0, 0x09e);
23862439
23872440   /* patch the protection */
2388   state->m_rom_base[0x220/4] = 0x03e00008;
2441   state->m_rom_base.target()[0x220/4] = 0x03e00008;
23892442
23902443#if ENABLE_SPEEDUP_HACKS
23912444   /* install speedup for main CPU */
23922445   state->m_main_speedup_max_cycles = 120;
2393   state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x10006f0c, 0x10006f0f, FUNC(cojagr3k_main_speedup_r));
2446   state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x10006f0c, 0x10006f0f, read32_delegate(FUNC(cojag_state::cojagr3k_main_speedup_r),state));
23942447#endif
23952448}
23962449
r14896r14897
24062459
24072460      /* install speedup for main CPU */
24082461      state->m_main_speedup_max_cycles = 200;
2409      state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x10021b60, 0x10021b63, FUNC(cojagr3k_main_speedup_r));
2462      state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x10021b60, 0x10021b63, read32_delegate(FUNC(cojag_state::cojagr3k_main_speedup_r),state));
24102463   }
24112464#endif
24122465}
r14896r14897
24232476      /* install speedup for main CPU */
24242477      state->m_main_speedup_max_cycles = 200;
24252478      if (main_speedup_addr != 0)
2426         state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(main_speedup_addr, main_speedup_addr + 3, FUNC(cojagr3k_main_speedup_r));
2427      state->m_main_gpu_wait = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0400d900, 0x0400d900 + 3, FUNC(main_gpu_wait_r));
2479         state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(main_speedup_addr, main_speedup_addr + 3, read32_delegate(FUNC(cojag_state::cojagr3k_main_speedup_r),state));
2480      state->m_main_gpu_wait = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0400d900, 0x0400d900 + 3, read32_delegate(FUNC(cojag_state::main_gpu_wait_r),state));
24282481   }
24292482#endif
24302483}
r14896r14897
24482501
24492502      /* install speedup for main CPU */
24502503      state->m_main_speedup_max_cycles = 50;
2451      state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x12005b34, 0x12005b37, FUNC(cojagr3k_main_speedup_r));
2504      state->m_main_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x12005b34, 0x12005b37, read32_delegate(FUNC(cojag_state::cojagr3k_main_speedup_r),state));
24522505   }
24532506#endif
24542507}
src/mame/drivers/onetwo.c
r14896r14897
5050{
5151public:
5252   onetwo_state(const machine_config &mconfig, device_type type, const char *tag)
53      : driver_device(mconfig, type, tag) { }
53      : driver_device(mconfig, type, tag) ,
54      m_paletteram(*this, "paletteram"),
55      m_paletteram2(*this, "paletteram2"),
56      m_fgram(*this, "fgram"){ }
5457
5558   /* memory pointers */
56   UINT8 *  m_fgram;
57   UINT8 *  m_paletteram;
58   UINT8 *  m_paletteram2;
59   required_shared_ptr<UINT8> m_paletteram;
60   required_shared_ptr<UINT8> m_paletteram2;
61   required_shared_ptr<UINT8> m_fgram;
5962
6063   /* video-related */
6164   tilemap_t *m_fg_tilemap;
r14896r14897
8285static TILE_GET_INFO( get_fg_tile_info )
8386{
8487   onetwo_state *state = machine.driver_data<onetwo_state>();
85   int code = (state->m_fgram[tile_index * 2 + 1] << 8) | state->m_fgram[tile_index * 2];
86   int color = (state->m_fgram[tile_index * 2 + 1] & 0x80) >> 7;
88   int code = (state->m_fgram.target()[tile_index * 2 + 1] << 8) | state->m_fgram.target()[tile_index * 2];
89   int color = (state->m_fgram.target()[tile_index * 2 + 1] & 0x80) >> 7;
8790
8891   code &= 0x7fff;
8992
r14896r14897
111114
112115WRITE8_MEMBER(onetwo_state::onetwo_fgram_w)
113116{
114   m_fgram[offset] = data;
117   m_fgram.target()[offset] = data;
115118   m_fg_tilemap->mark_tile_dirty(offset / 2);
116119}
117120
r14896r14897
129132
130133WRITE8_MEMBER(onetwo_state::onetwo_soundlatch_w)
131134{
132   soundlatch_w(space, 0, data);
135   soundlatch_byte_w(space, 0, data);
133136   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
134137}
135138
r14896r14897
138141   onetwo_state *state = machine.driver_data<onetwo_state>();
139142   int r, g, b;
140143
141   r = state->m_paletteram[offset] & 0x1f;
142   g = state->m_paletteram2[offset] & 0x1f;
143   b = ((state->m_paletteram[offset] & 0x60) >> 2) | ((state->m_paletteram2[offset] & 0xe0) >> 5);
144   r = state->m_paletteram.target()[offset] & 0x1f;
145   g = state->m_paletteram2.target()[offset] & 0x1f;
146   b = ((state->m_paletteram.target()[offset] & 0x60) >> 2) | ((state->m_paletteram2.target()[offset] & 0xe0) >> 5);
144147   palette_set_color_rgb(machine, offset, pal5bit(r), pal5bit(g), pal5bit(b));
145148}
146149
147150WRITE8_MEMBER(onetwo_state::palette1_w)
148151{
149   m_paletteram[offset] = data;
152   m_paletteram.target()[offset] = data;
150153   set_color(machine(), offset);
151154}
152155
153156WRITE8_MEMBER(onetwo_state::palette2_w)
154157{
155   m_paletteram2[offset] = data;
158   m_paletteram2.target()[offset] = data;
156159   set_color(machine(), offset);
157160}
158161
r14896r14897
165168static ADDRESS_MAP_START( main_cpu, AS_PROGRAM, 8, onetwo_state )
166169   AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION("maincpu", 0x10000)
167170   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
168   AM_RANGE(0xc800, 0xc87f) AM_RAM_WRITE(palette1_w) AM_BASE(m_paletteram)
169   AM_RANGE(0xc900, 0xc97f) AM_RAM_WRITE(palette2_w) AM_BASE(m_paletteram2)
170   AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(onetwo_fgram_w) AM_BASE(m_fgram)
171   AM_RANGE(0xc800, 0xc87f) AM_RAM_WRITE(palette1_w) AM_SHARE("paletteram")
172   AM_RANGE(0xc900, 0xc97f) AM_RAM_WRITE(palette2_w) AM_SHARE("paletteram2")
173   AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(onetwo_fgram_w) AM_SHARE("fgram")
171174   AM_RANGE(0xe000, 0xffff) AM_RAM
172175ADDRESS_MAP_END
173176
r14896r14897
183186static ADDRESS_MAP_START( sound_cpu, AS_PROGRAM, 8, onetwo_state )
184187   AM_RANGE(0x0000, 0x5fff) AM_ROM
185188   AM_RANGE(0xf000, 0xf7ff) AM_RAM
186   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
189   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
187190ADDRESS_MAP_END
188191
189192static ADDRESS_MAP_START( sound_cpu_io, AS_IO, 8, onetwo_state )
r14896r14897
191194   AM_RANGE(0x00, 0x00) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_status_port_r, ym3812_control_port_w)
192195   AM_RANGE(0x20, 0x20) AM_DEVWRITE_LEGACY("ymsnd", ym3812_write_port_w)
193196   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
194   AM_RANGE(0xc0, 0xc0) AM_WRITE(soundlatch_clear_w)
197   AM_RANGE(0xc0, 0xc0) AM_WRITE(soundlatch_clear_byte_w)
195198ADDRESS_MAP_END
196199
197200/*************************************
src/mame/drivers/gng.c
r14896r14897
5050   AM_RANGE(0x3002, 0x3002) AM_READ_PORT("P2")
5151   AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DSW1")
5252   AM_RANGE(0x3004, 0x3004) AM_READ_PORT("DSW2")
53   AM_RANGE(0x3800, 0x38ff) AM_WRITE(paletteram_RRRRGGGGBBBBxxxx_split2_w) AM_SHARE("paletteram2")
54   AM_RANGE(0x3900, 0x39ff) AM_WRITE(paletteram_RRRRGGGGBBBBxxxx_split1_w) AM_SHARE("paletteram")
55   AM_RANGE(0x3a00, 0x3a00) AM_WRITE(soundlatch_w)
53   AM_RANGE(0x3800, 0x38ff) AM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_split_hi_w) AM_SHARE("paletteram2")
54   AM_RANGE(0x3900, 0x39ff) AM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_split_lo_w) AM_SHARE("paletteram")
55   AM_RANGE(0x3a00, 0x3a00) AM_WRITE(soundlatch_byte_w)
5656   AM_RANGE(0x3b08, 0x3b09) AM_WRITE(gng_bgscrollx_w)
5757   AM_RANGE(0x3b0a, 0x3b0b) AM_WRITE(gng_bgscrolly_w)
5858   AM_RANGE(0x3c00, 0x3c00) AM_NOP /* watchdog? */
r14896r14897
6969static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, gng_state )
7070   AM_RANGE(0x0000, 0x7fff) AM_ROM
7171   AM_RANGE(0xc000, 0xc7ff) AM_RAM
72   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
72   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r)
7373   AM_RANGE(0xe000, 0xe001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
7474   AM_RANGE(0xe002, 0xe003) AM_DEVWRITE_LEGACY("ym2", ym2203_w)
7575ADDRESS_MAP_END
src/mame/drivers/gts3.c
r14896r14897
516516ROM_END
517517
518518/*-------------------------------------------------------------------
519/ Street Fighter 2
519/ Street Fighter II
520520/-------------------------------------------------------------------*/
521521ROM_START(sfight2)
522522   ROM_REGION(0x10000, "maincpu", 0)
r14896r14897
941941GAME(1995,   stargatp2,   stargatp,   gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Stargate (rev.2)",            GAME_IS_SKELETON_MECHANICAL)
942942GAME(1995,   stargatp3,   stargatp,   gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Stargate (rev.3)",            GAME_IS_SKELETON_MECHANICAL)
943943GAME(1995,   stargatp4,   stargatp,   gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Stargate (rev.4)",            GAME_IS_SKELETON_MECHANICAL)
944GAME(1993,   sfight2,   0,         gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Street Fighter 2",            GAME_IS_SKELETON_MECHANICAL)
945GAME(1993,   sfight2a,   sfight2,   gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Street Fighter 2 (rev.1)",            GAME_IS_SKELETON_MECHANICAL)
946GAME(1993,   sfight2b,   sfight2,   gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Street Fighter 2 (rev.2)",            GAME_IS_SKELETON_MECHANICAL)
944GAME(1993,   sfight2,   0,         gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Street Fighter II",            GAME_IS_SKELETON_MECHANICAL)
945GAME(1993,   sfight2a,   sfight2,   gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Street Fighter II (rev.1)",            GAME_IS_SKELETON_MECHANICAL)
946GAME(1993,   sfight2b,   sfight2,   gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Street Fighter II (rev.2)",            GAME_IS_SKELETON_MECHANICAL)
947947GAME(1992,   smb,      0,         gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Super Mario Brothers",            GAME_IS_SKELETON_MECHANICAL)
948948GAME(1992,   smb1,      smb,      gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Super Mario Brothers (rev.1)",            GAME_IS_SKELETON_MECHANICAL)
949949GAME(1992,   smb2,      smb,      gts3,   gts3,   gts3,   ROT0,   "Gottlieb",            "Super Mario Brothers (rev.2)",            GAME_IS_SKELETON_MECHANICAL)
src/mame/drivers/wc90b.c
r14896r14897
116116
117117WRITE8_MEMBER(wc90b_state::wc90b_sound_command_w)
118118{
119   soundlatch_w(space, offset, data);
119   soundlatch_byte_w(space, offset, data);
120120   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
121121}
122122
r14896r14897
164164   AM_RANGE(0xc000, 0xcfff) AM_RAM
165165   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
166166   AM_RANGE(0xd800, 0xdfff) AM_RAM
167   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_be_w) AM_SHARE("paletteram")
167   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_be_w) AM_SHARE("paletteram")
168168   AM_RANGE(0xe800, 0xefff) AM_ROM
169169   AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank2")
170170   AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("share1")
r14896r14897
178178   AM_RANGE(0xe400, 0xe400) AM_WRITE(adpcm_data_w)
179179   AM_RANGE(0xe800, 0xe801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
180180   AM_RANGE(0xf000, 0xf7ff) AM_RAM
181   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
181   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
182182ADDRESS_MAP_END
183183
184184
src/mame/drivers/liberate.c
r14896r14897
314314   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE_LEGACY("ay1", ay8910_address_w)
315315   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_LEGACY("ay2", ay8910_data_w)
316316   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE_LEGACY("ay2", ay8910_address_w)
317   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
317   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
318318   AM_RANGE(0xc000, 0xc000) AM_WRITENOP //irq ack
319319   AM_RANGE(0xe000, 0xffff) AM_ROM
320320ADDRESS_MAP_END
r14896r14897
326326   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE_LEGACY("ay1", ay8910_address_w)
327327   AM_RANGE(0x7000, 0x7000) AM_DEVWRITE_LEGACY("ay2", ay8910_data_w)
328328   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE_LEGACY("ay2", ay8910_address_w)
329   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_r)
329   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_byte_r)
330330   AM_RANGE(0xc000, 0xffff) AM_ROM
331331ADDRESS_MAP_END
332332
src/mame/drivers/gunsmoke.c
r14896r14897
106106   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1")
107107   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
108108   AM_RANGE(0xc4c9, 0xc4cb) AM_READ(gunsmoke_protection_r)
109   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
109   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_byte_w)
110110   AM_RANGE(0xc804, 0xc804) AM_WRITE(gunsmoke_c804_w)   // ROM bank switch, screen flip
111111   AM_RANGE(0xc806, 0xc806) AM_WRITE(watchdog_reset_w)
112112   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(gunsmoke_videoram_w) AM_BASE(m_videoram)
r14896r14897
121121static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, gunsmoke_state )
122122   AM_RANGE(0x0000, 0x7fff) AM_ROM
123123   AM_RANGE(0xc000, 0xc7ff) AM_RAM
124   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
124   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r)
125125   AM_RANGE(0xe000, 0xe001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
126126   AM_RANGE(0xe002, 0xe003) AM_DEVWRITE_LEGACY("ym2", ym2203_w)
127127ADDRESS_MAP_END
src/mame/drivers/seta.c
r14896r14897
13791379/*------------------------------
13801380    timer write handler
13811381------------------------------*/
1382static WRITE16_HANDLER( timer_regs_w )
1382WRITE16_MEMBER(seta_state::timer_regs_w)
13831383{
1384   seta_state *state = space->machine().driver_data<seta_state>();
1385   uPD71054_state *uPD71054 = &state->m_uPD71054;
1384   uPD71054_state *uPD71054 = &m_uPD71054;
13861385
13871386   data &= 0xff;
13881387
r14896r14897
14011400         uPD71054->max[offset] = (uPD71054->max[offset]&0x00ff)+(data<<8);
14021401      }
14031402      if( uPD71054->max[offset] != 0 ) {
1404         uPD71054_update_timer( space->machine(), &space->device(), offset );
1403         uPD71054_update_timer( machine(), &space.device(), offset );
14051404      }
14061405      break;
14071406     case 0x0003:
r14896r14897
14631462
14641463*/
14651464
1466static READ16_HANDLER( sharedram_68000_r )
1465READ16_MEMBER(seta_state::sharedram_68000_r)
14671466{
1468   seta_state *state = space->machine().driver_data<seta_state>();
14691467
1470   return ((UINT16)state->m_sharedram[offset]) & 0xff;
1468   return ((UINT16)m_sharedram[offset]) & 0xff;
14711469}
14721470
1473static WRITE16_HANDLER( sharedram_68000_w )
1471WRITE16_MEMBER(seta_state::sharedram_68000_w)
14741472{
14751473   if (ACCESSING_BITS_0_7)
14761474   {
1477      seta_state *state = space->machine().driver_data<seta_state>();
1478      state->m_sharedram[offset] = data & 0xff;
1475      m_sharedram[offset] = data & 0xff;
14791476   }
14801477}
14811478
r14896r14897
14881485
14891486*/
14901487
1491static WRITE16_HANDLER( sub_ctrl_w )
1488WRITE16_MEMBER(seta_state::sub_ctrl_w)
14921489{
1493   seta_state *state = space->machine().driver_data<seta_state>();
14941490   switch(offset)
14951491   {
14961492      case 0/2:   // bit 0: reset sub cpu?
14971493         if (ACCESSING_BITS_0_7)
14981494         {
1499            seta_state *state = space->machine().driver_data<seta_state>();
15001495
1501            if ( !(state->m_sub_ctrl_data & 1) && (data & 1) )
1502               cputag_set_input_line(space->machine(), "sub", INPUT_LINE_RESET, PULSE_LINE);
1503            state->m_sub_ctrl_data = data;
1496            if ( !(m_sub_ctrl_data & 1) && (data & 1) )
1497               cputag_set_input_line(machine(), "sub", INPUT_LINE_RESET, PULSE_LINE);
1498            m_sub_ctrl_data = data;
15041499         }
15051500         break;
15061501
r14896r14897
15081503         break;
15091504
15101505      case 4/2:   // not sure
1511         if (ACCESSING_BITS_0_7)   state->soundlatch_w(*space, 0, data & 0xff);
1506         if (ACCESSING_BITS_0_7)   soundlatch_byte_w(*&space, 0, data & 0xff);
15121507         break;
15131508
15141509      case 6/2:   // not sure
1515         if (ACCESSING_BITS_0_7)   state->soundlatch2_w(*space, 0, data & 0xff);
1510         if (ACCESSING_BITS_0_7)   soundlatch2_byte_w(*&space, 0, data & 0xff);
15161511         break;
15171512   }
15181513
r14896r14897
15201515
15211516
15221517/* DSW reading for 16 bit CPUs */
1523static READ16_HANDLER( seta_dsw_r )
1518READ16_MEMBER(seta_state::seta_dsw_r)
15241519{
1525   UINT16 dsw = input_port_read(space->machine(), "DSW");
1520   UINT16 dsw = input_port_read(machine(), "DSW");
15261521   if (offset == 0)   return (dsw >> 8) & 0xff;
15271522   else            return (dsw >> 0) & 0xff;
15281523}
r14896r14897
15931588/**/AM_RANGE(0x600000, 0x6005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)      // Sprites Y
15941589   AM_RANGE(0x600600, 0x600607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
15951590
1596   AM_RANGE(0x800000, 0x800007) AM_WRITE_LEGACY(sub_ctrl_w)            // Sub CPU Control?
1597   AM_RANGE(0xa00000, 0xa00fff) AM_READWRITE_LEGACY(sharedram_68000_r,sharedram_68000_w)   // Shared RAM
1591   AM_RANGE(0x800000, 0x800007) AM_WRITE(sub_ctrl_w)            // Sub CPU Control?
1592   AM_RANGE(0xa00000, 0xa00fff) AM_READWRITE(sharedram_68000_r,sharedram_68000_w)   // Shared RAM
15981593   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
15991594   AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_SHARE("share1")               // RAM (Mirrored?)
16001595   AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_SHARE("share1")               // RAM (Mirrored?)
r14896r14897
16131608   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                  // IRQ enable/acknowledge?
16141609   AM_RANGE(0x400000, 0x400007) AM_WRITE(twineagl_tilebank_w)      // special tile banking to animate water in twineagl
16151610   AM_RANGE(0x500000, 0x500001) AM_WRITENOP                  // ?
1616   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
1611   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
16171612   AM_RANGE(0x700000, 0x7003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
16181613   AM_RANGE(0x800000, 0x800005) AM_WRITEONLY AM_BASE(m_vctrl_0)// VRAM Ctrl
16191614   AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(seta_vram_0_w) AM_BASE(m_vram_0)   // VRAM
1620   AM_RANGE(0xa00000, 0xa00007) AM_WRITE_LEGACY(sub_ctrl_w)            // Sub CPU Control?
1621   AM_RANGE(0xb00000, 0xb00fff) AM_READWRITE_LEGACY(sharedram_68000_r,sharedram_68000_w)   // Shared RAM
1615   AM_RANGE(0xa00000, 0xa00007) AM_WRITE(sub_ctrl_w)            // Sub CPU Control?
1616   AM_RANGE(0xb00000, 0xb00fff) AM_READWRITE(sharedram_68000_r,sharedram_68000_w)   // Shared RAM
16221617   AM_RANGE(0xc00000, 0xc00001) AM_WRITENOP                  // ? $4000
16231618   AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)      // Sprites Y
16241619   AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
r14896r14897
16311626                                Caliber 50
16321627***************************************************************************/
16331628
1634static READ16_HANDLER ( calibr50_ip_r )
1629READ16_MEMBER(seta_state::calibr50_ip_r)
16351630{
1636   int dir1 = input_port_read(space->machine(), "ROT1");   // analog port
1637   int dir2 = input_port_read(space->machine(), "ROT2");   // analog port
1631   int dir1 = input_port_read(machine(), "ROT1");   // analog port
1632   int dir2 = input_port_read(machine(), "ROT2");   // analog port
16381633
16391634   switch (offset)
16401635   {
1641      case 0x00/2:   return input_port_read(space->machine(), "P1");   // p1
1642      case 0x02/2:   return input_port_read(space->machine(), "P2");   // p2
1636      case 0x00/2:   return input_port_read(machine(), "P1");   // p1
1637      case 0x02/2:   return input_port_read(machine(), "P2");   // p2
16431638
1644      case 0x08/2:   return input_port_read(space->machine(), "COINS");   // Coins
1639      case 0x08/2:   return input_port_read(machine(), "COINS");   // Coins
16451640
16461641      case 0x10/2:   return (dir1 & 0xff);      // lower 8 bits of p1 rotation
16471642      case 0x12/2:   return (dir1 >> 8);         // upper 4 bits of p1 rotation
r14896r14897
16491644      case 0x16/2:   return (dir2 >> 8);         // upper 4 bits of p2 rotation
16501645      case 0x18/2:   return 0xffff;            // ? (value's read but not used)
16511646      default:
1652         logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space->device()), offset*2);
1647         logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset*2);
16531648         return 0;
16541649   }
16551650}
16561651
1657static WRITE16_HANDLER( calibr50_soundlatch_w )
1652WRITE16_MEMBER(seta_state::calibr50_soundlatch_w)
16581653{
1659   seta_state *state = space->machine().driver_data<seta_state>();
16601654   if (ACCESSING_BITS_0_7)
16611655   {
1662      state->soundlatch_word_w(*space, 0, data, mem_mask);
1663      cputag_set_input_line(space->machine(), "sub", INPUT_LINE_NMI, PULSE_LINE);
1664      device_spin_until_time(&space->device(), attotime::from_usec(50));   // Allow the other cpu to reply
1656      soundlatch_word_w(*&space, 0, data, mem_mask);
1657      cputag_set_input_line(machine(), "sub", INPUT_LINE_NMI, PULSE_LINE);
1658      device_spin_until_time(&space.device(), attotime::from_usec(50));   // Allow the other cpu to reply
16651659   }
16661660}
16671661
r14896r14897
16741668   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                  // ? (random value)
16751669   AM_RANGE(0x400000, 0x400001) AM_READ(watchdog_reset16_r)      // Watchdog
16761670   AM_RANGE(0x500000, 0x500001) AM_WRITENOP                  // ?
1677   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
1671   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
16781672   AM_RANGE(0x700000, 0x7003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
16791673   AM_RANGE(0x800000, 0x800005) AM_WRITEONLY AM_BASE(m_vctrl_0)// VRAM Ctrl
16801674   AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(seta_vram_0_w) AM_BASE(m_vram_0)   // VRAM
16811675
16821676   AM_RANGE(0x904000, 0x904fff) AM_RAM                        //
1683   AM_RANGE(0xa00000, 0xa00019) AM_READ_LEGACY(calibr50_ip_r)            // Input Ports
1677   AM_RANGE(0xa00000, 0xa00019) AM_READ(calibr50_ip_r)            // Input Ports
16841678/**/AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)      // Sprites Y
16851679   AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
16861680   AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
1687   AM_RANGE(0xb00000, 0xb00001) AM_READ(soundlatch2_word_r) AM_WRITE_LEGACY(calibr50_soundlatch_w)   // From Sub CPU
1681   AM_RANGE(0xb00000, 0xb00001) AM_READ(soundlatch2_word_r) AM_WRITE(calibr50_soundlatch_w)   // From Sub CPU
16881682/**/AM_RANGE(0xc00000, 0xc00001) AM_RAM                        // ? $4000
16891683ADDRESS_MAP_END
16901684
r14896r14897
16931687                                U.S. Classic
16941688***************************************************************************/
16951689
1696static READ16_HANDLER( usclssic_dsw_r )
1690READ16_MEMBER(seta_state::usclssic_dsw_r)
16971691{
16981692   switch (offset)
16991693   {
1700      case 0/2:   return (input_port_read(space->machine(), "DSW") >>  8) & 0xf;
1701      case 2/2:   return (input_port_read(space->machine(), "DSW") >> 12) & 0xf;
1702      case 4/2:   return (input_port_read(space->machine(), "DSW") >>  0) & 0xf;
1703      case 6/2:   return (input_port_read(space->machine(), "DSW") >>  4) & 0xf;
1694      case 0/2:   return (input_port_read(machine(), "DSW") >>  8) & 0xf;
1695      case 2/2:   return (input_port_read(machine(), "DSW") >> 12) & 0xf;
1696      case 4/2:   return (input_port_read(machine(), "DSW") >>  0) & 0xf;
1697      case 6/2:   return (input_port_read(machine(), "DSW") >>  4) & 0xf;
17041698   }
17051699   return 0;
17061700}
17071701
1708static READ16_HANDLER( usclssic_trackball_x_r )
1702READ16_MEMBER(seta_state::usclssic_trackball_x_r)
17091703{
17101704   static const char *const portx_name[2] = { "P1X", "P2X" };
1711   seta_state *state = space->machine().driver_data<seta_state>();
17121705
17131706   switch (offset)
17141707   {
1715      case 0/2:   return (input_port_read(space->machine(), portx_name[state->m_usclssic_port_select]) >> 0) & 0xff;
1716      case 2/2:   return (input_port_read(space->machine(), portx_name[state->m_usclssic_port_select]) >> 8) & 0xff;
1708      case 0/2:   return (input_port_read(machine(), portx_name[m_usclssic_port_select]) >> 0) & 0xff;
1709      case 2/2:   return (input_port_read(machine(), portx_name[m_usclssic_port_select]) >> 8) & 0xff;
17171710   }
17181711   return 0;
17191712}
17201713
1721static READ16_HANDLER( usclssic_trackball_y_r )
1714READ16_MEMBER(seta_state::usclssic_trackball_y_r)
17221715{
17231716   static const char *const porty_name[2] = { "P1Y", "P2Y" };
1724   seta_state *state = space->machine().driver_data<seta_state>();
17251717
17261718   switch (offset)
17271719   {
1728      case 0/2:   return (input_port_read(space->machine(), porty_name[state->m_usclssic_port_select]) >> 0) & 0xff;
1729      case 2/2:   return (input_port_read(space->machine(), porty_name[state->m_usclssic_port_select]) >> 8) & 0xff;
1720      case 0/2:   return (input_port_read(machine(), porty_name[m_usclssic_port_select]) >> 0) & 0xff;
1721      case 2/2:   return (input_port_read(machine(), porty_name[m_usclssic_port_select]) >> 8) & 0xff;
17301722   }
17311723   return 0;
17321724}
17331725
17341726
1735static WRITE16_HANDLER( usclssic_lockout_w )
1727WRITE16_MEMBER(seta_state::usclssic_lockout_w)
17361728{
17371729   if (ACCESSING_BITS_0_7)
17381730   {
1739      seta_state *state = space->machine().driver_data<seta_state>();
17401731      int tiles_offset = (data & 0x10) ? 0x4000: 0;
17411732
1742      state->m_usclssic_port_select = (data & 0x40) >> 6;
1733      m_usclssic_port_select = (data & 0x40) >> 6;
17431734
1744      if (tiles_offset != state->m_tiles_offset)
1745         space->machine().tilemap().mark_all_dirty();
1746      state->m_tiles_offset = tiles_offset;
1735      if (tiles_offset != m_tiles_offset)
1736         machine().tilemap().mark_all_dirty();
1737      m_tiles_offset = tiles_offset;
17471738
1748      seta_coin_lockout_w(space->machine(), data);
1739      seta_coin_lockout_w(machine(), data);
17491740   }
17501741}
17511742
r14896r14897
17581749/**/AM_RANGE(0x900000, 0x900001) AM_RAM                           // ? $4000
17591750   AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE(m_vctrl_0)         // VRAM Ctrl
17601751/**/AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
1761   AM_RANGE(0xb40000, 0xb40003) AM_READ_LEGACY(usclssic_trackball_x_r)      // TrackBall X
1762   AM_RANGE(0xb40000, 0xb40001) AM_WRITE_LEGACY(usclssic_lockout_w)         // Coin Lockout + Tiles Banking
1763   AM_RANGE(0xb40004, 0xb40007) AM_READ_LEGACY(usclssic_trackball_y_r)      // TrackBall Y + Buttons
1752   AM_RANGE(0xb40000, 0xb40003) AM_READ(usclssic_trackball_x_r)      // TrackBall X
1753   AM_RANGE(0xb40000, 0xb40001) AM_WRITE(usclssic_lockout_w)         // Coin Lockout + Tiles Banking
1754   AM_RANGE(0xb40004, 0xb40007) AM_READ(usclssic_trackball_y_r)      // TrackBall Y + Buttons
17641755   AM_RANGE(0xb4000a, 0xb4000b) AM_WRITENOP                     // ? (value's not important. In lev2&6)
17651756   AM_RANGE(0xb40010, 0xb40011) AM_READ_PORT("COINS")               // Coins
1766   AM_RANGE(0xb40010, 0xb40011) AM_WRITE_LEGACY(calibr50_soundlatch_w)      // To Sub CPU
1767   AM_RANGE(0xb40018, 0xb4001f) AM_READ_LEGACY(usclssic_dsw_r)            // 2 DSWs
1757   AM_RANGE(0xb40010, 0xb40011) AM_WRITE(calibr50_soundlatch_w)      // To Sub CPU
1758   AM_RANGE(0xb40018, 0xb4001f) AM_READ(usclssic_dsw_r)            // 2 DSWs
17681759   AM_RANGE(0xb40018, 0xb40019) AM_WRITE(watchdog_reset16_w)         // Watchdog
17691760   AM_RANGE(0xb80000, 0xb80001) AM_READNOP                        // Watchdog (value is discarded)?
17701761   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)         // Sprites Code + X + Attr
r14896r14897
17851776   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                  // ? watchdog ?
17861777   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                  // ? 0 (irq ack lev 2?)
17871778   AM_RANGE(0x500000, 0x500001) AM_WRITENOP                  // ? (end of lev 1: bit 4 goes 1,0,1)
1788   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
1779   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
17891780   AM_RANGE(0x700000, 0x7003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
17901781   AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)      // Sprites Y
17911782   AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
r14896r14897
18101801   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
18111802   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
18121803   AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // (gundhara) Coin Lockout + Video Registers
1813   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
1804   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
18141805   AM_RANGE(0x700000, 0x7003ff) AM_RAM                        // (rezon,jjsquawk)
18151806   AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
18161807   AM_RANGE(0x703c00, 0x7047ff) AM_RAM AM_BASE_SIZE(m_paletteram2, m_paletteram2_size)   // 2nd Palette for the palette offset effect
r14896r14897
18451836   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
18461837   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
18471838   AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs) // (gundhara) Coin Lockout + Video Registers
1848   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
1839   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
18491840   AM_RANGE(0x700000, 0x7003ff) AM_RAM                        // (rezon,jjsquawk)
18501841   AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
18511842   AM_RANGE(0x703c00, 0x7047ff) AM_RAM AM_BASE_SIZE(m_paletteram2, m_paletteram2_size)   // 2nd Palette for the palette offset effect
r14896r14897
18711862                    and Zombie Raid (with slight variations)
18721863***************************************************************************/
18731864
1874static READ16_HANDLER( zombraid_gun_r ) // Serial interface
1865READ16_MEMBER(seta_state::zombraid_gun_r)// Serial interface
18751866{
18761867   static const char *const portnames[] = { "GUNX1", "GUNY1", "GUNX2", "GUNY2" };
1877   seta_state *state = space->machine().driver_data<seta_state>();
18781868
1879   int data = input_port_read(space->machine(), portnames[state->m_gun_input_src]);   // Input Ports 5-8
1880   return (data >> state->m_gun_input_bit) & 1;
1869   int data = input_port_read(machine(), portnames[m_gun_input_src]);   // Input Ports 5-8
1870   return (data >> m_gun_input_bit) & 1;
18811871}
18821872
18831873// Bit 0 is clock, 1 is data, 2 is reset
1884static WRITE16_HANDLER( zombraid_gun_w )
1874WRITE16_MEMBER(seta_state::zombraid_gun_w)
18851875{
1886   seta_state *state = space->machine().driver_data<seta_state>();
18871876
1888   if(data&4) { state->m_gun_bit_count = 0; return; } // Reset
1877   if(data&4) { m_gun_bit_count = 0; return; } // Reset
18891878
1890   if((data&1) == state->m_gun_old_clock) return; // No change
1879   if((data&1) == m_gun_old_clock) return; // No change
18911880
1892   if(state->m_gun_old_clock == 0) // Rising edge
1881   if(m_gun_old_clock == 0) // Rising edge
18931882   {
1894      switch (state->m_gun_bit_count)
1883      switch (m_gun_bit_count)
18951884      {
18961885         case 0:
18971886         case 1: // Starting sequence 2,3,2,3. Other inputs?
18981887            break;
18991888         case 2: // First bit of source
1900            state->m_gun_input_src = (state->m_gun_input_src&2) | (data>>1);
1889            m_gun_input_src = (m_gun_input_src&2) | (data>>1);
19011890            break;
19021891         case 3: // Second bit of source
1903            state->m_gun_input_src = (state->m_gun_input_src&1) | (data&2);
1892            m_gun_input_src = (m_gun_input_src&1) | (data&2);
19041893            break;
19051894         default:
19061895            /* Gun Recoils */
r14896r14897
19081897            output_set_value("Player1_Gun_Recoil", (data & 0x10)>>4 );
19091898            output_set_value("Player2_Gun_Recoil", (data & 0x8)>>3 );
19101899
1911            state->m_gun_input_bit = state->m_gun_bit_count - 4;
1912            state->m_gun_input_bit = 8 - state->m_gun_input_bit; // Reverse order
1900            m_gun_input_bit = m_gun_bit_count - 4;
1901            m_gun_input_bit = 8 - m_gun_input_bit; // Reverse order
19131902            break;
19141903      }
1915      state->m_gun_bit_count++;
1904      m_gun_bit_count++;
19161905   }
19171906
1918   state->m_gun_old_clock = data & 1;
1907   m_gun_old_clock = data & 1;
19191908}
19201909
19211910static ADDRESS_MAP_START( wrofaero_map, AS_PROGRAM, 16, seta_state )
r14896r14897
19281917   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
19291918   AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // (gundhara) Coin Lockout + Video Registers
19301919
1931   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
1920   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
19321921   AM_RANGE(0x700000, 0x7003ff) AM_RAM                        // (rezon,jjsquawk)
19331922   AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
19341923   AM_RANGE(0x701000, 0x70ffff) AM_RAM                        //
r14896r14897
19441933   AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
19451934   AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
19461935#if __uPD71054_TIMER
1947   AM_RANGE(0xd00000, 0xd00007) AM_WRITE_LEGACY(timer_regs_w)            // ?
1936   AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w)            // ?
19481937#else
19491938   AM_RANGE(0xd00000, 0xd00007) AM_WRITENOP                  // ?
19501939#endif
r14896r14897
19521941   AM_RANGE(0xf00000, 0xf00001) AM_WRITENOP                  // ? Sound  IRQ Ack
19531942ADDRESS_MAP_END
19541943
1955static READ16_HANDLER( zingzipbl_unknown_r )
1944READ16_MEMBER(seta_state::zingzipbl_unknown_r)
19561945{
19571946   return 0x0000;
19581947}
r14896r14897
19641953   AM_RANGE(0x300000, 0x30ffff) AM_RAM                        // RAM (wrofaero only?)
19651954//  AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")                 // P1
19661955//  AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")                 // P2
1967   AM_RANGE(0x400002, 0x400003) AM_READ_LEGACY(zingzipbl_unknown_r)      // P2
1956   AM_RANGE(0x400002, 0x400003) AM_READ(zingzipbl_unknown_r)      // P2
19681957//  AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")              // Coins
19691958   AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // (gundhara) Coin Lockout + Video Registers
19701959
1971   //AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)              // DSW
1960   //AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)              // DSW
19721961   AM_RANGE(0x700000, 0x7003ff) AM_RAM                        // (rezon,jjsquawk)
19731962   AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
19741963   AM_RANGE(0x701000, 0x70ffff) AM_RAM                        //
r14896r14897
19781967   AM_RANGE(0x884000, 0x88ffff) AM_RAM                        // (jjsquawk)
19791968/**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE(m_vctrl_0)      // VRAM 0&1 Ctrl
19801969
1981   AM_RANGE(0x902010, 0x902013) AM_READ_LEGACY(zingzipbl_unknown_r )
1970   AM_RANGE(0x902010, 0x902013) AM_READ(zingzipbl_unknown_r )
19821971
19831972/**/AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE(m_vctrl_2)      // VRAM 2&3 Ctrl
19841973/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)      // Sprites Y
r14896r14897
19871976   AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
19881977   AM_RANGE(0xc00000, 0xc03fff) AM_RAM // soundram on original
19891978#if __uPD71054_TIMER
1990   AM_RANGE(0xd00000, 0xd00007) AM_WRITE_LEGACY(timer_regs_w)            // ?
1979   AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w)            // ?
19911980#else
19921981   AM_RANGE(0xd00000, 0xd00007) AM_WRITENOP                  // ?
19931982#endif
r14896r14897
20051994   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
20061995   AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // (gundhara) Coin Lockout + Video Registers
20071996
2008   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
1997   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
20091998   AM_RANGE(0x700000, 0x70b3ff) AM_RAM                        // RZ: (rezon,jjsquawk)
20101999   AM_RANGE(0x70b400, 0x70bfff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
20112000   AM_RANGE(0x70c000, 0x70ffff) AM_RAM                        //
r14896r14897
20202009   AM_RANGE(0xb0c000, 0xb0ffff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // RZ: Sprites Code + X + Attr
20212010   AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
20222011#if __uPD71054_TIMER
2023   AM_RANGE(0xd00000, 0xd00007) AM_WRITE_LEGACY(timer_regs_w)            // ?
2012   AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w)            // ?
20242013#else
20252014   AM_RANGE(0xd00000, 0xd00007) AM_WRITENOP                  // ?
20262015#endif
r14896r14897
20372026   AM_RANGE(0xf00000, 0xf0ffff) AM_RAM                        // RAM
20382027   AM_RANGE(0x100000, 0x100001) AM_READNOP                     // ?
20392028   AM_RANGE(0x200000, 0x200001) AM_READNOP                     // ?
2040   AM_RANGE(0x300000, 0x300003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2029   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r)            // DSW
20412030   AM_RANGE(0x400000, 0x400001) AM_WRITENOP                  // ?
20422031   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
20432032   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
20442033   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")            // Coins
2045   //AM_RANGE(0x600000, 0x60000f) AM_READ_LEGACY(krzybowl_input_r     )   // P1
2034   //AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r     )   // P1
20462035   AM_RANGE(0x8000f0, 0x8000f1) AM_RAM                        // NVRAM
20472036   AM_RANGE(0x800100, 0x8001ff) AM_RAM                        // NVRAM
20482037   AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
r14896r14897
20672056};
20682057
20692058
2070static READ16_HANDLER( keroppi_protection_r )
2059READ16_MEMBER(seta_state::keroppi_protection_r)
20712060{
2072   seta_state *state = space->machine().driver_data<seta_state>();
2073   UINT16 result = keroppi_protection_word[state->m_keroppi_protection_count];
2061   UINT16 result = keroppi_protection_word[m_keroppi_protection_count];
20742062
2075   state->m_keroppi_protection_count++;
2076   if (state->m_keroppi_protection_count > 15)
2077      state->m_keroppi_protection_count = 15;
2063   m_keroppi_protection_count++;
2064   if (m_keroppi_protection_count > 15)
2065      m_keroppi_protection_count = 15;
20782066
20792067   return result;
20802068}
20812069
2082static READ16_HANDLER( keroppi_protection_init_r )
2070READ16_MEMBER(seta_state::keroppi_protection_init_r)
20832071{
2084   seta_state *state = space->machine().driver_data<seta_state>();
2085   state->m_keroppi_protection_count = 0;
2072   m_keroppi_protection_count = 0;
20862073
20872074   return 0x00;
20882075}
20892076
2090static READ16_HANDLER( keroppi_coin_r )
2077READ16_MEMBER(seta_state::keroppi_coin_r)
20912078{
2092   seta_state *state = space->machine().driver_data<seta_state>();
2093   UINT16 result = input_port_read(space->machine(), "COINS");
2079   UINT16 result = input_port_read(machine(), "COINS");
20942080
2095   if (state->m_keroppi_prize_hop == 2)
2081   if (m_keroppi_prize_hop == 2)
20962082   {
20972083      result &= ~0x0002;      /* prize hopper */
2098      state->m_keroppi_prize_hop = 0;
2084      m_keroppi_prize_hop = 0;
20992085   }
21002086
21012087   return result;
r14896r14897
21072093   state->m_keroppi_prize_hop = 2;
21082094}
21092095
2110static WRITE16_HANDLER( keroppi_prize_w )
2096WRITE16_MEMBER(seta_state::keroppi_prize_w)
21112097{
2112   seta_state *state = space->machine().driver_data<seta_state>();
2113   if ((data & 0x0010) && !state->m_keroppi_prize_hop)
2098   if ((data & 0x0010) && !m_keroppi_prize_hop)
21142099   {
2115      state->m_keroppi_prize_hop = 1;
2116      space->machine().scheduler().timer_set(attotime::from_seconds(3), FUNC(keroppi_prize_hop_callback), 0x20);      /* 3 seconds */
2100      m_keroppi_prize_hop = 1;
2101      machine().scheduler().timer_set(attotime::from_seconds(3), FUNC(keroppi_prize_hop_callback), 0x20);      /* 3 seconds */
21172102   }
21182103}
21192104
21202105static ADDRESS_MAP_START( keroppi_map, AS_PROGRAM, 16, seta_state )
21212106   AM_RANGE(0x000000, 0x07ffff) AM_ROM                        // ROM
21222107   AM_RANGE(0xf00000, 0xf0ffff) AM_RAM                        // RAM
2123   AM_RANGE(0x100000, 0x100001) AM_READ_LEGACY(keroppi_protection_r)      //
2124   AM_RANGE(0x200000, 0x200001) AM_READ_LEGACY(keroppi_protection_init_r)   //
2125   AM_RANGE(0x300000, 0x300003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2108   AM_RANGE(0x100000, 0x100001) AM_READ(keroppi_protection_r)      //
2109   AM_RANGE(0x200000, 0x200001) AM_READ(keroppi_protection_init_r)   //
2110   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r)            // DSW
21262111   AM_RANGE(0x400000, 0x400001) AM_WRITENOP                  // ?
21272112   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
21282113   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
2129   AM_RANGE(0x500004, 0x500005) AM_READ_LEGACY(keroppi_coin_r)         // Coins
2114   AM_RANGE(0x500004, 0x500005) AM_READ(keroppi_coin_r)         // Coins
21302115   AM_RANGE(0x8000f0, 0x8000f1) AM_RAM                        // NVRAM
21312116   AM_RANGE(0x800100, 0x8001ff) AM_RAM                        // NVRAM
21322117   AM_RANGE(0x900000, 0x900001) AM_WRITENOP                  // ?
2133   AM_RANGE(0x900002, 0x900003) AM_WRITE_LEGACY(keroppi_prize_w)         //
2118   AM_RANGE(0x900002, 0x900003) AM_WRITE(keroppi_prize_w)         //
21342119   AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
21352120   AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
21362121   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
r14896r14897
21582143   AM_RANGE(0xf05000, 0xf050ff) AM_RAM                        // Backup RAM?
21592144   AM_RANGE(0x100000, 0x100001) AM_WRITENOP                  // ? 1 (start of interrupts, main loop: watchdog?)
21602145   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                  // ? 0/1 (IRQ acknowledge?)
2161   AM_RANGE(0x300000, 0x300003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2146   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r)            // DSW
21622147   AM_RANGE(0x400000, 0x400001) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // Coin Lockout + Sound Enable (bit 4?)
21632148   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
21642149   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
r14896r14897
21842169   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
21852170   AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // Coin Lockout + Video Registers
21862171   AM_RANGE(0x500006, 0x500007) AM_READ_PORT("EXTRA")            // Buttons 4,5,6
2187   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r            )   // DSW
2172   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
21882173   AM_RANGE(0x700000, 0x7003ff) AM_RAM
21892174   AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
21902175   AM_RANGE(0x701000, 0x70ffff) AM_RAM                        //
r14896r14897
22172202   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                  // Watchdog
22182203   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                  // ? IRQ Ack
22192204   AM_RANGE(0x500000, 0x500001) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // Coin Lockout + Video Registers
2220   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2205   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
22212206   AM_RANGE(0x700000, 0x7003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
22222207   AM_RANGE(0x800000, 0x800005) AM_RAM AM_BASE(m_vctrl_0)      // VRAM Ctrl
22232208   AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(seta_vram_0_w) AM_BASE(m_vram_0   )   // VRAM
r14896r14897
22392224// the spritey low bits are mapped to 1 in every 4 bytes here as if it were a 32-bit bus..which is weird
22402225// other ram is similar..
22412226
2242static WRITE16_HANDLER( setaroul_spriteylow_w )
2227WRITE16_MEMBER(seta_state::setaroul_spriteylow_w)
22432228{
2244   seta001_device *dev = space->machine().device<seta001_device>("spritegen");
2229   seta001_device *dev = machine().device<seta001_device>("spritegen");
22452230   if ((offset&1)==0) spriteylow_w8(dev, offset>>1, (data & 0xff00) >> 8);
22462231}
22472232
2248static WRITE16_HANDLER( setaroul_spritectrl_w )
2233WRITE16_MEMBER(seta_state::setaroul_spritectrl_w)
22492234{
2250   seta001_device *dev = space->machine().device<seta001_device>("spritegen");
2235   seta001_device *dev = machine().device<seta001_device>("spritegen");
22512236   if ((offset&1)==0) spritectrl_w8(dev, offset>>1, (data & 0xff00) >> 8);
22522237}
22532238
2254static WRITE16_HANDLER( setaroul_spritecode_w )
2239WRITE16_MEMBER(seta_state::setaroul_spritecode_w)
22552240{
2256   seta001_device *dev = space->machine().device<seta001_device>("spritegen");
2241   seta001_device *dev = machine().device<seta001_device>("spritegen");
22572242   if ((offset&1)==1) spritecodelow_w8(dev, offset>>1, (data & 0xff00) >> 8);
22582243   if ((offset&1)==0) spritecodehigh_w8(dev, offset>>1, (data & 0xff00) >> 8);
22592244}
22602245
2261static READ16_HANDLER( setaroul_spritecode_r )
2246READ16_MEMBER(seta_state::setaroul_spritecode_r)
22622247{
22632248   UINT16 ret;
2264   seta001_device *dev = space->machine().device<seta001_device>("spritegen");
2249   seta001_device *dev = machine().device<seta001_device>("spritegen");
22652250   if ((offset&1)==1)
22662251      ret = spritecodelow_r8(dev, offset>>1);
22672252   else
r14896r14897
22962281
22972282   AM_RANGE(0xe00000, 0xe03fff) AM_RAM_WRITE(seta_vram_0_w) AM_BASE(m_vram_0   )   // VRAM - draws wheel if you reset enough times..
22982283   AM_RANGE(0xe40000, 0xe40005) AM_RAM AM_BASE(m_vctrl_0)      // VRAM Ctrl
2299   AM_RANGE(0xf00000, 0xf03fff) AM_READWRITE_LEGACY(setaroul_spritecode_r, setaroul_spritecode_w)
2300   AM_RANGE(0xf40000, 0xf40bff) AM_WRITE_LEGACY(setaroul_spriteylow_w)
2301   AM_RANGE(0xf40c00, 0xf40c11) AM_WRITE_LEGACY(setaroul_spritectrl_w)
2284   AM_RANGE(0xf00000, 0xf03fff) AM_READWRITE(setaroul_spritecode_r, setaroul_spritecode_w)
2285   AM_RANGE(0xf40000, 0xf40bff) AM_WRITE(setaroul_spriteylow_w)
2286   AM_RANGE(0xf40c00, 0xf40c11) AM_WRITE(setaroul_spritectrl_w)
23022287ADDRESS_MAP_END
23032288
23042289/***************************************************************************
r14896r14897
23142299   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
23152300   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
23162301   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
2317   AM_RANGE(0x400008, 0x40000b) AM_READ_LEGACY(seta_dsw_r)            // DSW
2302   AM_RANGE(0x400008, 0x40000b) AM_READ(seta_dsw_r)            // DSW
23182303   AM_RANGE(0x40000c, 0x40000d) AM_READWRITE(watchdog_reset16_r,watchdog_reset16_w)   // Watchdog (extdwnhl (R) & sokonuke (W) MUST RETURN $FFFF)
23192304   AM_RANGE(0x500000, 0x500003) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // Coin Lockout + Video Registers
23202305   AM_RANGE(0x500004, 0x500007) AM_NOP                        // IRQ Ack  (extdwnhl (R) & sokonuke (W))
r14896r14897
23442329   AM_RANGE(0x200000, 0x20ffff) AM_RAM                        // RAM
23452330   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
23462331   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
2347   AM_RANGE(0x500004, 0x500007) AM_READ_LEGACY(seta_dsw_r)            // DSW
2332   AM_RANGE(0x500004, 0x500007) AM_READ(seta_dsw_r)            // DSW
23482333   AM_RANGE(0x500008, 0x500009) AM_READ_PORT("COINS")            // Coins
23492334   AM_RANGE(0x50000c, 0x50000d) AM_READWRITE(watchdog_reset16_r,watchdog_reset16_w)   // xx Watchdog? (sokonuke)
23502335   AM_RANGE(0x600000, 0x600005) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // ? Coin Lockout + Video Registers
r14896r14897
23642349   AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
23652350   AM_RANGE(0xb04000, 0xb07fff) AM_RAM                        // tested
23662351#if __uPD71054_TIMER
2367   AM_RANGE(0xc00000, 0xc00007) AM_WRITE_LEGACY(timer_regs_w)            // ?
2352   AM_RANGE(0xc00000, 0xc00007) AM_WRITE(timer_regs_w)            // ?
23682353#else
23692354   AM_RANGE(0xc00000, 0xc00007) AM_WRITENOP                  // ?
23702355#endif
r14896r14897
23782363   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
23792364   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
23802365   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")            // Coins
2381   AM_RANGE(0x500008, 0x50000b) AM_READ_LEGACY(seta_dsw_r)            // DSW
2366   AM_RANGE(0x500008, 0x50000b) AM_READ(seta_dsw_r)            // DSW
23822367   AM_RANGE(0x50000c, 0x50000d) AM_WRITE(watchdog_reset16_w)      // Watchdog
23832368   AM_RANGE(0x600000, 0x600005) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // ? Coin Lockout + Video Registers
23842369   AM_RANGE(0x600006, 0x600007) AM_WRITENOP                  // ?
r14896r14897
23932378   AM_RANGE(0xa80000, 0xa80001) AM_RAM                        // ? $4000
23942379   AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
23952380#if __uPD71054_TIMER
2396   AM_RANGE(0xc00000, 0xc00007) AM_WRITE_LEGACY(timer_regs_w)            // ?
2381   AM_RANGE(0xc00000, 0xc00007) AM_WRITE(timer_regs_w)            // ?
23972382#else
23982383   AM_RANGE(0xc00000, 0xc00007) AM_WRITENOP                  // ?
23992384#endif
r14896r14897
24052390                                Krazy Bowl
24062391***************************************************************************/
24072392
2408static READ16_HANDLER( krzybowl_input_r )
2393READ16_MEMBER(seta_state::krzybowl_input_r)
24092394{
24102395   // analog ports
2411   int dir1x = input_port_read(space->machine(), "TRACK1_X") & 0xfff;
2412   int dir1y = input_port_read(space->machine(), "TRACK1_Y") & 0xfff;
2413   int dir2x = input_port_read(space->machine(), "TRACK2_X") & 0xfff;
2414   int dir2y = input_port_read(space->machine(), "TRACK2_Y") & 0xfff;
2396   int dir1x = input_port_read(machine(), "TRACK1_X") & 0xfff;
2397   int dir1y = input_port_read(machine(), "TRACK1_Y") & 0xfff;
2398   int dir2x = input_port_read(machine(), "TRACK2_X") & 0xfff;
2399   int dir2y = input_port_read(machine(), "TRACK2_Y") & 0xfff;
24152400
24162401   switch (offset)
24172402   {
r14896r14897
24242409      case 0xc/2:   return dir2y & 0xff;
24252410      case 0xe/2:   return dir2y >> 8;
24262411      default:
2427         logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space->device()), offset*2);
2412         logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset*2);
24282413         return 0;
24292414   }
24302415}
r14896r14897
24342419   AM_RANGE(0xf00000, 0xf0ffff) AM_RAM                        // RAM
24352420   AM_RANGE(0x100000, 0x100001) AM_READNOP                     // ?
24362421   AM_RANGE(0x200000, 0x200001) AM_READNOP                     // ?
2437   AM_RANGE(0x300000, 0x300003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2422   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r)            // DSW
24382423   AM_RANGE(0x400000, 0x400001) AM_WRITENOP                  // ?
24392424   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
24402425   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
24412426   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")            // Coins
2442   AM_RANGE(0x600000, 0x60000f) AM_READ_LEGACY(krzybowl_input_r)         // P1
2427   AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r)         // P1
24432428   AM_RANGE(0x8000f0, 0x8000f1) AM_RAM                        // NVRAM
24442429   AM_RANGE(0x800100, 0x8001ff) AM_RAM                        // NVRAM
24452430   AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
r14896r14897
24552440                            Mobile Suit Gundam
24562441***************************************************************************/
24572442
2458static WRITE16_HANDLER( msgundam_vregs_w )
2443WRITE16_MEMBER(seta_state::msgundam_vregs_w)
24592444{
2460   seta_state *state = space->machine().driver_data<seta_state>();
24612445   // swap $500002 with $500004
24622446   switch( offset )
24632447   {
24642448      case 1:   offset = 2;   break;
24652449      case 2:   offset = 1;   break;
24662450   }
2467   state->seta_vregs_w(*space,offset,data,mem_mask);
2451   seta_vregs_w(*&space,offset,data,mem_mask);
24682452}
24692453
24702454/* Mirror RAM is necessary or startup, to clear Work RAM after the test */
r14896r14897
24782462   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
24792463   AM_RANGE(0x400000, 0x400001) AM_WRITENOP                  // Lev 2 IRQ Ack
24802464   AM_RANGE(0x400004, 0x400005) AM_WRITENOP                  // Lev 4 IRQ Ack
2481   AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE_LEGACY(msgundam_vregs_w) AM_BASE(m_vregs)   // Coin Lockout + Video Registers
2482   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2465   AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(msgundam_vregs_w) AM_BASE(m_vregs)   // Coin Lockout + Video Registers
2466   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
24832467   AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
24842468   AM_RANGE(0x800000, 0x8005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)      // Sprites Y
24852469   AM_RANGE(0x800600, 0x800607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
r14896r14897
24912475   AM_RANGE(0xb80000, 0xb80005) AM_RAM AM_BASE(m_vctrl_2)      // VRAM 2&3 Ctrl
24922476   AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
24932477#if __uPD71054_TIMER
2494   AM_RANGE(0xd00000, 0xd00007) AM_WRITE_LEGACY(timer_regs_w)   // ?
2478   AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w)   // ?
24952479#else
24962480   AM_RANGE(0xd00000, 0xd00007) AM_WRITENOP   // ?
24972481#endif
r14896r14897
25072491   AM_RANGE(0x000000, 0x07ffff) AM_ROM                        // ROM
25082492   AM_RANGE(0x100000, 0x17ffff) AM_ROM                        // ROM
25092493   AM_RANGE(0x200000, 0x20ffff) AM_RAM                        // RAM
2510   AM_RANGE(0x300000, 0x300003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2494   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r)            // DSW
25112495   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
25122496   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
25132497   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
r14896r14897
25362520   AM_RANGE(0x000000, 0x07ffff) AM_ROM                        // ROM
25372521   AM_RANGE(0x100000, 0x17ffff) AM_ROM                        // ROM
25382522   AM_RANGE(0x200000, 0x20ffff) AM_RAM                        // RAM
2539   AM_RANGE(0x300000, 0x300003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2523   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r)            // DSW
25402524   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
25412525   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
25422526   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
r14896r14897
25592543                            Pro Mahjong Kiwame
25602544***************************************************************************/
25612545
2562static READ16_HANDLER( kiwame_nvram_r )
2546READ16_MEMBER(seta_state::kiwame_nvram_r)
25632547{
2564   seta_state *state = space->machine().driver_data<seta_state>();
2565   return state->m_kiwame_nvram[offset] & 0xff;
2548   return m_kiwame_nvram[offset] & 0xff;
25662549}
25672550
2568static WRITE16_HANDLER( kiwame_nvram_w )
2551WRITE16_MEMBER(seta_state::kiwame_nvram_w)
25692552{
25702553   if (ACCESSING_BITS_0_7)
25712554   {
2572      seta_state *state = space->machine().driver_data<seta_state>();
2573      COMBINE_DATA( &state->m_kiwame_nvram[offset] );
2555      COMBINE_DATA( &m_kiwame_nvram[offset] );
25742556   }
25752557}
25762558
2577static READ16_HANDLER( kiwame_input_r )
2559READ16_MEMBER(seta_state::kiwame_input_r)
25782560{
25792561   int row_select = kiwame_nvram_r( space, 0x10a/2,0x00ff ) & 0x1f;
25802562   int i;
r14896r14897
25852567
25862568   switch( offset )
25872569   {
2588      case 0x00/2:   return input_port_read(space->machine(), keynames[i]);
2570      case 0x00/2:   return input_port_read(machine(), keynames[i]);
25892571      case 0x02/2:   return 0xffff;
2590      case 0x04/2:   return input_port_read(space->machine(), "COINS");
2572      case 0x04/2:   return input_port_read(machine(), "COINS");
25912573//      case 0x06/2:
25922574      case 0x08/2:   return 0xffff;
25932575
25942576      default:
2595         logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space->device()), offset*2);
2577         logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset*2);
25962578         return 0x0000;
25972579   }
25982580}
r14896r14897
26002582static ADDRESS_MAP_START( kiwame_map, AS_PROGRAM, 16, seta_state )
26012583   AM_RANGE(0x000000, 0x07ffff) AM_ROM                        // ROM
26022584   AM_RANGE(0x200000, 0x20ffff) AM_RAM                        // RAM
2603   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(kiwame_nvram_r, kiwame_nvram_w) AM_BASE(m_kiwame_nvram)   // NVRAM + Regs ?
2585   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE(kiwame_nvram_r, kiwame_nvram_w) AM_BASE(m_kiwame_nvram)   // NVRAM + Regs ?
26042586   AM_RANGE(0x800000, 0x803fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
26052587/**/AM_RANGE(0x900000, 0x900001) AM_RAM                        // ? 0x4000
26062588/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)      // Sprites Y
26072589   AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
26082590   AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
26092591   AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
2610   AM_RANGE(0xd00000, 0xd00009) AM_READ_LEGACY(kiwame_input_r)         // mahjong panel
2611   AM_RANGE(0xe00000, 0xe00003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2592   AM_RANGE(0xd00000, 0xd00009) AM_READ(kiwame_input_r)         // mahjong panel
2593   AM_RANGE(0xe00000, 0xe00003) AM_READ(seta_dsw_r)            // DSW
26122594ADDRESS_MAP_END
26132595
26142596
r14896r14897
26162598                        Thunder & Lightning / Wit's
26172599***************************************************************************/
26182600
2619static READ16_HANDLER( thunderl_protection_r )
2601READ16_MEMBER(seta_state::thunderl_protection_r)
26202602{
2621//  logerror("PC %06X - Protection Read\n", cpu_get_pc(&space->device()));
2603//  logerror("PC %06X - Protection Read\n", cpu_get_pc(&space.device()));
26222604   return 0x00dd;
26232605}
2624static WRITE16_HANDLER( thunderl_protection_w )
2606WRITE16_MEMBER(seta_state::thunderl_protection_w)
26252607{
2626//  logerror("PC %06X - Protection Written: %04X <- %04X\n", cpu_get_pc(&space->device()), offset*2, data);
2608//  logerror("PC %06X - Protection Written: %04X <- %04X\n", cpu_get_pc(&space.device()), offset*2, data);
26272609}
26282610
26292611/* Similar to downtown etc. */
r14896r14897
26342616   AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
26352617   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                  // ?
26362618   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                  // ?
2637   AM_RANGE(0x400000, 0x40ffff) AM_WRITE_LEGACY(thunderl_protection_w)   // Protection (not in wits)
2619   AM_RANGE(0x400000, 0x40ffff) AM_WRITE(thunderl_protection_w)   // Protection (not in wits)
26382620   AM_RANGE(0x500000, 0x500001) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // Coin Lockout
2639   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2621   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
26402622   AM_RANGE(0x700000, 0x7003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
26412623   AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")               // P1
26422624   AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")               // P2
26432625   AM_RANGE(0xb00004, 0xb00005) AM_READ_PORT("COINS")            // Coins
2644   AM_RANGE(0xb0000c, 0xb0000d) AM_READ_LEGACY(thunderl_protection_r   )   // Protection (not in wits)
2626   AM_RANGE(0xb0000c, 0xb0000d) AM_READ(thunderl_protection_r   )   // Protection (not in wits)
26452627   AM_RANGE(0xb00008, 0xb00009) AM_READ_PORT("P3")               // P3 (wits)
26462628   AM_RANGE(0xb0000a, 0xb0000b) AM_READ_PORT("P4")               // P4 (wits)
26472629/**/AM_RANGE(0xc00000, 0xc00001) AM_RAM                        // ? 0x4000
r14896r14897
26582640//  AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)  // Sound
26592641   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                  // ?
26602642   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                  // ?
2661//  AM_RANGE(0x400000, 0x40ffff) AM_WRITE_LEGACY(thunderl_protection_w)    // Protection (not in wits)
2643//  AM_RANGE(0x400000, 0x40ffff) AM_WRITE(thunderl_protection_w)    // Protection (not in wits)
26622644   AM_RANGE(0x500000, 0x500001) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // Coin Lockout
2663   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2645   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
26642646   AM_RANGE(0x700000, 0x7003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
26652647   AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")               // P1
26662648   AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")               // P2
26672649   AM_RANGE(0xb00004, 0xb00005) AM_READ_PORT("COINS")            // Coins
2668//  AM_RANGE(0xb0000c, 0xb0000d) AM_READ_LEGACY(thunderl_protection_r  )   // Protection (not in wits)
2650//  AM_RANGE(0xb0000c, 0xb0000d) AM_READ(thunderl_protection_r  )   // Protection (not in wits)
26692651   AM_RANGE(0xb00008, 0xb00009) AM_READ_PORT("P3")               // P3 (wits)
26702652   AM_RANGE(0xb0000a, 0xb0000b) AM_READ_PORT("P4")               // P4 (wits)
26712653/**/AM_RANGE(0xc00000, 0xc00001) AM_RAM                        // ? 0x4000
r14896r14897
26792661                    Wiggie Waggie
26802662***************************************************************************/
26812663
2682static READ8_HANDLER( wiggie_soundlatch_r )
2664READ8_MEMBER(seta_state::wiggie_soundlatch_r)
26832665{
2684   seta_state *state = space->machine().driver_data<seta_state>();
26852666
2686   return state->m_wiggie_soundlatch;
2667   return m_wiggie_soundlatch;
26872668}
26882669
2689static WRITE16_HANDLER( wiggie_soundlatch_w )
2670WRITE16_MEMBER(seta_state::wiggie_soundlatch_w)
26902671{
2691   seta_state *state = space->machine().driver_data<seta_state>();
26922672
2693   state->m_wiggie_soundlatch = data >> 8;
2694   cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
2673   m_wiggie_soundlatch = data >> 8;
2674   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
26952675}
26962676
26972677
r14896r14897
27002680   AM_RANGE(0xffc000, 0xffffff) AM_RAM                        // RAM
27012681   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                  // ?
27022682   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                  // ?
2703   AM_RANGE(0x400000, 0x40ffff) AM_WRITE_LEGACY(thunderl_protection_w)   // Protection (not in wits)
2683   AM_RANGE(0x400000, 0x40ffff) AM_WRITE(thunderl_protection_w)   // Protection (not in wits)
27042684   AM_RANGE(0x500000, 0x500001) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // Coin Lockout
2705   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2685   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
27062686   AM_RANGE(0x700000, 0x7003ff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
27072687   AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")               // P1
27082688   AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")               // P2
27092689   AM_RANGE(0xb00004, 0xb00005) AM_READ_PORT("COINS")            // Coins
2710   AM_RANGE(0xb0000c, 0xb0000d) AM_READ_LEGACY(thunderl_protection_r)      // Protection (not in wits)
2690   AM_RANGE(0xb0000c, 0xb0000d) AM_READ(thunderl_protection_r)      // Protection (not in wits)
27112691   AM_RANGE(0xb00008, 0xb00009) AM_READ_PORT("P3")               // P3 (wits)
27122692   AM_RANGE(0xb0000a, 0xb0000b) AM_READ_PORT("P4")               // P4 (wits)
27132693/**/AM_RANGE(0xc00000, 0xc00001) AM_RAM                        // ? 0x4000
r14896r14897
27212701   AM_RANGE(0x0000, 0x7fff) AM_ROM
27222702   AM_RANGE(0x8000, 0x87ff) AM_RAM
27232703   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
2724   AM_RANGE(0xa000, 0xa000) AM_READ_LEGACY(wiggie_soundlatch_r)
2704   AM_RANGE(0xa000, 0xa000) AM_READ(wiggie_soundlatch_r)
27252705ADDRESS_MAP_END
27262706
27272707
r14896r14897
27402720   AM_RANGE(0x400000, 0x400001) AM_WRITENOP                  // ? (end of lev 2)
27412721   AM_RANGE(0x400004, 0x400005) AM_WRITENOP                  // ? (end of lev 2)
27422722   AM_RANGE(0x500000, 0x500001) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // Coin Lockout + Video Registers
2743   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2723   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
27442724   AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)      // Sprites Y
27452725   AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
27462726/**/AM_RANGE(0xa80000, 0xa80001) AM_RAM                        // ? 0x4000
r14896r14897
27532733                            Ultra Toukond Densetsu
27542734***************************************************************************/
27552735
2756static WRITE16_HANDLER( utoukond_soundlatch_w )
2736WRITE16_MEMBER(seta_state::utoukond_soundlatch_w)
27572737{
2758   seta_state *state = space->machine().driver_data<seta_state>();
27592738   if (ACCESSING_BITS_0_7)
27602739   {
2761      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
2762      state->soundlatch_w(*space, 0, data & 0xff);
2740      cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
2741      soundlatch_byte_w(*&space, 0, data & 0xff);
27632742   }
27642743}
27652744
r14896r14897
27702749   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
27712750   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
27722751   AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // ? Coin Lockout + Video Registers
2773   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2752   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r)            // DSW
27742753   AM_RANGE(0x700400, 0x700fff) AM_RAM   AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
27752754   AM_RANGE(0x800000, 0x803fff) AM_RAM_WRITE(seta_vram_0_w) AM_BASE(m_vram_0)   // VRAM 0&1
27762755   AM_RANGE(0x880000, 0x883fff) AM_RAM_WRITE(seta_vram_2_w) AM_BASE(m_vram_2)   // VRAM 2&3
r14896r14897
27792758   AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)      // Sprites Y
27802759   AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
27812760   AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
2782   AM_RANGE(0xc00000, 0xc00001) AM_WRITE_LEGACY(utoukond_soundlatch_w)   // To Sound CPU (cause an IRQ)
2761   AM_RANGE(0xc00000, 0xc00001) AM_WRITE(utoukond_soundlatch_w)   // To Sound CPU (cause an IRQ)
27832762   AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP                  // ? ack
27842763ADDRESS_MAP_END
27852764
r14896r14897
27872766                                Pairs Love
27882767***************************************************************************/
27892768
2790static READ16_HANDLER( pairlove_prot_r )
2769READ16_MEMBER(seta_state::pairlove_prot_r)
27912770{
2792   seta_state *state = space->machine().driver_data<seta_state>();
27932771   int retdata;
27942772
2795   retdata = state->m_pairslove_protram[offset];
2796   //mame_printf_debug("pairs love protection? read %06x %04x %04x\n",cpu_get_pc(&space->device()), offset,retdata);
2797   state->m_pairslove_protram[offset] = state->m_pairslove_protram_old[offset];
2773   retdata = m_pairslove_protram[offset];
2774   //mame_printf_debug("pairs love protection? read %06x %04x %04x\n",cpu_get_pc(&space.device()), offset,retdata);
2775   m_pairslove_protram[offset] = m_pairslove_protram_old[offset];
27982776   return retdata;
27992777}
28002778
2801static WRITE16_HANDLER( pairlove_prot_w )
2779WRITE16_MEMBER(seta_state::pairlove_prot_w)
28022780{
2803   seta_state *state = space->machine().driver_data<seta_state>();
2804   //mame_printf_debug("pairs love protection? write %06x %04x %04x\n",cpu_get_pc(&space->device()), offset,data);
2805   state->m_pairslove_protram_old[offset] = state->m_pairslove_protram[offset];
2806   state->m_pairslove_protram[offset] = data;
2781   //mame_printf_debug("pairs love protection? write %06x %04x %04x\n",cpu_get_pc(&space.device()), offset,data);
2782   m_pairslove_protram_old[offset] = m_pairslove_protram[offset];
2783   m_pairslove_protram[offset] = data;
28072784}
28082785
28092786static ADDRESS_MAP_START( pairlove_map, AS_PROGRAM, 16, seta_state )
28102787   AM_RANGE(0x000000, 0x03ffff) AM_ROM                        // ROM
28112788   AM_RANGE(0x100000, 0x100001) AM_WRITENOP                  // ? 1 (start of interrupts, main loop: watchdog?)
28122789   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                  // ? 0/1 (IRQ acknowledge?)
2813   AM_RANGE(0x300000, 0x300003) AM_READ_LEGACY(seta_dsw_r)            // DSW
2790   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r)            // DSW
28142791   AM_RANGE(0x400000, 0x400001) AM_RAM_WRITE(seta_vregs_w) AM_BASE(m_vregs)   // Coin Lockout + Sound Enable (bit 4?)
28152792   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
28162793   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
28172794   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")            // Coins
2818   AM_RANGE(0x900000, 0x9001ff) AM_READWRITE_LEGACY(pairlove_prot_r,pairlove_prot_w)
2795   AM_RANGE(0x900000, 0x9001ff) AM_READWRITE(pairlove_prot_r,pairlove_prot_w)
28192796   AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
28202797   AM_RANGE(0xb00000, 0xb00fff) AM_RAM AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
28212798   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)      // Sprites Code + X + Attr
r14896r14897
28382815   AM_RANGE(0x610004, 0x610005) AM_READ_PORT("INPUT")
28392816   AM_RANGE(0x610006, 0x610007) AM_WRITENOP
28402817   AM_RANGE(0x620000, 0x620003) AM_WRITENOP   // protection
2841   AM_RANGE(0x630000, 0x630003) AM_READ_LEGACY(seta_dsw_r)
2818   AM_RANGE(0x630000, 0x630003) AM_READ(seta_dsw_r)
28422819   AM_RANGE(0x640400, 0x640fff) AM_WRITEONLY AM_BASE_SIZE(m_paletteram, m_paletteram_size)   // Palette
28432820   AM_RANGE(0x650000, 0x650003) AM_DEVWRITE8_LEGACY("ymsnd", ym3812_w, 0x00ff)
28442821   AM_RANGE(0x658000, 0x658001) AM_DEVWRITE8("oki", okim6295_device, write, 0x00ff)
r14896r14897
28582835                             International Toote
28592836***************************************************************************/
28602837
2861static READ16_HANDLER( inttoote_dsw_r )
2838READ16_MEMBER(seta_state::inttoote_dsw_r)
28622839{
28632840   int shift = offset * 4;
2864   return   ((((input_port_read(space->machine(), "DSW1") >> shift)       & 0xf)) << 0) |
2865         ((((input_port_read(space->machine(), "DSW2_3") >> shift)     & 0xf)) << 4) |
2866         ((((input_port_read(space->machine(), "DSW2_3") >> (shift+8)) & 0xf)) << 8) ;
2841   return   ((((input_port_read(machine(), "DSW1") >> shift)       & 0xf)) << 0) |
2842         ((((input_port_read(machine(), "DSW2_3") >> shift)     & 0xf)) << 4) |
2843         ((((input_port_read(machine(), "DSW2_3") >> (shift+8)) & 0xf)) << 8) ;
28672844}
28682845
2869static READ16_HANDLER( inttoote_key_r )
2846READ16_MEMBER(seta_state::inttoote_key_r)
28702847{
2871   seta_state *state = space->machine().driver_data<seta_state>();
28722848
2873   switch( *state->m_inttoote_key_select )
2849   switch( *m_inttoote_key_select )
28742850   {
2875      case 0x08:   return input_port_read(space->machine(), "BET0");
2876      case 0x10:   return input_port_read(space->machine(), "BET1");
2877      case 0x20:   return input_port_read(space->machine(), "BET2");
2878      case 0x40:   return input_port_read(space->machine(), "BET3");
2879      case 0x80:   return input_port_read(space->machine(), "BET4");
2851      case 0x08:   return input_port_read(machine(), "BET0");
2852      case 0x10:   return input_port_read(machine(), "BET1");
2853      case 0x20:   return input_port_read(machine(), "BET2");
2854      case 0x40:   return input_port_read(machine(), "BET3");
2855      case 0x80:   return input_port_read(machine(), "BET4");
28802856   }
28812857
2882   logerror("%06X: unknown read, select = %04x\n",cpu_get_pc(&space->device()), *state->m_inttoote_key_select);
2858   logerror("%06X: unknown read, select = %04x\n",cpu_get_pc(&space.device()), *m_inttoote_key_select);
28832859   return 0xffff;
28842860}
28852861
2886static READ16_HANDLER( inttoote_700000_r )
2862READ16_MEMBER(seta_state::inttoote_700000_r)
28872863{
2888   seta_state *state = space->machine().driver_data<seta_state>();
28892864
2890   return state->m_inttoote_700000[offset] & 0x3f;
2865   return m_inttoote_700000[offset] & 0x3f;
28912866}
28922867
28932868static ADDRESS_MAP_START( inttoote_map, AS_PROGRAM, 16, seta_state )
28942869   AM_RANGE(0x000000, 0x1fffff) AM_ROM   // ROM (up to 2MB)
28952870
2896   AM_RANGE(0x200000, 0x200001) AM_RAM_READ_LEGACY(inttoote_key_r) AM_BASE(m_inttoote_key_select)
2871   AM_RANGE(0x200000, 0x200001) AM_RAM_READ(inttoote_key_r) AM_BASE(m_inttoote_key_select)
28972872   AM_RANGE(0x200002, 0x200003) AM_READ_PORT("P1")
28982873   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("P2") AM_WRITENOP
28992874
r14896r14897
29042879   AM_RANGE(0x300040, 0x300041) AM_WRITENOP   // lev4 ack
29052880   AM_RANGE(0x300060, 0x300061) AM_WRITENOP   // lev6 ack
29062881
2907   AM_RANGE(0x500000, 0x500003) AM_READ_LEGACY(inttoote_dsw_r)   // DSW x 3
2882   AM_RANGE(0x500000, 0x500003) AM_READ(inttoote_dsw_r)   // DSW x 3
29082883
2909   AM_RANGE(0x700000, 0x700101) AM_RAM_READ_LEGACY(inttoote_700000_r) AM_BASE(m_inttoote_700000)
2884   AM_RANGE(0x700000, 0x700101) AM_RAM_READ(inttoote_700000_r) AM_BASE(m_inttoote_700000)
29102885
29112886   AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff)
29122887
r14896r14897
29252900   AM_RANGE(0xffc000, 0xffffff) AM_RAM   // RAM
29262901ADDRESS_MAP_END
29272902
2928static READ16_HANDLER( jockeyc_mux_r )
2903READ16_MEMBER(seta_state::jockeyc_mux_r)
29292904{
2930   seta_state *state = space->machine().driver_data<seta_state>();
29312905
2932   switch( state->m_jockeyc_key_select )
2906   switch( m_jockeyc_key_select )
29332907   {
2934      case 0x08:   return input_port_read(space->machine(), "BET0");
2935      case 0x10:   return input_port_read(space->machine(), "BET1");
2936      case 0x20:   return input_port_read(space->machine(), "BET2");
2937      case 0x40:   return input_port_read(space->machine(), "BET3");
2938      case 0x80:   return input_port_read(space->machine(), "BET4");
2908      case 0x08:   return input_port_read(machine(), "BET0");
2909      case 0x10:   return input_port_read(machine(), "BET1");
2910      case 0x20:   return input_port_read(machine(), "BET2");
2911      case 0x40:   return input_port_read(machine(), "BET3");
2912      case 0x80:   return input_port_read(machine(), "BET4");
29392913   }
29402914
29412915   return 0xffff;
29422916}
29432917
2944static WRITE16_HANDLER( jockeyc_mux_w )
2918WRITE16_MEMBER(seta_state::jockeyc_mux_w)
29452919{
2946   seta_state *state = space->machine().driver_data<seta_state>();
29472920
29482921   /* other bits used too */
2949   state->m_jockeyc_key_select = data & 0xf8;
2922   m_jockeyc_key_select = data & 0xf8;
29502923}
29512924
2952static READ16_HANDLER( unk_r )
2925READ16_MEMBER(seta_state::unk_r)
29532926{
2954   return 0xffff;//space->machine().rand();
2927   return 0xffff;//machine().rand();
29552928}
29562929
29572930/* same as International Toote but without the protection and different RTC hook-up */
29582931static ADDRESS_MAP_START( jockeyc_map, AS_PROGRAM, 16, seta_state )
29592932   AM_RANGE(0x000000, 0x1fffff) AM_ROM   // ROM (up to 2MB)
29602933
2961   AM_RANGE(0x200000, 0x200001) AM_READWRITE_LEGACY(jockeyc_mux_r,jockeyc_mux_w)
2934   AM_RANGE(0x200000, 0x200001) AM_READWRITE(jockeyc_mux_r,jockeyc_mux_w)
29622935   AM_RANGE(0x200002, 0x200003) AM_READ_PORT("P1")
29632936   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("P2") AM_WRITENOP
29642937
r14896r14897
29712944   AM_RANGE(0x300040, 0x300041) AM_WRITENOP   // lev4 ack
29722945   AM_RANGE(0x300060, 0x300061) AM_WRITENOP   // lev6 ack
29732946
2974   AM_RANGE(0x500000, 0x500003) AM_READ_LEGACY(inttoote_dsw_r)   // DSW x 3
2975   AM_RANGE(0x600000, 0x600003) AM_READ_LEGACY(unk_r)
2947   AM_RANGE(0x500000, 0x500003) AM_READ(inttoote_dsw_r)   // DSW x 3
2948   AM_RANGE(0x600000, 0x600003) AM_READ(unk_r)
29762949
29772950   AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff)
29782951
r14896r14897
30002973
30012974***************************************************************************/
30022975
3003static WRITE8_HANDLER( sub_bankswitch_w )
2976WRITE8_MEMBER(seta_state::sub_bankswitch_w)
30042977{
3005   UINT8 *rom = space->machine().region("sub")->base();
2978   UINT8 *rom = machine().region("sub")->base();
30062979   int bank = data >> 4;
30072980
3008   memory_set_bankptr(space->machine(), "bank1", &rom[bank * 0x4000 + 0xc000]);
2981   memory_set_bankptr(machine(), "bank1", &rom[bank * 0x4000 + 0xc000]);
30092982}
30102983
3011static WRITE8_HANDLER( sub_bankswitch_lockout_w )
2984WRITE8_MEMBER(seta_state::sub_bankswitch_lockout_w)
30122985{
30132986   sub_bankswitch_w(space,offset,data);
3014   seta_coin_lockout_w(space->machine(), data);
2987   seta_coin_lockout_w(machine(), data);
30152988}
30162989
30172990
r14896r14897
30192992                                Thundercade
30202993***************************************************************************/
30212994
3022static READ8_HANDLER( ff_r )   {return 0xff;}
2995READ8_MEMBER(seta_state::ff_r){return 0xff;}
30232996
30242997static ADDRESS_MAP_START( tndrcade_sub_map, AS_PROGRAM, 8, seta_state )
30252998   AM_RANGE(0x0000, 0x01ff) AM_RAM                      // RAM
3026   AM_RANGE(0x0800, 0x0800) AM_READ_LEGACY(ff_r)                  // ? (bits 0/1/2/3: 1 -> do test 0-ff/100-1e0/5001-57ff/banked rom)
3027   //AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_r)              //
3028   //AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_r)             //
2999   AM_RANGE(0x0800, 0x0800) AM_READ(ff_r)                  // ? (bits 0/1/2/3: 1 -> do test 0-ff/100-1e0/5001-57ff/banked rom)
3000   //AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r)              //
3001   //AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_byte_r)             //
30293002   AM_RANGE(0x1000, 0x1000) AM_READ_PORT("P1")               // P1
3030   AM_RANGE(0x1000, 0x1000) AM_WRITE_LEGACY(sub_bankswitch_lockout_w)   // ROM Bank + Coin Lockout
3003   AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w)   // ROM Bank + Coin Lockout
30313004   AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P2")               // P2
30323005   AM_RANGE(0x1002, 0x1002) AM_READ_PORT("COINS")            // Coins
30333006   AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r,ym2203_w)
r14896r14897
30453018
30463019static ADDRESS_MAP_START( twineagl_sub_map, AS_PROGRAM, 8, seta_state )
30473020   AM_RANGE(0x0000, 0x01ff) AM_RAM                     // RAM
3048   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_r)         //
3049   AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_r)         //
3021   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r)         //
3022   AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_byte_r)         //
30503023   AM_RANGE(0x1000, 0x1000) AM_READ_PORT("P1")            // P1
3051   AM_RANGE(0x1000, 0x1000) AM_WRITE_LEGACY(sub_bankswitch_lockout_w)   // ROM Bank + Coin Lockout
3024   AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w)   // ROM Bank + Coin Lockout
30523025   AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P2")            // P2
30533026   AM_RANGE(0x1002, 0x1002) AM_READ_PORT("COINS")         // Coins
30543027   AM_RANGE(0x5000, 0x57ff) AM_RAM AM_BASE(m_sharedram)      // Shared RAM
r14896r14897
30623035                                DownTown
30633036***************************************************************************/
30643037
3065static READ8_HANDLER( downtown_ip_r )
3038READ8_MEMBER(seta_state::downtown_ip_r)
30663039{
3067   int dir1 = input_port_read(space->machine(), "ROT1");   // analog port
3068   int dir2 = input_port_read(space->machine(), "ROT2");   // analog port
3040   int dir1 = input_port_read(machine(), "ROT1");   // analog port
3041   int dir2 = input_port_read(machine(), "ROT2");   // analog port
30693042
30703043   dir1 = (~ (0x800 >> dir1)) & 0xfff;
30713044   dir2 = (~ (0x800 >> dir2)) & 0xfff;
30723045
30733046   switch (offset)
30743047   {
3075      case 0:   return (input_port_read(space->machine(), "COINS") & 0xf0) + (dir1 >> 8);   // upper 4 bits of p1 rotation + coins
3048      case 0:   return (input_port_read(machine(), "COINS") & 0xf0) + (dir1 >> 8);   // upper 4 bits of p1 rotation + coins
30763049      case 1:   return (dir1 & 0xff);               // lower 8 bits of p1 rotation
3077      case 2:   return input_port_read(space->machine(), "P1");   // p1
3050      case 2:   return input_port_read(machine(), "P1");   // p1
30783051      case 3:   return 0xff;                     // ?
30793052      case 4:   return (dir2 >> 8);                  // upper 4 bits of p2 rotation + ?
30803053      case 5:   return (dir2 & 0xff);               // lower 8 bits of p2 rotation
3081      case 6:   return input_port_read(space->machine(), "P2");   // p2
3054      case 6:   return input_port_read(machine(), "P2");   // p2
30823055      case 7:   return 0xff;                     // ?
30833056   }
30843057
r14896r14897
30873060
30883061static ADDRESS_MAP_START( downtown_sub_map, AS_PROGRAM, 8, seta_state )
30893062   AM_RANGE(0x0000, 0x01ff) AM_RAM                     // RAM
3090   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_r)         //
3091   AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_r)         //
3092   AM_RANGE(0x1000, 0x1007) AM_READ_LEGACY(downtown_ip_r)         // Input Ports
3093   AM_RANGE(0x1000, 0x1000) AM_WRITE_LEGACY(sub_bankswitch_lockout_w)   // ROM Bank + Coin Lockout
3063   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r)         //
3064   AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_byte_r)         //
3065   AM_RANGE(0x1000, 0x1007) AM_READ(downtown_ip_r)         // Input Ports
3066   AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w)   // ROM Bank + Coin Lockout
30943067   AM_RANGE(0x5000, 0x57ff) AM_RAM AM_BASE(m_sharedram)      // Shared RAM
30953068   AM_RANGE(0x7000, 0x7fff) AM_ROM                     // ROM
30963069   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")               // Banked ROM
r14896r14897
31053078static MACHINE_RESET(calibr50)
31063079{
31073080   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
3108   sub_bankswitch_w(space, 0, 0);
3081   seta_state *state = machine.driver_data<seta_state>();
3082   state->sub_bankswitch_w(*space, 0, 0);
31093083}
31103084
3111static WRITE8_HANDLER( calibr50_soundlatch2_w )
3085WRITE8_MEMBER(seta_state::calibr50_soundlatch2_w)
31123086{
3113   seta_state *state = space->machine().driver_data<seta_state>();
3114   state->soundlatch2_w(*space,0,data);
3115   device_spin_until_time(&space->device(), attotime::from_usec(50));   // Allow the other cpu to reply
3087   soundlatch2_byte_w(space,0,data);
3088   device_spin_until_time(&space.device(), attotime::from_usec(50));   // Allow the other cpu to reply
31163089}
31173090
31183091static ADDRESS_MAP_START( calibr50_sub_map, AS_PROGRAM, 8, seta_state )
31193092   AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_r,seta_sound_w)   // Sound
3120   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r)            // From Main CPU
3121   AM_RANGE(0x4000, 0x4000) AM_WRITE_LEGACY(sub_bankswitch_w)         // Bankswitching
3093   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r)            // From Main CPU
3094   AM_RANGE(0x4000, 0x4000) AM_WRITE(sub_bankswitch_w)         // Bankswitching
31223095   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")                  // Banked ROM
31233096   AM_RANGE(0xc000, 0xffff) AM_ROM                        // ROM
3124   AM_RANGE(0xc000, 0xc000) AM_WRITE_LEGACY(calibr50_soundlatch2_w)   // To Main CPU
3097   AM_RANGE(0xc000, 0xc000) AM_WRITE(calibr50_soundlatch2_w)   // To Main CPU
31253098ADDRESS_MAP_END
31263099
31273100
r14896r14897
31313104
31323105static ADDRESS_MAP_START( metafox_sub_map, AS_PROGRAM, 8, seta_state )
31333106   AM_RANGE(0x0000, 0x01ff) AM_RAM                     // RAM
3134   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_r)         //
3135   AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_r)         //
3107   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r)         //
3108   AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_byte_r)         //
31363109   AM_RANGE(0x1000, 0x1000) AM_READ_PORT("COINS")         // Coins
3137   AM_RANGE(0x1000, 0x1000) AM_WRITE_LEGACY(sub_bankswitch_lockout_w)   // ROM Bank + Coin Lockout
3110   AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w)   // ROM Bank + Coin Lockout
31383111   AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P1")            // P1
31393112   //AM_RANGE(0x1004, 0x1004) AM_READNOP                     // ?
31403113   AM_RANGE(0x1006, 0x1006) AM_READ_PORT("P2")            // P2
r14896r14897
31593132   ADDRESS_MAP_GLOBAL_MASK(0xff)
31603133   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym3438_r, ym3438_w)
31613134   AM_RANGE(0x80, 0x80) AM_WRITENOP //?
3162   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
3135   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
31633136ADDRESS_MAP_END
31643137
31653138
r14896r14897
85698542   ADDRESS_MAP_UNMAP_HIGH
85708543   AM_RANGE(0x0000, 0x7fff) AM_ROM
85718544   AM_RANGE(0x8000, 0xdfff) AM_ROM//ROMBANK("bank1")
8572   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_r)
8545   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r)
85738546   AM_RANGE(0xf800, 0xffff) AM_RAM
85748547ADDRESS_MAP_END
85758548
r14896r14897
85798552   AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
85808553   //AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE_LEGACY("upd", upd7759_control_w)
85818554   //AM_RANGE(0x80, 0x80) AM_MIRROR(0x3f) AM_DEVREADWRITE_LEGACY("upd", upd7759_status_r, upd7759_port_w)
8582   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3f) AM_READ(soundlatch_r)
8555   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3f) AM_READ(soundlatch_byte_r)
85838556ADDRESS_MAP_END
85848557
85858558
r14896r14897
1044710420   ROM_LOAD16_BYTE( "ufo018.bin", 0x001, 0x200, CRC(1c584d5f) SHA1(f1c7e3da8b108d78b459cae53fabb6e28d3a7ee8) )
1044810421ROM_END
1044910422
10450static READ16_HANDLER( twineagl_debug_r )
10423READ16_MEMBER(seta_state::twineagl_debug_r)
1045110424{
1045210425   /*  At several points in the code, the program checks if four
1045310426        consecutive bytes in this range are equal to a string, and if they
r14896r14897
1047910452
1048010453/* Extra RAM ? Check code at 0x00ba90 */
1048110454/* 2000F8 = A3 enables it, 2000F8 = 00 disables? see downtown too */
10482static READ16_HANDLER( twineagl_200100_r )
10455READ16_MEMBER(seta_state::twineagl_200100_r)
1048310456{
10484   seta_state *state = space->machine().driver_data<seta_state>();
1048510457
1048610458   // protection check at boot
10487   logerror("%04x: twineagl_200100_r %d\n",cpu_get_pc(&space->device()),offset);
10488   return state->m_twineagl_xram[offset];
10459   logerror("%04x: twineagl_200100_r %d\n",cpu_get_pc(&space.device()),offset);
10460   return m_twineagl_xram[offset];
1048910461}
10490static WRITE16_HANDLER( twineagl_200100_w )
10462WRITE16_MEMBER(seta_state::twineagl_200100_w)
1049110463{
10492   logerror("%04x: twineagl_200100_w %d = %02x\n",cpu_get_pc(&space->device()),offset,data);
10464   logerror("%04x: twineagl_200100_w %d = %02x\n",cpu_get_pc(&space.device()),offset,data);
1049310465
1049410466   if (ACCESSING_BITS_0_7)
1049510467   {
10496      seta_state *state = space->machine().driver_data<seta_state>();
10497      state->m_twineagl_xram[offset] = data & 0xff;
10468      m_twineagl_xram[offset] = data & 0xff;
1049810469   }
1049910470}
1050010471
1050110472static DRIVER_INIT( twineagl )
1050210473{
10474   seta_state *state = machine.driver_data<seta_state>();
1050310475   /* debug? */
10504   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x800000, 0x8000ff, FUNC(twineagl_debug_r));
10476   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x800000, 0x8000ff, read16_delegate(FUNC(seta_state::twineagl_debug_r),state));
1050510477
1050610478   /* This allows 2 simultaneous players and the use of the "Copyright" Dip Switch. */
10507   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x200100, 0x20010f, FUNC(twineagl_200100_r), FUNC(twineagl_200100_w));
10479   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x200100, 0x20010f, read16_delegate(FUNC(seta_state::twineagl_200100_r),state), write16_delegate(FUNC(seta_state::twineagl_200100_w),state));
1050810480}
1050910481
1051010482
1051110483/* Protection? NVRAM is handled writing commands here */
10512static READ16_HANDLER( downtown_protection_r )
10484READ16_MEMBER(seta_state::downtown_protection_r)
1051310485{
10514   seta_state *state = space->machine().driver_data<seta_state>();
10515   int job = state->m_downtown_protection[0xf8/2] & 0xff;
10486   int job = m_downtown_protection[0xf8/2] & 0xff;
1051610487
1051710488   switch (job)
1051810489   {
r14896r14897
1052310494         else                              return 0;
1052410495      }
1052510496      default:
10526         return state->m_downtown_protection[offset] & 0xff;
10497         return m_downtown_protection[offset] & 0xff;
1052710498   }
1052810499}
1052910500
10530static WRITE16_HANDLER( downtown_protection_w )
10501WRITE16_MEMBER(seta_state::downtown_protection_w)
1053110502{
10532   seta_state *state = space->machine().driver_data<seta_state>();
10533   COMBINE_DATA(&state->m_downtown_protection[offset]);
10503   COMBINE_DATA(&m_downtown_protection[offset]);
1053410504}
1053510505
1053610506static DRIVER_INIT( downtown )
1053710507{
10538   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x200000, 0x2001ff, FUNC(downtown_protection_r), FUNC(downtown_protection_w));
10508   seta_state *state = machine.driver_data<seta_state>();
10509   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x200000, 0x2001ff, read16_delegate(FUNC(seta_state::downtown_protection_r),state), write16_delegate(FUNC(seta_state::downtown_protection_w),state));
1053910510}
1054010511
1054110512
10542static READ16_HANDLER( arbalest_debug_r )
10513READ16_MEMBER(seta_state::arbalest_debug_r)
1054310514{
1054410515   /*  At some points in the code, the program checks if four
1054510516        consecutive bytes in this range are equal to a string, and if they
r14896r14897
1055510526
1055610527static DRIVER_INIT( arbalest )
1055710528{
10558   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x80000, 0x8000f, FUNC(arbalest_debug_r));
10529   seta_state *state = machine.driver_data<seta_state>();
10530   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80000, 0x8000f, read16_delegate(FUNC(seta_state::arbalest_debug_r),state));
1055910531}
1056010532
1056110533
r14896r14897
1061410586
1061510587static DRIVER_INIT( zombraid )
1061610588{
10617   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xf00002, 0xf00003, FUNC(zombraid_gun_r));
10618   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xf00000, 0xf00001, FUNC(zombraid_gun_w));
10589   seta_state *state = machine.driver_data<seta_state>();
10590   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf00002, 0xf00003, read16_delegate(FUNC(seta_state::zombraid_gun_r),state));
10591   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xf00000, 0xf00001, write16_delegate(FUNC(seta_state::zombraid_gun_w),state));
1061910592}
1062010593
1062110594
r14896r14897
1066610639
1066710640   /* X1_010 is not used. */
1066810641   machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(0x100000, 0x103fff);
10642   seta_state *state = machine.driver_data<seta_state>();
10643   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xB00008, 0xB00009, write16_delegate(FUNC(seta_state::wiggie_soundlatch_w),state));
1066910644
10670   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xB00008, 0xB00009, FUNC(wiggie_soundlatch_w));
10671
1067210645}
1067310646
1067410647static DRIVER_INIT( crazyfgt )
src/mame/drivers/laserbat.c
r14896r14897
6565
6666   m_input_mux = (data & 0x30) >> 4;
6767
68   flip_screen_set_no_update(machine(), data & 0x08);
68   flip_screen_set_no_update(data & 0x08);
6969
7070   coin_counter_w(machine(), 0,data & 1);
7171
r14896r14897
180180static ADDRESS_MAP_START( laserbat_io_map, AS_IO, 8, laserbat_state )
181181   AM_RANGE(0x00, 0x00) AM_WRITE(laserbat_cnteff_w)
182182   AM_RANGE(0x01, 0x01) AM_WRITE(video_extra_w)
183   AM_RANGE(0x02, 0x02) AM_READ(laserbat_input_r) AM_WRITE_LEGACY(laserbat_csound1_w)
183   AM_RANGE(0x02, 0x02) AM_READ(laserbat_input_r) AM_WRITE(laserbat_csound1_w)
184184   AM_RANGE(0x04, 0x05) AM_WRITE(sprite_x_y_w)
185185   AM_RANGE(0x06, 0x06) AM_WRITE(laserbat_input_mux_w)
186   AM_RANGE(0x07, 0x07) AM_WRITE_LEGACY(laserbat_csound2_w)
186   AM_RANGE(0x07, 0x07) AM_WRITE(laserbat_csound2_w)
187187   AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
188188ADDRESS_MAP_END
189189
190190
191191static ADDRESS_MAP_START( catnmous_io_map, AS_IO, 8, laserbat_state )
192   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_w) // soundlatch ?
192   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_byte_w) // soundlatch ?
193193   AM_RANGE(0x01, 0x01) AM_WRITE(video_extra_w)
194194   AM_RANGE(0x02, 0x02) AM_READ(laserbat_input_r)
195195   AM_RANGE(0x02, 0x02) AM_WRITENOP // unknown
r14896r14897
650650   AY8910_LEGACY_OUTPUT,
651651   AY8910_DEFAULT_LOADS,
652652   DEVCB_NULL,
653   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
653   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
654654   DEVCB_NULL,//ay8910_port0a_w,
655655   DEVCB_NULL
656656};
src/mame/drivers/tp84.c
r14896r14897
135135   AM_RANGE(0x3004, 0x3004) AM_WRITEONLY AM_BASE(m_flipscreen_x)
136136   AM_RANGE(0x3005, 0x3005) AM_WRITEONLY AM_BASE(m_flipscreen_y)
137137   AM_RANGE(0x3800, 0x3800) AM_WRITE(tp84_sh_irqtrigger_w)
138   AM_RANGE(0x3a00, 0x3a00) AM_WRITE(soundlatch_w)
138   AM_RANGE(0x3a00, 0x3a00) AM_WRITE(soundlatch_byte_w)
139139   AM_RANGE(0x3c00, 0x3c00) AM_WRITEONLY AM_BASE(m_scroll_x)
140140   AM_RANGE(0x3e00, 0x3e00) AM_WRITEONLY AM_BASE(m_scroll_y)
141141   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(m_bg_videoram)
r14896r14897
161161   AM_RANGE(0x1c04, 0x1c04) AM_WRITEONLY AM_BASE(m_flipscreen_x)
162162   AM_RANGE(0x1c05, 0x1c05) AM_WRITEONLY AM_BASE(m_flipscreen_y)
163163   AM_RANGE(0x1e00, 0x1e00) AM_WRITE(tp84_sh_irqtrigger_w)
164   AM_RANGE(0x1e80, 0x1e80) AM_WRITE(soundlatch_w)
164   AM_RANGE(0x1e80, 0x1e80) AM_WRITE(soundlatch_byte_w)
165165   AM_RANGE(0x1f00, 0x1f00) AM_WRITEONLY AM_BASE(m_scroll_x)
166166   AM_RANGE(0x1f80, 0x1f80) AM_WRITEONLY AM_BASE(m_scroll_y)
167167   AM_RANGE(0x8000, 0xffff) AM_ROM
r14896r14897
189189static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, tp84_state )
190190   AM_RANGE(0x0000, 0x3fff) AM_ROM
191191   AM_RANGE(0x4000, 0x43ff) AM_RAM
192   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
192   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
193193   AM_RANGE(0x8000, 0x8000) AM_READ(tp84_sh_timer_r)
194194   AM_RANGE(0xa000, 0xa1ff) AM_WRITE(tp84_filter_w)
195195   AM_RANGE(0xc000, 0xc000) AM_WRITENOP
src/mame/drivers/vball.c
r14896r14897
171171/* The sound system comes all but verbatim from Double Dragon */
172172WRITE8_MEMBER(vball_state::cpu_sound_command_w)
173173{
174   soundlatch_w(space, offset, data);
174   soundlatch_byte_w(space, offset, data);
175175   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
176176}
177177
r14896r14897
187187*/
188188WRITE8_MEMBER(vball_state::vb_scrollx_hi_w)
189189{
190   flip_screen_set(machine(), ~data&1);
190   flip_screen_set(~data&1);
191191   m_vb_scrollx_hi = (data & 0x02) << 7;
192192   vb_bgprombank_w(machine(), (data >> 2) & 0x07);
193193   vb_spprombank_w(machine(), (data >> 5) & 0x07);
r14896r14897
229229   AM_RANGE(0x8000, 0x87ff) AM_RAM
230230   AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
231231   AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE("oki", okim6295_device, read, write)
232   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
232   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_byte_r)
233233ADDRESS_MAP_END
234234
235235
src/mame/drivers/stv.c
r14896r14897
4646    0x001f PORT-AD
4747*/
4848
49static READ8_HANDLER( stv_ioga_r )
49READ8_MEMBER(saturn_state::stv_ioga_r)
5050{
51   saturn_state *state = space->machine().driver_data<saturn_state>();
5251   UINT8 res;
5352
5453   res = 0xff;
5554   offset &= 0x1f; // mirror?
5655
57   if(offset & 0x20 && !space->debugger_access())
56   if(offset & 0x20 && !space.debugger_access())
5857      printf("Reading from mirror %08x?\n",offset);
5958
6059   switch(offset)
6160   {
62      case 0x01: res = input_port_read(space->machine(), "PORTA"); break; // P1
63      case 0x03: res = input_port_read(space->machine(), "PORTB"); break; // P2
64      case 0x05: res = input_port_read(space->machine(), "PORTC"); break; // SYSTEM
65      case 0x07: res = state->m_system_output | 0xf0; break; // port D, read-backs value written
66      case 0x09: res = input_port_read(space->machine(), "PORTE"); break; // P3
67      case 0x0b: res = input_port_read(space->machine(), "PORTF"); break; // P4
61      case 0x01: res = input_port_read(machine(), "PORTA"); break; // P1
62      case 0x03: res = input_port_read(machine(), "PORTB"); break; // P2
63      case 0x05: res = input_port_read(machine(), "PORTC"); break; // SYSTEM
64      case 0x07: res = m_system_output | 0xf0; break; // port D, read-backs value written
65      case 0x09: res = input_port_read(machine(), "PORTE"); break; // P3
66      case 0x0b: res = input_port_read(machine(), "PORTF"); break; // P4
6867      case 0x1b: res = 0; break; // Serial COM READ status
6968   }
7069
7170   return res;
7271}
7372
74static WRITE8_HANDLER( stv_ioga_w )
73WRITE8_MEMBER(saturn_state::stv_ioga_w)
7574{
76   saturn_state *state = space->machine().driver_data<saturn_state>();
7775   offset &= 0x1f; // mirror?
7876
79   if(offset & 0x20 && !space->debugger_access())
77   if(offset & 0x20 && !space.debugger_access())
8078      printf("Reading from mirror %08x?\n",offset);
8179
8280   switch(offset)
8381   {
8482      case 0x07:
85         state->m_system_output = data & 0xf;
83         m_system_output = data & 0xf;
8684         /*Why does the BIOS tests these as ACTIVE HIGH? A program bug?*/
87         coin_counter_w(space->machine(), 0,~data & 0x01);
88         coin_counter_w(space->machine(), 1,~data & 0x02);
89         coin_lockout_w(space->machine(), 0,~data & 0x04);
90         coin_lockout_w(space->machine(), 1,~data & 0x08);
85         coin_counter_w(machine(), 0,~data & 0x01);
86         coin_counter_w(machine(), 1,~data & 0x02);
87         coin_lockout_w(machine(), 0,~data & 0x04);
88         coin_lockout_w(machine(), 1,~data & 0x08);
9189         break;
9290   }
9391}
9492
95static READ8_HANDLER( critcrsh_ioga_r )
93READ8_MEMBER(saturn_state::critcrsh_ioga_r)
9694{
9795   UINT8 res;
9896   const char *const lgnames[] = { "LIGHTX", "LIGHTY" };
r14896r14897
103101   {
104102      case 0x01:
105103      case 0x03:
106         res = input_port_read(space->machine(), lgnames[offset >> 1]);
104         res = input_port_read(machine(), lgnames[offset >> 1]);
107105         res = BITSWAP8(res, 2, 3, 0, 1, 6, 7, 5, 4) & 0xf3;
108         res |= (input_port_read(space->machine(), "PORTC") & 0x10) ? 0x0 : 0x4; // x/y hit latch actually
106         res |= (input_port_read(machine(), "PORTC") & 0x10) ? 0x0 : 0x4; // x/y hit latch actually
109107         break;
110108      default: res = stv_ioga_r(space,offset); break;
111109   }
r14896r14897
113111   return res;
114112}
115113
116static READ8_HANDLER( magzun_ioga_r )
114READ8_MEMBER(saturn_state::magzun_ioga_r)
117115{
118   //saturn_state *state = space->machine().driver_data<saturn_state>();
119116   UINT8 res;
120117
121118   res = 0xff;
r14896r14897
139136   return res;
140137}
141138
142static WRITE8_HANDLER( magzun_ioga_w )
139WRITE8_MEMBER(saturn_state::magzun_ioga_w)
143140{
144   saturn_state *state = space->machine().driver_data<saturn_state>();
145141
146142   switch(offset)
147143   {
148      case 0x13: state->m_serial_tx = (data << 8) | (state->m_serial_tx & 0xff); break;
149      case 0x15: state->m_serial_tx = (data & 0xff) | (state->m_serial_tx & 0xff00); break;
144      case 0x13: m_serial_tx = (data << 8) | (m_serial_tx & 0xff); break;
145      case 0x15: m_serial_tx = (data & 0xff) | (m_serial_tx & 0xff00); break;
150146      default: stv_ioga_w(space,offset,data); break;
151147   }
152148}
153149
154static READ8_HANDLER( stvmp_ioga_r )
150READ8_MEMBER(saturn_state::stvmp_ioga_r)
155151{
156   saturn_state *state = space->machine().driver_data<saturn_state>();
157152   const char *const mpnames[2][5] = {
158153      {"P1_KEY0", "P1_KEY1", "P1_KEY2", "P1_KEY3", "P1_KEY4"},
159154      {"P2_KEY0", "P2_KEY1", "P2_KEY2", "P2_KEY3", "P2_KEY4"} };
r14896r14897
165160   {
166161      case 0x01:
167162      case 0x03:
168         if(state->m_port_sel & 0x10) // joystick select
163         if(m_port_sel & 0x10) // joystick select
169164            res = stv_ioga_r(space,offset);
170165         else // mahjong panel select
171166         {
r14896r14897
173168
174169            for(i=0;i<5;i++)
175170            {
176               if(state->m_mux_data & 1 << i)
177                  res = input_port_read(space->machine(), mpnames[offset >> 1][i]);
171               if(m_mux_data & 1 << i)
172                  res = input_port_read(machine(), mpnames[offset >> 1][i]);
178173            }
179174         }
180175         break;
r14896r14897
184179   return res;
185180}
186181
187static WRITE8_HANDLER( stvmp_ioga_w )
182WRITE8_MEMBER(saturn_state::stvmp_ioga_w)
188183{
189   saturn_state *state = space->machine().driver_data<saturn_state>();
190184
191185   switch(offset)
192186   {
193      case 0x09: state->m_mux_data = data ^ 0xff; break;
194      case 0x11: state->m_port_sel = data; break;
187      case 0x09: m_mux_data = data ^ 0xff; break;
188      case 0x11: m_port_sel = data; break;
195189      default:   stv_ioga_w(space,offset,data); break;
196190   }
197191}
198192
199193/* remaps with a 8-bit handler because MAME can't install r/w handlers with a different bus parallelism than the CPU native one, shrug ... */
200static READ32_HANDLER( stv_ioga_r32 )
194READ32_MEMBER(saturn_state::stv_ioga_r32)
201195{
202   //saturn_state *state = space->machine().driver_data<saturn_state>();
203196   UINT32 res;
204197
205198   res = 0;
r14896r14897
213206   return res;
214207}
215208
216static WRITE32_HANDLER ( stv_ioga_w32 )
209WRITE32_MEMBER(saturn_state::stv_ioga_w32)
217210{
218   //saturn_state *state = space->machine().driver_data<saturn_state>();
219211
220212   if(ACCESSING_BITS_16_23)
221213      stv_ioga_w(space,offset*4+1,data >> 16);
r14896r14897
227219   return;
228220}
229221
230static READ32_HANDLER( critcrsh_ioga_r32 )
222READ32_MEMBER(saturn_state::critcrsh_ioga_r32)
231223{
232224   UINT32 res;
233225
r14896r14897
237229   if(ACCESSING_BITS_0_7)
238230      res |= critcrsh_ioga_r(space,offset*4+3);
239231   if(ACCESSING_BITS_8_15 || ACCESSING_BITS_24_31)
240      if(!space->debugger_access())
232      if(!space.debugger_access())
241233         printf("Warning: IOGA reads from odd offset %02x %08x!\n",offset*4,mem_mask);
242234
243235   return res;
244236}
245237
246static READ32_HANDLER( stvmp_ioga_r32 )
238READ32_MEMBER(saturn_state::stvmp_ioga_r32)
247239{
248240   UINT32 res;
249241
r14896r14897
253245   if(ACCESSING_BITS_0_7)
254246      res |= stvmp_ioga_r(space,offset*4+3);
255247   if(ACCESSING_BITS_8_15 || ACCESSING_BITS_24_31)
256      if(!space->debugger_access())
248      if(!space.debugger_access())
257249         printf("Warning: IOGA reads from odd offset %02x %08x!\n",offset*4,mem_mask);
258250
259251   return res;
260252}
261253
262static WRITE32_HANDLER( stvmp_ioga_w32 )
254WRITE32_MEMBER(saturn_state::stvmp_ioga_w32)
263255{
264256   if(ACCESSING_BITS_16_23)
265257      stvmp_ioga_w(space,offset*4+1,data >> 16);
266258   if(ACCESSING_BITS_0_7)
267259      stvmp_ioga_w(space,offset*4+3,data);
268260   if(ACCESSING_BITS_8_15 || ACCESSING_BITS_24_31)
269      if(!space->debugger_access())
261      if(!space.debugger_access())
270262         printf("Warning: IOGA writes to odd offset %02x (%08x) -> %08x!",offset*4,mem_mask,data);
271263}
272264
273static READ32_HANDLER( magzun_ioga_r32 )
265READ32_MEMBER(saturn_state::magzun_ioga_r32)
274266{
275267   UINT32 res;
276268
r14896r14897
280272   if(ACCESSING_BITS_0_7)
281273      res |= magzun_ioga_r(space,offset*4+3);
282274   if(ACCESSING_BITS_8_15 || ACCESSING_BITS_24_31)
283      if(!space->debugger_access())
275      if(!space.debugger_access())
284276         printf("Warning: IOGA reads from odd offset %02x %08x!\n",offset*4,mem_mask);
285277
286278   return res;
287279}
288280
289static WRITE32_HANDLER( magzun_ioga_w32 )
281WRITE32_MEMBER(saturn_state::magzun_ioga_w32)
290282{
291283   if(ACCESSING_BITS_16_23)
292284      magzun_ioga_w(space,offset*4+1,data >> 16);
293285   if(ACCESSING_BITS_0_7)
294286      magzun_ioga_w(space,offset*4+3,data);
295287   if(ACCESSING_BITS_8_15 || ACCESSING_BITS_24_31)
296      if(!space->debugger_access())
288      if(!space.debugger_access())
297289         printf("Warning: IOGA writes to odd offset %02x (%08x) -> %08x!",offset*4,mem_mask,data);
298290}
299291
r14896r14897
352344   sh2drc_set_options(machine.device("maincpu"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
353345   sh2drc_set_options(machine.device("slave"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
354346
355   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x00400000, 0x0040003f, FUNC(stv_ioga_r32), FUNC(stv_ioga_w32));
356   machine.device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x00400000, 0x0040003f, FUNC(stv_ioga_r32), FUNC(stv_ioga_w32));
347   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stv_ioga_r32),state), write32_delegate(FUNC(saturn_state::stv_ioga_w32),state));
348   machine.device("slave")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stv_ioga_r32),state), write32_delegate(FUNC(saturn_state::stv_ioga_w32),state));
357349
358350   state->m_vdp2.pal = 0;
359351}
r14896r14897
361353DRIVER_INIT(critcrsh)
362354{
363355   DRIVER_INIT_CALL(stv);
364
365   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x00400000, 0x0040003f, FUNC(critcrsh_ioga_r32), FUNC(stv_ioga_w32));
366   machine.device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x00400000, 0x0040003f, FUNC(critcrsh_ioga_r32), FUNC(stv_ioga_w32));
356   saturn_state *state = machine.driver_data<saturn_state>();
357   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::critcrsh_ioga_r32),state), write32_delegate(FUNC(saturn_state::stv_ioga_w32),state));
358   machine.device("slave")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::critcrsh_ioga_r32),state), write32_delegate(FUNC(saturn_state::stv_ioga_w32),state));
367359}
368360
369361/*
r14896r14897
374366    TODO: game doesn't work if not in debugger?
375367*/
376368
377static READ32_HANDLER( magzun_hef_hack_r )
369READ32_MEMBER(saturn_state::magzun_hef_hack_r)
378370{
379   saturn_state *state = space->machine().driver_data<saturn_state>();
380371
381   if(cpu_get_pc(&space->device())==0x604bf20) return 0x00000001; //HWEF
372   if(cpu_get_pc(&space.device())==0x604bf20) return 0x00000001; //HWEF
382373
383   if(cpu_get_pc(&space->device())==0x604bfbe) return 0x00000002; //HREF
374   if(cpu_get_pc(&space.device())==0x604bfbe) return 0x00000002; //HREF
384375
385   return state->m_workram_h[0x08e830/4];
376   return m_workram_h[0x08e830/4];
386377}
387378
388static READ32_HANDLER( magzun_rx_hack_r )
379READ32_MEMBER(saturn_state::magzun_rx_hack_r)
389380{
390   saturn_state *state = space->machine().driver_data<saturn_state>();
391381
392   if(cpu_get_pc(&space->device())==0x604c006) return 0x40;
382   if(cpu_get_pc(&space.device())==0x604c006) return 0x40;
393383
394   return state->m_workram_h[0x0ff3b4/4];
384   return m_workram_h[0x0ff3b4/4];
395385}
396386
397387DRIVER_INIT(magzun)
398388{
389   saturn_state *state = machine.driver_data<saturn_state>();
399390   sh2drc_add_pcflush(machine.device("maincpu"), 0x604bf20);
400391   sh2drc_add_pcflush(machine.device("maincpu"), 0x604bfbe);
401392   sh2drc_add_pcflush(machine.device("maincpu"), 0x604c006);
402393
403394   DRIVER_INIT_CALL(stv);
404395
405   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x00400000, 0x0040003f, FUNC(magzun_ioga_r32), FUNC(magzun_ioga_w32));
406   machine.device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x00400000, 0x0040003f, FUNC(magzun_ioga_r32), FUNC(magzun_ioga_w32));
396   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::magzun_ioga_r32),state), write32_delegate(FUNC(saturn_state::magzun_ioga_w32),state));
397   machine.device("slave")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::magzun_ioga_r32),state), write32_delegate(FUNC(saturn_state::magzun_ioga_w32),state));
407398
408   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x608e830, 0x608e833, FUNC(magzun_hef_hack_r) );
409   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x60ff3b4, 0x60ff3b7, FUNC(magzun_rx_hack_r) );
399   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x608e830, 0x608e833, read32_delegate(FUNC(saturn_state::magzun_hef_hack_r),state));
400   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x60ff3b4, 0x60ff3b7, read32_delegate(FUNC(saturn_state::magzun_rx_hack_r),state));
410401
411402   /* Program ROM patches, don't understand how to avoid these two checks ... */
412403   {
r14896r14897
422413DRIVER_INIT(stvmp)
423414{
424415   DRIVER_INIT_CALL(stv);
425
426   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x00400000, 0x0040003f, FUNC(stvmp_ioga_r32), FUNC(stvmp_ioga_w32));
427   machine.device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x00400000, 0x0040003f, FUNC(stvmp_ioga_r32), FUNC(stvmp_ioga_w32));
416   saturn_state *state = machine.driver_data<saturn_state>();
417   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stvmp_ioga_r32),state), write32_delegate(FUNC(saturn_state::stvmp_ioga_w32),state));
418   machine.device("slave")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stvmp_ioga_r32),state), write32_delegate(FUNC(saturn_state::stvmp_ioga_w32),state));
428419}
429420
430421
r14896r14897
672663
673664*/
674665
675static READ32_HANDLER( astrass_hack_r )
666READ32_MEMBER(saturn_state::astrass_hack_r)
676667{
677   saturn_state *state = space->machine().driver_data<saturn_state>();
678668
679   if(cpu_get_pc(&space->device()) == 0x60011ba) return 0x00000000;
669   if(cpu_get_pc(&space.device()) == 0x60011ba) return 0x00000000;
680670
681   return state->m_workram_h[0x000770/4];
671   return m_workram_h[0x000770/4];
682672}
683673
684674DRIVER_INIT( astrass )
685675{
676   saturn_state *state = machine.driver_data<saturn_state>();
686677   sh2drc_add_pcflush(machine.device("maincpu"), 0x60011ba);
687678   sh2drc_add_pcflush(machine.device("maincpu"), 0x605b9da);
688679
689   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x06000770, 0x06000773, FUNC(astrass_hack_r) );
680   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x06000770, 0x06000773, read32_delegate(FUNC(saturn_state::astrass_hack_r),state));
690681
691682   install_astrass_protection(machine);
692683
src/mame/drivers/queen.c
r14896r14897
9393   DECLARE_WRITE32_MEMBER( bios_ext4_ram_w );
9494
9595   DECLARE_WRITE32_MEMBER( bios_ram_w );
96   DECLARE_READ8_MEMBER(at_page8_r);
97   DECLARE_WRITE8_MEMBER(at_page8_w);
98   DECLARE_READ8_MEMBER(pc_dma_read_byte);
99   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
100   DECLARE_READ8_MEMBER(vga_setting);
96101};
97102
98103
r14896r14897
381386   ide_controller32_w(device, 0x3f0/4 + offset, data, mem_mask);
382387}
383388
384static READ8_HANDLER(at_page8_r)
389READ8_MEMBER(queen_state::at_page8_r)
385390{
386   queen_state *state = space->machine().driver_data<queen_state>();
387   UINT8 data = state->m_at_pages[offset % 0x10];
391   UINT8 data = m_at_pages[offset % 0x10];
388392
389393   switch(offset % 8) {
390394   case 1:
391      data = state->m_dma_offset[(offset / 8) & 1][2];
395      data = m_dma_offset[(offset / 8) & 1][2];
392396      break;
393397   case 2:
394      data = state->m_dma_offset[(offset / 8) & 1][3];
398      data = m_dma_offset[(offset / 8) & 1][3];
395399      break;
396400   case 3:
397      data = state->m_dma_offset[(offset / 8) & 1][1];
401      data = m_dma_offset[(offset / 8) & 1][1];
398402      break;
399403   case 7:
400      data = state->m_dma_offset[(offset / 8) & 1][0];
404      data = m_dma_offset[(offset / 8) & 1][0];
401405      break;
402406   }
403407   return data;
404408}
405409
406410
407static WRITE8_HANDLER(at_page8_w)
411WRITE8_MEMBER(queen_state::at_page8_w)
408412{
409   queen_state *state = space->machine().driver_data<queen_state>();
410   state->m_at_pages[offset % 0x10] = data;
413   m_at_pages[offset % 0x10] = data;
411414
412415   switch(offset % 8) {
413416   case 1:
414      state->m_dma_offset[(offset / 8) & 1][2] = data;
417      m_dma_offset[(offset / 8) & 1][2] = data;
415418      break;
416419   case 2:
417      state->m_dma_offset[(offset / 8) & 1][3] = data;
420      m_dma_offset[(offset / 8) & 1][3] = data;
418421      break;
419422   case 3:
420      state->m_dma_offset[(offset / 8) & 1][1] = data;
423      m_dma_offset[(offset / 8) & 1][1] = data;
421424      break;
422425   case 7:
423      state->m_dma_offset[(offset / 8) & 1][0] = data;
426      m_dma_offset[(offset / 8) & 1][0] = data;
424427      break;
425428   }
426429}
427430
428static READ32_HANDLER(at_page32_r)
429{
430   return read32le_with_read8_handler(at_page8_r, space, offset, mem_mask);
431}
432431
433
434static WRITE32_HANDLER(at_page32_w)
435{
436   write32le_with_write8_handler(at_page8_w, space, offset, data, mem_mask);
437}
438
439432static READ8_DEVICE_HANDLER(at_dma8237_2_r)
440433{
441434   return i8237_r(device, offset / 2);
r14896r14897
468461}
469462
470463
471static READ8_HANDLER( pc_dma_read_byte )
464READ8_MEMBER(queen_state::pc_dma_read_byte)
472465{
473   queen_state *state = space->machine().driver_data<queen_state>();
474   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
466   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
475467      & 0xFF0000;
476468
477   return space->read_byte(page_offset + offset);
469   return space.read_byte(page_offset + offset);
478470}
479471
480472
481static WRITE8_HANDLER( pc_dma_write_byte )
473WRITE8_MEMBER(queen_state::pc_dma_write_byte)
482474{
483   queen_state *state = space->machine().driver_data<queen_state>();
484   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
475   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
485476      & 0xFF0000;
486477
487   space->write_byte(page_offset + offset, data);
478   space.write_byte(page_offset + offset, data);
488479}
489480
490481static void set_dma_channel(device_t *device, int channel, int state)
r14896r14897
502493{
503494   DEVCB_LINE(pc_dma_hrq_changed),
504495   DEVCB_NULL,
505   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
506   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
496   DEVCB_DRIVER_MEMBER(queen_state, pc_dma_read_byte),
497   DEVCB_DRIVER_MEMBER(queen_state, pc_dma_write_byte),
507498   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
508499   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
509500   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
540531   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
541532   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
542533   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
543   AM_RANGE(0x0080, 0x009f) AM_READWRITE_LEGACY(at_page32_r,            at_page32_w)
534   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,   at_page8_w, 0xffffffff)
544535   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
545536   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
546537   AM_RANGE(0x00e8, 0x00ef) AM_NOP
src/mame/drivers/timelimt.c
r14896r14897
2121
2222static MACHINE_START( timelimt )
2323{
24   soundlatch_setclearedvalue( machine, 0 );
24   machine.driver_data<timelimt_state>()->soundlatch_setclearedvalue( 0 );
2525}
2626
2727static MACHINE_RESET( timelimt )
r14896r14897
4747   AM_RANGE(0x0000, 0x7fff) AM_ROM      /* rom */
4848   AM_RANGE(0x8000, 0x87ff) AM_RAM      /* ram */
4949   AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(timelimt_videoram_w) AM_BASE(m_videoram)   /* video ram */
50   AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(timelimt_bg_videoram_w) AM_BASE(m_bg_videoram) AM_SIZE(m_bg_videoram_size)/* background ram */
50   AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(timelimt_bg_videoram_w) AM_BASE_SIZE(m_bg_videoram,m_bg_videoram_size)/* background ram */
5151   AM_RANGE(0x9800, 0x98ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   /* sprite ram */
5252   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("INPUTS")
5353   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("SYSTEM")
5454   AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW")
5555   AM_RANGE(0xb000, 0xb000) AM_WRITE(nmi_enable_w)   /* nmi enable */
5656   AM_RANGE(0xb003, 0xb003) AM_WRITE(sound_reset_w)/* sound reset ? */
57   AM_RANGE(0xb800, 0xb800) AM_WRITE(soundlatch_w) /* sound write */
57   AM_RANGE(0xb800, 0xb800) AM_WRITE(soundlatch_byte_w) /* sound write */
5858   AM_RANGE(0xb800, 0xb800) AM_READNOP      /* NMI ack? */
5959   AM_RANGE(0xc800, 0xc800) AM_WRITE(timelimt_scroll_x_lsb_w)
6060   AM_RANGE(0xc801, 0xc801) AM_WRITE(timelimt_scroll_x_msb_w)
r14896r14897
7575
7676static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, timelimt_state )
7777   ADDRESS_MAP_GLOBAL_MASK(0xff)
78   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_w)
78   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_byte_w)
7979   AM_RANGE(0x8c, 0x8d) AM_DEVREADWRITE_LEGACY("ay1", ay8910_r, ay8910_address_data_w)
8080   AM_RANGE(0x8e, 0x8f) AM_DEVREADWRITE_LEGACY("ay2", ay8910_r, ay8910_address_data_w)
8181ADDRESS_MAP_END
r14896r14897
210210{
211211   AY8910_LEGACY_OUTPUT,
212212   AY8910_DEFAULT_LOADS,
213   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
213   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
214214   DEVCB_NULL,
215215   DEVCB_NULL,
216216   DEVCB_NULL
src/mame/drivers/champbwl.c
r14896r14897
165165      : tnzs_state(mconfig, type, tag) { }
166166
167167   UINT8    m_last_trackball_val[2];
168   DECLARE_READ8_MEMBER(trackball_r);
169   DECLARE_WRITE8_MEMBER(champbwl_misc_w);
170   DECLARE_WRITE8_MEMBER(doraemon_outputs_w);
168171};
169172
170173
171174
172static READ8_HANDLER( trackball_r )
175READ8_MEMBER(champbwl_state::trackball_r)
173176{
174   champbwl_state *state = space->machine().driver_data<champbwl_state>();
175177   UINT8 ret;
176   UINT8 port4 = input_port_read(space->machine(), "FAKEX");
177   UINT8 port5 = input_port_read(space->machine(), "FAKEY");
178   UINT8 port4 = input_port_read(machine(), "FAKEX");
179   UINT8 port5 = input_port_read(machine(), "FAKEY");
178180
179   ret = (((port4 - state->m_last_trackball_val[0]) & 0x0f)<<4) | ((port5 - state->m_last_trackball_val[1]) & 0x0f);
181   ret = (((port4 - m_last_trackball_val[0]) & 0x0f)<<4) | ((port5 - m_last_trackball_val[1]) & 0x0f);
180182
181   state->m_last_trackball_val[0] = port4;
182   state->m_last_trackball_val[1] = port5;
183   m_last_trackball_val[0] = port4;
184   m_last_trackball_val[1] = port5;
183185
184186   return ret;
185187}
186188
187static WRITE8_HANDLER( champbwl_misc_w )
189WRITE8_MEMBER(champbwl_state::champbwl_misc_w)
188190{
189   coin_counter_w(space->machine(), 0, data & 1);
190   coin_counter_w(space->machine(), 1, data & 2);
191   coin_counter_w(machine(), 0, data & 1);
192   coin_counter_w(machine(), 1, data & 2);
191193
192   coin_lockout_w(space->machine(), 0, ~data & 8);
193   coin_lockout_w(space->machine(), 1, ~data & 4);
194   coin_lockout_w(machine(), 0, ~data & 8);
195   coin_lockout_w(machine(), 1, ~data & 4);
194196
195   memory_set_bank(space->machine(), "bank1", (data & 0x30) >> 4);
197   memory_set_bank(machine(), "bank1", (data & 0x30) >> 4);
196198}
197199
198static ADDRESS_MAP_START( champbwl_map, AS_PROGRAM, 8, tnzs_state )
200static ADDRESS_MAP_START( champbwl_map, AS_PROGRAM, 8, champbwl_state )
199201   AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("maincpu", 0x10000)
200202   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
201203   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("nvram")
r14896r14897
206208   AM_RANGE(0xe300, 0xe303) AM_MIRROR(0xfc) AM_DEVWRITE_LEGACY("spritegen", spritectrl_w8) /* control registers (0x80 mirror used by Arkanoid 2) */
207209   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE_LEGACY("spritegen", spritebgflag_w8)   /* enable / disable background transparency */
208210
209   AM_RANGE(0xf000, 0xf000) AM_READ_LEGACY(trackball_r)
211   AM_RANGE(0xf000, 0xf000) AM_READ(trackball_r)
210212   AM_RANGE(0xf002, 0xf002) AM_READ_PORT("IN0")
211213   AM_RANGE(0xf004, 0xf004) AM_READ_PORT("IN1")
212214   AM_RANGE(0xf006, 0xf006) AM_READ_PORT("IN2")
213215   AM_RANGE(0xf007, 0xf007) AM_READ_PORT("IN3")
214216
215   AM_RANGE(0xf000, 0xf000) AM_WRITE_LEGACY(champbwl_misc_w)
217   AM_RANGE(0xf000, 0xf000) AM_WRITE(champbwl_misc_w)
216218   AM_RANGE(0xf002, 0xf002) AM_WRITENOP //buttons light?
217219   AM_RANGE(0xf004, 0xf004) AM_WRITENOP //buttons light?
218220   AM_RANGE(0xf006, 0xf006) AM_WRITENOP //buttons light?
r14896r14897
221223
222224
223225
224static WRITE8_HANDLER( doraemon_outputs_w )
226WRITE8_MEMBER(champbwl_state::doraemon_outputs_w)
225227{
226   coin_counter_w(space->machine(), 0, data & 1);   // coin in counter
227   coin_counter_w(space->machine(), 1, data & 2);   // gift out counter
228   coin_counter_w(machine(), 0, data & 1);   // coin in counter
229   coin_counter_w(machine(), 1, data & 2);   // gift out counter
228230
229   coin_lockout_w(space->machine(), 0, ~data & 8);   // coin lockout
230   ticket_dispenser_w(space->machine().device("hopper"), 0, (data & 0x04) ? 0x00 : 0x80);   // gift out motor
231   coin_lockout_w(machine(), 0, ~data & 8);   // coin lockout
232   machine().device<ticket_dispenser_device>("hopper")->write(*&space, 0, (data & 0x04) ? 0x00 : 0x80);   // gift out motor
231233
232   memory_set_bank(space->machine(), "bank1", (data & 0x30) >> 4);
234   memory_set_bank(machine(), "bank1", (data & 0x30) >> 4);
233235
234236//  popmessage("%02x", data);
235237}
236238
237static ADDRESS_MAP_START( doraemon, AS_PROGRAM, 8, tnzs_state )
239static ADDRESS_MAP_START( doraemon, AS_PROGRAM, 8, champbwl_state )
238240   AM_RANGE(0x0000, 0x3fff) AM_ROM
239241   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
240242   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("nvram")
r14896r14897
244246   AM_RANGE(0xe000, 0xe2ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r8, spriteylow_w8)
245247   AM_RANGE(0xe300, 0xe303) AM_DEVWRITE_LEGACY("spritegen", spritectrl_w8)
246248   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE_LEGACY("spritegen", spritebgflag_w8)   /* enable / disable background transparency */
247   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("IN0") AM_WRITE_LEGACY(doraemon_outputs_w)
249   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("IN0") AM_WRITE(doraemon_outputs_w)
248250   AM_RANGE(0xf002, 0xf002) AM_READ_PORT("IN1") AM_WRITENOP   // Ack?
249251   AM_RANGE(0xf004, 0xf004) AM_WRITENOP                  // Ack?
250252   AM_RANGE(0xf006, 0xf006) AM_READ_PORT("DSW") AM_WRITENOP   // Ack?
r14896r14897
396398   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
397399   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN  )
398400   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3  )
399   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_READ_LINE_DEVICE("hopper", ticket_dispenser_line_r)   // sensor
401   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r)   // sensor
400402   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN  )
401403   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
402404INPUT_PORTS_END
r14896r14897
541543
542544   MCFG_NVRAM_ADD_0FILL("nvram")
543545   MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
544   MCFG_TICKET_DISPENSER_ADD("hopper", 2000, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW )
546   MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(2000), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW )
545547
546548   MCFG_MACHINE_START(doraemon)
547549
src/mame/drivers/bishi.c
r14896r14897
156156   AM_RANGE(0x870000, 0x8700ff) AM_DEVWRITE_LEGACY("k055555", k055555_word_w)   // PCU2
157157   AM_RANGE(0x880000, 0x880003) AM_DEVREADWRITE8_LEGACY("ymz", ymz280b_r, ymz280b_w, 0xff00)
158158   AM_RANGE(0xa00000, 0xa01fff) AM_DEVREADWRITE_LEGACY("k056832", k056832_ram_word_r, k056832_ram_word_w)   // Graphic planes
159   AM_RANGE(0xb00000, 0xb03fff) AM_RAM_WRITE(paletteram16_xbgr_word_be_w) AM_SHARE("paletteram")
159   AM_RANGE(0xb00000, 0xb03fff) AM_RAM_WRITE(paletteram_xbgr_word_be_w) AM_SHARE("paletteram")
160160   AM_RANGE(0xb04000, 0xb047ff) AM_READ(bishi_mirror_r)   // bug in the ram/rom test?
161161   AM_RANGE(0xc00000, 0xc01fff) AM_READ(bishi_K056832_rom_r)
162162ADDRESS_MAP_END
src/mame/drivers/vamphalf.c
r14896r14897
6565{
6666public:
6767   vamphalf_state(const machine_config &mconfig, device_type type, const char *tag)
68      : driver_device(mconfig, type, tag)
68      : driver_device(mconfig, type, tag),
69        m_tiles(*this,"tiles"),
70        m_wram(*this,"wram"),
71        m_tiles32(*this,"tiles32"),
72        m_wram32(*this,"wram32")
6973      {
7074         m_has_extra_gfx = 0;
7175      }
7276
73   UINT16 *m_tiles;
74   UINT16 *m_wram;
75   UINT32 *m_tiles32;
76   UINT32 *m_wram32;
77   required_shared_ptr<UINT16> m_tiles;
78   required_shared_ptr<UINT16> m_wram;
79   required_shared_ptr<UINT32> m_tiles32;
80   required_shared_ptr<UINT32> m_wram32;
7781   int m_flip_bit;
7882   int m_flipscreen;
7983   int m_palshift;
r14896r14897
319323}
320324
321325static ADDRESS_MAP_START( common_map, AS_PROGRAM, 16, vamphalf_state )
322   AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE(m_wram)
323   AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE(m_tiles)
324   AM_RANGE(0x80000000, 0x8000ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
326   AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("wram")
327   AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_SHARE("tiles")
328   AM_RANGE(0x80000000, 0x8000ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
325329   AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("user1",0)
326330ADDRESS_MAP_END
327331
328332static ADDRESS_MAP_START( common_32bit_map, AS_PROGRAM, 32, vamphalf_state )
329   AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_BASE(m_wram32)
330   AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE(m_tiles32)
333   AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("wram32")
334   AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_SHARE("tiles32")
331335   AM_RANGE(0x80000000, 0x8000ffff) AM_RAM_WRITE(paletteram32_w) AM_SHARE("paletteram")
332336   AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("user1",0)
333337ADDRESS_MAP_END
r14896r14897
441445ADDRESS_MAP_END
442446
443447static ADDRESS_MAP_START( aoh_map, AS_PROGRAM, 32, vamphalf_state )
444   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(m_wram32)
445   AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE(m_tiles32)
448   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("wram32")
449   AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_SHARE("tiles32")
446450   AM_RANGE(0x80000000, 0x8000ffff) AM_RAM_WRITE(paletteram32_w) AM_SHARE("paletteram")
447451   AM_RANGE(0x80210000, 0x80210003) AM_READ_PORT("SYSTEM")
448452   AM_RANGE(0x80220000, 0x80220003) AM_READ_PORT("P1_P2")
r14896r14897
525529         // 16bit version
526530         if(state->m_tiles != NULL)
527531         {
528            if(state->m_tiles[offs] & 0x0100) continue;
532            if(state->m_tiles.target()[offs] & 0x0100) continue;
529533
530            code  = state->m_tiles[offs+1];
531            color = (state->m_tiles[offs+2] >> state->m_palshift) & 0x7f;
534            code  = state->m_tiles.target()[offs+1];
535            color = (state->m_tiles.target()[offs+2] >> state->m_palshift) & 0x7f;
532536
533537            // boonggab
534538            if(state->m_has_extra_gfx)
535539            {
536               code  |= ((state->m_tiles[offs+2] & 0x100) << 8);
540               code  |= ((state->m_tiles.target()[offs+2] & 0x100) << 8);
537541            }
538542
539            x = state->m_tiles[offs+3] & 0x01ff;
540            y = 256 - (state->m_tiles[offs] & 0x00ff);
543            x = state->m_tiles.target()[offs+3] & 0x01ff;
544            y = 256 - (state->m_tiles.target()[offs] & 0x00ff);
541545
542            fx = state->m_tiles[offs] & 0x8000;
543            fy = state->m_tiles[offs] & 0x4000;
546            fx = state->m_tiles.target()[offs] & 0x8000;
547            fy = state->m_tiles.target()[offs] & 0x4000;
544548         }
545549         // 32bit version
546550         else
547551         {
548552            offs /= 2;
549553
550            if(state->m_tiles32[offs] & 0x01000000) continue;
554            if(state->m_tiles32.target()[offs] & 0x01000000) continue;
551555
552            code  = state->m_tiles32[offs] & 0xffff;
553            color = ((state->m_tiles32[offs+1] >> state->m_palshift) & 0x7f0000) >> 16;
556            code  = state->m_tiles32.target()[offs] & 0xffff;
557            color = ((state->m_tiles32.target()[offs+1] >> state->m_palshift) & 0x7f0000) >> 16;
554558
555            x = state->m_tiles32[offs+1] & 0x01ff;
556            y = 256 - ((state->m_tiles32[offs] & 0x00ff0000) >> 16);
559            x = state->m_tiles32.target()[offs+1] & 0x01ff;
560            y = 256 - ((state->m_tiles32.target()[offs] & 0x00ff0000) >> 16);
557561
558            fx = state->m_tiles32[offs] & 0x80000000;
559            fy = state->m_tiles32[offs] & 0x40000000;
562            fx = state->m_tiles32.target()[offs] & 0x80000000;
563            fy = state->m_tiles32.target()[offs] & 0x40000000;
560564         }
561565
562566         if(state->m_flipscreen)
r14896r14897
603607         offs = (block + cnt) / 2;
604608         {
605609            offs /= 2;
606            code  = (state->m_tiles32[offs] & 0xffff) | ((state->m_tiles32[offs] & 0x3000000) >> 8);
607            color = ((state->m_tiles32[offs+1] >> state->m_palshift) & 0x7f0000) >> 16;
610            code  = (state->m_tiles32.target()[offs] & 0xffff) | ((state->m_tiles32.target()[offs] & 0x3000000) >> 8);
611            color = ((state->m_tiles32.target()[offs+1] >> state->m_palshift) & 0x7f0000) >> 16;
608612
609            x = state->m_tiles32[offs+1] & 0x01ff;
610            y = 256 - ((state->m_tiles32[offs] & 0x00ff0000) >> 16);
613            x = state->m_tiles32.target()[offs+1] & 0x01ff;
614            y = 256 - ((state->m_tiles32.target()[offs] & 0x00ff0000) >> 16);
611615
612            fx = state->m_tiles32[offs] & 0x4000000;
613            fy = 0; // not used ? or it's state->m_tiles32[offs] & 0x8000000?
616            fx = state->m_tiles32.target()[offs] & 0x4000000;
617            fy = 0; // not used ? or it's state->m_tiles32.target()[offs] & 0x8000000?
614618         }
615619
616620         if(state->m_flipscreen)
r14896r14897
20842088         device_eat_cycles(&space.device(), 50);
20852089   }
20862090
2087   return m_wram[(0x4a840/2)+offset];
2091   return m_wram.target()[(0x4a840/2)+offset];
20882092}
20892093
20902094READ16_MEMBER(vamphalf_state::vamphafk_speedup_r)
r14896r14897
20972101         device_eat_cycles(&space.device(), 50);
20982102   }
20992103
2100   return m_wram[(0x4a6d0/2)+offset];
2104   return m_wram.target()[(0x4a6d0/2)+offset];
21012105}
21022106
21032107READ16_MEMBER(vamphalf_state::misncrft_speedup_r)
r14896r14897
21102114         device_eat_cycles(&space.device(), 50);
21112115   }
21122116
2113   return m_wram[(0x72eb4/2)+offset];
2117   return m_wram.target()[(0x72eb4/2)+offset];
21142118}
21152119
21162120READ16_MEMBER(vamphalf_state::coolmini_speedup_r)
r14896r14897
21232127         device_eat_cycles(&space.device(), 50);
21242128   }
21252129
2126   return m_wram[(0xd2e80/2)+offset];
2130   return m_wram.target()[(0xd2e80/2)+offset];
21272131}
21282132
21292133READ16_MEMBER(vamphalf_state::suplup_speedup_r)
r14896r14897
21362140         device_eat_cycles(&space.device(), 50);
21372141   }
21382142
2139   return m_wram[(0x11605c/2)+offset];
2143   return m_wram.target()[(0x11605c/2)+offset];
21402144}
21412145
21422146READ16_MEMBER(vamphalf_state::luplup_speedup_r)
r14896r14897
21492153         device_eat_cycles(&space.device(), 50);
21502154   }
21512155
2152   return m_wram[(0x115e84/2)+offset];
2156   return m_wram.target()[(0x115e84/2)+offset];
21532157}
21542158
21552159READ16_MEMBER(vamphalf_state::luplup29_speedup_r)
r14896r14897
21622166         device_eat_cycles(&space.device(), 50);
21632167   }
21642168
2165   return m_wram[(0x113f08/2)+offset];
2169   return m_wram.target()[(0x113f08/2)+offset];
21662170}
21672171
21682172READ16_MEMBER(vamphalf_state::puzlbang_speedup_r)
r14896r14897
21752179         device_eat_cycles(&space.device(), 50);
21762180   }
21772181
2178   return m_wram[(0x113ecc/2)+offset];
2182   return m_wram.target()[(0x113ecc/2)+offset];
21792183}
21802184
21812185READ32_MEMBER(vamphalf_state::wyvernwg_speedup_r)
r14896r14897
21902194         device_eat_cycles(&space.device(), 50);
21912195   }
21922196
2193   return m_wram32[0x00b56fc/4];
2197   return m_wram32.target()[0x00b56fc/4];
21942198}
21952199
21962200READ32_MEMBER(vamphalf_state::wyvernwga_speedup_r)
r14896r14897
22052209         device_eat_cycles(&space.device(), 50);
22062210   }
22072211
2208   return m_wram32[0x00b74f8/4];
2212   return m_wram32.target()[0x00b74f8/4];
22092213}
22102214
22112215
r14896r14897
22202224         device_eat_cycles(&space.device(), 50);
22212225   }
22222226
2223   return m_wram32[0x005e874/4];
2227   return m_wram32.target()[0x005e874/4];
22242228}
22252229
22262230READ32_MEMBER(vamphalf_state::mrkicker_speedup_r)
r14896r14897
22342238         device_eat_cycles(&space.device(), 50);
22352239   }
22362240
2237   return m_wram32[0x00701a4/4];
2241   return m_wram32.target()[0x00701a4/4];
22382242}
22392243
22402244
r14896r14897
22482252         device_eat_cycles(&space.device(), 50);
22492253   }
22502254
2251   return m_wram[(0xcde70/2)+offset];
2255   return m_wram.target()[(0xcde70/2)+offset];
22522256}
22532257
22542258READ32_MEMBER(vamphalf_state::aoh_speedup_r)
r14896r14897
22632267   }
22642268
22652269
2266   return m_wram32[0x28a09c/4];
2270   return m_wram32.target()[0x28a09c/4];
22672271}
22682272
22692273READ16_MEMBER(vamphalf_state::jmpbreak_speedup_r)
r14896r14897
22762280         device_eat_cycles(&space.device(), 50);
22772281   }
22782282
2279   return m_wram[(0x00906fc / 2)+offset];
2283   return m_wram.target()[(0x00906fc / 2)+offset];
22802284}
22812285
22822286READ16_MEMBER(vamphalf_state::mrdig_speedup_r)
r14896r14897
22892293         device_eat_cycles(&space.device(), 50);
22902294   }
22912295
2292   return m_wram[(0x00a99c / 2)+offset];
2296   return m_wram.target()[(0x00a99c / 2)+offset];
22932297}
22942298
22952299READ16_MEMBER(vamphalf_state::dtfamily_speedup_r)
r14896r14897
23002304   if (pc == 0x12fa6)
23012305      device_spin_until_interrupt(&space.device());
23022306
2303   return m_wram[0xcc2a8 / 2];
2307   return m_wram.target()[0xcc2a8 / 2];
23042308
23052309}
23062310
r14896r14897
23102314   if (cpu_get_pc(&space.device()) == 0x130c2)
23112315      device_spin_until_interrupt(&space.device());
23122316
2313   return m_wram[0x780d8 / 2];
2317   return m_wram.target()[0x780d8 / 2];
23142318
23152319}
23162320
r14896r14897
23222326         device_spin_until_interrupt(&space.device());
23232327   }
23242328
2325   return m_wram[(0xf1b7c / 2)+offset];
2329   return m_wram.target()[(0xf1b7c / 2)+offset];
23262330}
23272331
23282332static DRIVER_INIT( vamphalf )
src/mame/drivers/1942.c
r14896r14897
9494   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2")
9595   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSWA")
9696   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSWB")
97   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
97   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_byte_w)
9898   AM_RANGE(0xc802, 0xc803) AM_WRITE(c1942_scroll_w)
9999   AM_RANGE(0xc804, 0xc804) AM_WRITE(c1942_c804_w)
100100   AM_RANGE(0xc805, 0xc805) AM_WRITE(c1942_palette_bank_w)
r14896r14897
108108static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, _1942_state )
109109   AM_RANGE(0x0000, 0x3fff) AM_ROM
110110   AM_RANGE(0x4000, 0x47ff) AM_RAM
111   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
111   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
112112   AM_RANGE(0x8000, 0x8001) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
113113   AM_RANGE(0xc000, 0xc001) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
114114ADDRESS_MAP_END
src/mame/drivers/mayumi.c
r14896r14897
1818{
1919public:
2020   mayumi_state(const machine_config &mconfig, device_type type, const char *tag)
21      : driver_device(mconfig, type, tag) { }
21      : driver_device(mconfig, type, tag) ,
22      m_videoram(*this, "videoram"){ }
2223
2324   /* memory pointers */
24   UINT8 *    m_videoram;
25   required_shared_ptr<UINT8> m_videoram;
2526//  UINT8 *    m_nvram;       // this currently uses generic nvram handlers
2627
2728   /* video-related */
r14896r14897
4647static TILE_GET_INFO( get_tile_info )
4748{
4849   mayumi_state *state = machine.driver_data<mayumi_state>();
49   int code = state->m_videoram[tile_index] + (state->m_videoram[tile_index + 0x800] & 0x1f) * 0x100;
50   int col = (state->m_videoram[tile_index + 0x1000] >> 3) & 0x1f;
50   int code = state->m_videoram.target()[tile_index] + (state->m_videoram.target()[tile_index + 0x800] & 0x1f) * 0x100;
51   int col = (state->m_videoram.target()[tile_index + 0x1000] >> 3) & 0x1f;
5152
5253   SET_TILE_INFO(0, code, col, 0);
5354}
r14896r14897
6061
6162WRITE8_MEMBER(mayumi_state::mayumi_videoram_w)
6263{
63   m_videoram[offset] = data;
64   m_videoram.target()[offset] = data;
6465   m_tilemap->mark_tile_dirty(offset & 0x7ff);
6566}
6667
r14896r14897
99100
100101   m_int_enable = data & 1;
101102
102   flip_screen_set(machine(), data & 2);
103   flip_screen_set(data & 2);
103104}
104105
105106WRITE8_MEMBER(mayumi_state::input_sel_w)
r14896r14897
139140   AM_RANGE(0x0000, 0x7fff) AM_ROM
140141   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
141142   AM_RANGE(0xc000, 0xdfff) AM_RAM AM_SHARE("nvram")
142   AM_RANGE(0xe000, 0xf7ff) AM_RAM_WRITE(mayumi_videoram_w) AM_BASE(m_videoram)
143   AM_RANGE(0xe000, 0xf7ff) AM_RAM_WRITE(mayumi_videoram_w) AM_SHARE("videoram")
143144ADDRESS_MAP_END
144145
145146
src/mame/drivers/raiden.c
r14896r14897
6363   AM_RANGE(0x00000, 0x01fff) AM_RAM
6464   AM_RANGE(0x02000, 0x027ff) AM_RAM_WRITE(raiden_background_w) AM_BASE(m_back_data)
6565   AM_RANGE(0x02800, 0x02fff) AM_RAM_WRITE(raiden_foreground_w) AM_BASE(m_fore_data)
66   AM_RANGE(0x03000, 0x03fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
66   AM_RANGE(0x03000, 0x03fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
6767   AM_RANGE(0x04000, 0x04fff) AM_RAM AM_SHARE("share1")
6868   AM_RANGE(0x07ffe, 0x0afff) AM_WRITENOP
6969   AM_RANGE(0xc0000, 0xfffff) AM_ROM
r14896r14897
104104   AM_RANGE(0x00000, 0x05fff) AM_RAM
105105   AM_RANGE(0x06000, 0x067ff) AM_RAM_WRITE(raiden_background_w) AM_BASE(m_back_data)
106106   AM_RANGE(0x06800, 0x06fff) AM_RAM_WRITE(raiden_foreground_w) AM_BASE(m_fore_data)
107   AM_RANGE(0x07000, 0x07fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
107   AM_RANGE(0x07000, 0x07fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
108108   AM_RANGE(0x08000, 0x08fff) AM_RAM AM_SHARE("share1")
109109   //AM_RANGE(0x07ffe, 0x0afff) AM_WRITENOP
110110   AM_RANGE(0xc0000, 0xfffff) AM_ROM
src/mame/drivers/bloodbro.c
r14896r14897
125125   AM_RANGE(0x08d400, 0x08d7ff) AM_RAM
126126   AM_RANGE(0x08d800, 0x08dfff) AM_RAM_WRITE(bloodbro_txvideoram_w) AM_BASE(m_txvideoram)
127127   AM_RANGE(0x08e000, 0x08e7ff) AM_RAM
128   AM_RANGE(0x08e800, 0x08f7ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
128   AM_RANGE(0x08e800, 0x08f7ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
129129   AM_RANGE(0x08f800, 0x08ffff) AM_RAM
130130   AM_RANGE(0x0a0000, 0x0a000d) AM_READWRITE_LEGACY(seibu_main_word_r, seibu_main_word_w)
131131   AM_RANGE(0x0c0000, 0x0c007f) AM_RAM AM_BASE(m_scroll)
r14896r14897
151151   AM_RANGE(0x0c1002, 0x0c1003) AM_READ_PORT("IN0")
152152   AM_RANGE(0x0c1004, 0x0c1005) AM_READ_PORT("IN1")
153153   AM_RANGE(0x0c1000, 0x0c17ff) AM_RAM
154   AM_RANGE(0x128000, 0x1287ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
154   AM_RANGE(0x128000, 0x1287ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
155155   AM_RANGE(0x120000, 0x128fff) AM_RAM
156156ADDRESS_MAP_END
157157
src/mame/drivers/galaxia.c
r14896r14897
8080
8181***************************************************************************/
8282
83static WRITE8_HANDLER(galaxia_video_w)
83WRITE8_MEMBER(galaxia_state::galaxia_video_w)
8484{
85   galaxia_state *state = space->machine().driver_data<galaxia_state>();
86//  space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos());
87   state->m_bg_tilemap->mark_tile_dirty(offset);
88   state->cvs_video_or_color_ram_w(*space, offset, data);
85//  machine().primary_screen->update_partial(machine().primary_screen->vpos());
86   m_bg_tilemap->mark_tile_dirty(offset);
87   cvs_video_or_color_ram_w(*&space, offset, data);
8988}
9089
91static WRITE8_HANDLER(galaxia_scroll_w)
90WRITE8_MEMBER(galaxia_state::galaxia_scroll_w)
9291{
93   galaxia_state *state = space->machine().driver_data<galaxia_state>();
94   space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos());
92   machine().primary_screen->update_partial(machine().primary_screen->vpos());
9593
9694   // fixed scrolling area
9795   for (int i = 1; i < 6; i++)
98      state->m_bg_tilemap->set_scrolly(i, data);
96      m_bg_tilemap->set_scrolly(i, data);
9997}
10098
101static WRITE8_HANDLER(galaxia_ctrlport_w)
99WRITE8_MEMBER(galaxia_state::galaxia_ctrlport_w)
102100{
103101   // d0/d1: maybe coincounter
104102   // other bits: unknown
105103}
106104
107static WRITE8_HANDLER(galaxia_dataport_w)
105WRITE8_MEMBER(galaxia_state::galaxia_dataport_w)
108106{
109107   // cvs-style video fx? or lamps?
110108}
111109
112static READ8_HANDLER(galaxia_collision_r)
110READ8_MEMBER(galaxia_state::galaxia_collision_r)
113111{
114   galaxia_state *state = space->machine().driver_data<galaxia_state>();
115   space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos());
116   return state->m_collision_register;
112   machine().primary_screen->update_partial(machine().primary_screen->vpos());
113   return m_collision_register;
117114}
118115
119static READ8_HANDLER(galaxia_collision_clear)
116READ8_MEMBER(galaxia_state::galaxia_collision_clear)
120117{
121   galaxia_state *state = space->machine().driver_data<galaxia_state>();
122   space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos());
123   state->m_collision_register = 0;
118   machine().primary_screen->update_partial(machine().primary_screen->vpos());
119   m_collision_register = 0;
124120   return 0xff;
125121}
126122
r14896r14897
130126   AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_DEVREADWRITE_LEGACY("s2636_0", s2636_work_ram_r, s2636_work_ram_w)
131127   AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_DEVREADWRITE_LEGACY("s2636_1", s2636_work_ram_r, s2636_work_ram_w)
132128   AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_DEVREADWRITE_LEGACY("s2636_2", s2636_work_ram_r, s2636_work_ram_w)
133   AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ(cvs_video_or_color_ram_r) AM_WRITE_LEGACY(galaxia_video_w) AM_BASE(m_video_ram)
129   AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ(cvs_video_or_color_ram_r) AM_WRITE(galaxia_video_w) AM_BASE(m_video_ram)
134130   AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
135131   AM_RANGE(0x2000, 0x33ff) AM_ROM
136132   AM_RANGE(0x7214, 0x7214) AM_READ_PORT("IN0")
r14896r14897
140136   AM_RANGE(0x0000, 0x13ff) AM_ROM
141137   AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_RAM
142138   AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_DEVREADWRITE_LEGACY("s2636_0", s2636_work_ram_r, s2636_work_ram_w)
143   AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ(cvs_video_or_color_ram_r) AM_WRITE_LEGACY(galaxia_video_w)  AM_BASE(m_video_ram)
139   AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ(cvs_video_or_color_ram_r) AM_WRITE(galaxia_video_w)  AM_BASE(m_video_ram)
144140   AM_RANGE(0x1c00, 0x1cff) AM_MIRROR(0x6000) AM_RAM AM_BASE(m_bullet_ram)
145141   AM_RANGE(0x2000, 0x33ff) AM_ROM
146142ADDRESS_MAP_END
147143
148144static ADDRESS_MAP_START( galaxia_io_map, AS_IO, 8, galaxia_state )
149145   ADDRESS_MAP_UNMAP_HIGH
150   AM_RANGE(0x00, 0x00) AM_WRITE_LEGACY(galaxia_scroll_w) AM_READ_PORT("IN0")
146   AM_RANGE(0x00, 0x00) AM_WRITE(galaxia_scroll_w) AM_READ_PORT("IN0")
151147   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1")
152148   AM_RANGE(0x05, 0x05) AM_READNOP
153149   AM_RANGE(0x06, 0x06) AM_READ_PORT("DSW0")
154150   AM_RANGE(0x07, 0x07) AM_READ_PORT("DSW1")
155151   AM_RANGE(0xac, 0xac) AM_READNOP
156   AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_READWRITE_LEGACY(galaxia_collision_r, galaxia_ctrlport_w)
157   AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE_LEGACY(galaxia_collision_clear, galaxia_dataport_w)
152   AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_READWRITE(galaxia_collision_r, galaxia_ctrlport_w)
153   AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(galaxia_collision_clear, galaxia_dataport_w)
158154   AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
159155   AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_BASE(m_fo_state)
160156ADDRESS_MAP_END
src/mame/drivers/fromanc2.c
r14896r14897
4040WRITE16_MEMBER(fromanc2_state::fromanc2_sndcmd_w)
4141{
4242
43   soundlatch_w(space, offset, (data >> 8) & 0xff);   // 1P (LEFT)
44   soundlatch2_w(space, offset, data & 0xff);         // 2P (RIGHT)
43   soundlatch_byte_w(space, offset, (data >> 8) & 0xff);   // 1P (LEFT)
44   soundlatch2_byte_w(space, offset, data & 0xff);         // 2P (RIGHT)
4545
4646   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
4747   m_sndcpu_nmi_flag = 0;
r14896r14897
292292
293293static ADDRESS_MAP_START( fromanc2_sound_io_map, AS_IO, 8, fromanc2_state )
294294   ADDRESS_MAP_GLOBAL_MASK(0xff)
295   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r) AM_WRITENOP         // snd cmd (1P) / ?
296   AM_RANGE(0x04, 0x04) AM_READ(soundlatch2_r)                     // snd cmd (2P)
295   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r) AM_WRITENOP         // snd cmd (1P) / ?
296   AM_RANGE(0x04, 0x04) AM_READ(soundlatch2_byte_r)                     // snd cmd (2P)
297297   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
298298   AM_RANGE(0x0c, 0x0c) AM_READ(fromanc2_sndcpu_nmi_clr)
299299ADDRESS_MAP_END
src/mame/drivers/rallyx.c
r14896r14897
243243         break;
244244
245245      case 0x03:   /* FLIP */
246         flip_screen_set_no_update(machine(), bit);
246         flip_screen_set_no_update(bit);
247247         machine().tilemap().set_flip_all(bit * (TILEMAP_FLIPX | TILEMAP_FLIPY));
248248         break;
249249
r14896r14897
285285         break;
286286
287287      case 0x03:   /* FLIP */
288         flip_screen_set_no_update(machine(), bit);
288         flip_screen_set_no_update(bit);
289289         machine().tilemap().set_flip_all(bit * (TILEMAP_FLIPX | TILEMAP_FLIPY));
290290         break;
291291
r14896r14897
345345   AM_RANGE(0xa180, 0xa180) AM_READ_PORT("DSW2")
346346   AM_RANGE(0xa000, 0xa00f) AM_MIRROR(0x00f0) AM_WRITEONLY AM_BASE(m_radarattr)   // jungler writes to a03x
347347   AM_RANGE(0xa080, 0xa080) AM_WRITE(watchdog_reset_w)
348   AM_RANGE(0xa100, 0xa100) AM_WRITE(soundlatch_w)
348   AM_RANGE(0xa100, 0xa100) AM_WRITE(soundlatch_byte_w)
349349   AM_RANGE(0xa130, 0xa130) AM_WRITE(rallyx_scrollx_w)   /* only jungler and tactcian */
350350   AM_RANGE(0xa140, 0xa140) AM_WRITE(rallyx_scrolly_w)   /* only jungler and tactcian */
351351   AM_RANGE(0xa180, 0xa187) AM_WRITE(locomotn_latch_w)
src/mame/drivers/dai3wksi.c
r14896r14897
4848{
4949public:
5050   dai3wksi_state(const machine_config &mconfig, device_type type, const char *tag)
51      : driver_device(mconfig, type, tag) { }
51      : driver_device(mconfig, type, tag) ,
52      m_dai3wksi_videoram(*this, "dai3wksi_videoram"){ }
5253
5354   /* video */
54   UINT8 *     m_dai3wksi_videoram;
55   size_t      m_dai3wksi_videoram_size;
55   required_shared_ptr<UINT8> m_dai3wksi_videoram;
5656   int         m_dai3wksi_flipscreen;
5757   int         m_dai3wksi_redscreen;
5858   int         m_dai3wksi_redterop;
r14896r14897
134134
135135   dai3wksi_get_pens(pens);
136136
137   for (offs = 0; offs < state->m_dai3wksi_videoram_size; offs++)
137   for (offs = 0; offs < state->m_dai3wksi_videoram.bytes(); offs++)
138138   {
139139      offs_t i;
140140
141141      UINT8 x = offs << 2;
142142      UINT8 y = offs >> 6;
143      UINT8 data = state->m_dai3wksi_videoram[offs];
143      UINT8 data = state->m_dai3wksi_videoram.target()[offs];
144144      UINT8 color;
145145      int value = (x >> 2) + ((y >> 5) << 6) + 64 * 8 * (state->m_dai3wksi_redterop ? 1 : 0);
146146
r14896r14897
509509   AM_RANGE(0x3000, 0x3000) AM_WRITE(dai3wksi_audio_1_w)
510510   AM_RANGE(0x3400, 0x3400) AM_WRITE(dai3wksi_audio_2_w)
511511   AM_RANGE(0x3800, 0x3800) AM_WRITE(dai3wksi_audio_3_w)
512   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE_SIZE(m_dai3wksi_videoram, m_dai3wksi_videoram_size)
512   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_SHARE("dai3wksi_videoram")
513513ADDRESS_MAP_END
514514
515515
src/mame/drivers/realbrk.c
r14896r14897
155155static ADDRESS_MAP_START( base_mem, AS_PROGRAM, 16, realbrk_state )
156156   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                  // ROM
157157   AM_RANGE(0x200000, 0x203fff) AM_RAM                   AM_BASE(m_spriteram)   // Sprites
158   AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram"   )   // Palette
158   AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram"   )   // Palette
159159   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(realbrk_vram_0_w) AM_BASE(m_vram_0   )   // Background   (0)
160160   AM_RANGE(0x602000, 0x603fff) AM_RAM_WRITE(realbrk_vram_1_w) AM_BASE(m_vram_1   )   // Background   (1)
161161   AM_RANGE(0x604000, 0x604fff) AM_RAM_WRITE(realbrk_vram_2_w) AM_BASE(m_vram_2   )   // Text         (2)
src/mame/drivers/diverboy.c
r14896r14897
5757{
5858public:
5959   diverboy_state(const machine_config &mconfig, device_type type, const char *tag)
60      : driver_device(mconfig, type, tag) { }
60      : driver_device(mconfig, type, tag) ,
61      m_spriteram(*this, "spriteram"){ }
6162
6263   /* memory pointers */
63   UINT16 * m_spriteram;
64   required_shared_ptr<UINT16> m_spriteram;
6465//  UINT16 *  m_paletteram;   // currently this uses generic palette handling
65   size_t    m_spriteram_size;
6666
6767   /* devices */
6868   device_t *m_audiocpu;
r14896r14897
7777static void draw_sprites( running_machine& machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
7878{
7979   diverboy_state *state = machine.driver_data<diverboy_state>();
80   UINT16 *source = state->m_spriteram;
81   UINT16 *finish = source + (state->m_spriteram_size / 2);
80   UINT16 *source = state->m_spriteram.target();
81   UINT16 *finish = source + (state->m_spriteram.bytes() / 2);
8282
8383   while (source < finish)
8484   {
r14896r14897
123123
124124   if (ACCESSING_BITS_0_7)
125125   {
126      soundlatch_w(space, 0, data & 0xff);
126      soundlatch_byte_w(space, 0, data & 0xff);
127127      device_set_input_line(m_audiocpu, 0, HOLD_LINE);
128128   }
129129}
r14896r14897
142142static ADDRESS_MAP_START( diverboy_map, AS_PROGRAM, 16, diverboy_state )
143143   AM_RANGE(0x000000, 0x03ffff) AM_ROM
144144   AM_RANGE(0x040000, 0x04ffff) AM_RAM
145   AM_RANGE(0x080000, 0x083fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
145   AM_RANGE(0x080000, 0x083fff) AM_RAM AM_SHARE("spriteram")
146146   AM_RANGE(0x100000, 0x100001) AM_WRITE(soundcmd_w)
147   AM_RANGE(0x140000, 0x1407ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
147   AM_RANGE(0x140000, 0x1407ff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
148148   AM_RANGE(0x180000, 0x180001) AM_READ_PORT("P1_P2")
149149   AM_RANGE(0x180002, 0x180003) AM_READ_PORT("DSW")
150150   AM_RANGE(0x180008, 0x180009) AM_READ_PORT("COINS")
r14896r14897
161161   AM_RANGE(0x8000, 0x87ff) AM_RAM
162162   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("oki", okibank_w)
163163   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
164   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
164   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
165165ADDRESS_MAP_END
166166
167167
src/mame/drivers/carjmbre.c
r14896r14897
7171   AM_RANGE(0x9800, 0x985f) AM_MIRROR(0x80) AM_WRITEONLY AM_BASE_SIZE(m_spriteram, m_spriteram_size)
7272   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
7373   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("P2")
74   AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW") AM_WRITE(soundlatch_w)
74   AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW") AM_WRITE(soundlatch_byte_w)
7575ADDRESS_MAP_END
7676
7777static ADDRESS_MAP_START( carjmbre_sound_map, AS_PROGRAM, 8, carjmbre_state )
r14896r14897
8282
8383static ADDRESS_MAP_START( carjmbre_sound_io_map, AS_IO, 8, carjmbre_state )
8484   ADDRESS_MAP_GLOBAL_MASK(0xff)
85   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
85   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)
8686   AM_RANGE(0x10, 0x10) AM_WRITENOP         //?? written on init/0xff sound command reset
8787   AM_RANGE(0x20, 0x21) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
8888   AM_RANGE(0x22, 0x22) AM_WRITENOP         //?? written before and after 0x21 with same value
src/mame/drivers/vmetal.c
r14896r14897
236236
237237   AM_RANGE(0x160000, 0x16ffff) AM_READ(varia_crom_read) // cgrom read window ..
238238
239   AM_RANGE(0x170000, 0x173fff) AM_RAM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
239   AM_RANGE(0x170000, 0x173fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
240240   AM_RANGE(0x174000, 0x174fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
241241   AM_RANGE(0x175000, 0x177fff) AM_RAM
242242   AM_RANGE(0x178000, 0x1787ff) AM_RAM AM_BASE(m_tlookup)
src/mame/drivers/battlera.c
r14896r14897
3535{
3636   if (offset == 0)
3737   {
38      soundlatch_w(space,0,data);
38      soundlatch_byte_w(space,0,data);
3939      cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
4040   }
4141}
r14896r14897
111111   AM_RANGE(0x080000, 0x080001) AM_WRITE(battlera_adpcm_data_w)
112112   AM_RANGE(0x1fe800, 0x1fe80f) AM_DEVWRITE_LEGACY("c6280", c6280_w)
113113   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank7") /* Main ram */
114   AM_RANGE(0x1ff000, 0x1ff001) AM_READ(soundlatch_r) AM_DEVWRITE_LEGACY("msm", battlera_adpcm_reset_w)
114   AM_RANGE(0x1ff000, 0x1ff001) AM_READ(soundlatch_byte_r) AM_DEVWRITE_LEGACY("msm", battlera_adpcm_reset_w)
115115   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
116116ADDRESS_MAP_END
117117
src/mame/drivers/flower.c
r14896r14897
102102
103103WRITE8_MEMBER(flower_state::sound_command_w)
104104{
105   soundlatch_w(space, 0, data);
105   soundlatch_byte_w(space, 0, data);
106106
107107   if (*m_sn_nmi_enable & 1)
108108      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
r14896r14897
135135   AM_RANGE(0x0000, 0x3fff) AM_ROM
136136   AM_RANGE(0x4000, 0x4000) AM_WRITE(flower_soundcpu_irq_ack)
137137   AM_RANGE(0x4001, 0x4001) AM_WRITEONLY AM_BASE(m_sn_nmi_enable)
138   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
138   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
139139   AM_RANGE(0x8000, 0x803f) AM_DEVWRITE_LEGACY("flower", flower_sound1_w)
140140   AM_RANGE(0xa000, 0xa03f) AM_DEVWRITE_LEGACY("flower", flower_sound2_w)
141141   AM_RANGE(0xc000, 0xc7ff) AM_RAM
src/mame/drivers/xain.c
r14896r14897
223223
224224WRITE8_MEMBER(xain_state::xain_sound_command_w)
225225{
226   soundlatch_w(space,offset,data);
226   soundlatch_byte_w(space,offset,data);
227227   cputag_set_input_line(machine(), "audiocpu", M6809_IRQ_LINE, HOLD_LINE);
228228}
229229
r14896r14897
406406   AM_RANGE(0x3a0d, 0x3a0d) AM_WRITE(xain_flipscreen_w)
407407   AM_RANGE(0x3a0e, 0x3a0e) AM_WRITE(xain_68705_w)
408408   AM_RANGE(0x3a0f, 0x3a0f) AM_WRITE(xainCPUA_bankswitch_w)
409   AM_RANGE(0x3c00, 0x3dff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("paletteram")
410   AM_RANGE(0x3e00, 0x3fff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("paletteram2")
409   AM_RANGE(0x3c00, 0x3dff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram")
410   AM_RANGE(0x3e00, 0x3fff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
411411   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
412412   AM_RANGE(0x8000, 0xffff) AM_ROM
413413ADDRESS_MAP_END
r14896r14897
437437
438438static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, xain_state )
439439   AM_RANGE(0x0000, 0x07ff) AM_RAM
440   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_r)
440   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_byte_r)
441441   AM_RANGE(0x2800, 0x2801) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
442442   AM_RANGE(0x3000, 0x3001) AM_DEVWRITE_LEGACY("ym2", ym2203_w)
443443   AM_RANGE(0x4000, 0xffff) AM_ROM
src/mame/drivers/firefox.c
r14896r14897
4040public:
4141   firefox_state(const machine_config &mconfig, device_type type, const char *tag)
4242      : driver_device(mconfig, type, tag),
43        m_laserdisc(*this, "laserdisc") { }
43        m_laserdisc(*this, "laserdisc") ,
44      m_tileram(*this, "tileram"),
45      m_spriteram(*this, "spriteram"),
46      m_sprite_palette(*this, "sprite_palette"),
47      m_tile_palette(*this, "tile_palette"){ }
4448
4549   required_device<phillips_22vp931_device> m_laserdisc;
50   required_shared_ptr<unsigned char> m_tileram;
51   required_shared_ptr<UINT8> m_spriteram;
52   required_shared_ptr<unsigned char> m_sprite_palette;
53   required_shared_ptr<unsigned char> m_tile_palette;
4654   int m_n_disc_lock;
4755   int m_n_disc_data;
4856   int m_n_disc_read_data;
49   unsigned char *m_tileram;
50   unsigned char *m_tile_palette;
51   unsigned char *m_sprite_palette;
5257   x2212_device *m_nvram_1c;
5358   x2212_device *m_nvram_1d;
5459   tilemap_t *m_bgtiles;
r14896r14897
5661   UINT8 m_sound_to_main_flag;
5762   UINT8 m_main_to_sound_flag;
5863   int m_sprite_bank;
59   UINT8 *m_spriteram;
6064   DECLARE_READ8_MEMBER(firefox_disc_status_r);
6165   DECLARE_READ8_MEMBER(firefox_disc_data_r);
6266   DECLARE_WRITE8_MEMBER(firefox_disc_read_w);
r14896r14897
186190static TILE_GET_INFO( bgtile_get_info )
187191{
188192   firefox_state *state = machine.driver_data<firefox_state>();
189   SET_TILE_INFO(0, state->m_tileram[tile_index], 0, 0);
193   SET_TILE_INFO(0, state->m_tileram.target()[tile_index], 0, 0);
190194}
191195
192196
193197WRITE8_MEMBER(firefox_state::tileram_w)
194198{
195   m_tileram[offset] = data;
199   m_tileram.target()[offset] = data;
196200   m_bgtiles->mark_tile_dirty(offset);
197201}
198202
r14896r14897
261265
262266WRITE8_MEMBER(firefox_state::tile_palette_w)
263267{
264   m_tile_palette[ offset ] = data;
268   m_tile_palette.target()[ offset ] = data;
265269   set_rgba( machine(), 0, offset & 0xff, m_tile_palette );
266270}
267271
268272WRITE8_MEMBER(firefox_state::sprite_palette_w)
269273{
270   m_sprite_palette[ offset ] = data;
274   m_sprite_palette.target()[ offset ] = data;
271275   set_rgba( machine(), 256, offset & 0xff, m_sprite_palette );
272276}
273277
r14896r14897
297301READ8_MEMBER(firefox_state::sound_to_main_r)
298302{
299303   m_sound_to_main_flag = 0;
300   return soundlatch2_r(space, 0);
304   return soundlatch2_byte_r(space, 0);
301305}
302306
303307WRITE8_MEMBER(firefox_state::main_to_sound_w)
304308{
305309   m_main_to_sound_flag = 1;
306   soundlatch_w(space, 0, data);
310   soundlatch_byte_w(space, 0, data);
307311   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
308312}
309313
r14896r14897
317321READ8_MEMBER(firefox_state::main_to_sound_r)
318322{
319323   m_main_to_sound_flag = 0;
320   return soundlatch_r(space, 0);
324   return soundlatch_byte_r(space, 0);
321325}
322326
323327WRITE8_MEMBER(firefox_state::sound_to_main_w)
324328{
325329   m_sound_to_main_flag = 1;
326   soundlatch2_w(space, 0, data);
330   soundlatch2_byte_w(space, 0, data);
327331}
328332
329333
r14896r14897
496500
497501static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, firefox_state )
498502   AM_RANGE(0x0000, 0x0fff) AM_RAM
499   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(tileram_w) AM_BASE(m_tileram)
500   AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE(m_spriteram)
501   AM_RANGE(0x2800, 0x2aff) AM_RAM_WRITE(sprite_palette_w) AM_BASE(m_sprite_palette)
503   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(tileram_w) AM_SHARE("tileram")
504   AM_RANGE(0x2000, 0x27ff) AM_RAM AM_SHARE("spriteram")
505   AM_RANGE(0x2800, 0x2aff) AM_RAM_WRITE(sprite_palette_w) AM_SHARE("sprite_palette")
502506   AM_RANGE(0x2b00, 0x2b00) AM_MIRROR(0x04ff) AM_WRITE(firefox_objram_bank_w)
503   AM_RANGE(0x2c00, 0x2eff) AM_RAM_WRITE(tile_palette_w) AM_BASE(m_tile_palette)
507   AM_RANGE(0x2c00, 0x2eff) AM_RAM_WRITE(tile_palette_w) AM_SHARE("tile_palette")
504508   AM_RANGE(0x3000, 0x3fff) AM_ROMBANK("bank1")
505509   AM_RANGE(0x4000, 0x40ff) AM_READWRITE(nvram_r, nvram_w)                  /* NOVRAM */
506510   AM_RANGE(0x4100, 0x4100) AM_MIRROR(0x00f8) AM_READ_PORT("rdin0")         /* RDIN0 */
src/mame/drivers/mainevt.c
r14896r14897
162162
163163static ADDRESS_MAP_START( mainevt_map, AS_PROGRAM, 8, mainevt_state )
164164   AM_RANGE(0x1f80, 0x1f80) AM_WRITE(mainevt_bankswitch_w)
165   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_w)            /* probably */
165   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_byte_w)            /* probably */
166166   AM_RANGE(0x1f88, 0x1f88) AM_WRITE(mainevt_sh_irqtrigger_w)   /* probably */
167167   AM_RANGE(0x1f8c, 0x1f8d) AM_WRITENOP   /* ??? */
168168   AM_RANGE(0x1f90, 0x1f90) AM_WRITE(mainevt_coin_w)   /* coin counters + lamps */
r14896r14897
179179   AM_RANGE(0x0000, 0x3fff) AM_READWRITE(k052109_051960_r, k052109_051960_w)
180180
181181   AM_RANGE(0x4000, 0x5dff) AM_RAM
182   AM_RANGE(0x5e00, 0x5fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_be_w) AM_SHARE("paletteram")
182   AM_RANGE(0x5e00, 0x5fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram")
183183   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1")
184184   AM_RANGE(0x8000, 0xffff) AM_ROM
185185ADDRESS_MAP_END
r14896r14897
187187
188188static ADDRESS_MAP_START( devstors_map, AS_PROGRAM, 8, mainevt_state )
189189   AM_RANGE(0x1f80, 0x1f80) AM_WRITE(mainevt_bankswitch_w)
190   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_w)            /* probably */
190   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_byte_w)            /* probably */
191191   AM_RANGE(0x1f88, 0x1f88) AM_WRITE(mainevt_sh_irqtrigger_w)   /* probably */
192192   AM_RANGE(0x1f90, 0x1f90) AM_WRITE(mainevt_coin_w)   /* coin counters + lamps */
193193   AM_RANGE(0x1fb2, 0x1fb2) AM_WRITE(dv_nmienable_w)
r14896r14897
203203   AM_RANGE(0x0000, 0x3fff) AM_READWRITE(k052109_051960_r, k052109_051960_w)
204204
205205   AM_RANGE(0x4000, 0x5dff) AM_RAM
206   AM_RANGE(0x5e00, 0x5fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_be_w) AM_SHARE("paletteram")
206   AM_RANGE(0x5e00, 0x5fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram")
207207   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1")
208208   AM_RANGE(0x8000, 0xffff) AM_ROM
209209ADDRESS_MAP_END
r14896r14897
213213   AM_RANGE(0x0000, 0x7fff) AM_ROM
214214   AM_RANGE(0x8000, 0x83ff) AM_RAM
215215   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("upd", upd7759_port_w)
216   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
216   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
217217   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r,k007232_w)
218218   AM_RANGE(0xd000, 0xd000) AM_DEVREAD_LEGACY("upd", mainevt_sh_busy_r)
219219   AM_RANGE(0xe000, 0xe000) AM_WRITE(mainevt_sh_irqcontrol_w)
r14896r14897
223223static ADDRESS_MAP_START( devstors_sound_map, AS_PROGRAM, 8, mainevt_state )
224224   AM_RANGE(0x0000, 0x7fff) AM_ROM
225225   AM_RANGE(0x8000, 0x83ff) AM_RAM
226   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
226   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
227227   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r,k007232_w)
228228   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)
229229   AM_RANGE(0xe000, 0xe000) AM_WRITE(devstor_sh_irqcontrol_w)
src/mame/drivers/deco156.c
r14896r14897
6868static SCREEN_UPDATE_RGB32( wcvol95 )
6969{
7070   //FIXME: flip_screen_x should not be written!
71   flip_screen_set_no_update(screen.machine(), 1);
72
7371   deco156_state *state = screen.machine().driver_data<deco156_state>();
72   state->flip_screen_set_no_update(1);
7473
7574   screen.machine().priority_bitmap.fill(0);
7675   bitmap.fill(0);
src/mame/drivers/toki.c
r14896r14897
4545
4646WRITE16_MEMBER(toki_state::tokib_soundcommand16_w)
4747{
48   soundlatch_w(space, 0, data & 0xff);
48   soundlatch_byte_w(space, 0, data & 0xff);
4949   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
5050}
5151
r14896r14897
9393   AM_RANGE(0x000000, 0x05ffff) AM_ROM
9494   AM_RANGE(0x060000, 0x06d7ff) AM_RAM
9595   AM_RANGE(0x06d800, 0x06dfff) AM_RAM AM_SHARE("spriteram")
96   AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
96   AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
9797   AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE(m_background1_videoram16)
9898   AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE(m_background2_videoram16)
9999   AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE(m_videoram)
r14896r14897
108108static ADDRESS_MAP_START( tokib_map, AS_PROGRAM, 16, toki_state )
109109   AM_RANGE(0x000000, 0x05ffff) AM_ROM
110110   AM_RANGE(0x060000, 0x06dfff) AM_RAM
111   AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
111   AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
112112   AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE(m_background1_videoram16)
113113   AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE(m_background2_videoram16)
114114   AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE(m_videoram)
r14896r14897
136136   AM_RANGE(0xe400, 0xe400) AM_WRITE(toki_adpcm_data_w)
137137   AM_RANGE(0xec00, 0xec01) AM_MIRROR(0x0008) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)
138138   AM_RANGE(0xf000, 0xf7ff) AM_RAM
139   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
139   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
140140ADDRESS_MAP_END
141141
142142/*****************************************************************************/
src/mame/drivers/renegade.c
r14896r14897
214214
215215WRITE8_MEMBER(renegade_state::sound_w)
216216{
217   soundlatch_w(space, offset, data);
217   soundlatch_byte_w(space, offset, data);
218218   cputag_set_input_line(machine(), "audiocpu", M6809_IRQ_LINE, HOLD_LINE);
219219}
220220
r14896r14897
647647   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(renegade_videoram2_w) AM_BASE(m_videoram2)
648648   AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE(m_spriteram)
649649   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(renegade_videoram_w) AM_BASE(m_videoram)
650   AM_RANGE(0x3000, 0x30ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("paletteram")
651   AM_RANGE(0x3100, 0x31ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("paletteram2")
650   AM_RANGE(0x3000, 0x30ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram")
651   AM_RANGE(0x3100, 0x31ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
652652   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("IN0") AM_WRITE(renegade_scroll0_w)      /* Player#1 controls, P1,P2 start */
653653   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("IN1") AM_WRITE(renegade_scroll1_w)      /* Player#2 controls, coin triggers */
654654   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("DSW2") AM_WRITE(sound_w)   /* DIP2  various IO ports */
r14896r14897
663663
664664static ADDRESS_MAP_START( renegade_sound_map, AS_PROGRAM, 8, renegade_state )
665665   AM_RANGE(0x0000, 0x0fff) AM_RAM
666   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_r)
666   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_byte_r)
667667   AM_RANGE(0x1800, 0x1800) AM_WRITENOP // this gets written the same values as 0x2000
668668   AM_RANGE(0x2000, 0x2000) AM_DEVWRITE_LEGACY("adpcm", adpcm_play_w)
669669   AM_RANGE(0x2800, 0x2801) AM_DEVREADWRITE_LEGACY("ymsnd", ym3526_r,ym3526_w)
src/mame/drivers/junofrst.c
r14896r14897
299299   AM_RANGE(0x8033, 0x8033) AM_WRITEONLY AM_BASE(m_scroll)  /* not used in Juno */
300300   AM_RANGE(0x8034, 0x8035) AM_WRITE(flip_screen_w)
301301   AM_RANGE(0x8040, 0x8040) AM_WRITE(junofrst_sh_irqtrigger_w)
302   AM_RANGE(0x8050, 0x8050) AM_WRITE(soundlatch_w)
302   AM_RANGE(0x8050, 0x8050) AM_WRITE(soundlatch_byte_w)
303303   AM_RANGE(0x8060, 0x8060) AM_WRITE(junofrst_bankselect_w)
304304   AM_RANGE(0x8070, 0x8073) AM_WRITE(junofrst_blitter_w)
305305   AM_RANGE(0x8100, 0x8fff) AM_RAM
r14896r14897
311311static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, junofrst_state )
312312   AM_RANGE(0x0000, 0x0fff) AM_ROM
313313   AM_RANGE(0x2000, 0x23ff) AM_RAM
314   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
314   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
315315   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
316316   AM_RANGE(0x4001, 0x4001) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
317317   AM_RANGE(0x4002, 0x4002) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
318   AM_RANGE(0x5000, 0x5000) AM_WRITE(soundlatch2_w)
318   AM_RANGE(0x5000, 0x5000) AM_WRITE(soundlatch2_byte_w)
319319   AM_RANGE(0x6000, 0x6000) AM_WRITE(junofrst_i8039_irq_w)
320320ADDRESS_MAP_END
321321
r14896r14897
326326
327327
328328static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8, junofrst_state )
329   AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_r)
329   AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_byte_r)
330330   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE_LEGACY("dac", dac_w)
331331   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(i8039_irqen_and_status_w)
332332ADDRESS_MAP_END
src/mame/drivers/caswin.c
r14896r14897
5151{
5252public:
5353   caswin_state(const machine_config &mconfig, device_type type, const char *tag)
54      : driver_device(mconfig, type, tag) { }
54      : driver_device(mconfig, type, tag) ,
55      m_sc0_vram(*this, "sc0_vram"),
56      m_sc0_attr(*this, "sc0_attr"){ }
5557
56   UINT8 *m_sc0_vram;
57   UINT8 *m_sc0_attr;
58   required_shared_ptr<UINT8> m_sc0_vram;
59   required_shared_ptr<UINT8> m_sc0_attr;
5860   tilemap_t *m_sc0_tilemap;
5961   DECLARE_WRITE8_MEMBER(sc0_vram_w);
6062   DECLARE_WRITE8_MEMBER(sc0_attr_w);
r14896r14897
7072static TILE_GET_INFO( get_sc0_tile_info )
7173{
7274   caswin_state *state = machine.driver_data<caswin_state>();
73   int tile = (state->m_sc0_vram[tile_index] | ((state->m_sc0_attr[tile_index] & 0x70)<<4)) & 0x7ff;
74   int colour = state->m_sc0_attr[tile_index] & 0xf;
75   int tile = (state->m_sc0_vram.target()[tile_index] | ((state->m_sc0_attr.target()[tile_index] & 0x70)<<4)) & 0x7ff;
76   int colour = state->m_sc0_attr.target()[tile_index] & 0xf;
7577
7678   SET_TILE_INFO(
7779         0,
r14896r14897
9597
9698WRITE8_MEMBER(caswin_state::sc0_vram_w)
9799{
98   m_sc0_vram[offset] = data;
100   m_sc0_vram.target()[offset] = data;
99101   m_sc0_tilemap->mark_tile_dirty(offset);
100102}
101103
102104WRITE8_MEMBER(caswin_state::sc0_attr_w)
103105{
104   m_sc0_attr[offset] = data;
106   m_sc0_attr.target()[offset] = data;
105107   m_sc0_tilemap->mark_tile_dirty(offset);
106108}
107109
r14896r14897
115117/*---- ---x flip screen */
116118WRITE8_MEMBER(caswin_state::vvillage_vregs_w)
117119{
118   flip_screen_set(machine(), data & 1);
120   flip_screen_set(data & 1);
119121}
120122
121123/**********************
r14896r14897
158160   AM_RANGE(0x0000, 0x7fff) AM_ROM
159161   AM_RANGE(0xa000, 0xa000) AM_READ(vvillage_rng_r) //accessed by caswin only
160162   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("nvram")
161   AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(sc0_vram_w) AM_BASE(m_sc0_vram)
162   AM_RANGE(0xf800, 0xfbff) AM_RAM_WRITE(sc0_attr_w) AM_BASE(m_sc0_attr)
163   AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(sc0_vram_w) AM_SHARE("sc0_vram")
164   AM_RANGE(0xf800, 0xfbff) AM_RAM_WRITE(sc0_attr_w) AM_SHARE("sc0_attr")
163165ADDRESS_MAP_END
164166
165167static ADDRESS_MAP_START( vvillage_io, AS_IO, 8, caswin_state )
src/mame/drivers/hitpoker.c
r14896r14897
5252{
5353public:
5454   hitpoker_state(const machine_config &mconfig, device_type type, const char *tag)
55      : driver_device(mconfig, type, tag) { }
55      : driver_device(mconfig, type, tag) ,
56      m_sys_regs(*this, "sys_regs"){ }
5657
57   UINT8 *m_sys_regs;
58   required_shared_ptr<UINT8> m_sys_regs;
5859   UINT8 m_pic_data;
5960   UINT8 *m_videoram;
6061   UINT8 *m_paletteram;
r14896r14897
128129{
129130//  UINT8 *ROM = machine().region("maincpu")->base();
130131
131//  if(m_sys_regs[0x00] & 0x10)
132//  if(m_sys_regs.target()[0x00] & 0x10)
132133   m_videoram[offset] = data;
133134}
134135
r14896r14897
220221      return (m_pic_data & 0x7f) | (m_pic_data & 0x40 ? 0x80 : 0x00);
221222   }
222223
223   return m_sys_regs[offset];
224   return m_sys_regs.target()[offset];
224225}
225226
226227WRITE8_MEMBER(hitpoker_state::hitpoker_pic_w)
r14896r14897
228229   if(offset == 0)
229230      m_pic_data = (data & 0xff);// | (data & 0x40) ? 0x80 : 0x00;
230231//  logerror("%02x W\n",data);
231   m_sys_regs[offset] = data;
232   m_sys_regs.target()[offset] = data;
232233}
233234
234235#if 0
r14896r14897
262263ADDRESS_MAP_END
263264
264265static ADDRESS_MAP_START( hitpoker_io, AS_IO, 8, hitpoker_state )
265   AM_RANGE(MC68HC11_IO_PORTA, MC68HC11_IO_PORTA) AM_READWRITE(hitpoker_pic_r,hitpoker_pic_w) AM_BASE(m_sys_regs)
266   AM_RANGE(MC68HC11_IO_PORTA, MC68HC11_IO_PORTA) AM_READWRITE(hitpoker_pic_r,hitpoker_pic_w) AM_SHARE("sys_regs")
266267ADDRESS_MAP_END
267268
268269static INPUT_PORTS_START( hitpoker )
src/mame/drivers/taito_h.c
r14896r14897
255255   AM_RANGE(0x300000, 0x300001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
256256   AM_RANGE(0x300002, 0x300003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
257257   AM_RANGE(0x400000, 0x420fff) AM_DEVREADWRITE_LEGACY("tc0080vco", tc0080vco_word_r, tc0080vco_word_w)
258   AM_RANGE(0x500800, 0x500fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
258   AM_RANGE(0x500800, 0x500fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
259259ADDRESS_MAP_END
260260
261261static ADDRESS_MAP_START( recordbr_map, AS_PROGRAM, 16, taitoh_state )
r14896r14897
266266   AM_RANGE(0x300000, 0x300001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
267267   AM_RANGE(0x300002, 0x300003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
268268   AM_RANGE(0x400000, 0x420fff) AM_DEVREADWRITE_LEGACY("tc0080vco", tc0080vco_word_r, tc0080vco_word_w)
269   AM_RANGE(0x500800, 0x500fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
269   AM_RANGE(0x500800, 0x500fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
270270ADDRESS_MAP_END
271271
272272static ADDRESS_MAP_START( dleague_map, AS_PROGRAM, 16, taitoh_state )
r14896r14897
276276   AM_RANGE(0x300000, 0x300001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
277277   AM_RANGE(0x300002, 0x300003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
278278   AM_RANGE(0x400000, 0x420fff) AM_DEVREADWRITE_LEGACY("tc0080vco", tc0080vco_word_r, tc0080vco_word_w)
279   AM_RANGE(0x500800, 0x500fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
279   AM_RANGE(0x500800, 0x500fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
280280   AM_RANGE(0x600000, 0x600001) AM_WRITENOP   /* ?? writes zero once per frame */
281281ADDRESS_MAP_END
282282
src/mame/drivers/ginganin.c
r14896r14897
7676   AM_RANGE(0x020000, 0x023fff) AM_RAM
7777   AM_RANGE(0x030000, 0x0307ff) AM_RAM_WRITE(ginganin_txtram16_w) AM_BASE(m_txtram)
7878   AM_RANGE(0x040000, 0x0407ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
79   AM_RANGE(0x050000, 0x0507ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
79   AM_RANGE(0x050000, 0x0507ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
8080   AM_RANGE(0x060000, 0x06000f) AM_RAM_WRITE(ginganin_vregs16_w) AM_BASE(m_vregs)
8181   AM_RANGE(0x068000, 0x06bfff) AM_RAM_WRITE(ginganin_fgram16_w) AM_BASE(m_fgram)
8282   AM_RANGE(0x070000, 0x070001) AM_READ_PORT("P1_P2")
r14896r14897
9393static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, ginganin_state )
9494   AM_RANGE(0x0000, 0x07ff) AM_RAM
9595   AM_RANGE(0x0800, 0x0807) AM_DEVREADWRITE("6840ptm", ptm6840_device, read, write)
96   AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r)
96   AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_byte_r)
9797   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ymsnd", y8950_w)
9898   AM_RANGE(0x2800, 0x2801) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
9999   AM_RANGE(0x4000, 0xffff) AM_ROM
src/mame/drivers/tail2nos.c
r14896r14897
2222
2323   if (ACCESSING_BITS_0_7)
2424   {
25      soundlatch_w(space, offset, data & 0xff);
25      soundlatch_byte_w(space, offset, data & 0xff);
2626      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
2727   }
2828}
r14896r14897
4343   AM_RANGE(0xffc000, 0xffc2ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
4444   AM_RANGE(0xffc300, 0xffcfff) AM_RAM
4545   AM_RANGE(0xffd000, 0xffdfff) AM_RAM_WRITE(tail2nos_bgvideoram_w) AM_BASE(m_bgvideoram)
46   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
46   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
4747   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("INPUTS") AM_WRITE(tail2nos_gfxbank_w)
4848   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW")
4949   AM_RANGE(0xfff008, 0xfff009) AM_WRITE(sound_command_w)
r14896r14897
5757
5858static ADDRESS_MAP_START( sound_port_map, AS_IO, 8, tail2nos_state )
5959   ADDRESS_MAP_GLOBAL_MASK(0xff)
60   AM_RANGE(0x07, 0x07) AM_READ(soundlatch_r) AM_WRITENOP   /* the write is a clear pending command */
60   AM_RANGE(0x07, 0x07) AM_READ(soundlatch_byte_r) AM_WRITENOP   /* the write is a clear pending command */
6161   AM_RANGE(0x08, 0x0b) AM_DEVWRITE_LEGACY("ymsnd", ym2608_w)
6262#if 0
6363   AM_RANGE(0x18, 0x1b) AM_DEVREAD_LEGACY("ymsnd", ym2608_r)
src/mame/drivers/m79amb.c
r14896r14897
6262{
6363public:
6464   m79amb_state(const machine_config &mconfig, device_type type, const char *tag)
65      : driver_device(mconfig, type, tag) { }
65      : driver_device(mconfig, type, tag) ,
66      m_videoram(*this, "videoram"),
67      m_mask(*this, "mask"){ }
6668
6769   /* memory pointers */
68   UINT8 *        m_videoram;
69   UINT8 *        m_mask;
70   required_shared_ptr<UINT8> m_videoram;
71   required_shared_ptr<UINT8> m_mask;
7072
7173   /* misc */
7274   UINT8 m_lut_gun1[0x100];
r14896r14897
8082
8183WRITE8_MEMBER(m79amb_state::ramtek_videoram_w)
8284{
83   m_videoram[offset] = data & ~*m_mask;
85   m_videoram.target()[offset] = data & ~*m_mask.target();
8486}
8587
8688static SCREEN_UPDATE_RGB32( ramtek )
r14896r14897
9294   {
9395      int i;
9496
95      UINT8 data = state->m_videoram[offs];
97      UINT8 data = state->m_videoram.target()[offs];
9698      int y = offs >> 5;
9799      int x = (offs & 0x1f) << 3;
98100
r14896r14897
135137
136138static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, m79amb_state )
137139   AM_RANGE(0x0000, 0x1fff) AM_ROM
138   AM_RANGE(0x4000, 0x5fff) AM_RAM_WRITE(ramtek_videoram_w) AM_BASE(m_videoram)
140   AM_RANGE(0x4000, 0x5fff) AM_RAM_WRITE(ramtek_videoram_w) AM_SHARE("videoram")
139141   AM_RANGE(0x6000, 0x63ff) AM_RAM               /* ?? */
140142   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("8000") AM_DEVWRITE_LEGACY("discrete", m79amb_8000_w)
141   AM_RANGE(0x8001, 0x8001) AM_WRITEONLY AM_BASE(m_mask)
143   AM_RANGE(0x8001, 0x8001) AM_WRITEONLY AM_SHARE("mask")
142144   AM_RANGE(0x8002, 0x8002) AM_READ_PORT("8002") AM_WRITE(m79amb_8002_w)
143145   AM_RANGE(0x8003, 0x8003) AM_DEVWRITE_LEGACY("discrete", m79amb_8003_w)
144146   AM_RANGE(0x8004, 0x8004) AM_READ(gray5bit_controller0_r)
src/mame/drivers/koftball.c
r14896r14897
3838public:
3939   koftball_state(const machine_config &mconfig, device_type type, const char *tag)
4040      : driver_device(mconfig, type, tag),
41      m_maincpu(*this,"maincpu")
42      { }
41      m_maincpu(*this,"maincpu"),
42      m_main_ram(*this, "main_ram"),
43      m_bmc_1_videoram(*this, "bmc_1_videoram"),
44      m_bmc_2_videoram(*this, "bmc_2_videoram"){ }
4345
44   UINT16 *m_bmc_1_videoram;
45   UINT16 *m_bmc_2_videoram;
46   UINT16 *m_main_ram;
46   required_device<cpu_device> m_maincpu;
47   required_shared_ptr<UINT16> m_main_ram;
48   required_shared_ptr<UINT16> m_bmc_1_videoram;
49   required_shared_ptr<UINT16> m_bmc_2_videoram;
4750   tilemap_t *m_tilemap_1;
4851   tilemap_t *m_tilemap_2;
4952   UINT8 *m_bmc_colorram;
5053   int m_clr_offset;
5154   UINT16 m_prot_data;
5255
53   required_device<cpu_device> m_maincpu;
5456   DECLARE_WRITE16_MEMBER(bmc_RAMDAC_offset_w);
5557   DECLARE_WRITE16_MEMBER(bmc_RAMDAC_color_w);
5658   DECLARE_READ16_MEMBER(bmc_RAMDAC_color_r);
r14896r14897
6567static TILE_GET_INFO( get_t1_tile_info )
6668{
6769   koftball_state *state = machine.driver_data<koftball_state>();
68   int data = state->m_bmc_1_videoram[tile_index];
70   int data = state->m_bmc_1_videoram.target()[tile_index];
6971   SET_TILE_INFO(
7072         0,
7173         data,
r14896r14897
7678static TILE_GET_INFO( get_t2_tile_info )
7779{
7880   koftball_state *state = machine.driver_data<koftball_state>();
79   int data = state->m_bmc_2_videoram[tile_index];
81   int data = state->m_bmc_2_videoram.target()[tile_index];
8082   SET_TILE_INFO(
8183         0,
8284         data,
r14896r14897
145147
146148WRITE16_MEMBER(koftball_state::bmc_1_videoram_w)
147149{
148   COMBINE_DATA(&m_bmc_1_videoram[offset]);
150   COMBINE_DATA(&m_bmc_1_videoram.target()[offset]);
149151   m_tilemap_1->mark_tile_dirty(offset);
150152}
151153
152154WRITE16_MEMBER(koftball_state::bmc_2_videoram_w)
153155{
154   COMBINE_DATA(&m_bmc_2_videoram[offset]);
156   COMBINE_DATA(&m_bmc_2_videoram.target()[offset]);
155157   m_tilemap_2->mark_tile_dirty(offset);
156158}
157159
158160static ADDRESS_MAP_START( koftball_mem, AS_PROGRAM, 16, koftball_state )
159161   AM_RANGE(0x000000, 0x01ffff) AM_ROM
160   AM_RANGE(0x220000, 0x22ffff) AM_RAM AM_BASE(m_main_ram)
162   AM_RANGE(0x220000, 0x22ffff) AM_RAM AM_SHARE("main_ram")
161163
162   AM_RANGE(0x260000, 0x260fff) AM_WRITE(bmc_1_videoram_w) AM_BASE(m_bmc_1_videoram)
163   AM_RANGE(0x261000, 0x261fff) AM_WRITE(bmc_2_videoram_w) AM_BASE(m_bmc_2_videoram)
164   AM_RANGE(0x260000, 0x260fff) AM_WRITE(bmc_1_videoram_w) AM_SHARE("bmc_1_videoram")
165   AM_RANGE(0x261000, 0x261fff) AM_WRITE(bmc_2_videoram_w) AM_SHARE("bmc_2_videoram")
164166   AM_RANGE(0x262000, 0x26ffff) AM_RAM
165167
166168   AM_RANGE(0x280000, 0x28ffff) AM_RAM /* unused ? */
r14896r14897
313315      int offset=0;
314316      while(nvram[offset]!=0xffff)
315317      {
316         state->m_main_ram[offset]=nvram[offset];
318         state->m_main_ram.target()[offset]=nvram[offset];
317319         ++offset;
318320      }
319321   }
src/mame/drivers/atarisy4.c
r14896r14897
2424{
2525public:
2626   atarisy4_state(const machine_config &mconfig, device_type type, const char *tag)
27      : driver_device(mconfig, type, tag) { }
27      : driver_device(mconfig, type, tag) ,
28      m_m68k_ram(*this, "m68k_ram"),
29      m_screen_ram(*this, "screen_ram"){ }
2830
2931   UINT8 m_r_color_table[256];
3032   UINT8 m_g_color_table[256];
3133   UINT8 m_b_color_table[256];
3234   UINT16 m_dsp_bank[2];
3335   UINT8 m_csr[2];
34   UINT16 *m_m68k_ram;
36   required_shared_ptr<UINT16> m_m68k_ram;
3537   UINT16 *m_shared_ram[2];
36   UINT16 *m_screen_ram;
38   required_shared_ptr<UINT16> m_screen_ram;
3739   poly_manager *m_poly;
3840   DECLARE_WRITE16_MEMBER(gpu_w);
3941   DECLARE_READ16_MEMBER(gpu_r);
r14896r14897
168170
169171   for (y = cliprect.min_y; y <= cliprect.max_y; ++y)
170172   {
171      UINT16 *src = &state->m_screen_ram[(offset + (4096 * y)) / 2];
173      UINT16 *src = &state->m_screen_ram.target()[(offset + (4096 * y)) / 2];
172174      UINT32 *dest = &bitmap.pix32(y, cliprect.min_x);
173175      int x;
174176
r14896r14897
223225         {
224226            if (x >= 0 && x <= 511)
225227            {
226               UINT16 pix = state->m_screen_ram[xy_to_screen_addr(x,y) >> 1];
228               UINT16 pix = state->m_screen_ram.target()[xy_to_screen_addr(x,y) >> 1];
227229
228230               if (x & 1)
229231                  pix = (pix & (0x00ff)) | gpu.idr << 8;
230232               else
231233                  pix = (pix & (0xff00)) | gpu.idr;
232234
233               state->m_screen_ram[xy_to_screen_addr(x,y) >> 1] = pix;
235               state->m_screen_ram.target()[xy_to_screen_addr(x,y) >> 1] = pix;
234236            }
235237            ++x;
236238         }
r14896r14897
269271   clip.set(0, 511, 0, 511);
270272
271273   extra->color = color;
272   extra->screen_ram = state->m_screen_ram;
274   extra->screen_ram = state->m_screen_ram.target();
273275
274276   v1.x = gpu.points[0].x;
275277   v1.y = gpu.points[0].y;
r14896r14897
371373
372374         for (i = 0; i < gpu.gr[3]; ++i)
373375         {
374            UINT16 val = state->m_screen_ram[offset >> 1];
376            UINT16 val = state->m_screen_ram.target()[offset >> 1];
375377            val >>= (~offset & 1) << 3;
376378
377379            if (gpu.gr[4] & 0x10)
r14896r14897
627629 *************************************/
628630
629631static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarisy4_state )
630   AM_RANGE(0x000000, 0x00ffff) AM_RAM AM_BASE(m_m68k_ram)
632   AM_RANGE(0x000000, 0x00ffff) AM_RAM AM_SHARE("m68k_ram")
631633   AM_RANGE(0x010000, 0x01ffff) AM_RAM
632634   AM_RANGE(0x580000, 0x580001) AM_READ_PORT("JOYSTICK")
633635   AM_RANGE(0x588000, 0x588001) AM_READ(analog_r)
r14896r14897
636638   AM_RANGE(0x7c6000, 0x7c6001) AM_READWRITE(dsp1_status_r, dsp1_control_w)
637639   AM_RANGE(0x7f0000, 0x7f4fff) AM_READWRITE(m68k_shared_0_r, m68k_shared_0_w)
638640   AM_RANGE(0x7f6000, 0x7f6001) AM_READWRITE(dsp0_status_r, dsp0_control_w)
639   AM_RANGE(0xa00400, 0xbfffff) AM_RAM AM_BASE(m_screen_ram)
641   AM_RANGE(0xa00400, 0xbfffff) AM_RAM AM_SHARE("screen_ram")
640642   AM_RANGE(0xff8000, 0xff8fff) AM_READWRITE(gpu_r, gpu_w)
641643ADDRESS_MAP_END
642644
src/mame/drivers/lucky74.c
r14896r14897
708708    bit 0 contains the screen orientation.
709709*/
710710   state->m_ym2149_portb = data;
711   flip_screen_set(device->machine(), data & 0x01);
711   state->flip_screen_set(data & 0x01);
712712}
713713
714714READ8_MEMBER(lucky74_state::usart_8251_r)
src/mame/drivers/cninja.c
r14896r14897
5757WRITE16_MEMBER(cninja_state::cninja_sound_w)
5858{
5959
60   soundlatch_w(space, 0, data & 0xff);
60   soundlatch_byte_w(space, 0, data & 0xff);
6161   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
6262}
6363
6464WRITE16_MEMBER(cninja_state::stoneage_sound_w)
6565{
6666
67   soundlatch_w(space, 0, data & 0xff);
67   soundlatch_byte_w(space, 0, data & 0xff);
6868   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
6969}
7070
r14896r14897
307307   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ym2", ym2151_r, ym2151_w)
308308   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
309309   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
310   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
310   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
311311   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
312312   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
313313   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
r14896r14897
319319   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
320320   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
321321   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
322   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
322   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
323323   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
324324   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
325325   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
r14896r14897
329329   AM_RANGE(0x0000, 0x7fff) AM_ROM
330330   AM_RANGE(0x8000, 0x87ff) AM_RAM
331331   AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
332   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
332   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
333333   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
334334ADDRESS_MAP_END
335335
src/mame/drivers/wardner.c
r14896r14897
140140
141141   UINT8 *m_rambase_ae00;
142142   UINT8 *m_rambase_c000;
143   DECLARE_WRITE8_MEMBER(wardner_ramrom_bank_sw);
143144};
144145
145146
146static WRITE8_HANDLER( wardner_ramrom_bank_sw )
147WRITE8_MEMBER(wardner_state::wardner_ramrom_bank_sw)
147148{
148   wardner_state *state = space->machine().driver_data<wardner_state>();
149   if (state->m_wardner_membank != data) {
149   if (m_wardner_membank != data) {
150150      int bankaddress = 0;
151151
152152      address_space *mainspace;
153      UINT8 *RAM = space->machine().region("maincpu")->base();
153      UINT8 *RAM = machine().region("maincpu")->base();
154154
155      mainspace = space->machine().device("maincpu")->memory().space(AS_PROGRAM);
156      state->m_wardner_membank = data;
155      mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
156      m_wardner_membank = data;
157157
158158      if (data)
159159      {
r14896r14897
169169            case 6:  bankaddress = 0x30000; break; /* not used */
170170            default: bankaddress = 0x00000; break; /* not used */
171171         }
172         memory_set_bankptr(space->machine(), "bank1",&RAM[bankaddress]);
172         memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);
173173      }
174174      else
175175      {
176         mainspace->install_read_handler(0x8000, 0x8fff, read8_delegate(FUNC(wardner_state::wardner_sprite_r),state));
176         mainspace->install_read_handler(0x8000, 0x8fff, read8_delegate(FUNC(wardner_state::wardner_sprite_r),this));
177177         mainspace->install_read_bank(0xa000, 0xadff, "bank4");
178178         mainspace->install_read_bank(0xae00, 0xafff, "bank2");
179179         mainspace->install_read_bank(0xc000, 0xc7ff, "bank3");
180         memory_set_bankptr(space->machine(), "bank1", &RAM[0x0000]);
181         memory_set_bankptr(space->machine(), "bank2", state->m_rambase_ae00);
182         memory_set_bankptr(space->machine(), "bank3", state->m_rambase_c000);
183         memory_set_bankptr(space->machine(), "bank4", state->m_generic_paletteram_8);
180         memory_set_bankptr(machine(), "bank1", &RAM[0x0000]);
181         memory_set_bankptr(machine(), "bank2", m_rambase_ae00);
182         memory_set_bankptr(machine(), "bank3", m_rambase_c000);
183         memory_set_bankptr(machine(), "bank4", m_generic_paletteram_8);
184184      }
185185   }
186186}
r14896r14897
190190   wardner_state *state = machine.driver_data<wardner_state>();
191191   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
192192
193   wardner_ramrom_bank_sw(space,0,1);   /* Dummy value to ensure restoration */
194   wardner_ramrom_bank_sw(space,0,state->m_wardner_membank);
193   state->wardner_ramrom_bank_sw(*space,0,1);   /* Dummy value to ensure restoration */
194   state->wardner_ramrom_bank_sw(*space,0,state->m_wardner_membank);
195195}
196196
197197
r14896r14897
205205
206206   AM_RANGE(0x8000, 0x8fff) AM_WRITE(wardner_sprite_w) AM_SHARE("spriteram")
207207   AM_RANGE(0x9000, 0x9fff) AM_ROM
208   AM_RANGE(0xa000, 0xadff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_le_w) AM_SHARE("paletteram")
208   AM_RANGE(0xa000, 0xadff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_le_w) AM_SHARE("paletteram")
209209   AM_RANGE(0xae00, 0xafff) AM_RAM AM_BASE(m_rambase_ae00)
210210   AM_RANGE(0xb000, 0xbfff) AM_ROM
211211   AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_BASE(m_rambase_c000) AM_SHARE("share1")   /* Shared RAM with Sound Z80 */
r14896r14897
231231   AM_RANGE(0x5a, 0x5a) AM_WRITE(wardner_coin_dsp_w)      /* Machine system control */
232232   AM_RANGE(0x5c, 0x5c) AM_WRITE(wardner_control_w)      /* Machine system control */
233233   AM_RANGE(0x60, 0x65) AM_READWRITE(wardner_videoram_r, wardner_videoram_w)      /* data from video layer RAM */
234   AM_RANGE(0x70, 0x70) AM_WRITE_LEGACY(wardner_ramrom_bank_sw)   /* ROM bank select */
234   AM_RANGE(0x70, 0x70) AM_WRITE(wardner_ramrom_bank_sw)   /* ROM bank select */
235235ADDRESS_MAP_END
236236
237237
src/mame/drivers/missile.c
r14896r14897
356356{
357357public:
358358   missile_state(const machine_config &mconfig, device_type type, const char *tag)
359      : driver_device(mconfig, type, tag) { }
359      : driver_device(mconfig, type, tag) ,
360      m_videoram(*this, "videoram"){ }
360361
361   UINT8 *m_videoram;
362   required_shared_ptr<UINT8> m_videoram;
362363   const UINT8 *m_writeprom;
363364   emu_timer *m_irq_timer;
364365   emu_timer *m_cpu_timer;
r14896r14897
493494   if (address < 0x4000)
494495   {
495496      missile_state *state = direct.space().machine().driver_data<missile_state>();
496      direct.explicit_configure(0x0000 | offset, 0x3fff | offset, 0x3fff, state->m_videoram);
497      direct.explicit_configure(0x0000 | offset, 0x3fff | offset, 0x3fff, state->m_videoram.target());
497498      return ~0;
498499   }
499500
r14896r14897
594595static void write_vram(address_space *space, offs_t address, UINT8 data)
595596{
596597   missile_state *state = space->machine().driver_data<missile_state>();
597   UINT8 *videoram = state->m_videoram;
598   UINT8 *videoram = state->m_videoram.target();
598599   static const UINT8 data_lookup[4] = { 0x00, 0x0f, 0xf0, 0xff };
599600   offs_t vramaddr;
600601   UINT8 vramdata;
r14896r14897
626627static UINT8 read_vram(address_space *space, offs_t address)
627628{
628629   missile_state *state = space->machine().driver_data<missile_state>();
629   UINT8 *videoram = state->m_videoram;
630   UINT8 *videoram = state->m_videoram.target();
630631   offs_t vramaddr;
631632   UINT8 vramdata;
632633   UINT8 vrammask;
r14896r14897
670671static SCREEN_UPDATE_IND16( missile )
671672{
672673   missile_state *state = screen.machine().driver_data<missile_state>();
673   UINT8 *videoram = state->m_videoram;
674   UINT8 *videoram = state->m_videoram.target();
674675   int x, y;
675676
676677   /* draw the bitmap to the screen, looping over Y */
r14896r14897
712713
713714WRITE8_MEMBER(missile_state::missile_w)
714715{
715   UINT8 *videoram = m_videoram;
716   UINT8 *videoram = m_videoram.target();
716717   /* if we're in MADSEL mode, write to video RAM */
717718   if (get_madsel(&space))
718719   {
r14896r14897
769770
770771READ8_MEMBER(missile_state::missile_r)
771772{
772   UINT8 *videoram = m_videoram;
773   UINT8 *videoram = m_videoram.target();
773774   UINT8 result = 0xff;
774775
775776   /* if we're in MADSEL mode, read from video RAM */
r14896r14897
829830
830831/* complete memory map derived from schematics (implemented above) */
831832static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, missile_state )
832   AM_RANGE(0x0000, 0xffff) AM_READWRITE(missile_r, missile_w) AM_BASE(m_videoram)
833   AM_RANGE(0x0000, 0xffff) AM_READWRITE(missile_r, missile_w) AM_SHARE("videoram")
833834ADDRESS_MAP_END
834835
835836
r14896r14897
12791280GAME( 1980, missile,  0,       missile, missile,         0, ROT0, "Atari", "Missile Command (rev 3)", GAME_SUPPORTS_SAVE )
12801281GAME( 1980, missile2, missile, missile, missile,         0, ROT0, "Atari", "Missile Command (rev 2)", GAME_SUPPORTS_SAVE )
12811282GAME( 1980, missile1, missile, missile, missile,         0, ROT0, "Atari", "Missile Command (rev 1)", GAME_SUPPORTS_SAVE )
1282GAME( 1981, suprmatk, missile, missile, suprmatk, suprmatk, ROT0, "Atari / Gencomp", "Super Missile Attack (for rev 1)", GAME_SUPPORTS_SAVE )
1283GAME( 1981, suprmatkd,missile, missile, suprmatk,        0, ROT0, "Atari / Gencomp", "Super Missile Attack (not encrypted)", GAME_SUPPORTS_SAVE )
1283GAME( 1981, suprmatk, missile, missile, suprmatk, suprmatk, ROT0, "Atari / General Computer Corporation", "Super Missile Attack (for rev 1)", GAME_SUPPORTS_SAVE )
1284GAME( 1981, suprmatkd,missile, missile, suprmatk,        0, ROT0, "Atari / General Computer Corporation", "Super Missile Attack (not encrypted)", GAME_SUPPORTS_SAVE )
12841285
12851286/* the bootlegs are on different hardware and don't work */
12861287GAME( 198?, mcombat,  missile, missile, missile,         0, ROT0, "bootleg (Videotron)", "Missile Combat (Videotron bootleg, set 1)", GAME_NOT_WORKING )
src/mame/drivers/go2000.c
r14896r14897
3838{
3939public:
4040   go2000_state(const machine_config &mconfig, device_type type, const char *tag)
41      : driver_device(mconfig, type, tag) { }
41      : driver_device(mconfig, type, tag) ,
42      m_videoram(*this, "videoram"),
43      m_videoram2(*this, "videoram2"){ }
4244
4345   /* memory pointers */
44   UINT16 *  m_videoram;
45   UINT16 *  m_videoram2;
46   required_shared_ptr<UINT16> m_videoram;
47   required_shared_ptr<UINT16> m_videoram2;
4648//  UINT16 *  m_paletteram;   // currently this uses generic palette handling
4749
4850   /* devices */
r14896r14897
5456
5557WRITE16_MEMBER(go2000_state::sound_cmd_w)
5658{
57   soundlatch_w(space, offset, data & 0xff);
59   soundlatch_byte_w(space, offset, data & 0xff);
5860   device_set_input_line(m_soundcpu, 0, HOLD_LINE);
5961}
6062
6163static ADDRESS_MAP_START( go2000_map, AS_PROGRAM, 16, go2000_state )
6264   AM_RANGE(0x000000, 0x03ffff) AM_ROM
6365   AM_RANGE(0x200000, 0x203fff) AM_RAM
64   AM_RANGE(0x600000, 0x60ffff) AM_RAM AM_BASE(m_videoram)
65   AM_RANGE(0x610000, 0x61ffff) AM_RAM AM_BASE(m_videoram2)
66   AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
66   AM_RANGE(0x600000, 0x60ffff) AM_RAM AM_SHARE("videoram")
67   AM_RANGE(0x610000, 0x61ffff) AM_RAM AM_SHARE("videoram2")
68   AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
6769   AM_RANGE(0xa00000, 0xa00001) AM_READ_PORT("INPUTS")
6870   AM_RANGE(0xa00002, 0xa00003) AM_READ_PORT("DSW")
6971   AM_RANGE(0x620002, 0x620003) AM_WRITE(sound_cmd_w)
r14896r14897
8486
8587static ADDRESS_MAP_START( go2000_sound_io, AS_IO, 8, go2000_state )
8688   ADDRESS_MAP_GLOBAL_MASK(0xff)
87   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
89   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)
8890   AM_RANGE(0x00, 0x00) AM_DEVWRITE_LEGACY("dac1", dac_w)
8991   AM_RANGE(0x03, 0x03) AM_WRITE(go2000_pcm_1_bankswitch_w)
9092ADDRESS_MAP_END
r14896r14897
181183   {
182184      for (y = 0; y < 32; y++)
183185      {
184         int tile = state->m_videoram[count];
185         int attr = state->m_videoram2[count];
186         int tile = state->m_videoram.target()[count];
187         int attr = state->m_videoram2.target()[count];
186188         drawgfx_opaque(bitmap, cliprect, screen.machine().gfx[0], tile, attr, 0, 0, x * 8, y * 8);
187189         count++;
188190      }
r14896r14897
193195   {
194196      for (y = 0; y < 32; y++)
195197      {
196         int tile = state->m_videoram[count];
197         int attr = state->m_videoram2[count];
198         int tile = state->m_videoram.target()[count];
199         int attr = state->m_videoram2.target()[count];
198200         drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[0], tile, attr, 0, 0, x * 8, y * 8, 0xf);
199201         count++;
200202      }
r14896r14897
215217      int dx, dy;
216218      int flipx, y0;
217219
218      int y = state->m_videoram[offs + 0 + 0x00000 / 2];
219      int x = state->m_videoram[offs + 1 + 0x00000 / 2];
220      int dim = state->m_videoram2[offs + 0 + 0x00000 / 2];
220      int y = state->m_videoram.target()[offs + 0 + 0x00000 / 2];
221      int x = state->m_videoram.target()[offs + 1 + 0x00000 / 2];
222      int dim = state->m_videoram2.target()[offs + 0 + 0x00000 / 2];
221223
222224      int bank   =   (x >> 12) & 0xf;
223225
r14896r14897
266268         for (dx = 0; dx < dimx * 8; dx += 8)
267269         {
268270            int addr = (srcpg * 0x20 * 0x20) + ((srcx + tile_x) & 0x1f) * 0x20 + ((srcy + tile_y) & 0x1f);
269            int tile = state->m_videoram[addr + 0x00000 / 2];
270            int attr = state->m_videoram2[addr + 0x00000 / 2];
271            int tile = state->m_videoram.target()[addr + 0x00000 / 2];
272            int attr = state->m_videoram2.target()[addr + 0x00000 / 2];
271273
272274            int sx = x + dx;
273275            int sy = (y + dy) & 0xff;
r14896r14897
278280            if (flipx)
279281               tile_flipx = !tile_flipx;
280282
281            if (flip_screen_get(screen.machine()))
283            if (state->flip_screen())
282284            {
283285               sx = max_x - sx;
284286               sy = max_y - sy;
src/mame/drivers/jack.c
r14896r14897
6565
6666WRITE8_MEMBER(jack_state::jack_sh_command_w)
6767{
68   soundlatch_w(space, 0, data);
68   soundlatch_byte_w(space, 0, data);
6969   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
7070}
7171
r14896r14897
7474
7575WRITE8_MEMBER(jack_state::joinem_misc_w)
7676{
77   flip_screen_set(machine(), data & 0x80);
77   flip_screen_set(data & 0x80);
7878   m_joinem_snd_bit = data & 1;
7979}
8080
r14896r14897
776776{
777777   AY8910_LEGACY_OUTPUT,
778778   AY8910_DEFAULT_LOADS,
779   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
779   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
780780   DEVCB_DEVICE_HANDLER("audiocpu", timer_r)
781781};
782782
src/mame/drivers/dogfgt.c
r14896r14897
7171   AM_RANGE(0x1830, 0x1830) AM_READ_PORT("DSW2")
7272   AM_RANGE(0x1830, 0x1830) AM_WRITE(dogfgt_soundlatch_w)
7373   AM_RANGE(0x1840, 0x1840) AM_WRITE(dogfgt_soundcontrol_w)
74   AM_RANGE(0x1870, 0x187f) AM_WRITE(paletteram_BBGGGRRR_w) AM_SHARE("paletteram")
74   AM_RANGE(0x1870, 0x187f) AM_WRITE(paletteram_BBGGGRRR_byte_w) AM_SHARE("paletteram")
7575   AM_RANGE(0x2000, 0x3fff) AM_READWRITE(dogfgt_bitmapram_r, dogfgt_bitmapram_w)
7676   AM_RANGE(0x8000, 0xffff) AM_ROM
7777ADDRESS_MAP_END
src/mame/drivers/taitosj.c
r14896r14897
179179
180180WRITE8_MEMBER(taitosj_state::taitosj_soundcommand_w)
181181{
182   soundlatch_w(space,offset,data);
182   soundlatch_byte_w(space,offset,data);
183183   if (!m_sndnmi_disable) cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
184184}
185185
r14896r14897
346346   AM_RANGE(0x4803, 0x4803) AM_DEVREAD_LEGACY("ay3", ay8910_r)
347347   AM_RANGE(0x4804, 0x4805) AM_DEVWRITE_LEGACY("ay4", ay8910_address_data_w)
348348   AM_RANGE(0x4805, 0x4805) AM_DEVREAD_LEGACY("ay4", ay8910_r)
349   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_r)
349   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_byte_r)
350350   AM_RANGE(0xe000, 0xefff) AM_ROM   /* space for diagnostic ROM */
351351ADDRESS_MAP_END
352352
src/mame/drivers/vigilant.c
r14896r14897
110110static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, vigilant_state )
111111   ADDRESS_MAP_GLOBAL_MASK(0xff)
112112   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
113   AM_RANGE(0x80, 0x81) AM_READ(soundlatch_r) AM_DEVWRITE_LEGACY("m72", vigilant_sample_addr_w)   /* STL / STH */
113   AM_RANGE(0x80, 0x81) AM_READ(soundlatch_byte_r) AM_DEVWRITE_LEGACY("m72", vigilant_sample_addr_w)   /* STL / STH */
114114   AM_RANGE(0x82, 0x82) AM_DEVWRITE_LEGACY("m72", m72_sample_w)         /* COUNT UP */
115115   AM_RANGE(0x83, 0x83) AM_DEVWRITE_LEGACY("m72", m72_sound_irq_ack_w)   /* IRQ clear */
116116   AM_RANGE(0x84, 0x84) AM_DEVREAD_LEGACY("m72", m72_sample_r)   /* S ROM C */
r14896r14897
120120   ADDRESS_MAP_GLOBAL_MASK(0xff)
121121   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
122122   AM_RANGE(0x02, 0x03) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r, ym2203_w)
123   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)            /* SDRE */
123   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_byte_r)            /* SDRE */
124124   AM_RANGE(0x80, 0x81) AM_DEVWRITE_LEGACY("m72", vigilant_sample_addr_w)   /* STL / STH */
125125   AM_RANGE(0x82, 0x82) AM_DEVWRITE_LEGACY("m72", m72_sample_w)            /* COUNT UP */
126126   AM_RANGE(0x83, 0x83) AM_DEVWRITE_LEGACY("m72", m72_sound_irq_ack_w)      /* IRQ clear */
src/mame/drivers/nbmj8991.c
r14896r14897
4848
4949WRITE8_MEMBER(nbmj8991_state::nbmj8991_soundbank_w)
5050{
51   if (!(data & 0x80)) soundlatch_clear_w(space, 0, 0);
51   if (!(data & 0x80)) soundlatch_clear_byte_w(space, 0, 0);
5252   memory_set_bank(machine(), "bank1", data & 0x03);
5353}
5454
5555WRITE8_MEMBER(nbmj8991_state::nbmj8991_sound_w)
5656{
57   soundlatch_w(space, 0, data);
57   soundlatch_byte_w(space, 0, data);
5858}
5959
6060READ8_MEMBER(nbmj8991_state::nbmj8991_sound_r)
6161{
6262   int data;
6363
64   data = soundlatch_r(space,0);
64   data = soundlatch_byte_r(space,0);
6565   return data;
6666}
6767
src/mame/drivers/galivan.c
r14896r14897
3737
3838WRITE8_MEMBER(galivan_state::galivan_sound_command_w)
3939{
40   soundlatch_w(space,0,((data & 0x7f) << 1) | 1);
40   soundlatch_byte_w(space,0,((data & 0x7f) << 1) | 1);
4141}
4242
4343READ8_MEMBER(galivan_state::soundlatch_clear_r)
4444{
45   soundlatch_clear_w(space, 0, 0);
45   soundlatch_clear_byte_w(space, 0, 0);
4646   return 0;
4747}
4848
r14896r14897
118118   AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("dac1", dac_w)
119119   AM_RANGE(0x03, 0x03) AM_DEVWRITE_LEGACY("dac2", dac_w)
120120   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r)
121   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
121   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_byte_r)
122122ADDRESS_MAP_END
123123
124124
src/mame/drivers/deshoros.c
r14896r14897
2020{
2121public:
2222   deshoros_state(const machine_config &mconfig, device_type type, const char *tag)
23      : driver_device(mconfig, type, tag) { }
23      : driver_device(mconfig, type, tag) ,
24      m_io_ram(*this, "io_ram"){ }
2425
25   UINT8 *m_io_ram;
26   required_shared_ptr<UINT8> m_io_ram;
2627   char m_led_array[21];
2728   UINT8 m_bank;
2829   DECLARE_READ8_MEMBER(io_r);
r14896r14897
8384      case 0x03: return input_port_read(machine(), "KEY0" );
8485      case 0x04: return input_port_read(machine(), "KEY1" );
8586      case 0x05: return input_port_read(machine(), "SYSTEM" );
86      case 0x0a: return m_io_ram[offset]; //"buzzer" 0 read
87      case 0x0b: return m_io_ram[offset]; //"buzzer" 1 read
87      case 0x0a: return m_io_ram.target()[offset]; //"buzzer" 0 read
88      case 0x0b: return m_io_ram.target()[offset]; //"buzzer" 1 read
8889   }
8990//  printf("R -> [%02x]\n",offset);
9091
91   return m_io_ram[offset];
92   return m_io_ram.target()[offset];
9293}
9394
9495WRITE8_MEMBER(deshoros_state::io_w)
r14896r14897
9798   {
9899      case 0x00: /*Printer data*/                  return;
99100      case 0x02: update_led_array(data);              return;
100      case 0x05: coin_lockout_w(machine(), 0,m_io_ram[offset] & 1);return;
101      case 0x05: coin_lockout_w(machine(), 0,m_io_ram.target()[offset] & 1);return;
101102      case 0x06: /*Printer IRQ enable*/             return;
102103//      case 0x0a: "buzzer" 0 write
103104//      case 0x0b: "buzzer" 1 write
104105      case 0x0c: answer_bankswitch(machine(),data&0x03); return; //data & 0x10 enabled too,dunno if it is worth to shift the data...
105106   }
106   m_io_ram[offset] = data;
107   m_io_ram.target()[offset] = data;
107108//  printf("%02x -> [%02x]\n",data,offset);
108109}
109110
110111static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, deshoros_state )
111112   AM_RANGE(0x0000, 0x5fff) AM_ROMBANK("bank1")
112113   AM_RANGE(0x8000, 0x87ff) AM_RAM
113   AM_RANGE(0x9000, 0x900f) AM_READWRITE(io_r,io_w) AM_BASE(m_io_ram) //i/o area
114   AM_RANGE(0x9000, 0x900f) AM_READWRITE(io_r,io_w) AM_SHARE("io_ram") //i/o area
114115   AM_RANGE(0xc000, 0xffff) AM_ROM
115116ADDRESS_MAP_END
116117
src/mame/drivers/igs_m027.c
r14896r14897
2424{
2525public:
2626   igs_m027_state(const machine_config &mconfig, device_type type, const char *tag)
27      : driver_device(mconfig, type, tag) { }
27      : driver_device(mconfig, type, tag) ,
28      m_igs_mainram(*this, "igs_mainram"),
29      m_igs_cg_videoram(*this, "igs_cg_videoram"),
30      m_igs_palette32(*this, "igs_palette32"),
31      m_igs_tx_videoram(*this, "igs_tx_videoram"),
32      m_igs_bg_videoram(*this, "igs_bg_videoram"){ }
2833
29   UINT32 *m_igs_mainram;
30   UINT32 *m_igs_cg_videoram;
31   UINT32 *m_igs_tx_videoram;
32   UINT32 *m_igs_bg_videoram;
33   UINT32 *m_igs_palette32;
34   required_shared_ptr<UINT32> m_igs_mainram;
35   required_shared_ptr<UINT32> m_igs_cg_videoram;
36   required_shared_ptr<UINT32> m_igs_palette32;
37   required_shared_ptr<UINT32> m_igs_tx_videoram;
38   required_shared_ptr<UINT32> m_igs_bg_videoram;
3439   tilemap_t *m_igs_tx_tilemap;
3540   tilemap_t *m_igs_bg_tilemap;
3641   DECLARE_WRITE32_MEMBER(igs_cg_videoram_w);
r14896r14897
5863/* CGLayer */
5964WRITE32_MEMBER(igs_m027_state::igs_cg_videoram_w)
6065{
61   COMBINE_DATA(&m_igs_cg_videoram[offset]);
66   COMBINE_DATA(&m_igs_cg_videoram.target()[offset]);
6267   //if(data!=0)
63   logerror("PC(%08X) CG @%x = %x!\n",cpu_get_pc(&space.device()),offset ,m_igs_cg_videoram[offset]);
68   logerror("PC(%08X) CG @%x = %x!\n",cpu_get_pc(&space.device()),offset ,m_igs_cg_videoram.target()[offset]);
6469
6570
6671
r14896r14897
101106/* TX Layer */
102107WRITE32_MEMBER(igs_m027_state::igs_tx_videoram_w)
103108{
104   COMBINE_DATA(&m_igs_tx_videoram[offset]);
109   COMBINE_DATA(&m_igs_tx_videoram.target()[offset]);
105110   m_igs_tx_tilemap->mark_tile_dirty(offset);
106111   //if(data!=0)
107   //logerror( "TX VIDEO RAM OFFSET %x ,data %x!\n",offset ,m_igs_tx_videoram[offset]);
112   //logerror( "TX VIDEO RAM OFFSET %x ,data %x!\n",offset ,m_igs_tx_videoram.target()[offset]);
108113}
109114
110115static TILE_GET_INFO( get_tx_tilemap_tile_info )
r14896r14897
112117   igs_m027_state *state = machine.driver_data<igs_m027_state>();
113118   //ppppppppNNNNNNNN
114119   int tileno,colour;
115   tileno = state->m_igs_tx_videoram[tile_index] & 0xffff;
116   colour = (state->m_igs_tx_videoram[tile_index]>>0x10) & 0xffff;
120   tileno = state->m_igs_tx_videoram.target()[tile_index] & 0xffff;
121   colour = (state->m_igs_tx_videoram.target()[tile_index]>>0x10) & 0xffff;
117122
118123   SET_TILE_INFO(0,tileno,colour,0);
119124}
r14896r14897
121126/* BG Layer */
122127WRITE32_MEMBER(igs_m027_state::igs_bg_videoram_w)
123128{
124   COMBINE_DATA(&m_igs_bg_videoram[offset]);
129   COMBINE_DATA(&m_igs_bg_videoram.target()[offset]);
125130   m_igs_bg_tilemap->mark_tile_dirty(offset);
126131   //if(data!=0)
127   logerror("BG VIDEO RAM OFFSET %x ,data %x!\n",offset ,m_igs_bg_videoram[offset]);
132   logerror("BG VIDEO RAM OFFSET %x ,data %x!\n",offset ,m_igs_bg_videoram.target()[offset]);
128133}
129134
130135static TILE_GET_INFO( get_bg_tilemap_tile_info )
r14896r14897
132137   igs_m027_state *state = machine.driver_data<igs_m027_state>();
133138   //ppppppppNNNNNNNN
134139   int tileno,colour;
135   tileno = state->m_igs_bg_videoram[tile_index] & 0xffff;
136   colour = (state->m_igs_bg_videoram[tile_index]>>0x10) & 0xffff;
140   tileno = state->m_igs_bg_videoram.target()[tile_index] & 0xffff;
141   colour = (state->m_igs_bg_videoram.target()[tile_index]>>0x10) & 0xffff;
137142
138143   SET_TILE_INFO(0,tileno,colour,0);
139144}
r14896r14897
142147/* Palette Layer */
143148WRITE32_MEMBER(igs_m027_state::igs_palette32_w)
144149{
145   m_generic_paletteram_16.set_target((UINT16 *)m_igs_palette32, 0x800);
146   COMBINE_DATA(&m_igs_palette32[offset]);
147   //paletteram16_xGGGGGRRRRRBBBBB_word_w(offset*2,m_generic_paletteram_16[offset*2],0);
148   //paletteram16_xGGGGGRRRRRBBBBB_word_w(offset*2+1,m_generic_paletteram_16[offset*2+1],0);
150   m_generic_paletteram_16.set_target((UINT16 *)m_igs_palette32.target(), 0x800);
151   COMBINE_DATA(&m_igs_palette32.target()[offset]);
152   //paletteram_xGGGGGRRRRRBBBBB_word_w(offset*2,m_generic_paletteram_16[offset*2],0);
153   //paletteram_xGGGGGRRRRRBBBBB_word_w(offset*2+1,m_generic_paletteram_16[offset*2+1],0);
149154   //if(data!=0)
150   //fprintf(stdout,"PALETTE RAM OFFSET %x ,data %x!\n",offset ,m_igs_palette32[offset]);
155   //fprintf(stdout,"PALETTE RAM OFFSET %x ,data %x!\n",offset ,m_igs_palette32.target()[offset]);
151156}
152157
153158
r14896r14897
194199static ADDRESS_MAP_START( igs_majhong_map, AS_PROGRAM, 32, igs_m027_state )
195200   AM_RANGE(0x00000000, 0x00003fff) AM_ROM /* Internal ROM */
196201   AM_RANGE(0x08000000, 0x0807ffff) AM_ROM AM_REGION("user1", 0)/* Game ROM */
197   AM_RANGE(0x10000000, 0x100003ff) AM_RAM AM_BASE(m_igs_mainram)// main ram for asic?
202   AM_RANGE(0x10000000, 0x100003ff) AM_RAM AM_SHARE("igs_mainram")// main ram for asic?
198203   AM_RANGE(0x18000000, 0x18007fff) AM_RAM
199204
200   AM_RANGE(0x38001000, 0x380017ff) AM_RAM_WRITE(igs_cg_videoram_w) AM_BASE(m_igs_cg_videoram)      //0x200 * 1   CG PALETTE?
201   AM_RANGE(0x38001800, 0x38001fff) AM_RAM_WRITE(igs_palette32_w) AM_BASE(m_igs_palette32)      //0x200 * 1
205   AM_RANGE(0x38001000, 0x380017ff) AM_RAM_WRITE(igs_cg_videoram_w) AM_SHARE("igs_cg_videoram")      //0x200 * 1   CG PALETTE?
206   AM_RANGE(0x38001800, 0x38001fff) AM_RAM_WRITE(igs_palette32_w) AM_SHARE("igs_palette32")      //0x200 * 1
202207
203   AM_RANGE(0x38004000, 0x38005FFF) AM_RAM_WRITE(igs_tx_videoram_w) AM_BASE(m_igs_tx_videoram) /* Text Layer */
204   AM_RANGE(0x38006000, 0x38007FFF) AM_RAM_WRITE(igs_bg_videoram_w) AM_BASE(m_igs_bg_videoram) /* CG Layer */
208   AM_RANGE(0x38004000, 0x38005FFF) AM_RAM_WRITE(igs_tx_videoram_w) AM_SHARE("igs_tx_videoram") /* Text Layer */
209   AM_RANGE(0x38006000, 0x38007FFF) AM_RAM_WRITE(igs_bg_videoram_w) AM_SHARE("igs_bg_videoram") /* CG Layer */
205210
206211
207212   AM_RANGE(0x38002010, 0x38002017) AM_RAM      //??????????????
src/mame/drivers/splash.c
r14896r14897
5353{
5454   if (ACCESSING_BITS_0_7)
5555   {
56      soundlatch_w(space, 0, data & 0xff);
56      soundlatch_byte_w(space, 0, data & 0xff);
5757      cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
5858   }
5959}
r14896r14897
6262{
6363   if (ACCESSING_BITS_0_7)
6464   {
65      soundlatch_w(space, 0, data & 0xff);
65      soundlatch_byte_w(space, 0, data & 0xff);
6666      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
6767   }
6868
r14896r14897
100100   AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(splash_vram_w) AM_BASE(m_videoram)   /* Video RAM */
101101   AM_RANGE(0x881800, 0x881803) AM_RAM AM_BASE(m_vregs)                     /* Scroll registers */
102102   AM_RANGE(0x881804, 0x881fff) AM_RAM                                       /* Work RAM */
103   AM_RANGE(0x8c0000, 0x8c0fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")/* Palette is xRRRRxGGGGxBBBBx */
103   AM_RANGE(0x8c0000, 0x8c0fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")/* Palette is xRRRRxGGGGxBBBBx */
104104   AM_RANGE(0x900000, 0x900fff) AM_RAM AM_BASE(m_spriteram)                  /* Sprite RAM */
105105   AM_RANGE(0xffc000, 0xffffff) AM_RAM                                       /* Work RAM */
106106ADDRESS_MAP_END
r14896r14897
123123   AM_RANGE(0x0000, 0xd7ff) AM_ROM                              /* ROM */
124124   AM_RANGE(0xd800, 0xd800) AM_WRITE(splash_adpcm_data_w)            /* ADPCM data for the MSM5205 chip */
125125//  AM_RANGE(0xe000, 0xe000) AM_WRITENOP                                /* ??? */
126   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_r)                  /* Sound latch */
126   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r)                  /* Sound latch */
127127   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r,ym3812_w)   /* YM3812 */
128128   AM_RANGE(0xf800, 0xffff) AM_RAM                              /* RAM */
129129ADDRESS_MAP_END
r14896r14897
179179   AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(splash_vram_w) AM_BASE(m_videoram)   /* Video RAM */
180180   AM_RANGE(0x881800, 0x881803) AM_RAM AM_BASE(m_vregs)                     /* Scroll registers */
181181   AM_RANGE(0x881804, 0x881fff) AM_RAM                                       /* Work RAM */
182   AM_RANGE(0x8c0000, 0x8c0fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")/* Palette is xRRRRxGGGGxBBBBx */
182   AM_RANGE(0x8c0000, 0x8c0fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")/* Palette is xRRRRxGGGGxBBBBx */
183183   AM_RANGE(0xa00000, 0xa00001) AM_READ(roldfrog_bombs_r)
184184   AM_RANGE(0xd00000, 0xd00fff) AM_RAM AM_BASE(m_spriteram)                  /* Sprite RAM */
185185   AM_RANGE(0xe00000, 0xe00001) AM_WRITEONLY AM_BASE(m_bitmap_mode)         /* Bitmap Mode? */
r14896r14897
204204   AM_RANGE(0x40, 0x40) AM_NOP
205205   AM_RANGE(0x31, 0x31) AM_WRITE(sound_bank_w)
206206   AM_RANGE(0x37, 0x37) AM_WRITE(roldfrog_vblank_ack_w )
207   AM_RANGE(0x70, 0x70) AM_READ(soundlatch_r)
207   AM_RANGE(0x70, 0x70) AM_READ(soundlatch_byte_r)
208208
209209   AM_RANGE(0x0, 0xff) AM_READ(roldfrog_unk_r)
210210ADDRESS_MAP_END
r14896r14897
222222
223223WRITE16_MEMBER(splash_state::funystrp_sh_irqtrigger_w)
224224{
225   soundlatch_w(space, 0, data>>8);
225   soundlatch_byte_w(space, 0, data>>8);
226226   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
227227}
228228
r14896r14897
240240   AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(splash_vram_w) AM_BASE(m_videoram)   /* Video RAM */
241241   AM_RANGE(0x881800, 0x881803) AM_RAM AM_BASE(m_vregs)                     /* Scroll registers */
242242   AM_RANGE(0x881804, 0x881fff) AM_WRITENOP
243   AM_RANGE(0x8c0000, 0x8c0fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")/* Palette is xRRRRxGGGGxBBBBx */
243   AM_RANGE(0x8c0000, 0x8c0fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")/* Palette is xRRRRxGGGGxBBBBx */
244244   AM_RANGE(0xd00000, 0xd01fff) AM_READWRITE(spr_read, spr_write) AM_BASE(m_spriteram)      /* Sprite RAM */
245245   AM_RANGE(0xfe0000, 0xffffff) AM_RAM    AM_MASK(0xffff) /* there's fe0000 <-> ff0000 compare */            /* Work RAM */
246246ADDRESS_MAP_END
r14896r14897
285285   AM_RANGE(0x00, 0x00) AM_WRITE(msm1_data_w)
286286   AM_RANGE(0x01, 0x01) AM_WRITE(msm2_data_w)
287287   AM_RANGE(0x02, 0x02) AM_WRITE(sound_bank_w)
288   AM_RANGE(0x03, 0x03) AM_READ(soundlatch_r)
288   AM_RANGE(0x03, 0x03) AM_READ(soundlatch_byte_r)
289289   AM_RANGE(0x04, 0x04) AM_READ(int_source_r)
290290   AM_RANGE(0x06, 0x06) AM_WRITE(msm1_interrupt_w)
291291   AM_RANGE(0x07, 0x07) AM_WRITE(msm2_interrupt_w)
src/mame/drivers/subsino2.c
r14896r14897
7878{
7979public:
8080   subsino2_state(const machine_config &mconfig, device_type type, const char *tag)
81      : driver_device(mconfig, type, tag) { }
81      : driver_device(mconfig, type, tag) ,
82      m_outputs16(*this, "outputs16"),
83      m_outputs(*this, "outputs"),
84      m_am188em_regs(*this, "am188eregs"){ }
8285
8386   UINT8 *m_hm86171_colorram;
8487   layer_t m_layers[2];
r14896r14897
9194   UINT8 m_ss9601_disable;
9295   int m_hm86171_offs;
9396   UINT8 m_dsw_mask;
94   UINT8 *m_outputs;
95   UINT16 *m_outputs16;
96   UINT8 *m_am188em_regs;
97   required_shared_ptr<UINT16> m_outputs16;
98   required_shared_ptr<UINT8> m_outputs;
99   required_shared_ptr<UINT8> m_am188em_regs;
97100   UINT16 m_bishjan_sel;
98101   UINT16 m_bishjan_input;
99102   DECLARE_WRITE8_MEMBER(ss9601_byte_lo_w);
r14896r14897
829832
830833READ8_MEMBER(subsino2_state::am188em_regs_r)
831834{
832   return m_am188em_regs[offset];
835   return m_am188em_regs.target()[offset];
833836}
834837
835838WRITE8_MEMBER(subsino2_state::am188em_regs_w)
836839{
837   m_am188em_regs[offset] = data;
840   m_am188em_regs.target()[offset] = data;
838841}
839842
840843static MACHINE_RESET( am188em )
841844{
842845   subsino2_state *state = machine.driver_data<subsino2_state>();
843846   // start with masked interrupts
844   state->m_am188em_regs[AM188EM_IMASK+0] = 0xfd;
845   state->m_am188em_regs[AM188EM_IMASK+1] = 0x07;
846   state->m_am188em_regs[AM188EM_I0CON+0] = 0x0f;
847   state->m_am188em_regs[AM188EM_I0CON+1] = 0x00;
847   state->m_am188em_regs.target()[AM188EM_IMASK+0] = 0xfd;
848   state->m_am188em_regs.target()[AM188EM_IMASK+1] = 0x07;
849   state->m_am188em_regs.target()[AM188EM_I0CON+0] = 0x0f;
850   state->m_am188em_regs.target()[AM188EM_I0CON+1] = 0x00;
848851}
849852
850853static INTERRUPT_GEN( am188em_int0_irq )
851854{
852855   subsino2_state *state = device->machine().driver_data<subsino2_state>();
853   if ( ((state->m_am188em_regs[AM188EM_IMASK+0] & 0x10) == 0) ||   // IMASK.I0 mask
854       ((state->m_am188em_regs[AM188EM_I0CON+0] & 0x08) == 0) )   // I0CON.MSK mask
856   if ( ((state->m_am188em_regs.target()[AM188EM_IMASK+0] & 0x10) == 0) ||   // IMASK.I0 mask
857       ((state->m_am188em_regs.target()[AM188EM_I0CON+0] & 0x08) == 0) )   // I0CON.MSK mask
855858      device_set_input_line_and_vector(device, 0, HOLD_LINE, 0x0c);   // INT0 (background scrolling in xplan)
856859}
857860
858861static TIMER_DEVICE_CALLBACK( am188em_timer2_irq )
859862{
860863   subsino2_state *state = timer.machine().driver_data<subsino2_state>();
861   if ((state->m_am188em_regs[AM188EM_IMASK+0] & 0x01) == 0)   // TMR mask
864   if ((state->m_am188em_regs.target()[AM188EM_IMASK+0] & 0x01) == 0)   // TMR mask
862865      cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0x4c/4);
863866}
864867
r14896r14897
916919
917920   return   (res << 8) |                           // high byte
918921         input_port_read(machine(), "SYSTEM") |      // low byte
919         (ticket_dispenser_r(machine().device("hopper"), 0) ? 0x00 : 0x04)   // bit 2: hopper sensor
922         (machine().device<ticket_dispenser_device>("hopper")->read(space, 0) ? 0x00 : 0x04)   // bit 2: hopper sensor
920923   ;
921924}
922925
923926WRITE16_MEMBER(subsino2_state::bishjan_outputs_w)
924927{
925   m_outputs16[offset] = data;
928   m_outputs16.target()[offset] = data;
926929
927930   switch (offset)
928931   {
r14896r14897
930933         if (ACCESSING_BITS_0_7)
931934         {
932935            // coin out         data & 0x01;
933            ticket_dispenser_w(machine().device("hopper"), 0, (data & 0x0002) ? 0x80 : 0);   // hopper
936            machine().device<ticket_dispenser_device>("hopper")->write(space, 0, (data & 0x0002) ? 0x80 : 0);   // hopper
934937            coin_counter_w(machine(), 0,   data & 0x0010 );
935938         }
936939         break;
937940   }
938941
939//  popmessage("0: %04x", m_outputs16[0]);
942//  popmessage("0: %04x", m_outputs16.target()[0]);
940943}
941944
942945
r14896r14897
994997
995998WRITE8_MEMBER(subsino2_state::expcard_outputs_w)
996999{
997   m_outputs[offset] = data;
1000   m_outputs.target()[offset] = data;
9981001
9991002   switch (offset)
10001003   {
r14896r14897
10211024         break;
10221025   }
10231026
1024//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs[0], m_outputs[1], m_outputs[2], m_outputs[3]);
1027//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs.target()[0], m_outputs.target()[1], m_outputs.target()[2], m_outputs.target()[3]);
10251028}
10261029
10271030/***************************************************************************
r14896r14897
10301033
10311034WRITE8_MEMBER(subsino2_state::mtrain_outputs_w)
10321035{
1033   m_outputs[offset] = data;
1036   m_outputs.target()[offset] = data;
10341037
10351038   switch (offset)
10361039   {
r14896r14897
10561059         break;
10571060   }
10581061
1059//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs[0], m_outputs[1], m_outputs[2], m_outputs[3]);
1062//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs.target()[0], m_outputs.target()[1], m_outputs.target()[2], m_outputs.target()[3]);
10601063}
10611064
10621065WRITE8_MEMBER(subsino2_state::mtrain_videoram_w)
r14896r14897
11601163
11611164WRITE8_MEMBER(subsino2_state::saklove_outputs_w)
11621165{
1163   m_outputs[offset] = data;
1166   m_outputs.target()[offset] = data;
11641167
11651168   switch (offset)
11661169   {
r14896r14897
11801183         break;
11811184   }
11821185
1183//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs[0], m_outputs[1], m_outputs[2], m_outputs[3]);
1186//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs.target()[0], m_outputs.target()[1], m_outputs.target()[2], m_outputs.target()[3]);
11841187}
11851188
11861189static ADDRESS_MAP_START( saklove_map, AS_PROGRAM, 8, subsino2_state )
r14896r14897
12421245
12431246WRITE8_MEMBER(subsino2_state::xplan_outputs_w)
12441247{
1245   m_outputs[offset] = data;
1248   m_outputs.target()[offset] = data;
12461249
12471250   switch (offset)
12481251   {
r14896r14897
12701273         break;
12711274   }
12721275
1273//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs[0], m_outputs[1], m_outputs[2], m_outputs[3]);
1276//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs.target()[0], m_outputs.target()[1], m_outputs.target()[2], m_outputs.target()[3]);
12741277}
12751278
12761279static ADDRESS_MAP_START( xplan_map, AS_PROGRAM, 8, subsino2_state )
r14896r14897
13441347
13451348WRITE8_MEMBER(subsino2_state::xtrain_outputs_w)
13461349{
1347   m_outputs[offset] = data;
1350   m_outputs.target()[offset] = data;
13481351
13491352   switch (offset)
13501353   {
r14896r14897
13731376         break;
13741377   }
13751378
1376//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs[0], m_outputs[1], m_outputs[2], m_outputs[3]);
1379//  popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", m_outputs.target()[0], m_outputs.target()[1], m_outputs.target()[2], m_outputs.target()[3]);
13771380}
13781381
13791382static ADDRESS_MAP_START( expcard_io, AS_IO, 8, subsino2_state )
r14896r14897
21612164   MCFG_TIMER_ADD_PERIODIC("timer", h8_timer_irq, attotime::from_hz(60)) // timer, ?? Hz
21622165
21632166   MCFG_NVRAM_ADD_0FILL("nvram")
2164   MCFG_TICKET_DISPENSER_ADD("hopper", 200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
2167   MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
21652168
21662169   // video hardware
21672170   MCFG_SCREEN_ADD("screen", RASTER)
src/mame/drivers/buster.c
r14896r14897
1616{
1717public:
1818   buster_state(const machine_config &mconfig, device_type type, const char *tag)
19      : driver_device(mconfig, type, tag) { }
19      : driver_device(mconfig, type, tag) ,
20      m_vram(*this, "vram"){ }
2021
21   UINT8 *m_vram;
22   required_shared_ptr<UINT8> m_vram;
2223   DECLARE_READ8_MEMBER(test_r);
2324};
2425
r14896r14897
4041   {
4142      for (x=0;x<32;x++)
4243      {
43         int tile = (state->m_vram[count+1])|(state->m_vram[count]<<8);
44         int tile = (state->m_vram.target()[count+1])|(state->m_vram.target()[count]<<8);
4445         //int colour = tile>>12;
4546         drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*4);
4647
r14896r14897
5859#endif
5960
6061static ADDRESS_MAP_START( mainmap, AS_PROGRAM, 8, buster_state )
61   AM_RANGE(0x0000, 0x3fff) AM_ROM// AM_BASE(m_rom)
62   AM_RANGE(0x0000, 0x3fff) AM_ROM// AM_SHARE("rom")
6263   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_SHARE("wram")
63   AM_RANGE(0x5000, 0x5fff) AM_RAM AM_BASE(m_vram)
64   AM_RANGE(0x5000, 0x5fff) AM_RAM AM_SHARE("vram")
6465   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE("crtc", mc6845_device, address_w)
6566   AM_RANGE(0x6001, 0x6001) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
6667   AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN0")
src/mame/drivers/route16.c
r14896r14897
219219   AM_RANGE(0x4800, 0x4800) AM_READ_PORT("DSW") AM_WRITE(route16_out0_w)
220220   AM_RANGE(0x5000, 0x5000) AM_READ_PORT("P1") AM_WRITE(route16_out1_w)
221221   AM_RANGE(0x5800, 0x5800) AM_READ_PORT("P2")
222   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(m_videoram1) AM_SIZE(m_videoram_size)
222   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE_SIZE(m_videoram1,m_videoram_size)
223223ADDRESS_MAP_END
224224
225225
r14896r14897
230230   AM_RANGE(0x5000, 0x5000) AM_READ_PORT("P1") AM_WRITE(route16_out1_w)
231231   AM_RANGE(0x5800, 0x5800) AM_READ_PORT("P2")
232232   AM_RANGE(0x6400, 0x6400) AM_READ(routex_prot_read)
233   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(m_videoram1) AM_SIZE(m_videoram_size)
233   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE_SIZE(m_videoram1,m_videoram_size)
234234ADDRESS_MAP_END
235235
236236
r14896r14897
240240   AM_RANGE(0x4800, 0x4800) AM_READ_PORT("DSW") AM_WRITE(route16_out0_w)
241241   AM_RANGE(0x5000, 0x5000) AM_READ_PORT("P1") AM_WRITE(route16_out1_w)
242242   AM_RANGE(0x5800, 0x5800) AM_READ_PORT("P2")
243   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(m_videoram1) AM_SIZE(m_videoram_size)
243   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE_SIZE(m_videoram1,m_videoram_size)
244244ADDRESS_MAP_END
245245
246246
r14896r14897
251251   AM_RANGE(0x5000, 0x5000) AM_READ_PORT("P1") AM_WRITE(route16_out1_w)
252252   AM_RANGE(0x5800, 0x5800) AM_READ_PORT("P2") AM_WRITE(speakres_out2_w)
253253   AM_RANGE(0x6000, 0x6000) AM_READ(speakres_in3_r)
254   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(m_videoram1) AM_SIZE(m_videoram_size)
254   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE_SIZE(m_videoram1,m_videoram_size)
255255ADDRESS_MAP_END
256256
257257
r14896r14897
263263   AM_RANGE(0x5800, 0x5800) AM_READWRITE(ttmahjng_input_port_matrix_r, ttmahjng_input_port_matrix_w)
264264   AM_RANGE(0x6800, 0x6800) AM_DEVWRITE_LEGACY("ay8910", ay8910_data_w)
265265   AM_RANGE(0x6900, 0x6900) AM_DEVWRITE_LEGACY("ay8910", ay8910_address_w)
266   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(m_videoram1) AM_SIZE(m_videoram_size)
266   AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE_SIZE(m_videoram1,m_videoram_size)
267267ADDRESS_MAP_END
268268
269269
src/mame/drivers/m63.c
r14896r14897
125125{
126126public:
127127   m63_state(const machine_config &mconfig, device_type type, const char *tag)
128      : driver_device(mconfig, type, tag) { }
128      : driver_device(mconfig, type, tag) ,
129      m_spriteram(*this, "spriteram"),
130      m_scrollram(*this, "scrollram"),
131      m_videoram2(*this, "videoram2"),
132      m_videoram(*this, "videoram"),
133      m_colorram(*this, "colorram"){ }
129134
130   UINT8 *  m_videoram;
131   UINT8 *  m_colorram;
132   UINT8 *  m_spriteram;
133   UINT8 *  m_videoram2;
134   UINT8 *  m_scrollram;
135   size_t   m_spriteram_size;
135   required_shared_ptr<UINT8> m_spriteram;
136   required_shared_ptr<UINT8> m_scrollram;
137   required_shared_ptr<UINT8> m_videoram2;
138   required_shared_ptr<UINT8> m_videoram;
139   required_shared_ptr<UINT8> m_colorram;
136140
137141   UINT8    m_nmi_mask;
138142
r14896r14897
232236WRITE8_MEMBER(m63_state::m63_videoram_w)
233237{
234238
235   m_videoram[offset] = data;
239   m_videoram.target()[offset] = data;
236240   m_bg_tilemap->mark_tile_dirty(offset);
237241}
238242
239243WRITE8_MEMBER(m63_state::m63_colorram_w)
240244{
241245
242   m_colorram[offset] = data;
246   m_colorram.target()[offset] = data;
243247   m_bg_tilemap->mark_tile_dirty(offset);
244248}
245249
246250WRITE8_MEMBER(m63_state::m63_videoram2_w)
247251{
248252
249   m_videoram2[offset] = data;
253   m_videoram2.target()[offset] = data;
250254   m_fg_tilemap->mark_tile_dirty(offset);
251255}
252256
r14896r14897
262266
263267WRITE8_MEMBER(m63_state::m63_flipscreen_w)
264268{
265   if (flip_screen_get(machine()) != (~data & 0x01))
269   if (flip_screen() != (~data & 0x01))
266270   {
267      flip_screen_set(machine(), ~data & 0x01);
271      flip_screen_set(~data & 0x01);
268272      machine().tilemap().mark_all_dirty();
269273   }
270274}
r14896r14897
272276WRITE8_MEMBER(m63_state::fghtbskt_flipscreen_w)
273277{
274278
275   flip_screen_set(machine(), data);
276   m_fg_flag = flip_screen_get(machine()) ? TILE_FLIPX : 0;
279   flip_screen_set(data);
280   m_fg_flag = flip_screen() ? TILE_FLIPX : 0;
277281}
278282
279283
r14896r14897
281285{
282286   m63_state *state = machine.driver_data<m63_state>();
283287
284   int attr = state->m_colorram[tile_index];
285   int code = state->m_videoram[tile_index] | ((attr & 0x30) << 4);
288   int attr = state->m_colorram.target()[tile_index];
289   int code = state->m_videoram.target()[tile_index] | ((attr & 0x30) << 4);
286290   int color = (attr & 0x0f) + (state->m_pal_bank << 4);
287291
288292   SET_TILE_INFO(1, code, color, 0);
r14896r14897
292296{
293297   m63_state *state = machine.driver_data<m63_state>();
294298
295   int code = state->m_videoram2[tile_index];
299   int code = state->m_videoram2.target()[tile_index];
296300
297301   SET_TILE_INFO(0, code, 0, state->m_fg_flag);
298302}
r14896r14897
313317   m63_state *state = machine.driver_data<m63_state>();
314318   int offs;
315319
316   for (offs = 0; offs < state->m_spriteram_size; offs += 4)
320   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
317321   {
318      int code = state->m_spriteram[offs + 1] | ((state->m_spriteram[offs + 2] & 0x10) << 4);
319      int color = (state->m_spriteram[offs + 2] & 0x0f) + (state->m_pal_bank << 4);
320      int flipx = state->m_spriteram[offs + 2] & 0x20;
322      int code = state->m_spriteram.target()[offs + 1] | ((state->m_spriteram.target()[offs + 2] & 0x10) << 4);
323      int color = (state->m_spriteram.target()[offs + 2] & 0x0f) + (state->m_pal_bank << 4);
324      int flipx = state->m_spriteram.target()[offs + 2] & 0x20;
321325      int flipy = 0;
322      int sx = state->m_spriteram[offs + 3];
323      int sy = state->m_sy_offset - state->m_spriteram[offs];
326      int sx = state->m_spriteram.target()[offs + 3];
327      int sy = state->m_sy_offset - state->m_spriteram.target()[offs];
324328
325      if (flip_screen_get(machine))
329      if (state->flip_screen())
326330      {
327331         sx = 240 - sx;
328332         sy = state->m_sy_offset - sy;
r14896r14897
356360   int col;
357361
358362   for (col = 0; col < 32; col++)
359      state->m_bg_tilemap->set_scrolly(col, state->m_scrollram[col * 8]);
363      state->m_bg_tilemap->set_scrolly(col, state->m_scrollram.target()[col * 8]);
360364
361365   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
362366   draw_sprites(screen.machine(), bitmap, cliprect);
r14896r14897
426430{
427431   switch (m_p2 & 0xf0)
428432   {
429      case 0x60:   return soundlatch_r(space, 0); ;
433      case 0x60:   return soundlatch_byte_r(space, 0); ;
430434      case 0x70:   return machine().region("user1")->base()[((m_p1 & 0x1f) << 8) | offset];
431435   }
432436   return 0xff;
r14896r14897
450454   AM_RANGE(0x0000, 0xbfff) AM_ROM
451455   AM_RANGE(0xd000, 0xdfff) AM_RAM
452456   AM_RANGE(0xe000, 0xe1ff) AM_RAM
453   AM_RANGE(0xe200, 0xe2ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
454   AM_RANGE(0xe300, 0xe3ff) AM_RAM AM_BASE(m_scrollram)
455   AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(m63_videoram2_w) AM_BASE(m_videoram2)
456   AM_RANGE(0xe800, 0xebff) AM_RAM_WRITE(m63_videoram_w) AM_BASE(m_videoram)
457   AM_RANGE(0xec00, 0xefff) AM_RAM_WRITE(m63_colorram_w) AM_BASE(m_colorram)
457   AM_RANGE(0xe200, 0xe2ff) AM_RAM AM_SHARE("spriteram")
458   AM_RANGE(0xe300, 0xe3ff) AM_RAM AM_SHARE("scrollram")
459   AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(m63_videoram2_w) AM_SHARE("videoram2")
460   AM_RANGE(0xe800, 0xebff) AM_RAM_WRITE(m63_videoram_w) AM_SHARE("videoram")
461   AM_RANGE(0xec00, 0xefff) AM_RAM_WRITE(m63_colorram_w) AM_SHARE("colorram")
458462   AM_RANGE(0xf000, 0xf000) AM_WRITE(nmi_mask_w)
459463   AM_RANGE(0xf002, 0xf002) AM_WRITE(m63_flipscreen_w)
460464   AM_RANGE(0xf003, 0xf003) AM_WRITE(m63_palbank_w)
461465   AM_RANGE(0xf006, 0xf007) AM_WRITE(coin_w)
462   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("P1") AM_WRITE(soundlatch_w)
466   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("P1") AM_WRITE(soundlatch_byte_w)
463467   AM_RANGE(0xf801, 0xf801) AM_READ_PORT("P2") AM_WRITENOP   /* continues game when in stop mode (cleared by NMI handler) */
464468   AM_RANGE(0xf802, 0xf802) AM_READ_PORT("DSW1")
465469   AM_RANGE(0xf803, 0xf803) AM_WRITE(snd_irq_w)
r14896r14897
471475   AM_RANGE(0x8000, 0xbfff) AM_ROM
472476   AM_RANGE(0xc000, 0xc7ff) AM_RAM
473477   AM_RANGE(0xd000, 0xd1ff) AM_RAM
474   AM_RANGE(0xd200, 0xd2ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
475   AM_RANGE(0xd300, 0xd3ff) AM_RAM AM_BASE(m_scrollram)
476   AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(m63_videoram2_w) AM_BASE(m_videoram2)
477   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(m63_videoram_w) AM_BASE(m_videoram)
478   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(m63_colorram_w) AM_BASE(m_colorram)
478   AM_RANGE(0xd200, 0xd2ff) AM_RAM AM_SHARE("spriteram")
479   AM_RANGE(0xd300, 0xd3ff) AM_RAM AM_SHARE("scrollram")
480   AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(m63_videoram2_w) AM_SHARE("videoram2")
481   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(m63_videoram_w) AM_SHARE("videoram")
482   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(m63_colorram_w) AM_SHARE("colorram")
479483   AM_RANGE(0xf000, 0xf000) AM_READ(snd_status_r)
480484   AM_RANGE(0xf001, 0xf001) AM_READ_PORT("P1")
481485   AM_RANGE(0xf002, 0xf002) AM_READ_PORT("P2")
482486   AM_RANGE(0xf003, 0xf003) AM_READ_PORT("DSW")
483487   AM_RANGE(0xf000, 0xf000) AM_WRITE(snd_irq_w)
484488   AM_RANGE(0xf001, 0xf001) AM_WRITENOP
485   AM_RANGE(0xf002, 0xf002) AM_WRITE(soundlatch_w)
489   AM_RANGE(0xf002, 0xf002) AM_WRITE(soundlatch_byte_w)
486490   AM_RANGE(0xf800, 0xf800) AM_WRITENOP
487491   AM_RANGE(0xf801, 0xf801) AM_WRITE(nmi_mask_w)
488492   AM_RANGE(0xf802, 0xf802) AM_WRITE(fghtbskt_flipscreen_w)
src/mame/drivers/tecmosys.c
r14896r14897
196196   if (ACCESSING_BITS_0_7)
197197   {
198198      machine().scheduler().synchronize();
199      return soundlatch2_r(space,  0 );
199      return soundlatch2_byte_r(space,  0 );
200200   }
201201
202202   return 0;
r14896r14897
207207   if (ACCESSING_BITS_0_7)
208208   {
209209      machine().scheduler().synchronize();
210      soundlatch_w(space, 0x00, data & 0xff);
210      soundlatch_byte_w(space, 0x00, data & 0xff);
211211      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
212212   }
213213}
r14896r14897
300300   AM_RANGE(0x700000, 0x703fff) AM_RAM_WRITE(fg_tilemap_w) AM_BASE(m_fgtilemap_ram) // fix ram
301301   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(m_spriteram) // obj ram
302302   AM_RANGE(0x880000, 0x88000b) AM_READ(unk880000_r)
303   AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram") // AM_WRITEONLY // obj pal
303   AM_RANGE(0x900000, 0x907fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram") // AM_WRITEONLY // obj pal
304304
305305   //AM_RANGE(0x980000, 0x9807ff) AM_WRITEONLY // bg pal
306   //AM_RANGE(0x980800, 0x980fff) AM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram") // fix pal
306   //AM_RANGE(0x980800, 0x980fff) AM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram") // fix pal
307307   // the two above are as tested by the game code, I've only rolled them into one below to get colours to show right.
308308   AM_RANGE(0x980000, 0x980fff) AM_RAM_WRITE(tilemap_paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE(m_tilemap_paletteram16)
309309
r14896r14897
351351   AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("oki", okim6295_device, read, write)
352352   AM_RANGE(0x20, 0x20) AM_WRITE(tecmosys_oki_bank_w)
353353   AM_RANGE(0x30, 0x30) AM_WRITE(tecmosys_z80_bank_w)
354   AM_RANGE(0x40, 0x40) AM_READ(soundlatch_r)
355   AM_RANGE(0x50, 0x50) AM_WRITE(soundlatch2_w)
354   AM_RANGE(0x40, 0x40) AM_READ(soundlatch_byte_r)
355   AM_RANGE(0x50, 0x50) AM_WRITE(soundlatch2_byte_w)
356356   AM_RANGE(0x60, 0x61) AM_DEVREADWRITE_LEGACY("ymz", ymz280b_r, ymz280b_w)
357357ADDRESS_MAP_END
358358
src/mame/drivers/dassault.c
r14896r14897
166166
167167WRITE16_MEMBER(dassault_state::dassault_sound_w)
168168{
169   soundlatch_w(space, 0, data & 0xff);
169   soundlatch_byte_w(space, 0, data & 0xff);
170170   device_set_input_line(m_audiocpu, 0, HOLD_LINE); /* IRQ1 */
171171}
172172
r14896r14897
254254   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ym2", ym2151_r, ym2151_w)
255255   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
256256   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
257   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
257   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
258258   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
259259   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
260260   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/dambustr.c
r14896r14897
8787   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
8888   AM_RANGE(0xd400, 0xd7ff) AM_READ(galaxold_videoram_r)
8989   AM_RANGE(0xd800, 0xd83f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
90   AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
91   AM_RANGE(0xd860, 0xd87f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
90   AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
91   AM_RANGE(0xd860, 0xd87f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
9292
9393   AM_RANGE(0xd880, 0xd8ff) AM_RAM
9494
src/mame/drivers/tatsumi.c
r14896r14897
199199
200200WRITE16_MEMBER(tatsumi_state::cyclwarr_sound_w)
201201{
202   soundlatch_w(space, 0, data >> 8);
202   soundlatch_byte_w(space, 0, data >> 8);
203203   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
204204}
205205
r14896r14897
307307   AM_RANGE(0x0ba008, 0x0ba009) AM_READWRITE(cyclwarr_control_r, cyclwarr_control_w)
308308   AM_RANGE(0x0c0000, 0x0c3fff) AM_READWRITE(cyclwarr_sprite_r, cyclwarr_sprite_w) AM_BASE(m_spriteram)
309309   AM_RANGE(0x0ca000, 0x0ca1ff) AM_WRITE(tatsumi_sprite_control_w) AM_BASE(m_sprite_control_ram)
310   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
310   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
311311   AM_RANGE(0x140000, 0x1bffff) AM_ROMBANK("bank2") /* CPU B ROM */
312312   AM_RANGE(0x2c0000, 0x33ffff) AM_ROMBANK("bank1") /* CPU A ROM */
313313ADDRESS_MAP_END
r14896r14897
328328
329329   AM_RANGE(0x0c0000, 0x0c3fff) AM_READWRITE(cyclwarr_sprite_r, cyclwarr_sprite_w)
330330   AM_RANGE(0x0ca000, 0x0ca1ff) AM_WRITE(tatsumi_sprite_control_w)
331   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram16_xRRRRRGGGGGBBBBB_word_w)
331   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram_xRRRRRGGGGGBBBBB_word_w)
332332   AM_RANGE(0x140000, 0x1bffff) AM_ROMBANK("bank2") /* CPU B ROM */
333333   AM_RANGE(0x2c0000, 0x33ffff) AM_ROMBANK("bank1") /* CPU A ROM */
334334ADDRESS_MAP_END
r14896r14897
338338   AM_RANGE(0xe000, 0xffef) AM_RAM
339339   AM_RANGE(0xfff0, 0xfff1) AM_DEVREADWRITE_LEGACY("ymsnd", tatsumi_hack_ym2151_r, ym2151_w)
340340   AM_RANGE(0xfff4, 0xfff4) AM_DEVREAD_LEGACY("oki", tatsumi_hack_oki_r) AM_DEVWRITE("oki", okim6295_device, write)
341   AM_RANGE(0xfffc, 0xfffc) AM_READ(soundlatch_r)
341   AM_RANGE(0xfffc, 0xfffc) AM_READ(soundlatch_byte_r)
342342   AM_RANGE(0xfffe, 0xfffe) AM_WRITENOP
343343ADDRESS_MAP_END
344344
r14896r14897
363363   AM_RANGE(0x0ba008, 0x0ba009) AM_READWRITE(cyclwarr_control_r, cyclwarr_control_w)
364364   AM_RANGE(0x0c0000, 0x0c3fff) AM_READWRITE(cyclwarr_sprite_r, cyclwarr_sprite_w) AM_BASE(m_spriteram)
365365   AM_RANGE(0x0ca000, 0x0ca1ff) AM_WRITE(tatsumi_sprite_control_w) AM_BASE(m_sprite_control_ram)
366   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
366   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
367367   AM_RANGE(0x100000, 0x17ffff) AM_ROMBANK("bank2") /* CPU A ROM */
368368   AM_RANGE(0x200000, 0x27ffff) AM_ROMBANK("bank1") /* CPU B ROM */
369369ADDRESS_MAP_END
r14896r14897
382382
383383   AM_RANGE(0x0c0000, 0x0c3fff) AM_READWRITE(cyclwarr_sprite_r, cyclwarr_sprite_w)
384384   AM_RANGE(0x0ca000, 0x0ca1ff) AM_WRITE(tatsumi_sprite_control_w)
385   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram16_xRRRRRGGGGGBBBBB_word_w)
385   AM_RANGE(0x0d0000, 0x0d3fff) AM_READWRITE(cyclwarr_palette_r, paletteram_xRRRRRGGGGGBBBBB_word_w)
386386   AM_RANGE(0x100000, 0x17ffff) AM_ROMBANK("bank2") /* CPU A ROM */
387387   AM_RANGE(0x200000, 0x27ffff) AM_ROMBANK("bank1") /* CPU B ROM */
388388ADDRESS_MAP_END
src/mame/drivers/supbtime.c
r14896r14897
5252
5353WRITE16_MEMBER(supbtime_state::sound_w)
5454{
55   soundlatch_w(space, 0, data & 0xff);
55   soundlatch_byte_w(space, 0, data & 0xff);
5656   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
5757}
5858
r14896r14897
6464   AM_RANGE(0x104000, 0x11ffff) AM_WRITENOP /* Nothing there */
6565   AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
6666   AM_RANGE(0x120800, 0x13ffff) AM_WRITENOP /* Nothing there */
67   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
67   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
6868   AM_RANGE(0x180000, 0x18000f) AM_READ(supbtime_controls_r)
6969   AM_RANGE(0x18000a, 0x18000d) AM_WRITENOP
7070   AM_RANGE(0x1a0000, 0x1a0001) AM_WRITE(sound_w)
r14896r14897
7979   AM_RANGE(0x000000, 0x03ffff) AM_ROM
8080   AM_RANGE(0x100000, 0x100001) AM_WRITE(sound_w)
8181   AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
82   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
82   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
8383   AM_RANGE(0x180000, 0x18000f) AM_READ(supbtime_controls_r)
8484   AM_RANGE(0x18000a, 0x18000d) AM_WRITENOP
8585   AM_RANGE(0x1a0000, 0x1a3fff) AM_RAM
r14896r14897
100100   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
101101   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki", okim6295_device, read, write)
102102   AM_RANGE(0x130000, 0x130001) AM_NOP /* This board only has 1 oki chip */
103   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
103   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
104104   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
105105   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
106106   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/toratora.c
r14896r14897
2727{
2828public:
2929   toratora_state(const machine_config &mconfig, device_type type, const char *tag)
30      : driver_device(mconfig, type, tag) { }
30      : driver_device(mconfig, type, tag) ,
31      m_videoram(*this, "videoram"){ }
3132
3233   /* memory pointers */
33   UINT8 *    m_videoram;
34   size_t     m_videoram_size;
34   required_shared_ptr<UINT8> m_videoram;
3535
3636   /* video-related */
3737   int        m_timer;
r14896r14897
7373   toratora_state *state = screen.machine().driver_data<toratora_state>();
7474   offs_t offs;
7575
76   for (offs = 0; offs < state->m_videoram_size; offs++)
76   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
7777   {
7878      int i;
7979
8080      UINT8 y = offs >> 5;
8181      UINT8 x = offs << 3;
82      UINT8 data = state->m_videoram[offs];
82      UINT8 data = state->m_videoram.target()[offs];
8383
8484      for (i = 0; i < 8; i++)
8585      {
r14896r14897
9292
9393      /* the video system clears as it writes out the pixels */
9494      if (state->m_clear_tv)
95         state->m_videoram[offs] = 0;
95         state->m_videoram.target()[offs] = 0;
9696   }
9797
9898   state->m_clear_tv = 0;
r14896r14897
311311static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, toratora_state )
312312   AM_RANGE(0x0000, 0x0fff) AM_RAM
313313   AM_RANGE(0x1000, 0x7fff) AM_ROM  /* not fully populated */
314   AM_RANGE(0x8000, 0x9fff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
314   AM_RANGE(0x8000, 0x9fff) AM_RAM AM_SHARE("videoram")
315315   AM_RANGE(0xa000, 0xf047) AM_NOP
316316   AM_RANGE(0xf048, 0xf049) AM_NOP
317317   AM_RANGE(0xf04a, 0xf04a) AM_WRITE(clear_tv_w)   /* the read is mark *LEDEN, but not used */
src/mame/drivers/gbusters.c
r14896r14897
4040{
4141
4242   if (m_palette_selected)
43      paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset, data);
43      paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
4444   else
4545      m_ram[offset] = data;
4646}
r14896r14897
150150
151151static ADDRESS_MAP_START( gbusters_map, AS_PROGRAM, 8, gbusters_state )
152152   AM_RANGE(0x1f80, 0x1f80) AM_WRITE(gbusters_coin_counter_w)                  /* coin counters */
153   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_w)                           /* sound code # */
153   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_byte_w)                           /* sound code # */
154154   AM_RANGE(0x1f88, 0x1f88) AM_WRITE(gbusters_sh_irqtrigger_w)                  /* cause interrupt on audio CPU */
155155   AM_RANGE(0x1f8c, 0x1f8c) AM_WRITE(watchdog_reset_w)                        /* watchdog reset */
156156   AM_RANGE(0x1f90, 0x1f90) AM_READ_PORT("SYSTEM")
r14896r14897
171171static ADDRESS_MAP_START( gbusters_sound_map, AS_PROGRAM, 8, gbusters_state )
172172   AM_RANGE(0x0000, 0x7fff) AM_ROM                                       /* ROM 878h01.rom */
173173   AM_RANGE(0x8000, 0x87ff) AM_RAM                                       /* RAM */
174   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)                           /* soundlatch_r */
174   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)                           /* soundlatch_byte_r */
175175   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)      /* 007232 registers */
176176   AM_RANGE(0xc001, 0xc001) AM_DEVREAD_LEGACY("ymsnd", ym2151_status_port_r)               /* YM 2151 */
177177   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)            /* YM 2151 */
src/mame/drivers/bogeyman.c
r14896r14897
3030{
3131
3232   // bit 0 is flipscreen
33   flip_screen_set(machine(), data & 0x01);
33   flip_screen_set(data & 0x01);
3434
3535   // bit 5 goes to 8910 #0 BDIR pin
3636   if ((m_last_write & 0x20) == 0x20 && (data & 0x20) == 0x00)
src/mame/drivers/r2dtank.c
r14896r14897
5353{
5454public:
5555   r2dtank_state(const machine_config &mconfig, device_type type, const char *tag)
56      : driver_device(mconfig, type, tag) { }
56      : driver_device(mconfig, type, tag) ,
57      m_videoram(*this, "videoram"),
58      m_colorram(*this, "colorram"){ }
5759
58   UINT8 *m_videoram;
59   UINT8 *m_colorram;
60   required_shared_ptr<UINT8> m_videoram;
61   required_shared_ptr<UINT8> m_colorram;
6062   UINT8 m_flipscreen;
6163   UINT32 m_ttl74123_output;
6264   UINT8 m_AY8910_selected;
r14896r14897
106108
107109READ8_MEMBER(r2dtank_state::audio_command_r)
108110{
109   UINT8 ret = soundlatch_r(space, 0);
111   UINT8 ret = soundlatch_byte_r(space, 0);
110112
111113if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  Audio Command Read: %x\n", cpu_get_pc(&space.device()), ret);
112114
r14896r14897
116118
117119WRITE8_MEMBER(r2dtank_state::audio_command_w)
118120{
119   soundlatch_w(space, 0, ~data);
121   soundlatch_byte_w(space, 0, ~data);
120122   cputag_set_input_line(machine(), "audiocpu", M6800_IRQ_LINE, HOLD_LINE);
121123
122124if (LOG_AUDIO_COMM) logerror("%08X   CPU#0  Audio Command Write: %x\n", cpu_get_pc(&space.device()), data^0xff);
r14896r14897
125127
126128READ8_MEMBER(r2dtank_state::audio_answer_r)
127129{
128   UINT8 ret = soundlatch2_r(space, 0);
130   UINT8 ret = soundlatch2_byte_r(space, 0);
129131if (LOG_AUDIO_COMM) logerror("%08X  CPU#0  Audio Answer Read: %x\n", cpu_get_pc(&space.device()), ret);
130132
131133   return ret;
r14896r14897
138140   if (cpu_get_pc(&space.device()) == 0xfb12)
139141      data = 0x00;
140142
141   soundlatch2_w(space, 0, data);
143   soundlatch2_byte_w(space, 0, data);
142144   cputag_set_input_line(machine(), "maincpu", M6809_IRQ_LINE, HOLD_LINE);
143145
144146if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  Audio Answer Write: %x\n", cpu_get_pc(&space.device()), data);
r14896r14897
351353      if (state->m_flipscreen)
352354         offs = offs ^ 0x1fff;
353355
354      data = state->m_videoram[offs];
355      fore_color = (state->m_colorram[offs] >> 5) & 0x07;
356      data = state->m_videoram.target()[offs];
357      fore_color = (state->m_colorram.target()[offs] >> 5) & 0x07;
356358
357359      for (i = 0; i < 8; i++)
358360      {
r14896r14897
415417
416418
417419static ADDRESS_MAP_START( r2dtank_main_map, AS_PROGRAM, 8, r2dtank_state )
418   AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(m_videoram)
420   AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("videoram")
419421   AM_RANGE(0x2000, 0x3fff) AM_RAM
420   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(m_colorram)
422   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("colorram")
421423   AM_RANGE(0x6000, 0x7fff) AM_RAM
422424   AM_RANGE(0x8000, 0x8003) AM_DEVREAD("pia_main", pia6821_device, read) AM_DEVWRITE_LEGACY("pia_main", pia_comp_w)
423425   AM_RANGE(0x8004, 0x8004) AM_READWRITE(audio_answer_r, audio_command_w)
src/mame/drivers/m72.c
r14896r14897
10761076static ADDRESS_MAP_START( rtype_sound_portmap, AS_IO, 8, m72_state )
10771077   ADDRESS_MAP_GLOBAL_MASK(0xff)
10781078   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
1079   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
1079   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_byte_r)
10801080   AM_RANGE(0x06, 0x06) AM_DEVWRITE_LEGACY("m72", m72_sound_irq_ack_w)
10811081   AM_RANGE(0x84, 0x84) AM_DEVREAD_LEGACY("m72", m72_sample_r)
10821082ADDRESS_MAP_END
r14896r14897
10841084static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, m72_state )
10851085   ADDRESS_MAP_GLOBAL_MASK(0xff)
10861086   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
1087   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
1087   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_byte_r)
10881088   AM_RANGE(0x06, 0x06) AM_DEVWRITE_LEGACY("m72", m72_sound_irq_ack_w)
10891089   AM_RANGE(0x82, 0x82) AM_DEVWRITE_LEGACY("m72", m72_sample_w)
10901090   AM_RANGE(0x84, 0x84) AM_DEVREAD_LEGACY("m72", m72_sample_r)
r14896r14897
10931093static ADDRESS_MAP_START( rtype2_sound_portmap, AS_IO, 8, m72_state )
10941094   ADDRESS_MAP_GLOBAL_MASK(0xff)
10951095   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
1096   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
1096   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_byte_r)
10971097   AM_RANGE(0x80, 0x81) AM_DEVWRITE_LEGACY("m72", rtype2_sample_addr_w)
10981098   AM_RANGE(0x82, 0x82) AM_DEVWRITE_LEGACY("m72", m72_sample_w)
10991099   AM_RANGE(0x83, 0x83) AM_DEVWRITE_LEGACY("m72", m72_sound_irq_ack_w)
r14896r14897
11051105   ADDRESS_MAP_GLOBAL_MASK(0xff)
11061106   AM_RANGE(0x10, 0x13) AM_DEVWRITE_LEGACY("m72", poundfor_sample_addr_w)
11071107   AM_RANGE(0x40, 0x41) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
1108   AM_RANGE(0x42, 0x42) AM_READ(soundlatch_r)
1108   AM_RANGE(0x42, 0x42) AM_READ(soundlatch_byte_r)
11091109   AM_RANGE(0x42, 0x42) AM_DEVWRITE_LEGACY("m72", m72_sound_irq_ack_w)
11101110ADDRESS_MAP_END
11111111
src/mame/drivers/pokechmp.c
r14896r14897
8787
8888WRITE8_MEMBER(pokechmp_state::pokechmp_sound_w)
8989{
90   soundlatch_w(space, 0, data);
90   soundlatch_byte_w(space, 0, data);
9191   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
9292}
9393
r14896r14897
136136   AM_RANGE(0x1800, 0x1800) AM_WRITENOP   /* MSM5205 chip on Pocket Gal, not connected here? */
137137//  AM_RANGE(0x2000, 0x2000) AM_WRITE(pokechmp_sound_bank_w)/ * might still be sound bank */
138138   AM_RANGE(0x2800, 0x2800) AM_DEVREADWRITE("oki", okim6295_device, read, write) // extra
139   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
139   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
140140//  AM_RANGE(0x3400, 0x3400) AM_READ_LEGACY(pokechmp_adpcm_reset_r)    /* ? not sure */
141141   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank3")
142142   AM_RANGE(0x8000, 0xffff) AM_ROM
src/mame/drivers/mastboy.c
r14896r14897
445445public:
446446   mastboy_state(const machine_config &mconfig, device_type type, const char *tag)
447447      : driver_device(mconfig, type, tag),
448        m_nvram(*this, "nvram") { }
448        m_nvram(*this, "nvram") ,
449      m_workram(*this, "workram"),
450      m_tileram(*this, "tileram"),
451      m_colram(*this, "colram"){ }
449452
450453   required_shared_ptr<UINT8>   m_nvram;
451   UINT8* m_tileram;
454   required_shared_ptr<UINT8> m_workram;
455   required_shared_ptr<UINT8> m_tileram;
456   required_shared_ptr<UINT8> m_colram;
452457   UINT8* m_vram;
453   UINT8* m_colram;
454   UINT8* m_workram;
455458   UINT8 m_bank;
456459   int m_irq0_ack;
457460   int m_backupram_enabled;
r14896r14897
490493
491494   for (i=0;i<0x200;i+=2)
492495   {
493      int coldat = state->m_colram[i+1] |  (state->m_colram[i+0]<<8);
496      int coldat = state->m_colram.target()[i+1] |  (state->m_colram.target()[i+0]<<8);
494497
495498      palette_set_color_rgb(screen.machine(),i/2,pal4bit(coldat>>8),pal4bit(coldat>>12),pal4bit(coldat>>4));
496499   }
r14896r14897
500503      for (x=0;x<32;x++)
501504      {
502505         /* bytes 0 and 3 seem to be unused for rendering , they appear to contain data the game uses internally */
503         int tileno = (state->m_tileram[count+1]|(state->m_tileram[count+2]<<8))&0xfff;
504         int attr = (state->m_tileram[count+2]&0xf0)>>4;
506         int tileno = (state->m_tileram.target()[count+1]|(state->m_tileram.target()[count+2]<<8))&0xfff;
507         int attr = (state->m_tileram.target()[count+2]&0xf0)>>4;
505508         gfx_element *gfx;
506509
507510         if (tileno&0x800)
r14896r14897
603606
604607READ8_MEMBER(mastboy_state::mastboy_backupram_r)
605608{
606   return m_nvram[offset];
609   return m_nvram.target()[offset];
607610}
608611
609612WRITE8_MEMBER(mastboy_state::mastboy_backupram_w)
610613{
611614//  if (m_backupram_enabled)
612615//  {
613      m_nvram[offset] = data;
616      m_nvram.target()[offset] = data;
614617//  }
615618//  else
616619//  {
r14896r14897
702705   AM_RANGE(0x0000, 0x3fff) AM_ROM // Internal ROM
703706   AM_RANGE(0x4000, 0x7fff) AM_ROM // External ROM
704707
705   AM_RANGE(0x8000, 0x8fff) AM_RAM AM_BASE(m_workram)// work ram
706   AM_RANGE(0x9000, 0x9fff) AM_RAM AM_BASE(m_tileram)// tilemap ram
707   AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_BASE(m_colram) AM_MIRROR(0x0e00)  // colour ram
708   AM_RANGE(0x8000, 0x8fff) AM_RAM AM_SHARE("workram")// work ram
709   AM_RANGE(0x9000, 0x9fff) AM_RAM AM_SHARE("tileram")// tilemap ram
710   AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_SHARE("colram") AM_MIRROR(0x0e00)  // colour ram
708711
709712   AM_RANGE(0xc000, 0xffff) AM_READWRITE(banked_ram_r,banked_ram_w) // mastboy bank area read / write
710713
src/mame/drivers/rmhaihai.c
r14896r14897
3838{
3939public:
4040   rmhaihai_state(const machine_config &mconfig, device_type type, const char *tag)
41      : driver_device(mconfig, type, tag) { }
41      : driver_device(mconfig, type, tag) ,
42      m_colorram(*this, "colorram"),
43      m_videoram(*this, "videoram"){ }
4244
4345   int m_gfxbank;
44   UINT8 *m_videoram;
45   UINT8 *m_colorram;
46   required_shared_ptr<UINT8> m_colorram;
47   required_shared_ptr<UINT8> m_videoram;
4648   tilemap_t *m_bg_tilemap;
4749   int m_keyboard_cmd;
4850   DECLARE_WRITE8_MEMBER(rmhaihai_videoram_w);
r14896r14897
5860
5961WRITE8_MEMBER(rmhaihai_state::rmhaihai_videoram_w)
6062{
61   m_videoram[offset] = data;
63   m_videoram.target()[offset] = data;
6264   m_bg_tilemap->mark_tile_dirty(offset);
6365}
6466
6567WRITE8_MEMBER(rmhaihai_state::rmhaihai_colorram_w)
6668{
67   m_colorram[offset] = data;
69   m_colorram.target()[offset] = data;
6870   m_bg_tilemap->mark_tile_dirty(offset);
6971}
7072
7173static TILE_GET_INFO( get_bg_tile_info )
7274{
7375   rmhaihai_state *state = machine.driver_data<rmhaihai_state>();
74   int attr = state->m_colorram[tile_index];
75   int code = state->m_videoram[tile_index] + (state->m_gfxbank << 12) + ((attr & 0x07) << 8) + ((attr & 0x80) << 4);
76   int attr = state->m_colorram.target()[tile_index];
77   int code = state->m_videoram.target()[tile_index] + (state->m_gfxbank << 12) + ((attr & 0x07) << 8) + ((attr & 0x80) << 4);
7678   int color = (state->m_gfxbank << 5) + (attr >> 3);
7779
7880   SET_TILE_INFO(0, code, color, 0);
r14896r14897
165167
166168WRITE8_MEMBER(rmhaihai_state::ctrl_w)
167169{
168   flip_screen_set(machine(), data & 0x01);
170   flip_screen_set(data & 0x01);
169171
170172   // (data & 0x02) is switched on and off in service mode
171173
r14896r14897
197199static ADDRESS_MAP_START( rmhaihai_map, AS_PROGRAM, 8, rmhaihai_state )
198200   AM_RANGE(0x0000, 0x9fff) AM_ROM
199201   AM_RANGE(0xa000, 0xa7ff) AM_RAM
200   AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(rmhaihai_colorram_w) AM_BASE(m_colorram)
201   AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(rmhaihai_videoram_w) AM_BASE(m_videoram)
202   AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(rmhaihai_colorram_w) AM_SHARE("colorram")
203   AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(rmhaihai_videoram_w) AM_SHARE("videoram")
202204   AM_RANGE(0xb83c, 0xb83c) AM_WRITENOP   // ??
203205   AM_RANGE(0xbc00, 0xbc00) AM_WRITENOP   // ??
204206   AM_RANGE(0xc000, 0xdfff) AM_ROM
r14896r14897
222224   AM_RANGE(0x0000, 0x7fff) AM_ROM
223225   AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1")
224226   AM_RANGE(0xa000, 0xa7ff) AM_RAM
225   AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(rmhaihai_colorram_w) AM_BASE(m_colorram)
226   AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(rmhaihai_videoram_w) AM_BASE(m_videoram)
227   AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(rmhaihai_colorram_w) AM_SHARE("colorram")
228   AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(rmhaihai_videoram_w) AM_SHARE("videoram")
227229   AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("bank2")
228230   AM_RANGE(0xe000, 0xffff) AM_ROM
229231ADDRESS_MAP_END
src/mame/drivers/topspeed.c
r14896r14897
441441static ADDRESS_MAP_START( topspeed_map, AS_PROGRAM, 16, topspeed_state )
442442   AM_RANGE(0x000000, 0x0fffff) AM_ROM
443443   AM_RANGE(0x400000, 0x40ffff) AM_READWRITE(sharedram_r, sharedram_w) AM_BASE_SIZE(m_sharedram, m_sharedram_size)
444   AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
444   AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
445445   AM_RANGE(0x600002, 0x600003) AM_WRITE(cpua_ctrl_w)
446446   AM_RANGE(0x7e0000, 0x7e0001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
447447   AM_RANGE(0x7e0002, 0x7e0003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
src/mame/drivers/segae.c
r14896r14897
442442
443443   memory_configure_bank(machine(), "bank1", 0, 16, machine().region("maincpu")->base() + 0x10000, 0x4000);
444444
445   if ( !strcmp( m_system->name, "ridleofp" ) )
445   if ( !strcmp( system().name, "ridleofp" ) )
446446   {
447447      m_maincpu->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(systeme_state::ridleofp_port_f8_read), this));
448448      m_maincpu->memory().space(AS_IO)->install_write_handler(0xfa, 0xfa, write8_delegate(FUNC(systeme_state::ridleofp_port_fa_write), this));
449449   }
450   else if ( !strcmp( m_system->name, "hangonjr" ) )
450   else if ( !strcmp( system().name, "hangonjr" ) )
451451   {
452452      m_maincpu->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(systeme_state::hangonjr_port_f8_read), this));
453453      m_maincpu->memory().space(AS_IO)->install_write_handler(0xfa, 0xfa, write8_delegate(FUNC(systeme_state::hangonjr_port_fa_write), this));
454454   }
455   else if ( !strcmp( m_system->name, "opaopa" ) )
455   else if ( !strcmp( system().name, "opaopa" ) )
456456   {
457457      mc8123_decrypt_rom(machine(), "maincpu", "user1", "bank1", 8);
458458   }
459   else if ( !strcmp( m_system->name, "fantzn2" ) )
459   else if ( !strcmp( system().name, "fantzn2" ) )
460460   {
461461      mc8123_decrypt_rom(machine(), "maincpu", "user1", NULL, 0);
462462   }
463   else if ( !strcmp( m_system->name, "astrofl" ) )
463   else if ( !strcmp( system().name, "astrofl" ) )
464464   {
465465      sega_315_5177_decode(machine(), "maincpu");
466466   }
src/mame/drivers/amspdwy.c
r14896r14897
6969
7070WRITE8_MEMBER(amspdwy_state::amspdwy_sound_w)
7171{
72   soundlatch_w(space, 0, data);
72   soundlatch_byte_w(space, 0, data);
7373   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
7474}
7575
r14896r14897
114114static ADDRESS_MAP_START( amspdwy_sound_map, AS_PROGRAM, 8, amspdwy_state )
115115   AM_RANGE(0x0000, 0x7fff) AM_ROM                           // ROM
116116//  AM_RANGE(0x8000, 0x8000) AM_WRITENOP                            // ? Written with 0 at the start
117   AM_RANGE(0x9000, 0x9000) AM_READ(soundlatch_r)               // From Main CPU
117   AM_RANGE(0x9000, 0x9000) AM_READ(soundlatch_byte_r)               // From Main CPU
118118   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)         //
119119   AM_RANGE(0xc000, 0xdfff) AM_RAM                           // Work RAM
120120   AM_RANGE(0xffff, 0xffff) AM_READNOP                        // ??? IY = FFFF at the start ?
src/mame/drivers/fantland.c
r14896r14897
7575
7676WRITE8_MEMBER(fantland_state::fantland_soundlatch_w)
7777{
78   soundlatch_w(space, 0, data);
78   soundlatch_byte_w(space, 0, data);
7979   device_set_input_line(m_audio_cpu, INPUT_LINE_NMI, PULSE_LINE);
8080}
8181
r14896r14897
123123   AM_RANGE( 0x00000, 0x07fff ) AM_RAM
124124   AM_RANGE( 0x08000, 0x7ffff ) AM_ROM
125125
126   AM_RANGE( 0xa2000, 0xa21ff ) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w ) AM_SHARE("paletteram")
126   AM_RANGE( 0xa2000, 0xa21ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w ) AM_SHARE("paletteram")
127127
128128   AM_RANGE( 0xa3000, 0xa3001 ) AM_READ_PORT("a3000") AM_WRITE(fantland_nmi_enable_16_w )
129129   AM_RANGE( 0xa3002, 0xa3003 ) AM_READ_PORT("a3002") AM_WRITE(fantland_soundlatch_16_w )
r14896r14897
143143   AM_RANGE( 0x00000, 0x07fff ) AM_RAM
144144   AM_RANGE( 0x10000, 0x2ffff ) AM_ROM
145145
146   AM_RANGE( 0x52000, 0x521ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w ) AM_SHARE("paletteram")
146   AM_RANGE( 0x52000, 0x521ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w ) AM_SHARE("paletteram")
147147
148148   AM_RANGE( 0x53000, 0x53000 ) AM_READ_PORT("P1") AM_WRITE(fantland_nmi_enable_w )
149149   AM_RANGE( 0x53001, 0x53001 ) AM_READ_PORT("P2")
r14896r14897
235235   AM_RANGE( 0x00000, 0x07fff ) AM_RAM
236236   AM_RANGE( 0x10000, 0x2ffff ) AM_ROM
237237
238   AM_RANGE( 0x52000, 0x521ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w ) AM_SHARE("paletteram")
238   AM_RANGE( 0x52000, 0x521ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w ) AM_SHARE("paletteram")
239239   AM_RANGE( 0x53000, 0x53001 ) AM_READWRITE(borntofi_inputs_r, borntofi_nmi_enable_w )
240240   AM_RANGE( 0x53002, 0x53002 ) AM_READ_PORT( "DSW" ) AM_WRITE(fantland_soundlatch_w )
241241   AM_RANGE( 0x53003, 0x53003 ) AM_READ_PORT( "Controls" )
r14896r14897
264264   AM_RANGE(0x30000, 0x3ffff) AM_ROM
265265   AM_RANGE(0x70000, 0x7ffff) AM_ROM
266266
267   AM_RANGE(0x52000, 0x521ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w   ) AM_SHARE( "paletteram"   )
267   AM_RANGE(0x52000, 0x521ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w   ) AM_SHARE( "paletteram"   )
268268
269269   AM_RANGE(0x53000, 0x53000) AM_READ_PORT( "53000" ) AM_WRITE(borntofi_nmi_enable_w )
270270   AM_RANGE(0x53001, 0x53001) AM_READ_PORT( "53001" )
r14896r14897
292292ADDRESS_MAP_END
293293
294294static ADDRESS_MAP_START( fantland_sound_iomap, AS_IO, 8, fantland_state )
295   AM_RANGE( 0x0080, 0x0080 ) AM_READ(soundlatch_r )
295   AM_RANGE( 0x0080, 0x0080 ) AM_READ(soundlatch_byte_r )
296296   AM_RANGE( 0x0100, 0x0101 ) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w )
297297   AM_RANGE( 0x0180, 0x0180 ) AM_DEVWRITE_LEGACY("dac", dac_w )
298298ADDRESS_MAP_END
299299
300300static ADDRESS_MAP_START( galaxygn_sound_iomap, AS_IO, 8, fantland_state )
301   AM_RANGE( 0x0080, 0x0080 ) AM_READ(soundlatch_r )
301   AM_RANGE( 0x0080, 0x0080 ) AM_READ(soundlatch_byte_r )
302302   AM_RANGE( 0x0100, 0x0101 ) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w )
303303ADDRESS_MAP_END
304304
r14896r14897
400400
401401static ADDRESS_MAP_START( borntofi_sound_map, AS_PROGRAM, 8, fantland_state )
402402   AM_RANGE( 0x00000, 0x003ff ) AM_RAM
403   AM_RANGE( 0x04000, 0x04000 ) AM_READ(soundlatch_r)
403   AM_RANGE( 0x04000, 0x04000 ) AM_READ(soundlatch_byte_r)
404404   AM_RANGE( 0x04000, 0x0401f ) AM_WRITE(borntofi_msm5205_w)
405405   AM_RANGE( 0x08000, 0x0ffff ) AM_ROM
406406   AM_RANGE( 0xf8000, 0xfffff ) AM_ROM
r14896r14897
419419   AM_RANGE(0xb000, 0xb000) AM_WRITENOP   // on a car crash / hit
420420   AM_RANGE(0xc000, 0xc000) AM_WRITENOP   // ""
421421
422   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r )   // during NMI
422   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r )   // during NMI
423423ADDRESS_MAP_END
424424
425425
src/mame/drivers/atarig1.c
r14896r14897
6767 *
6868 *************************************/
6969
70static WRITE16_HANDLER( mo_control_w )
70WRITE16_MEMBER(atarig1_state::mo_control_w)
7171{
7272   if (ACCESSING_BITS_0_7)
7373   {
74      atarig1_state *state = space->machine().driver_data<atarig1_state>();
75      atarirle_control_w(state->m_rle, data & 7);
74      atarirle_control_w(m_rle, data & 7);
7675   }
7776}
7877
7978
80static WRITE16_HANDLER( mo_command_w )
79WRITE16_MEMBER(atarig1_state::mo_command_w)
8180{
82   atarig1_state *state = space->machine().driver_data<atarig1_state>();
83   COMBINE_DATA(state->m_mo_command);
84   atarirle_command_w(state->m_rle, (data == 0 && state->m_is_pitfight) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
81   COMBINE_DATA(m_mo_command);
82   atarirle_command_w(m_rle, (data == 0 && m_is_pitfight) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
8583}
8684
8785
r14896r14897
9290 *
9391 *************************************/
9492
95static READ16_HANDLER( special_port0_r )
93READ16_MEMBER(atarig1_state::special_port0_r)
9694{
97   atarig1_state *state = space->machine().driver_data<atarig1_state>();
98   int temp = input_port_read(space->machine(), "IN0");
99   if (state->m_cpu_to_sound_ready) temp ^= 0x1000;
95   int temp = input_port_read(machine(), "IN0");
96   if (m_cpu_to_sound_ready) temp ^= 0x1000;
10097   temp ^= 0x2000;      /* A2DOK always high for now */
10198   return temp;
10299}
103100
104101
105static WRITE16_HANDLER( a2d_select_w )
102WRITE16_MEMBER(atarig1_state::a2d_select_w)
106103{
107   atarig1_state *state = space->machine().driver_data<atarig1_state>();
108   state->m_which_input = offset;
104   m_which_input = offset;
109105}
110106
111107
112static READ16_HANDLER( a2d_data_r )
108READ16_MEMBER(atarig1_state::a2d_data_r)
113109{
114110   static const char *const adcnames[] = { "ADC0", "ADC1", "ADC2" };
115   atarig1_state *state = space->machine().driver_data<atarig1_state>();
116111
117112   /* Pit Fighter has no A2D, just another input port */
118   if (state->m_is_pitfight)
119      return input_port_read(space->machine(), "ADC0");
113   if (m_is_pitfight)
114      return input_port_read(machine(), "ADC0");
120115
121116   /* otherwise, assume it's hydra */
122   if (state->m_which_input < 3)
123      return input_port_read(space->machine(), adcnames[state->m_which_input]) << 8;
117   if (m_which_input < 3)
118      return input_port_read(machine(), adcnames[m_which_input]) << 8;
124119
125120   return 0;
126121}
r14896r14897
133128 *
134129 *************************************/
135130
136INLINE void update_bank(atarig1_state *state, int bank)
131void atarig1_state::update_bank(int bank)
137132{
138133   /* if the bank has changed, copy the memory; Pit Fighter needs this */
139   if (bank != state->m_bslapstic_bank)
134   if (bank != m_bslapstic_bank)
140135   {
141136      /* bank 0 comes from the copy we made earlier */
142137      if (bank == 0)
143         memcpy(state->m_bslapstic_base, state->m_bslapstic_bank0, 0x2000);
138         memcpy(m_bslapstic_base, m_bslapstic_bank0, 0x2000);
144139      else
145         memcpy(state->m_bslapstic_base, &state->m_bslapstic_base[bank * 0x1000], 0x2000);
140         memcpy(m_bslapstic_base, &m_bslapstic_base[bank * 0x1000], 0x2000);
146141
147142      /* remember the current bank */
148      state->m_bslapstic_bank = bank;
143      m_bslapstic_bank = bank;
149144   }
150145}
151146
r14896r14897
155150   atarig1_state *state = machine.driver_data<atarig1_state>();
156151   int bank = state->m_bslapstic_bank;
157152   state->m_bslapstic_bank = -1;
158   update_bank(state, bank);
153   state->update_bank(bank);
159154}
160155
161156
162static READ16_HANDLER( pitfightb_cheap_slapstic_r )
157READ16_MEMBER(atarig1_state::pitfightb_cheap_slapstic_r)
163158{
164   atarig1_state *state = space->machine().driver_data<atarig1_state>();
165   int result = state->m_bslapstic_base[offset & 0xfff];
159   int result = m_bslapstic_base[offset & 0xfff];
166160
167161   /* the cheap replacement slapstic just triggers on the simple banking */
168162   /* addresses; a software patch ensure that this is good enough */
169163
170164   /* offset 0 primes the chip */
171165   if (offset == 0)
172      state->m_bslapstic_primed = TRUE;
166      m_bslapstic_primed = TRUE;
173167
174168   /* one of 4 bankswitchers produces the result */
175   else if (state->m_bslapstic_primed)
169   else if (m_bslapstic_primed)
176170   {
177171      if (offset == 0x42)
178         update_bank(state, 0), state->m_bslapstic_primed = FALSE;
172         update_bank(0), m_bslapstic_primed = FALSE;
179173      else if (offset == 0x52)
180         update_bank(state, 1), state->m_bslapstic_primed = FALSE;
174         update_bank(1), m_bslapstic_primed = FALSE;
181175      else if (offset == 0x62)
182         update_bank(state, 2), state->m_bslapstic_primed = FALSE;
176         update_bank(2), m_bslapstic_primed = FALSE;
183177      else if (offset == 0x72)
184         update_bank(state, 3), state->m_bslapstic_primed = FALSE;
178         update_bank(3), m_bslapstic_primed = FALSE;
185179   }
186180   return result;
187181}
r14896r14897
192186   atarig1_state *state = machine.driver_data<atarig1_state>();
193187
194188   /* install a read handler */
195   state->m_bslapstic_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x038000, 0x03ffff, FUNC(pitfightb_cheap_slapstic_r));
189   state->m_bslapstic_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),state));
196190
197191   /* allocate memory for a copy of bank 0 */
198192   state->m_bslapstic_bank0 = auto_alloc_array(machine, UINT8, 0x2000);
r14896r14897
219213   AM_RANGE(0xf88000, 0xf8ffff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
220214   AM_RANGE(0xf90000, 0xf90001) AM_WRITE_LEGACY(atarigen_sound_upper_w)
221215   AM_RANGE(0xf98000, 0xf98001) AM_WRITE_LEGACY(atarigen_sound_reset_w)
222   AM_RANGE(0xfa0000, 0xfa0001) AM_WRITE_LEGACY(mo_control_w)
216   AM_RANGE(0xfa0000, 0xfa0001) AM_WRITE(mo_control_w)
223217   AM_RANGE(0xfb0000, 0xfb0001) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
224   AM_RANGE(0xfc0000, 0xfc0001) AM_READ_LEGACY(special_port0_r)
225   AM_RANGE(0xfc8000, 0xfc8007) AM_READWRITE_LEGACY(a2d_data_r, a2d_select_w)
218   AM_RANGE(0xfc0000, 0xfc0001) AM_READ(special_port0_r)
219   AM_RANGE(0xfc8000, 0xfc8007) AM_READWRITE(a2d_data_r, a2d_select_w)
226220   AM_RANGE(0xfd0000, 0xfd0001) AM_READ_LEGACY(atarigen_sound_upper_r)
227221   AM_RANGE(0xfd8000, 0xfdffff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
228222/*  AM_RANGE(0xfe0000, 0xfe7fff) AM_READ_LEGACY(from_r)*/
229223   AM_RANGE(0xfe8000, 0xfe89ff) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram_w) AM_SHARE("paletteram")
230224   AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE_LEGACY("rle", atarirle_spriteram_r, atarirle_spriteram_w)
231   AM_RANGE(0xff2000, 0xff2001) AM_WRITE_LEGACY(mo_command_w) AM_BASE(m_mo_command)
225   AM_RANGE(0xff2000, 0xff2001) AM_WRITE(mo_command_w) AM_BASE(m_mo_command)
232226   AM_RANGE(0xff4000, 0xff5fff) AM_WRITE_LEGACY(atarigen_playfield_w) AM_BASE(m_playfield)
233227   AM_RANGE(0xff6000, 0xff6fff) AM_WRITE_LEGACY(atarigen_alpha_w) AM_BASE(m_alpha)
234228   AM_RANGE(0xff0000, 0xffffff) AM_RAM
src/mame/drivers/toobin.c
r14896r14897
6666 *
6767 *************************************/
6868
69static WRITE16_HANDLER( interrupt_scan_w )
69WRITE16_MEMBER(toobin_state::interrupt_scan_w)
7070{
71   toobin_state *state = space->machine().driver_data<toobin_state>();
72   int oldword = state->m_interrupt_scan[offset];
71   int oldword = m_interrupt_scan[offset];
7372   int newword = oldword;
7473   COMBINE_DATA(&newword);
7574
7675   /* if something changed, update the word in memory */
7776   if (oldword != newword)
7877   {
79      state->m_interrupt_scan[offset] = newword;
80      atarigen_scanline_int_set(*space->machine().primary_screen, newword & 0x1ff);
78      m_interrupt_scan[offset] = newword;
79      atarigen_scanline_int_set(*machine().primary_screen, newword & 0x1ff);
8180   }
8281}
8382
r14896r14897
8988 *
9089 *************************************/
9190
92static READ16_HANDLER( special_port1_r )
91READ16_MEMBER(toobin_state::special_port1_r)
9392{
94   toobin_state *state = space->machine().driver_data<toobin_state>();
95   int result = input_port_read(space->machine(), "FF9000");
96   if (atarigen_get_hblank(*space->machine().primary_screen)) result ^= 0x8000;
97   if (state->m_cpu_to_sound_ready) result ^= 0x2000;
93   int result = input_port_read(machine(), "FF9000");
94   if (atarigen_get_hblank(*machine().primary_screen)) result ^= 0x8000;
95   if (m_cpu_to_sound_ready) result ^= 0x2000;
9896   return result;
9997}
10098
r14896r14897
118116   AM_RANGE(0xff8000, 0xff8001) AM_MIRROR(0x4500fe) AM_WRITE(watchdog_reset16_w)
119117   AM_RANGE(0xff8100, 0xff8101) AM_MIRROR(0x4500fe) AM_WRITE_LEGACY(atarigen_sound_w)
120118   AM_RANGE(0xff8300, 0xff8301) AM_MIRROR(0x45003e) AM_WRITE_LEGACY(toobin_intensity_w)
121   AM_RANGE(0xff8340, 0xff8341) AM_MIRROR(0x45003e) AM_WRITE_LEGACY(interrupt_scan_w) AM_BASE(m_interrupt_scan)
119   AM_RANGE(0xff8340, 0xff8341) AM_MIRROR(0x45003e) AM_WRITE(interrupt_scan_w) AM_BASE(m_interrupt_scan)
122120   AM_RANGE(0xff8380, 0xff8381) AM_MIRROR(0x45003e) AM_READWRITE_LEGACY(atarimo_0_slipram_r, toobin_slip_w)
123121   AM_RANGE(0xff83c0, 0xff83c1) AM_MIRROR(0x45003e) AM_WRITE_LEGACY(atarigen_scanline_int_ack_w)
124122   AM_RANGE(0xff8400, 0xff8401) AM_MIRROR(0x4500fe) AM_WRITE_LEGACY(atarigen_sound_reset_w)
r14896r14897
126124   AM_RANGE(0xff8600, 0xff8601) AM_MIRROR(0x4500fe) AM_WRITE_LEGACY(toobin_xscroll_w) AM_BASE(m_xscroll)
127125   AM_RANGE(0xff8700, 0xff8701) AM_MIRROR(0x4500fe) AM_WRITE_LEGACY(toobin_yscroll_w) AM_BASE(m_yscroll)
128126   AM_RANGE(0xff8800, 0xff8801) AM_MIRROR(0x4507fe) AM_READ_PORT("FF8800")
129   AM_RANGE(0xff9000, 0xff9001) AM_MIRROR(0x4507fe) AM_READ_LEGACY(special_port1_r)
127   AM_RANGE(0xff9000, 0xff9001) AM_MIRROR(0x4507fe) AM_READ(special_port1_r)
130128   AM_RANGE(0xff9800, 0xff9801) AM_MIRROR(0x4507fe) AM_READ_LEGACY(atarigen_sound_r)
131129   AM_RANGE(0xffa000, 0xffafff) AM_MIRROR(0x451000) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
132130   AM_RANGE(0xffc000, 0xffffff) AM_MIRROR(0x450000) AM_RAM
src/mame/drivers/legionna.c
r14896r14897
8787   AM_RANGE(0x101800, 0x101fff) AM_RAM_WRITE(legionna_foreground_w) AM_BASE(m_fore_data)
8888   AM_RANGE(0x102000, 0x1027ff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(m_mid_data)
8989   AM_RANGE(0x102800, 0x1037ff) AM_RAM_WRITE(legionna_text_w) AM_BASE(m_textram)
90   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* palette xRRRRxGGGGxBBBBx ? */
90   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* palette xRRRRxGGGGxBBBBx ? */
9191   AM_RANGE(0x105000, 0x105fff) AM_RAM AM_SHARE("spriteram")
9292   AM_RANGE(0x106000, 0x107fff) AM_RAM
9393   AM_RANGE(0x108000, 0x11ffff) AM_RAM /* main ram */
r14896r14897
103103   AM_RANGE(0x101800, 0x101fff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(m_mid_data)
104104   AM_RANGE(0x102000, 0x102fff) AM_RAM_WRITE(legionna_text_w) AM_BASE(m_textram)
105105   AM_RANGE(0x103000, 0x103fff) AM_RAM AM_SHARE("spriteram")
106   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
106   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
107107   AM_RANGE(0x108000, 0x11ffff) AM_RAM
108108ADDRESS_MAP_END
109109
r14896r14897
116116   AM_RANGE(0x102000, 0x1027ff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(m_mid_data)
117117   AM_RANGE(0x102800, 0x1037ff) AM_RAM_WRITE(legionna_text_w) AM_BASE(m_textram)
118118   AM_RANGE(0x103800, 0x103fff) AM_RAM_WRITE(legionna_foreground_w) AM_BASE(m_fore_data)
119   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
119   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
120120   AM_RANGE(0x105000, 0x105fff) AM_RAM AM_SHARE("spriteram")
121121   AM_RANGE(0x106000, 0x1067ff) AM_RAM
122122   AM_RANGE(0x106800, 0x106fff) AM_RAM
r14896r14897
129129{
130130   offset^=1;
131131   COMBINE_DATA(&m_generic_paletteram_16[offset]);
132   paletteram16_xBBBBBGGGGGRRRRR_word_w(space,offset,data,mem_mask);
132   paletteram_xBBBBBGGGGGRRRRR_word_w(space,offset,data,mem_mask);
133133}
134134
135135static ADDRESS_MAP_START( denjinmk_map, AS_PROGRAM, 16, legionna_state )
r14896r14897
157157   AM_RANGE(0x101000, 0x1017ff) AM_RAM_WRITE(legionna_foreground_w) AM_BASE(m_fore_data)
158158   AM_RANGE(0x101800, 0x101fff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(m_mid_data)
159159   AM_RANGE(0x102000, 0x102fff) AM_RAM_WRITE(legionna_text_w) AM_BASE(m_textram)
160   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
161   AM_RANGE(0x104000, 0x104fff) AM_RAM//_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
160   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
161   AM_RANGE(0x104000, 0x104fff) AM_RAM//_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
162162   AM_RANGE(0x105000, 0x105fff) AM_RAM
163163   AM_RANGE(0x106000, 0x106fff) AM_RAM
164164   AM_RANGE(0x107000, 0x107fff) AM_RAM AM_SHARE("spriteram")
r14896r14897
173173   AM_RANGE(0x101000, 0x1017ff) AM_RAM_WRITE(legionna_foreground_w) AM_BASE(m_fore_data)
174174   AM_RANGE(0x101800, 0x101fff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(m_mid_data)
175175   AM_RANGE(0x102000, 0x102fff) AM_RAM_WRITE(legionna_text_w) AM_BASE(m_textram)
176   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
176   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
177177   AM_RANGE(0x104000, 0x104fff) AM_RAM
178178   AM_RANGE(0x105000, 0x106fff) AM_RAM
179179   AM_RANGE(0x107000, 0x1077ff) AM_RAM AM_SHARE("spriteram")
r14896r14897
192192   AM_RANGE(0x101000, 0x1017ff) AM_RAM_WRITE(legionna_foreground_w) AM_BASE(m_fore_data)
193193   AM_RANGE(0x101800, 0x101fff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(m_mid_data)
194194   AM_RANGE(0x102000, 0x102fff) AM_RAM_WRITE(legionna_text_w) AM_BASE(m_textram)
195   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
195   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
196196   AM_RANGE(0x104000, 0x104fff) AM_RAM
197197   AM_RANGE(0x105000, 0x106fff) AM_RAM
198198   AM_RANGE(0x107000, 0x1077ff) AM_RAM AM_SHARE("spriteram")
r14896r14897
211211   AM_RANGE(0x101000, 0x1017ff) AM_RAM_WRITE(legionna_foreground_w) AM_BASE(m_fore_data)
212212   AM_RANGE(0x101800, 0x101fff) AM_RAM_WRITE(legionna_midground_w) AM_BASE(m_mid_data)
213213   AM_RANGE(0x102000, 0x102fff) AM_RAM_WRITE(legionna_text_w) AM_BASE(m_textram)
214   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
214   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
215215   AM_RANGE(0x104000, 0x104fff) AM_RAM
216216   AM_RANGE(0x105000, 0x106fff) AM_RAM
217217   AM_RANGE(0x107000, 0x1077ff) AM_RAM AM_SHARE("spriteram")
r14896r14897
234234   AM_RANGE(0x8000, 0x87ff) AM_RAM
235235   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("oki", okim_rombank_w)
236236   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
237   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
237   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
238238ADDRESS_MAP_END
239239
240240/*****************************************************************************/
src/mame/drivers/albazc.c
r14896r14897
1818{
1919public:
2020   albazc_state(const machine_config &mconfig, device_type type, const char *tag)
21      : driver_device(mconfig, type, tag) { }
21      : driver_device(mconfig, type, tag) ,
22      m_spriteram1(*this, "spriteram1"),
23      m_spriteram2(*this, "spriteram2"),
24      m_spriteram3(*this, "spriteram3"){ }
2225
2326   /* video-related */
24   UINT8 *  m_spriteram1;
25   UINT8 *  m_spriteram2;
26   UINT8 *  m_spriteram3;
27   required_shared_ptr<UINT8> m_spriteram1;
28   required_shared_ptr<UINT8> m_spriteram2;
29   required_shared_ptr<UINT8> m_spriteram3;
2730   UINT8 m_flip_bit;
2831   DECLARE_WRITE8_MEMBER(hanaroku_out_0_w);
2932   DECLARE_WRITE8_MEMBER(hanaroku_out_1_w);
r14896r14897
6265
6366   for (i = 511; i >= 0; i--)
6467   {
65      int code = state->m_spriteram1[i] | (state->m_spriteram2[i] << 8);
66      int color = (state->m_spriteram2[i + 0x200] & 0xf8) >> 3;
68      int code = state->m_spriteram1.target()[i] | (state->m_spriteram2.target()[i] << 8);
69      int color = (state->m_spriteram2.target()[i + 0x200] & 0xf8) >> 3;
6770      int flipx = 0;
6871      int flipy = 0;
69      int sx = state->m_spriteram1[i + 0x200] | ((state->m_spriteram2[i + 0x200] & 0x07) << 8);
70      int sy = 242 - state->m_spriteram3[i];
72      int sx = state->m_spriteram1.target()[i + 0x200] | ((state->m_spriteram2.target()[i + 0x200] & 0x07) << 8);
73      int sy = 242 - state->m_spriteram3.target()[i];
7174
7275      if (state->m_flip_bit)
7376      {
r14896r14897
145148   if(offset == 0)
146149   {
147150      /* core bug with this? */
148      //flip_screen_set(machine(), (data & 0x40) >> 6);
151      //flip_screen_set((data & 0x40) >> 6);
149152      m_flip_bit = (data & 0x40) >> 6;
150153   }
151154}
r14896r14897
154157
155158static ADDRESS_MAP_START( hanaroku_map, AS_PROGRAM, 8, albazc_state )
156159   AM_RANGE(0x0000, 0x7fff) AM_ROM
157   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(m_spriteram1)
158   AM_RANGE(0x9000, 0x97ff) AM_RAM AM_BASE(m_spriteram2)
159   AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_BASE(m_spriteram3)
160   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("spriteram1")
161   AM_RANGE(0x9000, 0x97ff) AM_RAM AM_SHARE("spriteram2")
162   AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_SHARE("spriteram3")
160163   AM_RANGE(0xa200, 0xa2ff) AM_WRITENOP   // ??? written once during P.O.S.T.
161164   AM_RANGE(0xa300, 0xa304) AM_WRITE(albazc_vregs_w)   // ???
162165   AM_RANGE(0xb000, 0xb000) AM_WRITENOP   // ??? always 0x40
src/mame/drivers/midas.c
r14896r14897
6161{
6262public:
6363   midas_state(const machine_config &mconfig, device_type type, const char *tag)
64      : driver_device(mconfig, type, tag) { }
64      : driver_device(mconfig, type, tag) ,
65      m_gfxregs(*this, "gfxregs"){ }
6566
6667   UINT16 *m_gfxram;
67   UINT16 *m_gfxregs;
68   required_shared_ptr<UINT16> m_gfxregs;
6869   tilemap_t *m_tmap;
6970   DECLARE_READ16_MEMBER(ret_ffff);
7071   DECLARE_WRITE16_MEMBER(midas_gfxregs_w);
r14896r14897
234235   {
235236      case 1:
236237      {
237         UINT16 addr = m_gfxregs[0];
238         UINT16 addr = m_gfxregs.target()[0];
238239         m_gfxram[addr] = data;
239         m_gfxregs[0] += m_gfxregs[2];
240         m_gfxregs.target()[0] += m_gfxregs.target()[2];
240241
241242         if ( addr >= 0x7000 && addr <= 0x7fff )   m_tmap->mark_tile_dirty(addr - 0x7000);
242243
r14896r14897
274275
275276   AM_RANGE(0x9c0000, 0x9c0005) AM_WRITE(midas_gfxregs_w ) AM_BASE(m_gfxregs )
276277
277   AM_RANGE(0xa00000, 0xa3ffff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w ) AM_SHARE("paletteram")
278   AM_RANGE(0xa00000, 0xa3ffff) AM_RAM_WRITE(paletteram_xrgb_word_be_w ) AM_SHARE("paletteram")
278279   AM_RANGE(0xa40000, 0xa7ffff) AM_RAM
279280
280281   AM_RANGE(0xb00000, 0xb00001) AM_READ(ret_ffff )
r14896r14897
320321{
321322   if (ACCESSING_BITS_0_7)
322323   {
323      ticket_dispenser_w(machine().device("prize1"), 0, (data & 0x0001) << 7);
324      ticket_dispenser_w(machine().device("prize2"), 0, (data & 0x0002) << 6);
325      ticket_dispenser_w(machine().device("ticket"), 0, (data & 0x0010) << 3);
324      machine().device<ticket_dispenser_device>("prize1")->write(space, 0, (data & 0x0001) << 7);
325      machine().device<ticket_dispenser_device>("prize2")->write(space, 0, (data & 0x0002) << 6);
326      machine().device<ticket_dispenser_device>("ticket")->write(space, 0, (data & 0x0010) << 3);
326327      // data & 0x0080 ?
327328   }
328329#ifdef MAME_DEBUG
r14896r14897
353354
354355   AM_RANGE(0x9c0000, 0x9c0005) AM_WRITE(midas_gfxregs_w ) AM_BASE(m_gfxregs )
355356
356   AM_RANGE(0xa00000, 0xa3ffff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w ) AM_SHARE("paletteram")
357   AM_RANGE(0xa00000, 0xa3ffff) AM_RAM_WRITE(paletteram_xrgb_word_be_w ) AM_SHARE("paletteram")
357358   AM_RANGE(0xa40000, 0xa7ffff) AM_RAM
358359
359360   AM_RANGE(0xb00000, 0xb00001) AM_READ(ret_ffff )
r14896r14897
656657   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
657658
658659   PORT_START("HAMMER")   // bc0000
659   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("prize1", ticket_dispenser_line_r)   // prize 1 sensor ("tejisw 1")
660   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("prize2", ticket_dispenser_line_r)   // prize 2 sensor ("tejisw 2")
660   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("prize1", ticket_dispenser_device, line_r)   // prize 1 sensor ("tejisw 1")
661   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("prize2", ticket_dispenser_device, line_r)   // prize 2 sensor ("tejisw 2")
661662   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_UNKNOWN )
662663   PORT_BIT( 0x0008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
663   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
664   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
664665   PORT_BIT( 0x0020, IP_ACTIVE_LOW,  IPT_UNKNOWN )
665666   PORT_BIT( 0x0040, IP_ACTIVE_LOW,  IPT_UNKNOWN )
666667   PORT_BIT( 0x0080, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_IMPULSE(5)   PORT_NAME( "Hammer" )
r14896r14897
732733
733734   MCFG_EEPROM_93C46_ADD("eeprom")
734735
735   MCFG_TICKET_DISPENSER_ADD("prize1", 1000*5, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
736   MCFG_TICKET_DISPENSER_ADD("prize2", 1000*5, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
737   MCFG_TICKET_DISPENSER_ADD("ticket",    200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
736   MCFG_TICKET_DISPENSER_ADD("prize1", attotime::from_msec(1000*5), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
737   MCFG_TICKET_DISPENSER_ADD("prize2", attotime::from_msec(1000*5), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
738   MCFG_TICKET_DISPENSER_ADD("ticket",    attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
738739
739740   /* video hardware */
740741   MCFG_SCREEN_ADD("screen", RASTER)
src/mame/drivers/aristmk4.c
r14896r14897
262262{
263263public:
264264   aristmk4_state(const machine_config &mconfig, device_type type, const char *tag)
265   : driver_device(mconfig, type, tag) { }
265   : driver_device(mconfig, type, tag) ,
266      m_mkiv_vram(*this, "mkiv_vram"){ }
266267
267268   int m_rtc_address_strobe;
268269   int m_rtc_data_strobe;
269270   samples_device *m_samples;
270271   UINT8 *m_shapeRomPtr;
271272   UINT8 m_shapeRom[0xc000];
272   UINT8 *m_mkiv_vram;
273   required_shared_ptr<UINT8> m_mkiv_vram;
273274   UINT8 *m_nvram;
274275   UINT8 m_psg_data;
275276   int m_ay8910_1;
r14896r14897
361362   {
362363      for (x=38;x--;)
363364      {
364      color = ((state->m_mkiv_vram[count]) & 0xe0) >> 5;
365         tile = (state->m_mkiv_vram[count+1]|state->m_mkiv_vram[count]<<8) & 0x3ff;
366         bgtile = (state->m_mkiv_vram[count+1]|state->m_mkiv_vram[count]<<8) & 0xff; // first 256 tiles
365      color = ((state->m_mkiv_vram.target()[count]) & 0xe0) >> 5;
366         tile = (state->m_mkiv_vram.target()[count+1]|state->m_mkiv_vram.target()[count]<<8) & 0x3ff;
367         bgtile = (state->m_mkiv_vram.target()[count+1]|state->m_mkiv_vram.target()[count]<<8) & 0xff; // first 256 tiles
367368         uBackgroundColour(screen.machine());   // read sw7
368369         gfx_element_decode(gfx, bgtile);   // force the machine to update only the first 256 tiles.
369370                        // as we only update the background, not the entire display.
370         flipx = ((state->m_mkiv_vram[count]) & 0x04);
371         flipy = ((state->m_mkiv_vram[count]) & 0x08);
371         flipx = ((state->m_mkiv_vram.target()[count]) & 0x04);
372         flipy = ((state->m_mkiv_vram.target()[count]) & 0x08);
372373         drawgfx_opaque(bitmap,cliprect,gfx,tile,color,flipx,flipy,(38-x-1)<<3,(27-y-1)<<3);
373374         count+=2;
374375      }
r14896r14897
875876******************************************************************************/
876877
877878static ADDRESS_MAP_START( aristmk4_map, AS_PROGRAM, 8, aristmk4_state )
878   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(m_mkiv_vram) // video ram -  chips U49 / U50
879   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("mkiv_vram") // video ram -  chips U49 / U50
879880   AM_RANGE(0x0800, 0x17ff) AM_RAM
880881   AM_RANGE(0x1800, 0x1800) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w)
881882   AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
r14896r14897
919920*/
920921
921922static ADDRESS_MAP_START( aristmk4_poker_map, AS_PROGRAM, 8, aristmk4_state )
922   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(m_mkiv_vram) // video ram -  chips U49 / U50
923   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("mkiv_vram") // video ram -  chips U49 / U50
923924   AM_RANGE(0x0800, 0x17ff) AM_RAM
924925   AM_RANGE(0x1800, 0x1800) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w)
925926   AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
src/mame/drivers/thunderx.c
r14896r14897
4848{
4949
5050   if (m_palette_selected)
51      paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset, data);
51      paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
5252   else
5353      m_ram[offset] = data;
5454}
r14896r14897
9191         logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(&space.device()),offset,data);
9292   }
9393   else
94      paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset, data);
94      paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
9595}
9696
9797/*
r14896r14897
397397
398398static ADDRESS_MAP_START( scontra_map, AS_PROGRAM, 8, thunderx_state )
399399   AM_RANGE(0x1f80, 0x1f80) AM_WRITE(scontra_bankswitch_w)   /* bankswitch control + coin counters */
400   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_w)
400   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_byte_w)
401401   AM_RANGE(0x1f88, 0x1f88) AM_WRITE(thunderx_sh_irqtrigger_w)      /* cause interrupt on audio CPU */
402402   AM_RANGE(0x1f8c, 0x1f8c) AM_WRITE(watchdog_reset_w)
403403   AM_RANGE(0x1f90, 0x1f90) AM_READ_PORT("SYSTEM")
r14896r14897
417417
418418static ADDRESS_MAP_START( thunderx_map, AS_PROGRAM, 8, thunderx_state )
419419   AM_RANGE(0x1f80, 0x1f80) AM_WRITE(thunderx_videobank_w)
420   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_w)
420   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_byte_w)
421421   AM_RANGE(0x1f88, 0x1f88) AM_WRITE(thunderx_sh_irqtrigger_w)      /* cause interrupt on audio CPU */
422422   AM_RANGE(0x1f8c, 0x1f8c) AM_WRITE(watchdog_reset_w)
423423   AM_RANGE(0x1f90, 0x1f90) AM_READ_PORT("SYSTEM")
r14896r14897
438438static ADDRESS_MAP_START( scontra_sound_map, AS_PROGRAM, 8, thunderx_state )
439439   AM_RANGE(0x0000, 0x7fff) AM_ROM               /* ROM */
440440   AM_RANGE(0x8000, 0x87ff) AM_RAM               /* RAM */
441   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)         /* soundlatch_r */
441   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)         /* soundlatch_byte_r */
442442   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)      /* 007232 registers */
443443   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)      /* YM2151 */
444444   AM_RANGE(0xf000, 0xf000) AM_DEVWRITE_LEGACY("k007232", scontra_snd_bankswitch_w)   /* 007232 bank select */
r14896r14897
447447static ADDRESS_MAP_START( thunderx_sound_map, AS_PROGRAM, 8, thunderx_state )
448448   AM_RANGE(0x0000, 0x7fff) AM_ROM
449449   AM_RANGE(0x8000, 0x87ff) AM_RAM
450   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
450   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
451451   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
452452ADDRESS_MAP_END
453453
src/mame/drivers/galaxi.c
r14896r14897
4949{
5050public:
5151   galaxi_state(const machine_config &mconfig, device_type type, const char *tag)
52      : driver_device(mconfig, type, tag) { }
52      : driver_device(mconfig, type, tag) ,
53      m_bg1_ram(*this, "bg1_ram"),
54      m_bg2_ram(*this, "bg2_ram"),
55      m_bg3_ram(*this, "bg3_ram"),
56      m_bg4_ram(*this, "bg4_ram"),
57      m_fg_ram(*this, "fg_ram"){ }
5358
5459   /* memory pointers */
55   UINT16 *  m_bg1_ram;
56   UINT16 *  m_bg2_ram;
57   UINT16 *  m_bg3_ram;
58   UINT16 *  m_bg4_ram;
59   UINT16 *  m_fg_ram;
60   required_shared_ptr<UINT16> m_bg1_ram;
61   required_shared_ptr<UINT16> m_bg2_ram;
62   required_shared_ptr<UINT16> m_bg3_ram;
63   required_shared_ptr<UINT16> m_bg4_ram;
64   required_shared_ptr<UINT16> m_fg_ram;
6065//  UINT16 *  m_paletteram;   // currently this uses generic palette handling
6166//  UINT16 *  m_nvram;        // currently this uses generic nvram handling
6267
r14896r14897
9196static TILE_GET_INFO( get_bg1_tile_info )
9297{
9398   galaxi_state *state = machine.driver_data<galaxi_state>();
94   UINT16 code = state->m_bg1_ram[tile_index];
99   UINT16 code = state->m_bg1_ram.target()[tile_index];
95100   SET_TILE_INFO(0, code, 0x10 + (code >> 12), 0);
96101}
97102
98103static TILE_GET_INFO( get_bg2_tile_info )
99104{
100105   galaxi_state *state = machine.driver_data<galaxi_state>();
101   UINT16 code = state->m_bg2_ram[tile_index];
106   UINT16 code = state->m_bg2_ram.target()[tile_index];
102107   SET_TILE_INFO(0, code, 0x10 + (code >> 12), 0);
103108}
104109
105110static TILE_GET_INFO( get_bg3_tile_info )
106111{
107112   galaxi_state *state = machine.driver_data<galaxi_state>();
108   UINT16 code = state->m_bg3_ram[tile_index];
113   UINT16 code = state->m_bg3_ram.target()[tile_index];
109114   SET_TILE_INFO(0, code, (code >> 12), 0);
110115}
111116
112117static TILE_GET_INFO( get_bg4_tile_info )
113118{
114119   galaxi_state *state = machine.driver_data<galaxi_state>();
115   UINT16 code = state->m_bg4_ram[tile_index];
120   UINT16 code = state->m_bg4_ram.target()[tile_index];
116121   SET_TILE_INFO(0, code, (code >> 12), 0);
117122}
118123
119124static TILE_GET_INFO( get_fg_tile_info )
120125{
121126   galaxi_state *state = machine.driver_data<galaxi_state>();
122   UINT16 code = state->m_fg_ram[tile_index];
127   UINT16 code = state->m_fg_ram.target()[tile_index];
123128   SET_TILE_INFO(1, code, 0x20 + (code >> 12), 0);
124129}
125130
126131WRITE16_MEMBER(galaxi_state::galaxi_bg1_w)
127132{
128   COMBINE_DATA(&m_bg1_ram[offset]);
133   COMBINE_DATA(&m_bg1_ram.target()[offset]);
129134   m_bg1_tmap->mark_tile_dirty(offset);
130135}
131136
132137WRITE16_MEMBER(galaxi_state::galaxi_bg2_w)
133138{
134   COMBINE_DATA(&m_bg2_ram[offset]);
139   COMBINE_DATA(&m_bg2_ram.target()[offset]);
135140   m_bg2_tmap->mark_tile_dirty(offset);
136141}
137142
138143WRITE16_MEMBER(galaxi_state::galaxi_bg3_w)
139144{
140   COMBINE_DATA(&m_bg3_ram[offset]);
145   COMBINE_DATA(&m_bg3_ram.target()[offset]);
141146   m_bg3_tmap->mark_tile_dirty(offset);
142147}
143148
144149WRITE16_MEMBER(galaxi_state::galaxi_bg4_w)
145150{
146   COMBINE_DATA(&m_bg4_ram[offset]);
151   COMBINE_DATA(&m_bg4_ram.target()[offset]);
147152   m_bg4_tmap->mark_tile_dirty(offset);
148153}
149154
150155WRITE16_MEMBER(galaxi_state::galaxi_fg_w)
151156{
152   COMBINE_DATA(&m_fg_ram[offset]);
157   COMBINE_DATA(&m_fg_ram.target()[offset]);
153158   m_fg_tmap->mark_tile_dirty(offset);
154159}
155160
r14896r14897
275280static ADDRESS_MAP_START( galaxi_map, AS_PROGRAM, 16, galaxi_state )
276281   AM_RANGE(0x000000, 0x03ffff) AM_ROM
277282
278   AM_RANGE(0x100000, 0x1003ff) AM_RAM_WRITE(galaxi_bg1_w) AM_BASE(m_bg1_ram)
279   AM_RANGE(0x100400, 0x1007ff) AM_RAM_WRITE(galaxi_bg2_w) AM_BASE(m_bg2_ram)
280   AM_RANGE(0x100800, 0x100bff) AM_RAM_WRITE(galaxi_bg3_w) AM_BASE(m_bg3_ram)
281   AM_RANGE(0x100c00, 0x100fff) AM_RAM_WRITE(galaxi_bg4_w) AM_BASE(m_bg4_ram)
283   AM_RANGE(0x100000, 0x1003ff) AM_RAM_WRITE(galaxi_bg1_w) AM_SHARE("bg1_ram")
284   AM_RANGE(0x100400, 0x1007ff) AM_RAM_WRITE(galaxi_bg2_w) AM_SHARE("bg2_ram")
285   AM_RANGE(0x100800, 0x100bff) AM_RAM_WRITE(galaxi_bg3_w) AM_SHARE("bg3_ram")
286   AM_RANGE(0x100c00, 0x100fff) AM_RAM_WRITE(galaxi_bg4_w) AM_SHARE("bg4_ram")
282287
283   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(galaxi_fg_w ) AM_BASE(m_fg_ram)
288   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(galaxi_fg_w ) AM_SHARE("fg_ram")
284289   AM_RANGE(0x102000, 0x1047ff) AM_READNOP   // unknown
285290
286   AM_RANGE(0x300000, 0x3007ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
291   AM_RANGE(0x300000, 0x3007ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
287292
288293   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("INPUTS")
289294   AM_RANGE(0x500000, 0x500001) AM_WRITE(galaxi_500000_w)
src/mame/drivers/murogmbl.c
r14896r14897
4242{
4343public:
4444   murogmbl_state(const machine_config &mconfig, device_type type, const char *tag)
45      : driver_device(mconfig, type, tag) { }
45      : driver_device(mconfig, type, tag) ,
46      m_video(*this, "video"){ }
4647
47   UINT8* m_video;
48   required_shared_ptr<UINT8> m_video;
4849};
4950
5051
r14896r14897
7778   AM_RANGE(0x0000, 0x1fFf) AM_ROM
7879   AM_RANGE(0x4000, 0x43ff) AM_RAM
7980   AM_RANGE(0x4800, 0x4bff) AM_RAM
80   AM_RANGE(0x5800, 0x5bff) AM_RAM AM_BASE(m_video)
81   AM_RANGE(0x5800, 0x5bff) AM_RAM AM_SHARE("video")
8182   AM_RANGE(0x5c00, 0x5fff) AM_RAM
8283   AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0")
8384   AM_RANGE(0x6800, 0x6800) AM_READ_PORT("DSW")
r14896r14897
102103   {
103104      for (x = 0; x < 32; x++)
104105      {
105         int tile = state->m_video[count];
106         int tile = state->m_video.target()[count];
106107         drawgfx_opaque(bitmap, cliprect, gfx, tile, 0, 0, 0, x * 8, y * 8);
107108
108109         count++;
src/mame/drivers/sothello.c
r14896r14897
144144    AM_RANGE( 0x31, 0x31) AM_READ(subcpu_halt_clear)
145145    AM_RANGE( 0x32, 0x32) AM_READ(subcpu_comm_status)
146146    AM_RANGE( 0x33, 0x33) AM_READ(soundcpu_status_r)
147    AM_RANGE( 0x40, 0x4f) AM_WRITE(soundlatch_w)
147    AM_RANGE( 0x40, 0x4f) AM_WRITE(soundlatch_byte_w)
148148    AM_RANGE( 0x50, 0x50) AM_WRITE(bank_w)
149149    AM_RANGE( 0x60, 0x61) AM_MIRROR(0x02) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
150150                  /* not sure, but the A1 line is ignored, code @ $8b8 */
r14896r14897
193193
194194static ADDRESS_MAP_START( soundcpu_io_map, AS_IO, 8, sothello_state )
195195    ADDRESS_MAP_GLOBAL_MASK(0xff)
196    AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
196    AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)
197197    AM_RANGE(0x01, 0x01) AM_WRITE(msm_data_w)
198198    AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("msm", msm_cfg_w)
199199    AM_RANGE(0x03, 0x03) AM_WRITE(soundcpu_busyflag_set_w)
src/mame/drivers/toypop.c
r14896r14897
511511
512512static WRITE8_DEVICE_HANDLER( flip )
513513{
514   flip_screen_set(device->machine(), data & 1);
514   toypop_state *state = device->machine().driver_data<toypop_state>();
515   state->flip_screen_set(data & 1);
515516}
516517
517518/* chip #0: player inputs, buttons, coins */
src/mame/drivers/tumbleb.c
r14896r14897
350350
351351WRITE16_MEMBER(tumbleb_state::jumppop_sound_w)
352352{
353   soundlatch_w(space, 0, data & 0xff);
353   soundlatch_byte_w(space, 0, data & 0xff);
354354   device_set_input_line(m_audiocpu, 0, ASSERT_LINE);
355355}
356356
r14896r14897
654654#endif
655655   AM_RANGE(0x100000, 0x100001) AM_READWRITE(tumblepb_prot_r, tumblepb_oki_w)
656656   AM_RANGE(0x120000, 0x123fff) AM_RAM AM_BASE(m_mainram)
657   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
657   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
658658   AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size) /* Bootleg sprite buffer */
659659   AM_RANGE(0x160800, 0x160807) AM_WRITEONLY /* writes past the end of spriteram */
660660   AM_RANGE(0x180000, 0x18000f) AM_READ(tumblepopb_controls_r)
r14896r14897
676676#endif
677677   AM_RANGE(0x100000, 0x100003) AM_DEVREADWRITE8_LEGACY("ymsnd", ym2151_r, ym2151_w, 0x00ff)
678678   AM_RANGE(0x100004, 0x100005) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
679   AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
679   AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
680680   AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size) /* sprites */
681681   AM_RANGE(0x160800, 0x16080f) AM_WRITEONLY /* goes slightly past the end of spriteram? */
682682   AM_RANGE(0x180000, 0x18000f) AM_READ(tumblepopb_controls_r)
r14896r14897
704704   AM_RANGE(0x100000, 0x100001) AM_WRITE(semicom_soundcmd_w)
705705   AM_RANGE(0x100002, 0x100003) AM_WRITE(bcstory_tilebank_w)
706706   AM_RANGE(0x120000, 0x123fff) AM_RAM AM_BASE(m_mainram)
707   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
707   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
708708   AM_RANGE(0x160000, 0x160fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size) /* Bootleg sprite buffer */
709709   AM_RANGE(0x180000, 0x18000f) AM_READ(tumblepopb_controls_r)
710710   AM_RANGE(0x18000c, 0x18000d) AM_WRITENOP
r14896r14897
720720static ADDRESS_MAP_START( jumppop_main_map, AS_PROGRAM, 16, tumbleb_state )
721721   AM_RANGE(0x000000, 0x07ffff) AM_ROM
722722   AM_RANGE(0x120000, 0x123fff) AM_RAM AM_BASE(m_mainram)
723   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
723   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
724724   AM_RANGE(0x160000, 0x160fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size) /* Bootleg sprite buffer */
725725   AM_RANGE(0x180000, 0x180001) AM_NOP   /* IRQ ack? */
726726   AM_RANGE(0x180002, 0x180003) AM_READ_PORT("PLAYERS")
r14896r14897
735735
736736WRITE16_MEMBER(tumbleb_state::jumpkids_sound_w)
737737{
738   soundlatch_w(space, 0, data & 0xff);
738   soundlatch_byte_w(space, 0, data & 0xff);
739739   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
740740}
741741
r14896r14897
745745   AM_RANGE(0xa00000, 0xa0000f) AM_RAM AM_BASE(m_control)
746746   AM_RANGE(0xa20000, 0xa20fff) AM_RAM_WRITE(tumblepb_pf1_data_w) AM_BASE(m_pf1_data)
747747   AM_RANGE(0xa22000, 0xa22fff) AM_RAM_WRITE(tumblepb_pf2_data_w) AM_BASE(m_pf2_data)
748   AM_RANGE(0xcf0000, 0xcf05ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
748   AM_RANGE(0xcf0000, 0xcf05ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
749749   AM_RANGE(0xe00000, 0xe00001) AM_READ_PORT("PLAYERS") AM_WRITE(suprtrio_tilebank_w)
750750   AM_RANGE(0xe40000, 0xe40001) AM_READ_PORT("SYSTEM")
751751   AM_RANGE(0xe80002, 0xe80003) AM_READ_PORT("DSW")
r14896r14897
756756static ADDRESS_MAP_START( pangpang_main_map, AS_PROGRAM, 16, tumbleb_state )
757757   AM_RANGE(0x000000, 0x07ffff) AM_ROM
758758   AM_RANGE(0x120000, 0x123fff) AM_RAM AM_BASE(m_mainram)
759   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
759   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
760760   AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size) /* Bootleg sprite buffer */
761761   AM_RANGE(0x160800, 0x160807) AM_WRITEONLY // writes past the end of spriteram
762762   AM_RANGE(0x180000, 0x18000f) AM_READ(tumblepopb_controls_r)
r14896r14897
773773{
774774   if (ACCESSING_BITS_0_7)
775775   {
776      soundlatch_w(space, 0, data & 0xff);
776      soundlatch_byte_w(space, 0, data & 0xff);
777777      // needed for Super Trio which reads the sound with polling
778778      // device_spin_until_time(&space.device(), attotime::from_usec(100));
779779      machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(20));
r14896r14897
793793   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
794794   AM_RANGE(0xf002, 0xf002) AM_DEVREADWRITE("oki", okim6295_device, read, write)
795795   //AM_RANGE(0xf006, 0xf006) ??
796   AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_r)
796   AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_byte_r)
797797   AM_RANGE(0xf00e, 0xf00e) AM_WRITE(oki_sound_bank_w)
798798ADDRESS_MAP_END
799799
r14896r14897
802802   AM_RANGE(0xd000, 0xd7ff) AM_RAM
803803   AM_RANGE(0xf002, 0xf002) AM_DEVREADWRITE("oki", okim6295_device, read, write)
804804   //AM_RANGE(0xf006, 0xf006) ??
805   AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_r)
805   AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_byte_r)
806806   AM_RANGE(0xf00e, 0xf00e) AM_WRITE(oki_sound_bank_w)
807807ADDRESS_MAP_END
808808
r14896r14897
820820READ8_MEMBER(tumbleb_state::jumppop_z80latch_r)
821821{
822822   device_set_input_line(m_audiocpu, 0, CLEAR_LINE);
823   return soundlatch_r(space, 0);
823   return soundlatch_byte_r(space, 0);
824824}
825825
826826static ADDRESS_MAP_START( jumppop_sound_io_map, AS_IO, 8, tumbleb_state )
r14896r14897
839839   AM_RANGE(0x000000, 0x07ffff) AM_ROM
840840   AM_RANGE(0x100000, 0x100001) AM_WRITE(jumpkids_sound_w)
841841   AM_RANGE(0x120000, 0x123fff) AM_RAM AM_BASE(m_mainram)
842   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
842   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
843843   AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size) /* Bootleg sprite buffer */
844844   AM_RANGE(0x160800, 0x160807) AM_WRITEONLY /* writes past the end of spriteram */
845845   AM_RANGE(0x180000, 0x18000f) AM_READ(tumblepopb_controls_r)
r14896r14897
868868   AM_RANGE(0x8000, 0x87ff) AM_RAM
869869   AM_RANGE(0x9000, 0x9000) AM_WRITE(jumpkids_oki_bank_w)
870870   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
871   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
871   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
872872ADDRESS_MAP_END
873873
874874
r14896r14897
37553755
37563756   /* different palette format, closer to tumblep -- is this controlled by a register? the palette was right with the hatch catch trojan */
37573757   tumbleb_state *state = machine.driver_data<tumbleb_state>();
3758   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x140000, 0x140fff, write16_delegate(FUNC(tumbleb_state::paletteram16_xxxxBBBBGGGGRRRR_word_w), state));
3758   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x140000, 0x140fff, write16_delegate(FUNC(tumbleb_state::paletteram_xxxxBBBBGGGGRRRR_word_w), state));
37593759
37603760   /* slightly different banking */
37613761   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x100002, 0x100003, write16_delegate(FUNC(tumbleb_state::chokchok_tilebank_w),state));
src/mame/drivers/cd32.c
r14896r14897
4949
5050static void handle_cd32_joystick_cia(running_machine &machine, UINT8 pra, UINT8 dra);
5151
52static WRITE32_HANDLER( aga_overlay_w )
52WRITE32_MEMBER(cd32_state::aga_overlay_w)
5353{
5454   if (ACCESSING_BITS_16_23)
5555   {
5656      data = (data >> 16) & 1;
5757
5858      /* switch banks as appropriate */
59      memory_set_bank(space->machine(), "bank1", data & 1);
59      memory_set_bank(machine(), "bank1", data & 1);
6060
6161      /* swap the write handlers between ROM and bank 1 based on the bit */
6262      if ((data & 1) == 0)
6363         /* overlay disabled, map RAM on 0x000000 */
64         space->install_write_bank(0x000000, 0x1fffff, "bank1");
64         space.install_write_bank(0x000000, 0x1fffff, "bank1");
6565      else
6666         /* overlay enabled, map Amiga system ROM on 0x000000 */
67         space->unmap_write(0x000000, 0x1fffff);
67         space.unmap_write(0x000000, 0x1fffff);
6868   }
6969}
7070
r14896r14897
128128   AM_RANGE(0x800000, 0x800003) AM_READ_PORT("DIPSW1")
129129   AM_RANGE(0x800010, 0x800013) AM_READ_PORT("DIPSW2")
130130   AM_RANGE(0xb80000, 0xb8003f) AM_DEVREADWRITE_LEGACY("akiko", amiga_akiko32_r, amiga_akiko32_w)
131   AM_RANGE(0xbfa000, 0xbfa003) AM_WRITE_LEGACY(aga_overlay_w)
131   AM_RANGE(0xbfa000, 0xbfa003) AM_WRITE(aga_overlay_w)
132132   AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE16_LEGACY(amiga_cia_r, amiga_cia_w, 0xffffffff)
133133   AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE16_LEGACY(amiga_custom_r, amiga_custom_w, 0xffffffff) AM_BASE(m_custom_regs)
134134   AM_RANGE(0xe00000, 0xe7ffff) AM_ROM AM_REGION("user1", 0x80000)   /* CD32 Extended ROM */
src/mame/drivers/micro3d.c
r14896r14897
275275   AM_RANGE(0x0000, 0x07ff) AM_RAM
276276   AM_RANGE(0xfd00, 0xfd01) AM_DEVREADWRITE_LEGACY("ym2151", ym2151_r, ym2151_w)
277277   AM_RANGE(0xfe00, 0xfe00) AM_DEVWRITE_LEGACY("upd7759", micro3d_upd7759_w)
278   AM_RANGE(0xff00, 0xff00) AM_WRITE_LEGACY(micro3d_snd_dac_a)
279   AM_RANGE(0xff01, 0xff01) AM_WRITE_LEGACY(micro3d_snd_dac_b)
280   AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE_LEGACY(micro3d_sound_io_r, micro3d_sound_io_w)
278   AM_RANGE(0xff00, 0xff00) AM_WRITE(micro3d_snd_dac_a)
279   AM_RANGE(0xff01, 0xff01) AM_WRITE(micro3d_snd_dac_b)
280   AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(micro3d_sound_io_r, micro3d_sound_io_w)
281281ADDRESS_MAP_END
282282
283283
src/mame/drivers/momoko.c
r14896r14897
6161   AM_RANGE(0xd400, 0xd400) AM_READ_PORT("IN0") AM_WRITENOP /* interrupt ack? */
6262   AM_RANGE(0xd402, 0xd402) AM_READ_PORT("IN1") AM_WRITE(momoko_flipscreen_w)
6363   AM_RANGE(0xd404, 0xd404) AM_WRITE(watchdog_reset_w)
64   AM_RANGE(0xd406, 0xd406) AM_READ_PORT("DSW0") AM_WRITE(soundlatch_w)
64   AM_RANGE(0xd406, 0xd406) AM_READ_PORT("DSW0") AM_WRITE(soundlatch_byte_w)
6565   AM_RANGE(0xd407, 0xd407) AM_READ_PORT("DSW1")
66   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_be_w) AM_SHARE("paletteram")
66   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_be_w) AM_SHARE("paletteram")
6767   AM_RANGE(0xdc00, 0xdc00) AM_WRITE(momoko_fg_scrolly_w)
6868   AM_RANGE(0xdc01, 0xdc01) AM_WRITE(momoko_fg_scrollx_w)
6969   AM_RANGE(0xdc02, 0xdc02) AM_WRITE(momoko_fg_select_w)
r14896r14897
217217   {
218218      AY8910_LEGACY_OUTPUT,
219219      AY8910_DEFAULT_LOADS,
220      DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
220      DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
221221      DEVCB_NULL,
222222      DEVCB_NULL,
223223      DEVCB_NULL
src/mame/drivers/cabaret.c
r14896r14897
3030{
3131public:
3232   cabaret_state(const machine_config &mconfig, device_type type, const char *tag)
33      : driver_device(mconfig, type, tag) { }
33      : driver_device(mconfig, type, tag) ,
34      m_fg_tile_ram(*this, "fg_tile_ram"),
35      m_fg_color_ram(*this, "fg_color_ram"),
36      m_bg_scroll(*this, "bg_scroll"),
37      m_bg_tile_ram(*this, "bg_tile_ram"){ }
3438
35   UINT8 *m_bg_tile_ram;
39   required_shared_ptr<UINT8> m_fg_tile_ram;
40   required_shared_ptr<UINT8> m_fg_color_ram;
41   required_shared_ptr<UINT8> m_bg_scroll;
42   required_shared_ptr<UINT8> m_bg_tile_ram;
3643   tilemap_t *m_bg_tilemap;
37   UINT8 *m_bg_scroll;
38   UINT8 *m_fg_tile_ram;
39   UINT8 *m_fg_color_ram;
4044   tilemap_t *m_fg_tilemap;
4145   int m_nmi_enable;
4246   UINT8 m_out[3];
r14896r14897
5963
6064WRITE8_MEMBER(cabaret_state::bg_scroll_w)
6165{
62   m_bg_scroll[offset] = data;
66   m_bg_scroll.target()[offset] = data;
6367   m_bg_tilemap->set_scrolly(offset,data);
6468}
6569
6670WRITE8_MEMBER(cabaret_state::bg_tile_w)
6771{
68   m_bg_tile_ram[offset] = data;
72   m_bg_tile_ram.target()[offset] = data;
6973   m_bg_tilemap->mark_tile_dirty(offset);
7074}
7175
7276static TILE_GET_INFO( get_bg_tile_info )
7377{
7478   cabaret_state *state = machine.driver_data<cabaret_state>();
75   int code = state->m_bg_tile_ram[tile_index];
79   int code = state->m_bg_tile_ram.target()[tile_index];
7680   SET_TILE_INFO(1, code & 0xff, 0, 0);
7781}
7882
7983static TILE_GET_INFO( get_fg_tile_info )
8084{
8185   cabaret_state *state = machine.driver_data<cabaret_state>();
82   int code = state->m_fg_tile_ram[tile_index] | (state->m_fg_color_ram[tile_index] << 8);
86   int code = state->m_fg_tile_ram.target()[tile_index] | (state->m_fg_color_ram.target()[tile_index] << 8);
8387   int tile = code & 0x1fff;
8488   SET_TILE_INFO(0, code, tile != 0x1fff ? ((code >> 12) & 0xe) + 1 : 0, 0);
8589}
8690
8791WRITE8_MEMBER(cabaret_state::fg_tile_w)
8892{
89   m_fg_tile_ram[offset] = data;
93   m_fg_tile_ram.target()[offset] = data;
9094   m_fg_tilemap->mark_tile_dirty(offset);
9195}
9296
9397WRITE8_MEMBER(cabaret_state::fg_color_w)
9498{
95   m_fg_color_ram[offset] = data;
99   m_fg_color_ram.target()[offset] = data;
96100   m_fg_tilemap->mark_tile_dirty(offset);
97101}
98102
r14896r14897
177181   AM_RANGE( 0x2000, 0x27ff ) AM_RAM_WRITE(fg_tile_w )  AM_BASE(m_fg_tile_ram )
178182   AM_RANGE( 0x2800, 0x2fff ) AM_RAM_WRITE(fg_color_w ) AM_BASE(m_fg_color_ram )
179183
180   AM_RANGE( 0x3000, 0x37ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_SHARE("paletteram")
181   AM_RANGE( 0x3800, 0x3fff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_SHARE("paletteram2")
184   AM_RANGE( 0x3000, 0x37ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) AM_SHARE("paletteram")
185   AM_RANGE( 0x3800, 0x3fff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) AM_SHARE("paletteram2")
182186
183187   AM_RANGE( 0x1000, 0x103f ) AM_RAM_WRITE(bg_scroll_w ) AM_BASE(m_bg_scroll )
184188
src/mame/drivers/kchamp.c
r14896r14897
9494
9595WRITE8_MEMBER(kchamp_state::sound_command_w)
9696{
97   soundlatch_w(space, 0, data);
97   soundlatch_byte_w(space, 0, data);
9898   device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0xff);
9999}
100100
r14896r14897
132132static ADDRESS_MAP_START( kchampvs_sound_io_map, AS_IO, 8, kchamp_state )
133133   ADDRESS_MAP_GLOBAL_MASK(0xff)
134134   AM_RANGE(0x00, 0x01) AM_DEVWRITE_LEGACY("ay1", ay8910_data_address_w)
135   AM_RANGE(0x01, 0x01) AM_READ(soundlatch_r)
135   AM_RANGE(0x01, 0x01) AM_READ(soundlatch_byte_r)
136136   AM_RANGE(0x02, 0x03) AM_DEVWRITE_LEGACY("ay2", ay8910_data_address_w)
137137   AM_RANGE(0x04, 0x04) AM_WRITE(sound_msm_w)
138138   AM_RANGE(0x05, 0x05) AM_DEVWRITE_LEGACY("msm", sound_control_w)
r14896r14897
187187   AM_RANGE(0x02, 0x03) AM_DEVWRITE_LEGACY("ay2", ay8910_data_address_w)
188188   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("dac", dac_w)
189189   AM_RANGE(0x05, 0x05) AM_WRITE(kc_sound_control_w)
190   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
190   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_byte_r)
191191ADDRESS_MAP_END
192192
193193static INPUT_PORTS_START( kchampvs )
src/mame/drivers/olibochu.c
r14896r14897
5959{
6060public:
6161   olibochu_state(const machine_config &mconfig, device_type type, const char *tag)
62      : driver_device(mconfig, type, tag) { }
62      : driver_device(mconfig, type, tag) ,
63      m_videoram(*this, "videoram"),
64      m_colorram(*this, "colorram"),
65      m_spriteram(*this, "spriteram"),
66      m_spriteram2(*this, "spriteram2"){ }
6367
6468   /* memory pointers */
65   UINT8 *  m_videoram;
66   UINT8 *  m_colorram;
67   UINT8 *  m_spriteram;
68   UINT8 *  m_spriteram2;
69   required_shared_ptr<UINT8> m_videoram;
70   required_shared_ptr<UINT8> m_colorram;
71   required_shared_ptr<UINT8> m_spriteram;
72   required_shared_ptr<UINT8> m_spriteram2;
6973//  UINT8 *  m_paletteram;    // currently this uses generic palette handling
70   size_t   m_spriteram_size;
71   size_t   m_spriteram2_size;
7274
7375   /* video-related */
7476   tilemap_t  *m_bg_tilemap;
r14896r14897
122124
123125WRITE8_MEMBER(olibochu_state::olibochu_videoram_w)
124126{
125   m_videoram[offset] = data;
127   m_videoram.target()[offset] = data;
126128   m_bg_tilemap->mark_tile_dirty(offset);
127129}
128130
129131WRITE8_MEMBER(olibochu_state::olibochu_colorram_w)
130132{
131   m_colorram[offset] = data;
133   m_colorram.target()[offset] = data;
132134   m_bg_tilemap->mark_tile_dirty(offset);
133135}
134136
135137WRITE8_MEMBER(olibochu_state::olibochu_flipscreen_w)
136138{
137   if (flip_screen_get(machine()) != (data & 0x80))
139   if (flip_screen() != (data & 0x80))
138140   {
139      flip_screen_set(machine(), data & 0x80);
141      flip_screen_set(data & 0x80);
140142      machine().tilemap().mark_all_dirty();
141143   }
142144
r14896r14897
146148static TILE_GET_INFO( get_bg_tile_info )
147149{
148150   olibochu_state *state = machine.driver_data<olibochu_state>();
149   int attr = state->m_colorram[tile_index];
150   int code = state->m_videoram[tile_index] + ((attr & 0x20) << 3);
151   int attr = state->m_colorram.target()[tile_index];
152   int code = state->m_videoram.target()[tile_index] + ((attr & 0x20) << 3);
151153   int color = (attr & 0x1f) + 0x20;
152154   int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
153155
r14896r14897
163165static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
164166{
165167   olibochu_state *state = machine.driver_data<olibochu_state>();
166   UINT8 *spriteram = state->m_spriteram;
167   UINT8 *spriteram_2 = state->m_spriteram2;
168   UINT8 *spriteram = state->m_spriteram.target();
169   UINT8 *spriteram_2 = state->m_spriteram2.target();
168170   int offs;
169171
170172   /* 16x16 sprites */
171   for (offs = 0; offs < state->m_spriteram_size; offs += 4)
173   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
172174   {
173175      int attr = spriteram[offs + 1];
174176      int code = spriteram[offs];
r14896r14897
178180      int sx = spriteram[offs + 3];
179181      int sy = ((spriteram[offs + 2] + 8) & 0xff) - 8;
180182
181      if (flip_screen_get(machine))
183      if (state->flip_screen())
182184      {
183185         sx = 240 - sx;
184186         sy = 240 - sy;
r14896r14897
194196   }
195197
196198   /* 8x8 sprites */
197   for (offs = 0; offs < state->m_spriteram2_size; offs += 4)
199   for (offs = 0; offs < state->m_spriteram2.bytes(); offs += 4)
198200   {
199201      int attr = spriteram_2[offs + 1];
200202      int code = spriteram_2[offs];
r14896r14897
204206      int sx = spriteram_2[offs + 3];
205207      int sy = spriteram_2[offs + 2];
206208
207      if (flip_screen_get(machine))
209      if (state->flip_screen())
208210      {
209211         sx = 248 - sx;
210212         sy = 248 - sy;
r14896r14897
241243   for (c = 15; c >= 0; c--)
242244      if (m_cmd & (1 << c)) break;
243245
244   if (c >= 0) soundlatch_w(space, 0, 15 - c);
246   if (c >= 0) soundlatch_byte_w(space, 0, 15 - c);
245247}
246248
247249
248250static ADDRESS_MAP_START( olibochu_map, AS_PROGRAM, 8, olibochu_state )
249251   AM_RANGE(0x0000, 0x7fff) AM_ROM
250   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(olibochu_videoram_w) AM_BASE(m_videoram)
251   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(olibochu_colorram_w) AM_BASE(m_colorram)
252   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(olibochu_videoram_w) AM_SHARE("videoram")
253   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(olibochu_colorram_w) AM_SHARE("colorram")
252254   AM_RANGE(0x9000, 0x903f) AM_RAM //???
253255   AM_RANGE(0x9800, 0x983f) AM_RAM //???
254256   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
r14896r14897
259261   AM_RANGE(0xa005, 0xa005) AM_READ_PORT("DSW2")
260262   AM_RANGE(0xa800, 0xa801) AM_WRITE(sound_command_w)
261263   AM_RANGE(0xa802, 0xa802) AM_WRITE(olibochu_flipscreen_w)   /* bit 6 = enable sound? */
262   AM_RANGE(0xf400, 0xf41f) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
263   AM_RANGE(0xf440, 0xf47f) AM_RAM AM_BASE_SIZE(m_spriteram2, m_spriteram2_size)
264   AM_RANGE(0xf400, 0xf41f) AM_RAM AM_SHARE("spriteram")
265   AM_RANGE(0xf440, 0xf47f) AM_RAM AM_SHARE("spriteram2")
264266   AM_RANGE(0xf000, 0xffff) AM_RAM
265267ADDRESS_MAP_END
266268
267269static ADDRESS_MAP_START( olibochu_sound_map, AS_PROGRAM, 8, olibochu_state )
268270   AM_RANGE(0x0000, 0x1fff) AM_ROM
269271   AM_RANGE(0x6000, 0x63ff) AM_RAM
270   AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_r)   /* likely ay8910 input port, not direct */
272   AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_byte_r)   /* likely ay8910 input port, not direct */
271273   AM_RANGE(0x7000, 0x7001) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
272274   AM_RANGE(0x7004, 0x7004) AM_WRITENOP //sound filter?
273275   AM_RANGE(0x7006, 0x7006) AM_WRITENOP //irq ack?
src/mame/drivers/m90.c
r14896r14897
5858{
5959   if (ACCESSING_BITS_0_7)
6060   {
61      soundlatch_w(space, offset, data);
61      soundlatch_byte_w(space, offset, data);
6262      cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
6363   }
6464}
r14896r14897
7777   AM_RANGE(0x80000, 0x8ffff) AM_ROMBANK("bank1")   /* Quiz F1 only */
7878   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
7979   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(m_video_data)
80   AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
80   AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
8181   AM_RANGE(0xffff0, 0xfffff) AM_ROM
8282ADDRESS_MAP_END
8383
r14896r14897
8686   AM_RANGE(0x6000e, 0x60fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
8787   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
8888   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(m_video_data)
89   AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
89   AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
9090   AM_RANGE(0xffff0, 0xfffff) AM_ROM
9191ADDRESS_MAP_END
9292
r14896r14897
9595   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
9696   AM_RANGE(0xc000e, 0xc0fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
9797   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(m_video_data)
98   AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
98   AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
9999   AM_RANGE(0xffff0, 0xfffff) AM_ROM
100100ADDRESS_MAP_END
101101
r14896r14897
131131static ADDRESS_MAP_START( m90_sound_cpu_io_map, AS_IO, 8, m90_state )
132132   ADDRESS_MAP_GLOBAL_MASK(0xff)
133133   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
134   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
134   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_byte_r)
135135   AM_RANGE(0x80, 0x81) AM_DEVWRITE_LEGACY("m72", rtype2_sample_addr_w)
136136   AM_RANGE(0x82, 0x82) AM_DEVWRITE_LEGACY("m72", m72_sample_w)
137137   AM_RANGE(0x83, 0x83) AM_DEVWRITE_LEGACY("m72", m72_sound_irq_ack_w)
r14896r14897
141141static ADDRESS_MAP_START( dynablsb_sound_cpu_io_map, AS_IO, 8, m90_state )
142142   ADDRESS_MAP_GLOBAL_MASK(0xff)
143143   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
144   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
144   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_byte_r)
145145   AM_RANGE(0x82, 0x82) AM_DEVWRITE_LEGACY("dac", dac_signed_w)
146146ADDRESS_MAP_END
147147
r14896r14897
149149   ADDRESS_MAP_GLOBAL_MASK(0xff)
150150   AM_RANGE(0x00, 0x01) AM_DEVWRITE_LEGACY("m72", poundfor_sample_addr_w)
151151   AM_RANGE(0x40, 0x41) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
152   AM_RANGE(0x42, 0x42) AM_READ(soundlatch_r)
152   AM_RANGE(0x42, 0x42) AM_READ(soundlatch_byte_r)
153153   AM_RANGE(0x42, 0x42) AM_DEVWRITE_LEGACY("m72", m72_sound_irq_ack_w)
154154ADDRESS_MAP_END
155155
src/mame/drivers/tugboat.c
r14896r14897
3232{
3333public:
3434   tugboat_state(const machine_config &mconfig, device_type type, const char *tag)
35      : driver_device(mconfig, type, tag) { }
35      : driver_device(mconfig, type, tag) ,
36      m_ram(*this, "ram"){ }
3637
37   UINT8 *m_ram;
38   required_shared_ptr<UINT8> m_ram;
3839   UINT8 m_hd46505_0_reg[18];
3940   UINT8 m_hd46505_1_reg[18];
4041   int m_reg0;
r14896r14897
8687
8788WRITE8_MEMBER(tugboat_state::tugboat_score_w)
8889{
89      if (offset>=0x8) m_ram[0x291d + 32*offset + 32*(1-8)] = data ^ 0x0f;
90      if (offset<0x8 ) m_ram[0x291d + 32*offset + 32*9] = data ^ 0x0f;
90      if (offset>=0x8) m_ram.target()[0x291d + 32*offset + 32*(1-8)] = data ^ 0x0f;
91      if (offset<0x8 ) m_ram.target()[0x291d + 32*offset + 32*9] = data ^ 0x0f;
9192}
9293
9394static void draw_tilemap(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,
r14896r14897
100101   {
101102      for (x = 0;x < 32;x++)
102103      {
103         int code = (state->m_ram[addr + 0x400] << 8) | state->m_ram[addr];
104         int code = (state->m_ram.target()[addr + 0x400] << 8) | state->m_ram.target()[addr];
104105         int color = (code & 0x3c00) >> 10;
105106         int rgn;
106107
r14896r14897
211212
212213
213214static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tugboat_state )
214   AM_RANGE(0x0000, 0x01ff) AM_RAM AM_BASE(m_ram)
215   AM_RANGE(0x0000, 0x01ff) AM_RAM AM_SHARE("ram")
215216   AM_RANGE(0x1060, 0x1061) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
216217   AM_RANGE(0x10a0, 0x10a1) AM_WRITE(tugboat_hd46505_0_w)   /* scrolling is performed changing the start_addr register (0C/0D) */
217218   AM_RANGE(0x10c0, 0x10c1) AM_WRITE(tugboat_hd46505_1_w)
src/mame/drivers/kingdrby.c
r14896r14897
7878{
7979public:
8080   kingdrby_state(const machine_config &mconfig, device_type type, const char *tag)
81      : driver_device(mconfig, type, tag) { }
81      : driver_device(mconfig, type, tag) ,
82      m_vram(*this, "vram"),
83      m_attr(*this, "attr"),
84      m_spriteram(*this, "spriteram"){ }
8285
8386   UINT8 m_sound_cmd;
84   UINT8 *m_vram;
85   UINT8 *m_attr;
87   required_shared_ptr<UINT8> m_vram;
88   required_shared_ptr<UINT8> m_attr;
8689   tilemap_t *m_sc0_tilemap;
8790   tilemap_t *m_sc0w_tilemap;
8891   tilemap_t *m_sc1_tilemap;
8992   UINT8 m_p1_hopper;
9093   UINT8 m_p2_hopper;
9194   UINT8 m_mux_data;
92   UINT8 *m_spriteram;
95   required_shared_ptr<UINT8> m_spriteram;
9396   DECLARE_WRITE8_MEMBER(sc0_vram_w);
9497   DECLARE_WRITE8_MEMBER(sc0_attr_w);
9598   DECLARE_WRITE8_MEMBER(led_array_w);
r14896r14897
121124static TILE_GET_INFO( get_sc0_tile_info )
122125{
123126   kingdrby_state *state = machine.driver_data<kingdrby_state>();
124   int tile = state->m_vram[tile_index] | state->m_attr[tile_index]<<8;
125   int color = (state->m_attr[tile_index] & 0x06)>>1;
127   int tile = state->m_vram.target()[tile_index] | state->m_attr.target()[tile_index]<<8;
128   int color = (state->m_attr.target()[tile_index] & 0x06)>>1;
126129
127130   tile&=0x1ff;
128131
r14896r14897
136139static TILE_GET_INFO( get_sc1_tile_info )
137140{
138141   kingdrby_state *state = machine.driver_data<kingdrby_state>();
139   int tile = state->m_vram[tile_index] | state->m_attr[tile_index]<<8;
140   int color = (state->m_attr[tile_index] & 0x06)>>1;
142   int tile = state->m_vram.target()[tile_index] | state->m_attr.target()[tile_index]<<8;
143   int color = (state->m_attr.target()[tile_index] & 0x06)>>1;
141144
142145   tile&=0x1ff;
143146   //original 0xc
r14896r14897
150153         color|0x40,
151154         0);
152155
153   tileinfo.category = (state->m_attr[tile_index] & 0x08)>>3;
156   tileinfo.category = (state->m_attr.target()[tile_index] & 0x08)>>3;
154157}
155158
156159static VIDEO_START(kingdrby)
r14896r14897
172175static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
173176{
174177   kingdrby_state *state = machine.driver_data<kingdrby_state>();
175   UINT8 *spriteram = state->m_spriteram;
178   UINT8 *spriteram = state->m_spriteram.target();
176179   int count = 0;
177180
178181   /*sprites not fully understood.*/
r14896r14897
219222   kingdrby_state *state = screen.machine().driver_data<kingdrby_state>();
220223   const rectangle &visarea = screen.visible_area();
221224   rectangle clip;
222   state->m_sc0_tilemap->set_scrollx(0, state->m_vram[0x342]);
223   state->m_sc0_tilemap->set_scrolly(0, state->m_vram[0x341]);
224   state->m_sc1_tilemap->set_scrollx(0, state->m_vram[0x342]);
225   state->m_sc1_tilemap->set_scrolly(0, state->m_vram[0x341]);
225   state->m_sc0_tilemap->set_scrollx(0, state->m_vram.target()[0x342]);
226   state->m_sc0_tilemap->set_scrolly(0, state->m_vram.target()[0x341]);
227   state->m_sc1_tilemap->set_scrollx(0, state->m_vram.target()[0x342]);
228   state->m_sc1_tilemap->set_scrolly(0, state->m_vram.target()[0x341]);
226229   state->m_sc0w_tilemap->set_scrolly(0, 32);
227230
228231   /* maybe it needs two window tilemaps? (one at the top, the other at the bottom)*/
r14896r14897
239242
240243WRITE8_MEMBER(kingdrby_state::sc0_vram_w)
241244{
242   m_vram[offset] = data;
245   m_vram.target()[offset] = data;
243246   m_sc0_tilemap->mark_tile_dirty(offset);
244247   m_sc0w_tilemap->mark_tile_dirty(offset);
245248   m_sc1_tilemap->mark_tile_dirty(offset);
r14896r14897
247250
248251WRITE8_MEMBER(kingdrby_state::sc0_attr_w)
249252{
250   m_attr[offset] = data;
253   m_attr.target()[offset] = data;
251254   m_sc0_tilemap->mark_tile_dirty(offset);
252255   m_sc0w_tilemap->mark_tile_dirty(offset);
253256   m_sc1_tilemap->mark_tile_dirty(offset);
r14896r14897
281284   cputag_set_input_line(device->machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
282285   state->m_sound_cmd = data;
283286   /* soundlatch is unneeded since we are already using perfect interleave. */
284   // soundlatch_w(space,0, data);
287   // soundlatch_byte_w(space,0, data);
285288}
286289
287290
r14896r14897
386389static ADDRESS_MAP_START( master_map, AS_PROGRAM, 8, kingdrby_state )
387390   AM_RANGE(0x0000, 0x2fff) AM_ROM
388391   AM_RANGE(0x3000, 0x33ff) AM_RAM AM_MIRROR(0xc00) AM_SHARE("share1")
389   AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(sc0_vram_w) AM_BASE(m_vram)
390   AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(sc0_attr_w) AM_BASE(m_attr)
392   AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(sc0_vram_w) AM_SHARE("vram")
393   AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(sc0_attr_w) AM_SHARE("attr")
391394ADDRESS_MAP_END
392395
393396static ADDRESS_MAP_START( master_io_map, AS_IO, 8, kingdrby_state )
r14896r14897
402405   AM_RANGE(0x5000, 0x5003) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)   /* I/O Ports */
403406   AM_RANGE(0x6000, 0x6003) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)   /* I/O Ports */
404407   AM_RANGE(0x7000, 0x73ff) AM_RAM AM_SHARE("share1")
405   AM_RANGE(0x7400, 0x74ff) AM_RAM AM_BASE(m_spriteram)
408   AM_RANGE(0x7400, 0x74ff) AM_RAM AM_SHARE("spriteram")
406409   AM_RANGE(0x7600, 0x7600) AM_DEVWRITE("crtc", mc6845_device, address_w)
407410   AM_RANGE(0x7601, 0x7601) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
408411   AM_RANGE(0x7801, 0x780f) AM_WRITE(led_array_w)
r14896r14897
422425   AM_RANGE(0x5000, 0x5003) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)   /* I/O Ports */
423426//  AM_RANGE(0x6000, 0x6003) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) /* I/O Ports */
424427   AM_RANGE(0x7000, 0x73ff) AM_RAM AM_SHARE("share1")
425   AM_RANGE(0x7400, 0x74ff) AM_RAM AM_BASE(m_spriteram)
428   AM_RANGE(0x7400, 0x74ff) AM_RAM AM_SHARE("spriteram")
426429   AM_RANGE(0x7600, 0x7600) AM_DEVWRITE("crtc", mc6845_device, address_w)
427430   AM_RANGE(0x7601, 0x7601) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
428431   AM_RANGE(0x7800, 0x7800) AM_READ_PORT("KEY0")
src/mame/drivers/r2dx_v33.c
r14896r14897
2929{
3030public:
3131   r2dx_v33_state(const machine_config &mconfig, device_type type, const char *tag)
32      : driver_device(mconfig, type, tag) { }
32      : driver_device(mconfig, type, tag) ,
33      m_spriteram(*this, "spriteram"){ }
3334
34   UINT16 *m_spriteram;
35   required_shared_ptr<UINT16> m_spriteram;
3536   DECLARE_WRITE16_MEMBER(rdx_bg_vram_w);
3637   DECLARE_WRITE16_MEMBER(rdx_md_vram_w);
3738   DECLARE_WRITE16_MEMBER(rdx_fg_vram_w);
r14896r14897
9798static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
9899{
99100   r2dx_v33_state *state = machine.driver_data<r2dx_v33_state>();
100   UINT16 *spriteram16 = state->m_spriteram;
101   UINT16 *spriteram16 = state->m_spriteram.target();
101102   int offs,fx,fy,x,y,color,sprite;
102103//  int cur_pri;
103104   int dx,dy,ax,ay;
r14896r14897
400401   AM_RANGE(0x00800, 0x00fff) AM_RAM // copies eeprom here?
401402   AM_RANGE(0x01000, 0x0bfff) AM_RAM
402403
403   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM AM_BASE(m_spriteram)
404   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM AM_SHARE("spriteram")
404405   AM_RANGE(0x0c800, 0x0cfff) AM_RAM
405406   AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE(rdx_bg_vram_w) AM_BASE_LEGACY(&bg_vram)
406407   AM_RANGE(0x0d800, 0x0dfff) AM_RAM_WRITE(rdx_md_vram_w) AM_BASE_LEGACY(&md_vram)
r14896r14897
408409   AM_RANGE(0x0e800, 0x0f7ff) AM_RAM_WRITE(rdx_tx_vram_w) AM_BASE_LEGACY(&tx_vram)
409410   AM_RANGE(0x0f800, 0x0ffff) AM_RAM /* Stack area */
410411   AM_RANGE(0x10000, 0x1efff) AM_RAM
411   AM_RANGE(0x1f000, 0x1ffff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
412   AM_RANGE(0x1f000, 0x1ffff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
412413
413414   AM_RANGE(0x20000, 0x3ffff) AM_ROMBANK("bank1")
414415   AM_RANGE(0x40000, 0xfffff) AM_ROM AM_REGION("mainprg", 0x40000 )
r14896r14897
473474   AM_RANGE(0x00800, 0x00fff) AM_RAM
474475   AM_RANGE(0x01000, 0x0bfff) AM_RAM
475476
476   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM AM_BASE(m_spriteram)
477   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM AM_SHARE("spriteram")
477478   AM_RANGE(0x0c800, 0x0cfff) AM_RAM
478479   AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE(rdx_bg_vram_w) AM_BASE_LEGACY(&bg_vram)
479480   AM_RANGE(0x0d800, 0x0dfff) AM_RAM_WRITE(rdx_md_vram_w) AM_BASE_LEGACY(&md_vram)
r14896r14897
481482   AM_RANGE(0x0e800, 0x0f7ff) AM_RAM_WRITE(rdx_tx_vram_w) AM_BASE_LEGACY(&tx_vram)
482483   AM_RANGE(0x0f800, 0x0ffff) AM_RAM /* Stack area */
483484   AM_RANGE(0x10000, 0x1efff) AM_RAM
484   AM_RANGE(0x1f000, 0x1ffff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
485   AM_RANGE(0x1f000, 0x1ffff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
485486
486487   AM_RANGE(0x20000, 0x3ffff) AM_ROMBANK("bank1")
487488   AM_RANGE(0x40000, 0xfffff) AM_ROM AM_REGION("mainprg", 0x40000 )
src/mame/drivers/embargo.c
r14896r14897
1212{
1313public:
1414   embargo_state(const machine_config &mconfig, device_type type, const char *tag)
15      : driver_device(mconfig, type, tag) { }
15      : driver_device(mconfig, type, tag) ,
16      m_videoram(*this, "videoram"){ }
1617
1718   /* memory pointers */
18   UINT8 *  m_videoram;
19   size_t   m_videoram_size;
19   required_shared_ptr<UINT8> m_videoram;
2020
2121   /* misc */
2222   UINT8    m_dial_enable_1;
r14896r14897
4141   embargo_state *state = screen.machine().driver_data<embargo_state>();
4242   offs_t offs;
4343
44   for (offs = 0; offs < state->m_videoram_size; offs++)
44   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
4545   {
4646      int i;
4747
4848      UINT8 x = offs << 3;
4949      UINT8 y = offs >> 5;
50      UINT8 data = state->m_videoram[offs];
50      UINT8 data = state->m_videoram.target()[offs];
5151
5252      for (i = 0; i < 8; i++)
5353      {
r14896r14897
155155static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, embargo_state )
156156   AM_RANGE(0x0000, 0x0fff) AM_ROM
157157   AM_RANGE(0x1e00, 0x1fff) AM_RAM
158   AM_RANGE(0x2000, 0x3fff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
158   AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("videoram")
159159ADDRESS_MAP_END
160160
161161
src/mame/drivers/superqix.c
r14896r14897
222222         coin_lockout_global_w(machine(), (data & 1) ^ m_invert_coin_lockout);
223223         break;
224224      case 4:
225         flip_screen_set(machine(), data & 1);
225         flip_screen_set(data & 1);
226226         break;
227227      case 5:
228228         m_port1 = data;
r14896r14897
289289   coin_lockout_global_w(machine(), ~data & 8);
290290
291291   // bit 4 = flip screen
292   flip_screen_set(machine(), data & 0x10);
292   flip_screen_set(data & 0x10);
293293
294294   // bit 5 = unknown (set on startup)
295295
r14896r14897
330330
331331WRITE8_MEMBER(superqix_state::bootleg_flipscreen_w)
332332{
333   flip_screen_set(machine(), ~data & 1);
333   flip_screen_set(~data & 1);
334334}
335335
336336
r14896r14897
572572ADDRESS_MAP_END
573573
574574static ADDRESS_MAP_START( pbillian_port_map, AS_IO, 8, superqix_state )
575   AM_RANGE(0x0000, 0x01ff) AM_RAM_WRITE(paletteram_BBGGRRII_w) AM_SHARE("paletteram")
575   AM_RANGE(0x0000, 0x01ff) AM_RAM_WRITE(paletteram_BBGGRRII_byte_w) AM_SHARE("paletteram")
576576   AM_RANGE(0x0401, 0x0401) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
577577   AM_RANGE(0x0402, 0x0403) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_address_w)
578578   AM_RANGE(0x0408, 0x0408) AM_READ(pbillian_from_mcu_r)
r14896r14897
585585ADDRESS_MAP_END
586586
587587static ADDRESS_MAP_START( hotsmash_port_map, AS_IO, 8, superqix_state )
588   AM_RANGE(0x0000, 0x01ff) AM_RAM_WRITE(paletteram_BBGGRRII_w) AM_SHARE("paletteram")
588   AM_RANGE(0x0000, 0x01ff) AM_RAM_WRITE(paletteram_BBGGRRII_byte_w) AM_SHARE("paletteram")
589589   AM_RANGE(0x0401, 0x0401) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
590590   AM_RANGE(0x0402, 0x0403) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_address_w)
591591   AM_RANGE(0x0408, 0x0408) AM_READ(hotsmash_from_mcu_r)
r14896r14897
598598ADDRESS_MAP_END
599599
600600static ADDRESS_MAP_START( sqix_port_map, AS_IO, 8, superqix_state )
601   AM_RANGE(0x0000, 0x00ff) AM_RAM_WRITE(paletteram_BBGGRRII_w) AM_SHARE("paletteram")
601   AM_RANGE(0x0000, 0x00ff) AM_RAM_WRITE(paletteram_BBGGRRII_byte_w) AM_SHARE("paletteram")
602602   AM_RANGE(0x0401, 0x0401) AM_DEVREAD_LEGACY("ay1", ay8910_r)
603603   AM_RANGE(0x0402, 0x0403) AM_DEVWRITE_LEGACY("ay1", ay8910_data_address_w)
604604   AM_RANGE(0x0405, 0x0405) AM_DEVREAD_LEGACY("ay2", ay8910_r)
r14896r14897
611611ADDRESS_MAP_END
612612
613613static ADDRESS_MAP_START( bootleg_port_map, AS_IO, 8, superqix_state )
614   AM_RANGE(0x0000, 0x00ff) AM_RAM_WRITE(paletteram_BBGGRRII_w) AM_SHARE("paletteram")
614   AM_RANGE(0x0000, 0x00ff) AM_RAM_WRITE(paletteram_BBGGRRII_byte_w) AM_SHARE("paletteram")
615615   AM_RANGE(0x0401, 0x0401) AM_DEVREAD_LEGACY("ay1", ay8910_r)
616616   AM_RANGE(0x0402, 0x0403) AM_DEVWRITE_LEGACY("ay1", ay8910_data_address_w)
617617   AM_RANGE(0x0405, 0x0405) AM_DEVREAD_LEGACY("ay2", ay8910_r)
src/mame/drivers/cyberbal.c
r14896r14897
101101 *
102102 *************************************/
103103
104static READ16_HANDLER( special_port0_r )
104READ16_MEMBER(cyberbal_state::special_port0_r)
105105{
106   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
107   int temp = input_port_read(space->machine(), "IN0");
108   if (state->m_cpu_to_sound_ready) temp ^= 0x0080;
106   int temp = input_port_read(machine(), "IN0");
107   if (m_cpu_to_sound_ready) temp ^= 0x0080;
109108   return temp;
110109}
111110
112111
113static READ16_HANDLER( special_port2_r )
112READ16_MEMBER(cyberbal_state::special_port2_r)
114113{
115   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
116   int temp = input_port_read(space->machine(), "IN2");
117   if (state->m_cpu_to_sound_ready) temp ^= 0x2000;
114   int temp = input_port_read(machine(), "IN2");
115   if (m_cpu_to_sound_ready) temp ^= 0x2000;
118116   return temp;
119117}
120118
121119
122static READ16_HANDLER( sound_state_r )
120READ16_MEMBER(cyberbal_state::sound_state_r)
123121{
124   cyberbal_state *state = space->machine().driver_data<cyberbal_state>();
125122   int temp = 0xffff;
126   if (state->m_cpu_to_sound_ready) temp ^= 0xffff;
123   if (m_cpu_to_sound_ready) temp ^= 0xffff;
127124   return temp;
128125}
129126
r14896r14897
135132 *
136133 *************************************/
137134
138static WRITE16_HANDLER( p2_reset_w )
135WRITE16_MEMBER(cyberbal_state::p2_reset_w)
139136{
140   cputag_set_input_line(space->machine(), "extra", INPUT_LINE_RESET, CLEAR_LINE);
137   cputag_set_input_line(machine(), "extra", INPUT_LINE_RESET, CLEAR_LINE);
141138}
142139
143140
r14896r14897
155152   AM_RANGE(0xfd0000, 0xfd1fff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
156153   AM_RANGE(0xfd2000, 0xfd3fff) AM_WRITE_LEGACY(atarigen_sound_reset_w)
157154   AM_RANGE(0xfd4000, 0xfd5fff) AM_WRITE(watchdog_reset16_w)
158   AM_RANGE(0xfd6000, 0xfd7fff) AM_WRITE_LEGACY(p2_reset_w)
155   AM_RANGE(0xfd6000, 0xfd7fff) AM_WRITE(p2_reset_w)
159156   AM_RANGE(0xfd8000, 0xfd9fff) AM_WRITE_LEGACY(atarigen_sound_upper_w)
160   AM_RANGE(0xfe0000, 0xfe0fff) AM_READ_LEGACY(special_port0_r)
157   AM_RANGE(0xfe0000, 0xfe0fff) AM_READ(special_port0_r)
161158   AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1")
162159   AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_1_w) AM_SHARE("share1") AM_BASE(m_paletteram_1)
163160   AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_0_w) AM_SHARE("share2") AM_BASE(m_paletteram_0)
r14896r14897
184181static ADDRESS_MAP_START( extra_map, AS_PROGRAM, 16, cyberbal_state )
185182   AM_RANGE(0x000000, 0x03ffff) AM_ROM
186183   AM_RANGE(0xfc0000, 0xfdffff) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
187   AM_RANGE(0xfe0000, 0xfe0fff) AM_READ_LEGACY(special_port0_r)
184   AM_RANGE(0xfe0000, 0xfe0fff) AM_READ(special_port0_r)
188185   AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1")
189186   AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_1_w) AM_SHARE("share1")
190187   AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_0_w) AM_SHARE("share2")
r14896r14897
211208static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, cyberbal_state )
212209   AM_RANGE(0x0000, 0x1fff) AM_RAM
213210   AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
214   AM_RANGE(0x2800, 0x2801) AM_WRITE_LEGACY(cyberbal_sound_68k_6502_w)
211   AM_RANGE(0x2800, 0x2801) AM_WRITE(cyberbal_sound_68k_6502_w)
215212   AM_RANGE(0x2802, 0x2803) AM_READWRITE_LEGACY(atarigen_6502_irq_ack_r, atarigen_6502_irq_ack_w)
216213   AM_RANGE(0x2804, 0x2805) AM_WRITE_LEGACY(atarigen_6502_sound_w)
217   AM_RANGE(0x2806, 0x2807) AM_WRITE_LEGACY(cyberbal_sound_bank_select_w)
214   AM_RANGE(0x2806, 0x2807) AM_WRITE(cyberbal_sound_bank_select_w)
218215   AM_RANGE(0x2c00, 0x2c01) AM_READ_LEGACY(atarigen_6502_sound_r)
219   AM_RANGE(0x2c02, 0x2c03) AM_READ_LEGACY(cyberbal_special_port3_r)
220   AM_RANGE(0x2c04, 0x2c05) AM_READ_LEGACY(cyberbal_sound_68k_6502_r)
221   AM_RANGE(0x2c06, 0x2c07) AM_READ_LEGACY(cyberbal_sound_6502_stat_r)
216   AM_RANGE(0x2c02, 0x2c03) AM_READ(cyberbal_special_port3_r)
217   AM_RANGE(0x2c04, 0x2c05) AM_READ(cyberbal_sound_68k_6502_r)
218   AM_RANGE(0x2c06, 0x2c07) AM_READ(cyberbal_sound_6502_stat_r)
222219   AM_RANGE(0x3000, 0x3fff) AM_ROMBANK("soundbank")
223220   AM_RANGE(0x4000, 0xffff) AM_ROM
224221ADDRESS_MAP_END
r14896r14897
233230
234231static ADDRESS_MAP_START( sound_68k_map, AS_PROGRAM, 16, cyberbal_state )
235232   AM_RANGE(0x000000, 0x03ffff) AM_ROM
236   AM_RANGE(0xff8000, 0xff87ff) AM_READ_LEGACY(cyberbal_sound_68k_r)
237   AM_RANGE(0xff8800, 0xff8fff) AM_WRITE_LEGACY(cyberbal_sound_68k_w)
238   AM_RANGE(0xff9000, 0xff97ff) AM_WRITE_LEGACY(cyberbal_io_68k_irq_ack_w)
239   AM_RANGE(0xff9800, 0xff9fff) AM_WRITE_LEGACY(cyberbal_sound_68k_dac_w)
233   AM_RANGE(0xff8000, 0xff87ff) AM_READ(cyberbal_sound_68k_r)
234   AM_RANGE(0xff8800, 0xff8fff) AM_WRITE(cyberbal_sound_68k_w)
235   AM_RANGE(0xff9000, 0xff97ff) AM_WRITE(cyberbal_io_68k_irq_ack_w)
236   AM_RANGE(0xff9800, 0xff9fff) AM_WRITE(cyberbal_sound_68k_dac_w)
240237   AM_RANGE(0xfff000, 0xffffff) AM_RAM
241238ADDRESS_MAP_END
242239
r14896r14897
252249   AM_RANGE(0x000000, 0x07ffff) AM_ROM
253250   AM_RANGE(0xfc0000, 0xfc0003) AM_READ_PORT("IN0")
254251   AM_RANGE(0xfc2000, 0xfc2003) AM_READ_PORT("IN1")
255   AM_RANGE(0xfc4000, 0xfc4003) AM_READ_LEGACY(special_port2_r)
252   AM_RANGE(0xfc4000, 0xfc4003) AM_READ(special_port2_r)
256253   AM_RANGE(0xfc6000, 0xfc6003) AM_READ_LEGACY(atarigen_sound_upper_r)
257254   AM_RANGE(0xfc8000, 0xfc8fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
258255   AM_RANGE(0xfca000, 0xfcafff) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram_w) AM_SHARE("paletteram")
r14896r14897
261258   AM_RANGE(0xfd4000, 0xfd4003) AM_WRITE(watchdog_reset16_w)
262259   AM_RANGE(0xfd6000, 0xfd6003) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
263260   AM_RANGE(0xfd8000, 0xfd8003) AM_WRITE_LEGACY(atarigen_sound_upper_w)
264   AM_RANGE(0xfe0000, 0xfe0003) AM_READ_LEGACY(sound_state_r)
261   AM_RANGE(0xfe0000, 0xfe0003) AM_READ(sound_state_r)
265262   AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_BASE(m_playfield)
266263   AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE_LEGACY(atarigen_alpha_w) AM_BASE(m_alpha)
267264   AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
src/mame/drivers/lockon.c
r14896r14897
1616#include "sound/flt_vol.h"
1717#include "includes/lockon.h"
1818
19#define V30_GND_ADDR   ((state->m_ctrl_reg & 0x3) << 16)
20#define V30_OBJ_ADDR   ((state->m_ctrl_reg & 0x18) << 13)
19#define V30_GND_ADDR   ((m_ctrl_reg & 0x3) << 16)
20#define V30_OBJ_ADDR   ((m_ctrl_reg & 0x18) << 13)
2121
2222
2323/*************************************
r14896r14897
2626 *
2727 *************************************/
2828
29static WRITE8_HANDLER( sound_vol );
30static READ8_HANDLER( adc_r );
3129
3230
31
32
3333/*************************************
3434 *
3535 *  Machine functions
r14896r14897
5151
5252*************************************/
5353
54static WRITE16_HANDLER( adrst_w )
54WRITE16_MEMBER(lockon_state::adrst_w)
5555{
56   lockon_state *state = space->machine().driver_data<lockon_state>();
57   state->m_ctrl_reg = data & 0xff;
56   m_ctrl_reg = data & 0xff;
5857
5958   /* Bus mastering for shared access */
60   device_set_input_line(state->m_ground, INPUT_LINE_HALT, data & 0x04 ? ASSERT_LINE : CLEAR_LINE);
61   device_set_input_line(state->m_object, INPUT_LINE_HALT, data & 0x20 ? ASSERT_LINE : CLEAR_LINE);
62   device_set_input_line(state->m_audiocpu, INPUT_LINE_HALT, data & 0x40 ? CLEAR_LINE : ASSERT_LINE);
59   device_set_input_line(m_ground, INPUT_LINE_HALT, data & 0x04 ? ASSERT_LINE : CLEAR_LINE);
60   device_set_input_line(m_object, INPUT_LINE_HALT, data & 0x20 ? ASSERT_LINE : CLEAR_LINE);
61   device_set_input_line(m_audiocpu, INPUT_LINE_HALT, data & 0x40 ? CLEAR_LINE : ASSERT_LINE);
6362}
6463
65static READ16_HANDLER( main_gnd_r )
64READ16_MEMBER(lockon_state::main_gnd_r)
6665{
67   lockon_state *state = space->machine().driver_data<lockon_state>();
68   address_space *gndspace = state->m_ground->memory().space(AS_PROGRAM);
66   address_space *gndspace = m_ground->memory().space(AS_PROGRAM);
6967   return gndspace->read_word(V30_GND_ADDR | offset * 2);
7068}
7169
72static WRITE16_HANDLER( main_gnd_w )
70WRITE16_MEMBER(lockon_state::main_gnd_w)
7371{
74   lockon_state *state = space->machine().driver_data<lockon_state>();
75   address_space *gndspace = state->m_ground->memory().space(AS_PROGRAM);
72   address_space *gndspace = m_ground->memory().space(AS_PROGRAM);
7673
7774   if (ACCESSING_BITS_0_7)
7875      gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 0), data);
r14896r14897
8077      gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 1), data >> 8);
8178}
8279
83static READ16_HANDLER( main_obj_r )
80READ16_MEMBER(lockon_state::main_obj_r)
8481{
85   lockon_state *state = space->machine().driver_data<lockon_state>();
86   address_space *objspace = state->m_object->memory().space(AS_PROGRAM);
82   address_space *objspace = m_object->memory().space(AS_PROGRAM);
8783   return objspace->read_word(V30_OBJ_ADDR | offset * 2);
8884}
8985
90static WRITE16_HANDLER( main_obj_w )
86WRITE16_MEMBER(lockon_state::main_obj_w)
9187{
92   lockon_state *state = space->machine().driver_data<lockon_state>();
93   address_space *objspace = state->m_object->memory().space(AS_PROGRAM);
88   address_space *objspace =m_object->memory().space(AS_PROGRAM);
9489
9590   if (ACCESSING_BITS_0_7)
9691      objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 0), data);
r14896r14897
9893      objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 1), data >> 8);
9994}
10095
101static WRITE16_HANDLER( tst_w )
96WRITE16_MEMBER(lockon_state::tst_w)
10297{
103   lockon_state *state = space->machine().driver_data<lockon_state>();
10498
10599   if (offset < 0x800)
106100   {
107      address_space *gndspace = state->m_ground->memory().space(AS_PROGRAM);
108      address_space *objspace = state->m_object->memory().space(AS_PROGRAM);
101      address_space *gndspace = m_ground->memory().space(AS_PROGRAM);
102      address_space *objspace = m_object->memory().space(AS_PROGRAM);
109103
110104      if (ACCESSING_BITS_0_7)
111105         gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 0), data);
r14896r14897
119113   }
120114}
121115
122static READ16_HANDLER( main_z80_r )
116READ16_MEMBER(lockon_state::main_z80_r)
123117{
124   lockon_state *state = space->machine().driver_data<lockon_state>();
125   address_space *sndspace = state->m_audiocpu->memory().space(AS_PROGRAM);
118   address_space *sndspace = m_audiocpu->memory().space(AS_PROGRAM);
126119   return 0xff00 | sndspace->read_byte(offset);
127120}
128121
129static WRITE16_HANDLER( main_z80_w )
122WRITE16_MEMBER(lockon_state::main_z80_w)
130123{
131   lockon_state *state = space->machine().driver_data<lockon_state>();
132   address_space *sndspace = state->m_audiocpu->memory().space(AS_PROGRAM);
124   address_space *sndspace = m_audiocpu->memory().space(AS_PROGRAM);
133125   sndspace->write_byte(offset, data);
134126}
135127
136static WRITE16_HANDLER( inten_w )
128WRITE16_MEMBER(lockon_state::inten_w)
137129{
138   lockon_state *state = space->machine().driver_data<lockon_state>();
139   state->m_main_inten = 1;
130   m_main_inten = 1;
140131}
141132
142static WRITE16_HANDLER( emres_w )
133WRITE16_MEMBER(lockon_state::emres_w)
143134{
144   lockon_state *state = space->machine().driver_data<lockon_state>();
145   watchdog_reset(space->machine());
146   state->m_main_inten = 0;
135   watchdog_reset(machine());
136   m_main_inten = 0;
147137}
148138
149139
r14896r14897
160150   AM_RANGE(0x06000, 0x06001) AM_READ_PORT("DSW")
161151   AM_RANGE(0x08000, 0x081ff) AM_RAM AM_BASE_SIZE(m_hud_ram, m_hudram_size)
162152   AM_RANGE(0x09000, 0x09fff) AM_RAM_WRITE(lockon_char_w) AM_BASE(m_char_ram)
163   AM_RANGE(0x0a000, 0x0a001) AM_WRITE_LEGACY(adrst_w)
153   AM_RANGE(0x0a000, 0x0a001) AM_WRITE(adrst_w)
164154   AM_RANGE(0x0b000, 0x0bfff) AM_WRITE(lockon_rotate_w)
165155   AM_RANGE(0x0c000, 0x0cfff) AM_WRITE(lockon_fb_clut_w)
166   AM_RANGE(0x0e000, 0x0e001) AM_WRITE_LEGACY(inten_w)
167   AM_RANGE(0x0f000, 0x0f001) AM_WRITE_LEGACY(emres_w)
168   AM_RANGE(0x10000, 0x1ffff) AM_READNOP AM_WRITE_LEGACY(tst_w)
169   AM_RANGE(0x20000, 0x2ffff) AM_READWRITE_LEGACY(main_z80_r, main_z80_w)
170   AM_RANGE(0x30000, 0x3ffff) AM_READWRITE_LEGACY(main_gnd_r, main_gnd_w)
171   AM_RANGE(0x40000, 0x4ffff) AM_READWRITE_LEGACY(main_obj_r, main_obj_w)
156   AM_RANGE(0x0e000, 0x0e001) AM_WRITE(inten_w)
157   AM_RANGE(0x0f000, 0x0f001) AM_WRITE(emres_w)
158   AM_RANGE(0x10000, 0x1ffff) AM_READNOP AM_WRITE(tst_w)
159   AM_RANGE(0x20000, 0x2ffff) AM_READWRITE(main_z80_r, main_z80_w)
160   AM_RANGE(0x30000, 0x3ffff) AM_READWRITE(main_gnd_r, main_gnd_w)
161   AM_RANGE(0x40000, 0x4ffff) AM_READWRITE(main_obj_r, main_obj_w)
172162   AM_RANGE(0x50000, 0x5ffff) AM_MIRROR(0x80000) AM_ROM
173163   AM_RANGE(0x60000, 0x6ffff) AM_MIRROR(0x80000) AM_ROM
174164   AM_RANGE(0x70000, 0x7ffff) AM_MIRROR(0x80000) AM_ROM
r14896r14897
201191static ADDRESS_MAP_START( sound_prg, AS_PROGRAM, 8, lockon_state )
202192   ADDRESS_MAP_UNMAP_HIGH
203193   AM_RANGE(0x0000, 0x6fff) AM_ROM
204   AM_RANGE(0x7000, 0x7000) AM_WRITE_LEGACY(sound_vol)
205   AM_RANGE(0x7400, 0x7403) AM_READ_LEGACY(adc_r) AM_WRITENOP
194   AM_RANGE(0x7000, 0x7000) AM_WRITE(sound_vol)
195   AM_RANGE(0x7400, 0x7403) AM_READ(adc_r) AM_WRITENOP
206196   AM_RANGE(0x7800, 0x7fff) AM_MIRROR(0x8000) AM_RAM
207197ADDRESS_MAP_END
208198
r14896r14897
338328 *
339329 *************************************/
340330
341static READ8_HANDLER( adc_r )
331READ8_MEMBER(lockon_state::adc_r)
342332{
343333   switch (offset)
344334   {
345      case 0:  return input_port_read(space->machine(), "ADC_BANK");
346      case 1:  return input_port_read(space->machine(), "ADC_PITCH");
347      case 2:  return input_port_read(space->machine(), "ADC_MISSILE");
348      case 3:  return input_port_read(space->machine(), "ADC_HOVER");
335      case 0:  return input_port_read(machine(), "ADC_BANK");
336      case 1:  return input_port_read(machine(), "ADC_PITCH");
337      case 2:  return input_port_read(machine(), "ADC_MISSILE");
338      case 3:  return input_port_read(machine(), "ADC_HOVER");
349339      default: return 0;
350340   }
351341}
r14896r14897
378368 *
379369 *************************************/
380370
381static WRITE8_HANDLER( sound_vol )
371WRITE8_MEMBER(lockon_state::sound_vol)
382372{
383373#define LO_SHUNT   250.0
384374#define LO_R0      5600.0
r14896r14897
392382#define LO_RI      100000.0
393383#define LO_RP      100000.0
394384
395   lockon_state *state = space->machine().driver_data<lockon_state>();
396385
397386   static const double gains[16] =
398387   {
r14896r14897
417406   double lgain = gains[data & 0xf];
418407   double rgain = gains[data >> 4];
419408
420   flt_volume_set_volume(state->m_f2203_1l, lgain);
421   flt_volume_set_volume(state->m_f2203_2l, lgain);
422   flt_volume_set_volume(state->m_f2203_3l, lgain);
409   flt_volume_set_volume(m_f2203_1l, lgain);
410   flt_volume_set_volume(m_f2203_2l, lgain);
411   flt_volume_set_volume(m_f2203_3l, lgain);
423412
424   flt_volume_set_volume(state->m_f2203_1r, rgain);
425   flt_volume_set_volume(state->m_f2203_2r, rgain);
426   flt_volume_set_volume(state->m_f2203_3r, rgain);
413   flt_volume_set_volume(m_f2203_1r, rgain);
414   flt_volume_set_volume(m_f2203_2r, rgain);
415   flt_volume_set_volume(m_f2203_3r, rgain);
427416}
428417
429418static void ym2203_irq(device_t *device, int irq)
src/mame/drivers/bfm_sc4h.c
r14896r14897
5757 
5858   UINT8 vfd_ser_value;
5959   int vfd_ser_count;
60   DECLARE_READ16_MEMBER(sc4_mem_r);
61   DECLARE_WRITE16_MEMBER(sc4_mem_w);
6062};
6163 
6264class sc4_adder4_state : public sc4_state
r14896r14897
7173   required_device<cpu_device> m_adder4cpu;
7274};
7375 
74static READ16_HANDLER( sc4_mem_r )
76READ16_MEMBER(sc4_state::sc4_mem_r)
7577{
76   sc4_state *state = space->machine().driver_data<sc4_state>();
77   int pc = cpu_get_pc(&space->device());
78   int cs = m68307_get_cs(state->m_maincpu, offset * 2);
78   int pc = cpu_get_pc(&space.device());
79   int cs = m68307_get_cs(m_maincpu, offset * 2);
7980   int base = 0, end = 0, base2 = 0, end2 = 0;
80//  if (!(space->debugger_access())) printf("cs is %d\n", cs);
81//  if (!(debugger_access())) printf("cs is %d\n", cs);
8182 
8283   switch ( cs )
8384   {
8485      case 1:
8586         if (offset<0x100000/2)
86            return state->m_cpuregion[offset];
87            return m_cpuregion[offset];
8788         else
8889            logerror("%08x maincpu read access offset %08x mem_mask %04x cs %d\n", pc, offset*2, mem_mask, cs);
8990         break;
r14896r14897
99100         if ((offset>=base) && (offset<end))
100101         {
101102            offset-=base;
102            return(state->m_mainram[offset]);
103            return(m_mainram[offset]);
103104         }
104105         else if ((offset>=base2) && (offset<end2))
105106         {
r14896r14897
135136                  return 0x0000;
136137 
137138               case 0x1244:
138                  return ymz280b_r(state->m_ymz,0);
139                  return ymz280b_r(m_ymz,0);
139140 
140141               case 0x1246:
141                  return ymz280b_r(state->m_ymz,1);
142                  return ymz280b_r(m_ymz,1);
142143 
143144               default:
144145                  logerror("%08x maincpu read access offset %08x mem_mask %04x cs %d (LAMPS etc.)\n", pc, offset*2, mem_mask, cs);
r14896r14897
157158         if ((offset>=base) && (offset<end))
158159         {
159160            offset-=base;
160            return duart68681_r(state->m_duart,offset);
161            return duart68681_r(m_duart,offset);
161162         }
162163         else
163164         {
r14896r14897
180181   return 0x0000;
181182}
182183 
183static WRITE16_HANDLER( sc4_mem_w )
184WRITE16_MEMBER(sc4_state::sc4_mem_w)
184185{
185   sc4_state *state = space->machine().driver_data<sc4_state>();
186   int pc = cpu_get_pc(&space->device());
187   int cs = m68307_get_cs(state->m_maincpu, offset * 2);
186   int pc = cpu_get_pc(&space.device());
187   int cs = m68307_get_cs(m_maincpu, offset * 2);
188188   int base = 0, end = 0, base2 = 0, end2 = 0;
189189 
190190   switch ( cs )
r14896r14897
206206         if ((offset>=base) && (offset<end))
207207         {
208208            offset-=base;
209            COMBINE_DATA(&state->m_mainram[offset]);
209            COMBINE_DATA(&m_mainram[offset]);
210210         }
211211         else if ((offset>=base2) && (offset<end2))
212212         {
r14896r14897
215215            switch (offset << 1)
216216            {
217217               case 0x1248:
218                  ymz280b_w(state->m_ymz,0, data & 0xff);
218                  ymz280b_w(m_ymz,0, data & 0xff);
219219                  break;
220220 
221221               case 0x124a:
222                  ymz280b_w(state->m_ymz,1, data & 0xff);
222                  ymz280b_w(m_ymz,1, data & 0xff);
223223                  break;
224224 
225225 
r14896r14897
240240         if ((offset>=base) && (offset<end))
241241         {
242242            offset-=base;
243            duart68681_w(state->m_duart,offset,data&0x00ff);
243            duart68681_w(m_duart,offset,data&0x00ff);
244244         }
245245         else
246246         {
r14896r14897
258258   }
259259}
260260 
261static ADDRESS_MAP_START( sc4_map, AS_PROGRAM, 16, sc4_adder4_state )
262   AM_RANGE(0x0000000, 0xffffff) AM_READWRITE_LEGACY(sc4_mem_r, sc4_mem_w)
261static ADDRESS_MAP_START( sc4_map, AS_PROGRAM, 16, sc4_state )
262   AM_RANGE(0x0000000, 0xffffff) AM_READWRITE(sc4_mem_r, sc4_mem_w)
263263ADDRESS_MAP_END
264264 
265265static ADDRESS_MAP_START( sc4_adder4_map, AS_PROGRAM, 32, sc4_adder4_state )
src/mame/drivers/warpsped.c
r14896r14897
9090{
9191public:
9292   warpspeed_state(const machine_config &mconfig, device_type type, const char *tag)
93      : driver_device(mconfig, type, tag) { }
93      : driver_device(mconfig, type, tag) ,
94      m_videoram(*this, "videoram"),
95      m_workram(*this, "workram"){ }
9496
95   UINT8      *m_videoram;
97   required_shared_ptr<UINT8> m_videoram;
9698   tilemap_t   *m_text_tilemap;
9799   tilemap_t   *m_starfield_tilemap;
98   UINT8      *m_workram;
100   required_shared_ptr<UINT8> m_workram;
99101   UINT8      m_regs[0x28];
100102   DECLARE_WRITE8_MEMBER(warpspeed_hardware_w);
101103   DECLARE_WRITE8_MEMBER(warpspeed_vidram_w);
r14896r14897
110112{
111113   warpspeed_state *state = machine.driver_data<warpspeed_state>();
112114
113   UINT8 code = state->m_videoram[tile_index] & 0x3f;
115   UINT8 code = state->m_videoram.target()[tile_index] & 0x3f;
114116   SET_TILE_INFO(0, code, 0, 0);
115117}
116118
r14896r14897
127129WRITE8_MEMBER(warpspeed_state::warpspeed_vidram_w)
128130{
129131
130   m_videoram[offset] = data;
132   m_videoram.target()[offset] = data;
131133   m_text_tilemap->mark_tile_dirty(offset);
132134}
133135
r14896r14897
215217
216218static ADDRESS_MAP_START( warpspeed_map, AS_PROGRAM, 8, warpspeed_state )
217219   AM_RANGE(0x0000, 0x0dff) AM_ROM
218   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(warpspeed_vidram_w ) AM_BASE(m_videoram)
219   AM_RANGE(0x1c00, 0x1cff) AM_RAM AM_BASE(m_workram)
220   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(warpspeed_vidram_w ) AM_SHARE("videoram")
221   AM_RANGE(0x1c00, 0x1cff) AM_RAM AM_SHARE("workram")
220222ADDRESS_MAP_END
221223
222224static ADDRESS_MAP_START ( warpspeed_io_map, AS_IO, 8, warpspeed_state )
src/mame/drivers/gijoe.c
r14896r14897
142142   if (ACCESSING_BITS_0_7)
143143   {
144144      data &= 0xff;
145      soundlatch_w(space, 0, data);
145      soundlatch_byte_w(space, 0, data);
146146   }
147147}
148148
r14896r14897
153153
154154READ16_MEMBER(gijoe_state::sound_status_r)
155155{
156   return soundlatch2_r(space, 0);
156   return soundlatch2_byte_r(space, 0);
157157}
158158
159159static void sound_nmi( device_t *device )
r14896r14897
172172   AM_RANGE(0x160000, 0x160007) AM_DEVWRITE_LEGACY("k056832", k056832_b_word_w)                           // VSCCS (board dependent)
173173   AM_RANGE(0x170000, 0x170001) AM_WRITENOP                                    // Watchdog
174174   AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_BASE(m_workram)               // Main RAM.  Spec. 180000-1803ff, 180400-187fff
175   AM_RANGE(0x190000, 0x190fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
175   AM_RANGE(0x190000, 0x190fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
176176   AM_RANGE(0x1a0000, 0x1a001f) AM_DEVWRITE_LEGACY("k053251", k053251_lsb_w)
177177   AM_RANGE(0x1b0000, 0x1b003f) AM_DEVWRITE_LEGACY("k056832", k056832_word_w)
178178   AM_RANGE(0x1c000c, 0x1c000d) AM_WRITE(sound_cmd_w)
r14896r14897
197197   AM_RANGE(0x0000, 0xebff) AM_ROM
198198   AM_RANGE(0xf000, 0xf7ff) AM_RAM
199199   AM_RANGE(0xf800, 0xfa2f) AM_DEVREADWRITE("k054539", k054539_device, read, write)
200   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_w)
201   AM_RANGE(0xfc02, 0xfc02) AM_READ(soundlatch_r)
200   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_byte_w)
201   AM_RANGE(0xfc02, 0xfc02) AM_READ(soundlatch_byte_r)
202202ADDRESS_MAP_END
203203
204204static INPUT_PORTS_START( gijoe )
src/mame/drivers/tigeroad.c
r14896r14897
139139   else if ((prevpc == 0x27f8) || (prevpc == 0x511a) || (prevpc == 0x5142) || (prevpc == 0x516a))
140140   {
141141      /* The main CPU stuffs the byte for the soundlatch into 0xfffffd.*/
142      state->soundlatch_w(*space,2,state->m_ram16[0x3ffc/2]);
142      state->soundlatch_byte_w(*space,2,state->m_ram16[0x3ffc/2]);
143143   }
144144}
145145
r14896r14897
152152WRITE16_MEMBER(tigeroad_state::tigeroad_soundcmd_w)
153153{
154154   if (ACCESSING_BITS_8_15)
155      soundlatch_w(space,offset,data >> 8);
155      soundlatch_byte_w(space,offset,data >> 8);
156156}
157157
158158static WRITE8_DEVICE_HANDLER( msm5205_w )
r14896r14897
177177   AM_RANGE(0xfec000, 0xfec7ff) AM_RAM_WRITE(tigeroad_videoram_w) AM_BASE(m_videoram)
178178   AM_RANGE(0xfe8000, 0xfe8003) AM_WRITE(tigeroad_scroll_w)
179179   AM_RANGE(0xfe800e, 0xfe800f) AM_WRITEONLY    /* fe800e = watchdog or IRQ acknowledge */
180   AM_RANGE(0xff8200, 0xff867f) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
180   AM_RANGE(0xff8200, 0xff867f) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
181181   AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_BASE(m_ram16)
182182ADDRESS_MAP_END
183183
r14896r14897
187187   AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
188188   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r, ym2203_w)
189189   AM_RANGE(0xc000, 0xc7ff) AM_RAM
190   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
190   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
191191ADDRESS_MAP_END
192192
193193static ADDRESS_MAP_START( sound_port_map, AS_IO, 8, tigeroad_state )
194194   ADDRESS_MAP_GLOBAL_MASK(0xff)
195   AM_RANGE(0x7f, 0x7f) AM_WRITE(soundlatch2_w)
195   AM_RANGE(0x7f, 0x7f) AM_WRITE(soundlatch2_byte_w)
196196ADDRESS_MAP_END
197197
198198static ADDRESS_MAP_START( sample_map, AS_PROGRAM, 8, tigeroad_state )
r14896r14897
201201
202202static ADDRESS_MAP_START( sample_port_map, AS_IO, 8, tigeroad_state )
203203   ADDRESS_MAP_GLOBAL_MASK(0xff)
204   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_r)
204   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r)
205205   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("msm", msm5205_w)
206206ADDRESS_MAP_END
207207
src/mame/drivers/spaceg.c
r14896r14897
177177{
178178public:
179179   spaceg_state(const machine_config &mconfig, device_type type, const char *tag)
180      : driver_device(mconfig, type, tag) { }
180      : driver_device(mconfig, type, tag) ,
181      m_colorram(*this, "colorram"),
182      m_videoram(*this, "videoram"),
183      m_io9400(*this, "io9400"),
184      m_io9401(*this, "io9401"){ }
181185
182   UINT8 *  m_videoram;
183   UINT8 *  m_colorram;
184   UINT8 *  m_io9400;
185   UINT8 *  m_io9401;
186   required_shared_ptr<UINT8> m_colorram;
187   required_shared_ptr<UINT8> m_videoram;
188   required_shared_ptr<UINT8> m_io9400;
189   required_shared_ptr<UINT8> m_io9401;
186190   DECLARE_WRITE8_MEMBER(zvideoram_w);
187191   DECLARE_READ8_MEMBER(spaceg_colorram_r);
188192};
r14896r14897
222226
223227WRITE8_MEMBER(spaceg_state::zvideoram_w)
224228{
225   int col = m_colorram[0x400];
229   int col = m_colorram.target()[0x400];
226230   int xoff = *m_io9400 >> 5 & 7;
227231   UINT16 offset2 = (offset + 0x100) & 0x1fff;
228232   UINT16 sdata = data << (8 - xoff);
229   UINT16 vram_data = m_videoram[offset] << 8 | (m_videoram[offset2]);
233   UINT16 vram_data = m_videoram.target()[offset] << 8 | (m_videoram.target()[offset2]);
230234
231235   if (col > 0x0f) popmessage("color > 0x0f = %2d", col);
232236   col &= 0x0f;
233237
234   switch (*m_io9401)
238   switch (*m_io9401.target())
235239   {
236240      // draw
237241      case 0:
r14896r14897
241245         vram_data |= sdata;
242246
243247         // update colorram
244         if (sdata&0xff00) m_colorram[offset] = col;
245         if (sdata&0x00ff) m_colorram[offset2] = col;
248         if (sdata&0xff00) m_colorram.target()[offset] = col;
249         if (sdata&0x00ff) m_colorram.target()[offset2] = col;
246250         break;
247251
248252      // erase
r14896r14897
256260         return;
257261   }
258262
259   m_videoram[offset]=vram_data>>8;
260   m_videoram[offset2]=vram_data&0xff;
263   m_videoram.target()[offset]=vram_data>>8;
264   m_videoram.target()[offset2]=vram_data&0xff;
261265}
262266
263267
r14896r14897
267271
268272   if (offset < 0x400)
269273   {
270      rgbcolor = (m_colorram[offset] << 1) | ((offset &0x100) >> 8);
274      rgbcolor = (m_colorram.target()[offset] << 1) | ((offset &0x100) >> 8);
271275
272276      if ((offset >= 0x200) && (offset < 0x220)) /* 0xa200- 0xa21f */
273277      {
r14896r14897
288292   if (*m_io9401 != 0x40)
289293      logerror("colorram read in mode: 9401 = %02x (offset = %04x)\n", *m_io9401, offset);
290294
291   return m_colorram[offset];
295   return m_colorram.target()[offset];
292296}
293297
294298
r14896r14897
300304   for (offs = 0; offs < 0x2000; offs++)
301305   {
302306      int i;
303      UINT8 data = state->m_videoram[offs];
307      UINT8 data = state->m_videoram.target()[offs];
304308      int y = offs & 0xff;
305309      int x = (offs >> 8) << 3;
306310
307311      for (i = 0; i < 8; i++)
308312      {
309         bitmap.pix16(y, x) = (data & 0x80) ? state->m_colorram[offs] : 0;
313         bitmap.pix16(y, x) = (data & 0x80) ? state->m_colorram.target()[offs] : 0;
310314
311315         x++;
312316         data <<= 1;
r14896r14897
328332   AM_RANGE(0x3000, 0x3fff) AM_ROM
329333   AM_RANGE(0x7000, 0x77ff) AM_RAM
330334
331   AM_RANGE(0xa000, 0xbfff) AM_RAM_READ(spaceg_colorram_r) AM_BASE(m_colorram)
332   AM_RANGE(0xc000, 0xdfff) AM_RAM_WRITE(zvideoram_w) AM_BASE(m_videoram)
335   AM_RANGE(0xa000, 0xbfff) AM_RAM_READ(spaceg_colorram_r) AM_SHARE("colorram")
336   AM_RANGE(0xc000, 0xdfff) AM_RAM_WRITE(zvideoram_w) AM_SHARE("videoram")
333337
334   AM_RANGE(0x9400, 0x9400) AM_WRITEONLY AM_BASE(m_io9400) /* gfx ctrl */
335   AM_RANGE(0x9401, 0x9401) AM_WRITEONLY AM_BASE(m_io9401) /* gfx ctrl */
338   AM_RANGE(0x9400, 0x9400) AM_WRITEONLY AM_SHARE("io9400") /* gfx ctrl */
339   AM_RANGE(0x9401, 0x9401) AM_WRITEONLY AM_SHARE("io9401") /* gfx ctrl */
336340   /* 9402 -
337341        bits 0 and 1 probably control the lamps under the player 1 and player 2 start buttons
338342        bit 2 - unknown -
src/mame/drivers/gei.c
r14896r14897
208208   set_led_status(device->machine(), 9,data & 0x08);
209209
210210   /* bit 5 - ticket out in trivia games */
211   ticket_dispenser_w(device->machine().device("ticket"), 0, (data & 0x20)<< 2);
211   device->machine().device<ticket_dispenser_device>("ticket")->write(*device->machine().memory().first_space(), 0, (data & 0x20)<< 2);
212212
213213   /* bit 6 enables NMI */
214214   state->m_nmi_mask = data & 0x40;
r14896r14897
615615   PORT_START("IN0")
616616   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
617617   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
618   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)      /* ticket status */
618   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)      /* ticket status */
619619   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
620620   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
621621   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14896r14897
723723   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x00) PORT_NAME ("Start in no coins mode")
724724   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x40)
725725   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x00)
726   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)      /* ticket status */
726   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)      /* ticket status */
727727   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
728728   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
729729   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14896r14897
900900   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x00) PORT_NAME ("Start in no coins mode")
901901   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x40)
902902   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x00)
903   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)      /* ticket status */
903   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)      /* ticket status */
904904   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
905905   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
906906   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14896r14897
10061006   PORT_MODIFY("IN0")
10071007   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
10081008   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
1009   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)      /* ticket status */
1009   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)      /* ticket status */
10101010   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
10111011   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
10121012   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14896r14897
11351135
11361136   MCFG_PPI8255_ADD( "ppi8255_0", getrivia_ppi8255_intf[0] )
11371137   MCFG_PPI8255_ADD( "ppi8255_1", getrivia_ppi8255_intf[1] )
1138   MCFG_TICKET_DISPENSER_ADD("ticket", 100, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
1138   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
11391139
11401140   /* sound hardware */
11411141   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/segas32.c
r14896r14897
508508}
509509
510510
511static READ16_HANDLER( interrupt_control_16_r )
511READ16_MEMBER(segas32_state::interrupt_control_16_r)
512512{
513513   switch (offset)
514514   {
r14896r14897
526526}
527527
528528
529static WRITE16_HANDLER( interrupt_control_16_w )
529WRITE16_MEMBER(segas32_state::interrupt_control_16_w)
530530{
531531   if (ACCESSING_BITS_0_7)
532      int_control_w(space, offset*2+0, data);
532      int_control_w(&space, offset*2+0, data);
533533   if (ACCESSING_BITS_8_15)
534      int_control_w(space, offset*2+1, data >> 8);
534      int_control_w(&space, offset*2+1, data >> 8);
535535}
536536
537537
538static READ32_HANDLER( interrupt_control_32_r )
538READ32_MEMBER(segas32_state::interrupt_control_32_r)
539539{
540540   switch (offset)
541541   {
r14896r14897
549549}
550550
551551
552static WRITE32_HANDLER( interrupt_control_32_w )
552WRITE32_MEMBER(segas32_state::interrupt_control_32_w)
553553{
554554   if (ACCESSING_BITS_0_7)
555      int_control_w(space, offset*4+0, data);
555      int_control_w(&space, offset*4+0, data);
556556   if (ACCESSING_BITS_8_15)
557      int_control_w(space, offset*4+1, data >> 8);
557      int_control_w(&space, offset*4+1, data >> 8);
558558   if (ACCESSING_BITS_16_23)
559      int_control_w(space, offset*4+2, data >> 16);
559      int_control_w(&space, offset*4+2, data >> 16);
560560   if (ACCESSING_BITS_24_31)
561      int_control_w(space, offset*4+3, data >> 24);
561      int_control_w(&space, offset*4+3, data >> 24);
562562}
563563
564564
r14896r14897
708708}
709709
710710
711static READ16_HANDLER( io_chip_r )
711READ16_MEMBER(segas32_state::io_chip_r)
712712{
713   return common_io_chip_r(space, 0, offset, mem_mask);
713   return common_io_chip_r(&space, 0, offset, mem_mask);
714714}
715715
716716
717static WRITE16_HANDLER( io_chip_w )
717WRITE16_MEMBER(segas32_state::io_chip_w)
718718{
719   common_io_chip_w(space, 0, offset, data, mem_mask);
719   common_io_chip_w(&space, 0, offset, data, mem_mask);
720720}
721721
722722
723static READ32_HANDLER( io_chip_0_r )
723READ32_MEMBER(segas32_state::io_chip_0_r)
724724{
725   return common_io_chip_r(space, 0, offset*2+0, mem_mask) |
726         (common_io_chip_r(space, 0, offset*2+1, mem_mask >> 16) << 16);
725   return common_io_chip_r(&space, 0, offset*2+0, mem_mask) |
726         (common_io_chip_r(&space, 0, offset*2+1, mem_mask >> 16) << 16);
727727}
728728
729729
730static WRITE32_HANDLER( io_chip_0_w )
730WRITE32_MEMBER(segas32_state::io_chip_0_w)
731731{
732732   if (ACCESSING_BITS_0_15)
733      common_io_chip_w(space, 0, offset*2+0, data, mem_mask);
733      common_io_chip_w(&space, 0, offset*2+0, data, mem_mask);
734734   if (ACCESSING_BITS_16_31)
735      common_io_chip_w(space, 0, offset*2+1, data >> 16, mem_mask >> 16);
735      common_io_chip_w(&space, 0, offset*2+1, data >> 16, mem_mask >> 16);
736736}
737737
738738
739static READ32_HANDLER( io_chip_1_r )
739READ32_MEMBER(segas32_state::io_chip_1_r)
740740{
741   return common_io_chip_r(space, 1, offset*2+0, mem_mask) |
742         (common_io_chip_r(space, 1, offset*2+1, mem_mask >> 16) << 16);
741   return common_io_chip_r(&space, 1, offset*2+0, mem_mask) |
742         (common_io_chip_r(&space, 1, offset*2+1, mem_mask >> 16) << 16);
743743}
744744
745745
746static WRITE32_HANDLER( io_chip_1_w )
746WRITE32_MEMBER(segas32_state::io_chip_1_w)
747747{
748748   if (ACCESSING_BITS_0_15)
749      common_io_chip_w(space, 1, offset*2+0, data, mem_mask);
749      common_io_chip_w(&space, 1, offset*2+0, data, mem_mask);
750750   if (ACCESSING_BITS_16_31)
751      common_io_chip_w(space, 1, offset*2+1, data >> 16, mem_mask >> 16);
751      common_io_chip_w(&space, 1, offset*2+1, data >> 16, mem_mask >> 16);
752752}
753753
754754
r14896r14897
759759 *
760760 *************************************/
761761
762static READ16_HANDLER( io_expansion_r )
762READ16_MEMBER(segas32_state::io_expansion_r)
763763{
764   segas32_state *state = space->machine().driver_data<segas32_state>();
765   if (state->m_custom_io_r[0])
766      return (*state->m_custom_io_r[0])(space, offset, mem_mask);
764   if (!m_custom_io_r[0].isnull())
765      return (m_custom_io_r[0])(space, offset, mem_mask);
767766   else
768      logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space->device()), offset);
767      logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space.device()), offset);
769768   return 0xffff;
770769}
771770
772771
773static WRITE16_HANDLER( io_expansion_w )
772WRITE16_MEMBER(segas32_state::io_expansion_w)
774773{
775   segas32_state *state = space->machine().driver_data<segas32_state>();
776774   /* only LSB matters */
777775   if (!ACCESSING_BITS_0_7)
778776   return;
779777
780   if (state->m_custom_io_w[0])
781      (*state->m_custom_io_w[0])(space, offset, data, mem_mask);
778   if (!m_custom_io_w[0].isnull())
779      (m_custom_io_w[0])(space, offset, data, mem_mask);
782780   else
783      logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space->device()), offset, data & 0xff);
781      logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
784782}
785783
786784
787static READ32_HANDLER( io_expansion_0_r )
785READ32_MEMBER(segas32_state::io_expansion_0_r)
788786{
789   segas32_state *state = space->machine().driver_data<segas32_state>();
790   if (state->m_custom_io_r[0])
791      return (*state->m_custom_io_r[0])(space, offset*2+0, mem_mask) |
792           ((*state->m_custom_io_r[0])(space, offset*2+1, mem_mask >> 16) << 16);
787   if (!m_custom_io_r[0].isnull())
788      return (m_custom_io_r[0])(space, offset*2+0, mem_mask) |
789           ((m_custom_io_r[0])(space, offset*2+1, mem_mask >> 16) << 16);
793790   else
794      logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space->device()), offset);
791      logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space.device()), offset);
795792   return 0xffffffff;
796793}
797794
798795
799static WRITE32_HANDLER( io_expansion_0_w )
796WRITE32_MEMBER(segas32_state::io_expansion_0_w)
800797{
801   segas32_state *state = space->machine().driver_data<segas32_state>();
802798   /* only LSB matters */
803799
804800
805801   if (ACCESSING_BITS_0_7)
806802   {
807803      /* harddunk uses bits 4,5 for output lamps */
808      if (state->m_sw3_output)
809         state->m_sw3_output(0, data & 0xff);
804      if (m_sw3_output)
805         m_sw3_output(0, data & 0xff);
810806
811      if (state->m_custom_io_w[0])
812         (*state->m_custom_io_w[0])(space, offset*2+0, data, mem_mask);
807      if (!m_custom_io_w[0].isnull())
808         (m_custom_io_w[0])(space, offset*2+0, data, mem_mask);
813809      else
814         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space->device()), offset, data & 0xff);
810         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
815811
816812   }
817813   if (ACCESSING_BITS_16_23)
818814   {
819      if (state->m_custom_io_w[0])
820         (*state->m_custom_io_w[0])(space, offset*2+1, data >> 16, mem_mask >> 16);
815      if (!m_custom_io_w[0].isnull())
816         (m_custom_io_w[0])(space, offset*2+1, data >> 16, mem_mask >> 16);
821817      else
822         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space->device()), offset, data & 0xff);
818         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
823819   }
824820}
825821
826822
827static READ32_HANDLER( io_expansion_1_r )
823READ32_MEMBER(segas32_state::io_expansion_1_r)
828824{
829   segas32_state *state = space->machine().driver_data<segas32_state>();
830   if (state->m_custom_io_r[1])
831      return (*state->m_custom_io_r[1])(space, offset*2+0, mem_mask) |
832           ((*state->m_custom_io_r[1])(space, offset*2+1, mem_mask >> 16) << 16);
825   if (!m_custom_io_r[1].isnull())
826      return (m_custom_io_r[1])(space, offset*2+0, mem_mask) |
827           ((m_custom_io_r[1])(space, offset*2+1, mem_mask >> 16) << 16);
833828   else
834      logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space->device()), offset);
829      logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space.device()), offset);
835830   return 0xffffffff;
836831}
837832
838833
839static WRITE32_HANDLER( io_expansion_1_w )
834WRITE32_MEMBER(segas32_state::io_expansion_1_w)
840835{
841   segas32_state *state = space->machine().driver_data<segas32_state>();
842836   /* only LSB matters */
843837   if (ACCESSING_BITS_0_7)
844838   {
845      if (state->m_custom_io_w[1])
846         (*state->m_custom_io_w[1])(space, offset*2+0, data, mem_mask);
839      if (!m_custom_io_w[1].isnull())
840         (m_custom_io_w[1])(space, offset*2+0, data, mem_mask);
847841      else
848         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space->device()), offset, data & 0xff);
842         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
849843   }
850844   if (ACCESSING_BITS_16_23)
851845   {
852      if (state->m_custom_io_w[1])
853         (*state->m_custom_io_w[1])(space, offset*2+1, data >> 16, mem_mask >> 16);
846      if (!m_custom_io_w[1].isnull())
847         (m_custom_io_w[1])(space, offset*2+1, data >> 16, mem_mask >> 16);
854848      else
855         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space->device()), offset, data & 0xff);
849         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
856850   }
857851}
858852
r14896r14897
864858 *
865859 *************************************/
866860
867static READ16_HANDLER( analog_custom_io_r )
861READ16_MEMBER(segas32_state::analog_custom_io_r)
868862{
869   segas32_state *state = space->machine().driver_data<segas32_state>();
870863   UINT16 result;
871864   switch (offset)
872865   {
r14896r14897
874867      case 0x12/2:
875868      case 0x14/2:
876869      case 0x16/2:
877         result = state->m_analog_value[offset & 3] | 0x7f;
878         state->m_analog_value[offset & 3] <<= 1;
870         result = m_analog_value[offset & 3] | 0x7f;
871         m_analog_value[offset & 3] <<= 1;
879872         return result;
880873   }
881   logerror("%06X:unknown analog_custom_io_r(%X) & %04X\n", cpu_get_pc(&space->device()), offset*2, mem_mask);
874   logerror("%06X:unknown analog_custom_io_r(%X) & %04X\n", cpu_get_pc(&space.device()), offset*2, mem_mask);
882875   return 0xffff;
883876}
884877
885878
886static WRITE16_HANDLER( analog_custom_io_w )
879WRITE16_MEMBER(segas32_state::analog_custom_io_w)
887880{
888   segas32_state *state = space->machine().driver_data<segas32_state>();
889881   static const char *const names[] = { "ANALOG1", "ANALOG2", "ANALOG3", "ANALOG4" };
890882   switch (offset)
891883   {
r14896r14897
893885      case 0x12/2:
894886      case 0x14/2:
895887      case 0x16/2:
896         state->m_analog_value[offset & 3] = input_port_read_safe(space->machine(), names[offset & 3], 0);
888         m_analog_value[offset & 3] = input_port_read_safe(machine(), names[offset & 3], 0);
897889         return;
898890   }
899   logerror("%06X:unknown analog_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space->device()), offset*2, data, mem_mask);
891   logerror("%06X:unknown analog_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
900892}
901893
902894
903static READ16_HANDLER( extra_custom_io_r )
895READ16_MEMBER(segas32_state::extra_custom_io_r)
904896{
905897   static const char *const names[] = { "EXTRA1", "EXTRA2", "EXTRA3", "EXTRA4" };
906898   switch (offset)
r14896r14897
909901      case 0x22/2:
910902      case 0x24/2:
911903      case 0x26/2:
912         return input_port_read_safe(space->machine(), names[offset & 3], 0xffff);
904         return input_port_read_safe(machine(), names[offset & 3], 0xffff);
913905   }
914906
915   logerror("%06X:unknown extra_custom_io_r(%X) & %04X\n", cpu_get_pc(&space->device()), offset*2, mem_mask);
907   logerror("%06X:unknown extra_custom_io_r(%X) & %04X\n", cpu_get_pc(&space.device()), offset*2, mem_mask);
916908   return 0xffff;
917909}
918910
919911
920static WRITE16_HANDLER( orunners_custom_io_w )
912WRITE16_MEMBER(segas32_state::orunners_custom_io_w)
921913{
922   segas32_state *state = space->machine().driver_data<segas32_state>();
923914   static const char *const names[] = { "ANALOG1", "ANALOG2", "ANALOG3", "ANALOG4", "ANALOG5", "ANALOG6", "ANALOG7", "ANALOG8" };
924915   switch (offset)
925916   {
r14896r14897
927918      case 0x12/2:
928919      case 0x14/2:
929920      case 0x16/2:
930         state->m_analog_value[offset & 3] = input_port_read_safe(space->machine(), names[state->m_analog_bank * 4 + (offset & 3)], 0);
921         m_analog_value[offset & 3] = input_port_read_safe(machine(), names[m_analog_bank * 4 + (offset & 3)], 0);
931922         return;
932923
933924      case 0x20/2:
934         state->m_analog_bank = data & 1;
925         m_analog_bank = data & 1;
935926         return;
936927   }
937   logerror("%06X:unknown orunners_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space->device()), offset*2, data, mem_mask);
928   logerror("%06X:unknown orunners_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
938929}
939930
940931
941static READ16_HANDLER( sonic_custom_io_r )
932READ16_MEMBER(segas32_state::sonic_custom_io_r)
942933{
943   segas32_state *state = space->machine().driver_data<segas32_state>();
944934   static const char *const names[] = { "TRACKX1", "TRACKY1", "TRACKX2", "TRACKY2", "TRACKX3", "TRACKY3" };
945935
946936   switch (offset)
r14896r14897
951941      case 0x0c/2:
952942      case 0x10/2:
953943      case 0x14/2:
954         return (UINT8)(input_port_read(space->machine(), names[offset/2]) - state->m_sonic_last[offset/2]);
944         return (UINT8)(input_port_read(machine(), names[offset/2]) - m_sonic_last[offset/2]);
955945   }
956946
957   logerror("%06X:unknown sonic_custom_io_r(%X) & %04X\n", cpu_get_pc(&space->device()), offset*2, mem_mask);
947   logerror("%06X:unknown sonic_custom_io_r(%X) & %04X\n", cpu_get_pc(&space.device()), offset*2, mem_mask);
958948   return 0xffff;
959949}
960950
961951
962static WRITE16_HANDLER( sonic_custom_io_w )
952WRITE16_MEMBER(segas32_state::sonic_custom_io_w)
963953{
964   segas32_state *state = space->machine().driver_data<segas32_state>();
965954   static const char *const names[] = { "TRACKX1", "TRACKY1", "TRACKX2", "TRACKY2", "TRACKX3", "TRACKY3" };
966955
967956   switch (offset)
r14896r14897
969958      case 0x00/2:
970959      case 0x08/2:
971960      case 0x10/2:
972         state->m_sonic_last[offset/2 + 0] = input_port_read(space->machine(), names[offset/2 + 0]);
973         state->m_sonic_last[offset/2 + 1] = input_port_read(space->machine(), names[offset/2 + 1]);
961         m_sonic_last[offset/2 + 0] = input_port_read(machine(), names[offset/2 + 0]);
962         m_sonic_last[offset/2 + 1] = input_port_read(machine(), names[offset/2 + 1]);
974963         return;
975964   }
976965
977   logerror("%06X:unknown sonic_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space->device()), offset*2, data, mem_mask);
966   logerror("%06X:unknown sonic_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
978967}
979968
980969
r14896r14897
985974 *
986975 *************************************/
987976
988static WRITE16_HANDLER( random_number_16_w )
977WRITE16_MEMBER(segas32_state::random_number_16_w)
989978{
990//  mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", cpu_get_pc(&space->device()), offset*2, data, mem_mask);
979//  mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
991980}
992981
993static READ16_HANDLER( random_number_16_r )
982READ16_MEMBER(segas32_state::random_number_16_r)
994983{
995   return space->machine().rand();
984   return machine().rand();
996985}
997986
998static WRITE32_HANDLER( random_number_32_w )
987WRITE32_MEMBER(segas32_state::random_number_32_w)
999988{
1000//  mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", cpu_get_pc(&space->device()), offset*2, data, mem_mask);
989//  mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
1001990}
1002991
1003static READ32_HANDLER( random_number_32_r )
992READ32_MEMBER(segas32_state::random_number_32_r)
1004993{
1005   return space->machine().rand() ^ (space->machine().rand() << 16);
994   return machine().rand() ^ (machine().rand() << 16);
1006995}
1007996
1008997
r14896r14897
10131002 *
10141003 *************************************/
10151004
1016static READ16_HANDLER( shared_ram_16_r )
1005READ16_MEMBER(segas32_state::shared_ram_16_r)
10171006{
1018   segas32_state *state = space->machine().driver_data<segas32_state>();
1019   return state->m_z80_shared_ram[offset*2+0] | (state->m_z80_shared_ram[offset*2+1] << 8);
1007   return m_z80_shared_ram[offset*2+0] | (m_z80_shared_ram[offset*2+1] << 8);
10201008}
10211009
10221010
1023static WRITE16_HANDLER( shared_ram_16_w )
1011WRITE16_MEMBER(segas32_state::shared_ram_16_w)
10241012{
1025   segas32_state *state = space->machine().driver_data<segas32_state>();
10261013   if (ACCESSING_BITS_0_7)
1027      state->m_z80_shared_ram[offset*2+0] = data;
1014      m_z80_shared_ram[offset*2+0] = data;
10281015   if (ACCESSING_BITS_8_15)
1029      state->m_z80_shared_ram[offset*2+1] = data >> 8;
1016      m_z80_shared_ram[offset*2+1] = data >> 8;
10301017}
10311018
10321019
1033static READ32_HANDLER( shared_ram_32_r )
1020READ32_MEMBER(segas32_state::shared_ram_32_r)
10341021{
1035   segas32_state *state = space->machine().driver_data<segas32_state>();
1036   return state->m_z80_shared_ram[offset*4+0] | (state->m_z80_shared_ram[offset*4+1] << 8) |
1037         (state->m_z80_shared_ram[offset*4+2] << 16) | (state->m_z80_shared_ram[offset*4+3] << 24);
1022   return m_z80_shared_ram[offset*4+0] | (m_z80_shared_ram[offset*4+1] << 8) |
1023         (m_z80_shared_ram[offset*4+2] << 16) | (m_z80_shared_ram[offset*4+3] << 24);
10381024}
10391025
10401026
1041static WRITE32_HANDLER( shared_ram_32_w )
1027WRITE32_MEMBER(segas32_state::shared_ram_32_w)
10421028{
1043   segas32_state *state = space->machine().driver_data<segas32_state>();
10441029   if (ACCESSING_BITS_0_7)
1045      state->m_z80_shared_ram[offset*4+0] = data;
1030      m_z80_shared_ram[offset*4+0] = data;
10461031   if (ACCESSING_BITS_8_15)
1047      state->m_z80_shared_ram[offset*4+1] = data >> 8;
1032      m_z80_shared_ram[offset*4+1] = data >> 8;
10481033   if (ACCESSING_BITS_16_23)
1049      state->m_z80_shared_ram[offset*4+2] = data >> 16;
1034      m_z80_shared_ram[offset*4+2] = data >> 16;
10501035   if (ACCESSING_BITS_24_31)
1051      state->m_z80_shared_ram[offset*4+3] = data >> 24;
1036      m_z80_shared_ram[offset*4+3] = data >> 24;
10521037}
10531038
10541039
r14896r14897
11041089}
11051090
11061091
1107static WRITE8_HANDLER( sound_int_control_lo_w )
1092WRITE8_MEMBER(segas32_state::sound_int_control_lo_w)
11081093{
1109   segas32_state *state = space->machine().driver_data<segas32_state>();
11101094   /* odd offsets are interrupt acks */
11111095   if (offset & 1)
11121096   {
1113      state->m_sound_irq_input &= data;
1114      update_sound_irq_state(space->machine());
1097      m_sound_irq_input &= data;
1098      update_sound_irq_state(machine());
11151099   }
11161100
11171101   /* high offsets signal an IRQ to the v60 */
11181102   if (offset & 4)
1119      signal_v60_irq(space->machine(), MAIN_IRQ_SOUND);
1103      signal_v60_irq(machine(), MAIN_IRQ_SOUND);
11201104}
11211105
11221106
1123static WRITE8_HANDLER( sound_int_control_hi_w )
1107WRITE8_MEMBER(segas32_state::sound_int_control_hi_w)
11241108{
1125   segas32_state *state = space->machine().driver_data<segas32_state>();
1126   state->m_sound_irq_control[offset] = data;
1127   update_sound_irq_state(space->machine());
1109   m_sound_irq_control[offset] = data;
1110   update_sound_irq_state(machine());
11281111}
11291112
11301113
r14896r14897
11441127 *
11451128 *************************************/
11461129
1147static WRITE8_HANDLER( sound_bank_lo_w )
1130WRITE8_MEMBER(segas32_state::sound_bank_lo_w)
11481131{
1149   segas32_state *state = space->machine().driver_data<segas32_state>();
1150   state->m_sound_bank = (state->m_sound_bank & ~0x3f) | (data & 0x3f);
1151   memory_set_bankptr(space->machine(), "bank1", space->machine().region("soundcpu")->base() + 0x100000 + 0x2000 * state->m_sound_bank);
1132   m_sound_bank = (m_sound_bank & ~0x3f) | (data & 0x3f);
1133   memory_set_bankptr(machine(), "bank1", machine().region("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
11521134}
11531135
11541136
1155static WRITE8_HANDLER( sound_bank_hi_w )
1137WRITE8_MEMBER(segas32_state::sound_bank_hi_w)
11561138{
1157   segas32_state *state = space->machine().driver_data<segas32_state>();
1158   state->m_sound_bank = (state->m_sound_bank & 0x3f) | ((data & 0x04) << 4) | ((data & 0x03) << 7);
1159   memory_set_bankptr(space->machine(), "bank1", space->machine().region("soundcpu")->base() + 0x100000 + 0x2000 * state->m_sound_bank);
1139   m_sound_bank = (m_sound_bank & 0x3f) | ((data & 0x04) << 4) | ((data & 0x03) << 7);
1140   memory_set_bankptr(machine(), "bank1", machine().region("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
11601141}
11611142
11621143
r14896r14897
11791160 *
11801161 *************************************/
11811162
1182static READ8_HANDLER( sound_dummy_r )
1163READ8_MEMBER(segas32_state::sound_dummy_r)
11831164{
1184   segas32_state *state = space->machine().driver_data<segas32_state>();
1185   return state->m_sound_dummy_value;
1165   return m_sound_dummy_value;
11861166}
11871167
11881168
1189static WRITE8_HANDLER( sound_dummy_w )
1169WRITE8_MEMBER(segas32_state::sound_dummy_w)
11901170{
1191   segas32_state *state = space->machine().driver_data<segas32_state>();
1192   state->m_sound_dummy_value = data;
1171   m_sound_dummy_value = data;
11931172}
11941173
11951174
r14896r14897
12091188   AM_RANGE(0x500000, 0x50000f) AM_MIRROR(0x0ffff0) AM_READWRITE(system32_sprite_control_r, system32_sprite_control_w)
12101189   AM_RANGE(0x600000, 0x60ffff) AM_MIRROR(0x0e0000) AM_READWRITE(system32_paletteram_r, system32_paletteram_w) AM_BASE(m_system32_paletteram[0])
12111190   AM_RANGE(0x610000, 0x61007f) AM_MIRROR(0x0eff80) AM_READWRITE(system32_mixer_r, system32_mixer_w)
1212   AM_RANGE(0x700000, 0x701fff) AM_MIRROR(0x0fe000) AM_READWRITE_LEGACY(shared_ram_16_r, shared_ram_16_w)
1213   AM_RANGE(0xc00000, 0xc0001f) AM_MIRROR(0x0fff80) AM_READWRITE_LEGACY(io_chip_r, io_chip_w)
1214   AM_RANGE(0xc00040, 0xc0007f) AM_MIRROR(0x0fff80) AM_READWRITE_LEGACY(io_expansion_r, io_expansion_w)
1215   AM_RANGE(0xd00000, 0xd0000f) AM_MIRROR(0x07fff0) AM_READWRITE_LEGACY(interrupt_control_16_r, interrupt_control_16_w)
1216   AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE_LEGACY(random_number_16_r, random_number_16_w)
1191   AM_RANGE(0x700000, 0x701fff) AM_MIRROR(0x0fe000) AM_READWRITE(shared_ram_16_r, shared_ram_16_w)
1192   AM_RANGE(0xc00000, 0xc0001f) AM_MIRROR(0x0fff80) AM_READWRITE(io_chip_r, io_chip_w)
1193   AM_RANGE(0xc00040, 0xc0007f) AM_MIRROR(0x0fff80) AM_READWRITE(io_expansion_r, io_expansion_w)
1194   AM_RANGE(0xd00000, 0xd0000f) AM_MIRROR(0x07fff0) AM_READWRITE(interrupt_control_16_r, interrupt_control_16_w)
1195   AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE(random_number_16_r, random_number_16_w)
12171196   AM_RANGE(0xf00000, 0xffffff) AM_ROM AM_REGION("maincpu", 0)
12181197ADDRESS_MAP_END
12191198
r14896r14897
12301209   AM_RANGE(0x610000, 0x61007f) AM_MIRROR(0x06ff80) AM_WRITE(multi32_mixer_0_w)
12311210   AM_RANGE(0x680000, 0x68ffff) AM_MIRROR(0x060000) AM_READWRITE(multi32_paletteram_1_r, multi32_paletteram_1_w) AM_BASE(m_system32_paletteram[1])
12321211   AM_RANGE(0x690000, 0x69007f) AM_MIRROR(0x06ff80) AM_WRITE(multi32_mixer_1_w)
1233   AM_RANGE(0x700000, 0x701fff) AM_MIRROR(0x0fe000) AM_READWRITE_LEGACY(shared_ram_32_r, shared_ram_32_w)
1234   AM_RANGE(0xc00000, 0xc0001f) AM_MIRROR(0x07ff80) AM_READWRITE_LEGACY(io_chip_0_r, io_chip_0_w)
1235   AM_RANGE(0xc00040, 0xc0007f) AM_MIRROR(0x07ff80) AM_READWRITE_LEGACY(io_expansion_0_r, io_expansion_0_w)
1236   AM_RANGE(0xc80000, 0xc8001f) AM_MIRROR(0x07ff80) AM_READWRITE_LEGACY(io_chip_1_r, io_chip_1_w)
1237   AM_RANGE(0xc80040, 0xc8007f) AM_MIRROR(0x07ff80) AM_READWRITE_LEGACY(io_expansion_1_r, io_expansion_1_w)
1238   AM_RANGE(0xd00000, 0xd0000f) AM_MIRROR(0x07fff0) AM_READWRITE_LEGACY(interrupt_control_32_r, interrupt_control_32_w)
1239   AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE_LEGACY(random_number_32_r, random_number_32_w)
1212   AM_RANGE(0x700000, 0x701fff) AM_MIRROR(0x0fe000) AM_READWRITE(shared_ram_32_r, shared_ram_32_w)
1213   AM_RANGE(0xc00000, 0xc0001f) AM_MIRROR(0x07ff80) AM_READWRITE(io_chip_0_r, io_chip_0_w)
1214   AM_RANGE(0xc00040, 0xc0007f) AM_MIRROR(0x07ff80) AM_READWRITE(io_expansion_0_r, io_expansion_0_w)
1215   AM_RANGE(0xc80000, 0xc8001f) AM_MIRROR(0x07ff80) AM_READWRITE(io_chip_1_r, io_chip_1_w)
1216   AM_RANGE(0xc80040, 0xc8007f) AM_MIRROR(0x07ff80) AM_READWRITE(io_expansion_1_r, io_expansion_1_w)
1217   AM_RANGE(0xd00000, 0xd0000f) AM_MIRROR(0x07fff0) AM_READWRITE(interrupt_control_32_r, interrupt_control_32_w)
1218   AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE(random_number_32_r, random_number_32_w)
12401219   AM_RANGE(0xf00000, 0xffffff) AM_ROM AM_REGION("maincpu", 0)
12411220ADDRESS_MAP_END
12421221
r14896r14897
12611240   ADDRESS_MAP_GLOBAL_MASK(0xff)
12621241   AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym1", ym3438_r, ym3438_w)
12631242   AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym2", ym3438_r, ym3438_w)
1264   AM_RANGE(0xa0, 0xaf) AM_WRITE_LEGACY(sound_bank_lo_w)
1265   AM_RANGE(0xb0, 0xbf) AM_WRITE_LEGACY(sound_bank_hi_w)
1266   AM_RANGE(0xc0, 0xcf) AM_WRITE_LEGACY(sound_int_control_lo_w)
1267   AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x04) AM_WRITE_LEGACY(sound_int_control_hi_w)
1268   AM_RANGE(0xf1, 0xf1) AM_READWRITE_LEGACY(sound_dummy_r, sound_dummy_w)
1243   AM_RANGE(0xa0, 0xaf) AM_WRITE(sound_bank_lo_w)
1244   AM_RANGE(0xb0, 0xbf) AM_WRITE(sound_bank_hi_w)
1245   AM_RANGE(0xc0, 0xcf) AM_WRITE(sound_int_control_lo_w)
1246   AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x04) AM_WRITE(sound_int_control_hi_w)
1247   AM_RANGE(0xf1, 0xf1) AM_READWRITE(sound_dummy_r, sound_dummy_w)
12691248ADDRESS_MAP_END
12701249
12711250
r14896r14897
12801259   ADDRESS_MAP_UNMAP_HIGH
12811260   ADDRESS_MAP_GLOBAL_MASK(0xff)
12821261   AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ymsnd", ym3438_r, ym3438_w)
1283   AM_RANGE(0xa0, 0xaf) AM_WRITE_LEGACY(sound_bank_lo_w)
1262   AM_RANGE(0xa0, 0xaf) AM_WRITE(sound_bank_lo_w)
12841263   AM_RANGE(0xb0, 0xbf) AM_DEVWRITE_LEGACY("sega", multipcm_bank_w)
1285   AM_RANGE(0xc0, 0xcf) AM_WRITE_LEGACY(sound_int_control_lo_w)
1286   AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x04) AM_WRITE_LEGACY(sound_int_control_hi_w)
1287   AM_RANGE(0xf1, 0xf1) AM_READWRITE_LEGACY(sound_dummy_r, sound_dummy_w)
1264   AM_RANGE(0xc0, 0xcf) AM_WRITE(sound_int_control_lo_w)
1265   AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x04) AM_WRITE(sound_int_control_hi_w)
1266   AM_RANGE(0xf1, 0xf1) AM_READWRITE(sound_dummy_r, sound_dummy_w)
12881267ADDRESS_MAP_END
12891268
12901269
r14896r14897
21392118// Both arescue and f1en appear to use an identical shared RAM system.
21402119
21412120
2142static WRITE16_HANDLER( dual_pcb_comms_w )
2121WRITE16_MEMBER(segas32_state::dual_pcb_comms_w)
21432122{
2144   segas32_state *state = space->machine().driver_data<segas32_state>();
2145   COMBINE_DATA(&state->m_dual_pcb_comms[offset]);
2123   COMBINE_DATA(&m_dual_pcb_comms[offset]);
21462124}
21472125
2148static READ16_HANDLER( dual_pcb_comms_r )
2126READ16_MEMBER(segas32_state::dual_pcb_comms_r)
21492127{
2150   segas32_state *state = space->machine().driver_data<segas32_state>();
2151   return state->m_dual_pcb_comms[offset];
2128   return m_dual_pcb_comms[offset];
21522129}
21532130
21542131
r14896r14897
21562133   Probably not a dip/solder link/trace cut, but maybe
21572134   just whichever way the cables are plugged in?
21582135   Both f1en and arescue master units try to set bit 1... */
2159static READ16_HANDLER( dual_pcb_masterslave )
2136READ16_MEMBER(segas32_state::dual_pcb_masterslave)
21602137{
21612138   return 0; // 0/1 master/slave
21622139}
r14896r14897
38343811 *
38353812 *************************************/
38363813
3837static void segas32_common_init(running_machine &machine, read16_space_func custom_r, write16_space_func custom_w)
3814static void segas32_common_init(running_machine &machine, read16_delegate custom_r, write16_delegate custom_w)
38383815{
38393816   segas32_state *state = machine.driver_data<segas32_state>();
38403817   /* reset the custom handlers and other pointers */
r14896r14897
40324009static DRIVER_INIT( alien3 )
40334010{
40344011   segas32_state *state = machine.driver_data<segas32_state>();
4035   segas32_common_init(machine, analog_custom_io_r, analog_custom_io_w);
4012   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
40364013   state->m_sw1_output = alien3_sw1_output;
40374014}
40384015
4039static READ16_HANDLER( arescue_handshake_r )
4016READ16_MEMBER(segas32_state::arescue_handshake_r)
40404017{
40414018   return 0;
40424019}
40434020
4044static READ16_HANDLER( arescue_slavebusy_r )
4021READ16_MEMBER(segas32_state::arescue_slavebusy_r)
40454022{
40464023   return 0x100; // prevents master trying to synch to slave.
40474024}
r14896r14897
40494026static DRIVER_INIT( arescue )
40504027{
40514028   segas32_state *state = machine.driver_data<segas32_state>();
4052   segas32_common_init(machine, analog_custom_io_r, analog_custom_io_w);
4029   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
40534030   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa00007, read16_delegate(FUNC(segas32_state::arescue_dsp_r),state), write16_delegate(FUNC(segas32_state::arescue_dsp_w),state));
40544031
40554032   state->m_dual_pcb_comms = auto_alloc_array(machine, UINT16, 0x1000/2);
4056   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x810000, 0x810fff, FUNC(dual_pcb_comms_r), FUNC(dual_pcb_comms_w));
4057   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x818000, 0x818003, FUNC(dual_pcb_masterslave));
4033   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),state), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),state));
4034   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_state::dual_pcb_masterslave),state));
40584035
4059   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x810000, 0x810001, FUNC(arescue_handshake_r));
4060   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x81000e, 0x81000f, FUNC(arescue_slavebusy_r));
4036   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x810000, 0x810001, read16_delegate(FUNC(segas32_state::arescue_handshake_r),state));
4037   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x81000e, 0x81000f, read16_delegate(FUNC(segas32_state::arescue_slavebusy_r),state));
40614038
40624039   state->m_sw1_output = arescue_sw1_output;
40634040}
r14896r14897
40654042
40664043static DRIVER_INIT( arabfgt )
40674044{
4068   segas32_common_init(machine, extra_custom_io_r, NULL);
4069
4070   /* install protection handlers */
40714045   segas32_state *state = machine.driver_data<segas32_state>();
4046   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::extra_custom_io_r),state), write16_delegate());
4047
4048   /* install protection handlers */   
40724049   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa00100, 0xa0011f, read16_delegate(FUNC(segas32_state::arf_wakeup_protection_r),state));
40734050   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa00fff, read16_delegate(FUNC(segas32_state::arabfgt_protection_r),state), write16_delegate(FUNC(segas32_state::arabfgt_protection_w),state));
40744051}
r14896r14897
40774054static DRIVER_INIT( brival )
40784055{
40794056   segas32_state *state = machine.driver_data<segas32_state>();
4080   segas32_common_init(machine, extra_custom_io_r, NULL);
4057   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::extra_custom_io_r),state), write16_delegate());
40814058
40824059   /* install protection handlers */
40834060   state->m_system32_protram = auto_alloc_array(machine, UINT16, 0x1000/2);
r14896r14897
40894066static DRIVER_INIT( darkedge )
40904067{
40914068   segas32_state *state = machine.driver_data<segas32_state>();
4092   segas32_common_init(machine, extra_custom_io_r, NULL);
4069   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::extra_custom_io_r),state), write16_delegate());
40934070
40944071   /* install protection handlers */
40954072   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa7ffff, read16_delegate(FUNC(segas32_state::darkedge_protection_r),state), write16_delegate(FUNC(segas32_state::darkedge_protection_w),state));
r14896r14897
40984075
40994076static DRIVER_INIT( dbzvrvs )
41004077{
4101   segas32_common_init(machine, NULL, NULL);
4078   segas32_common_init(machine, read16_delegate(), write16_delegate());
41024079
41034080   /* install protection handlers */
41044081   segas32_state *state = machine.driver_data<segas32_state>();
41054082   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa7ffff, read16_delegate(FUNC(segas32_state::dbzvrvs_protection_r),state), write16_delegate(FUNC(segas32_state::dbzvrvs_protection_w),state));
41064083}
41074084
4108static WRITE16_HANDLER( f1en_comms_echo_w )
4085WRITE16_MEMBER(segas32_state::f1en_comms_echo_w)
41094086{
41104087   // pretend that slave is following master op, enables attract mode video with sound
41114088   if (ACCESSING_BITS_0_7)
4112      space->write_byte( 0x810049, data );
4089      space.write_byte( 0x810049, data );
41134090}
41144091
41154092static DRIVER_INIT( f1en )
41164093{
41174094   segas32_state *state = machine.driver_data<segas32_state>();
4118   segas32_common_init(machine, analog_custom_io_r, analog_custom_io_w);
4095   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
41194096
41204097   state->m_dual_pcb_comms = auto_alloc_array(machine, UINT16, 0x1000/2);
4121   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x810000, 0x810fff, FUNC(dual_pcb_comms_r), FUNC(dual_pcb_comms_w));
4122   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x818000, 0x818003, FUNC(dual_pcb_masterslave));
4098   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),state), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),state));
4099   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_state::dual_pcb_masterslave),state));
41234100
4124   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x810048, 0x810049, FUNC(f1en_comms_echo_w));
4101   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x810048, 0x810049, write16_delegate(FUNC(segas32_state::f1en_comms_echo_w),state));
41254102
41264103   state->m_sw1_output = radm_sw1_output;
41274104}
r14896r14897
41304107static DRIVER_INIT( f1lap )
41314108{
41324109   segas32_state *state = machine.driver_data<segas32_state>();
4133   segas32_common_init(machine, analog_custom_io_r, analog_custom_io_w);
4110   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
41344111   state->m_sw1_output = f1lap_sw1_output;
41354112}
41364113
41374114
41384115static DRIVER_INIT( ga2 )
41394116{
4140   segas32_common_init(machine, extra_custom_io_r, NULL);
4141
4142   decrypt_ga2_protrom(machine);
41434117   segas32_state *state = machine.driver_data<segas32_state>();
4118   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::extra_custom_io_r),state), write16_delegate());
4119
4120   decrypt_ga2_protrom(machine);   
41444121   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa00fff, read16_delegate(FUNC(segas32_state::ga2_dpram_r),state), write16_delegate(FUNC(segas32_state::ga2_dpram_w),state));
41454122}
41464123
r14896r14897
41484125static DRIVER_INIT( harddunk )
41494126{
41504127   segas32_state *state = machine.driver_data<segas32_state>();
4151   segas32_common_init(machine, extra_custom_io_r, NULL);
4128   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::extra_custom_io_r),state), write16_delegate());
41524129   state->m_sw1_output = harddunk_sw1_output;
41534130   state->m_sw2_output = harddunk_sw2_output;
41544131   state->m_sw3_output = harddunk_sw3_output;
r14896r14897
41574134
41584135static DRIVER_INIT( holo )
41594136{
4160   segas32_common_init(machine, NULL, NULL);
4137   segas32_common_init(machine, read16_delegate(), write16_delegate());
41614138}
41624139
41634140
r14896r14897
41674144   /* Temp. Patch until we emulate the 'Drive Board', thanks to Malice */
41684145   UINT16 *pROM = (UINT16 *)machine.region("maincpu")->base();
41694146
4170   segas32_common_init(machine, analog_custom_io_r, analog_custom_io_w);
4147   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
41714148
41724149   pROM[0xC15A8/2] = 0xCD70;
41734150   pROM[0xC15AA/2] = 0xD8CD;
r14896r14897
41794156static DRIVER_INIT( orunners )
41804157{
41814158   segas32_state *state = machine.driver_data<segas32_state>();
4182   segas32_common_init(machine, analog_custom_io_r, orunners_custom_io_w);
4159   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::orunners_custom_io_w),state));
41834160   state->m_sw1_output = orunners_sw1_output;
41844161   state->m_sw2_output = orunners_sw2_output;
41854162}
r14896r14897
41884165static DRIVER_INIT( radm )
41894166{
41904167   segas32_state *state = machine.driver_data<segas32_state>();
4191   segas32_common_init(machine, analog_custom_io_r, analog_custom_io_w);
4168   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
41924169   state->m_sw1_output = radm_sw1_output;
41934170   state->m_sw2_output = radm_sw2_output;
41944171}
r14896r14897
41974174static DRIVER_INIT( radr )
41984175{
41994176   segas32_state *state = machine.driver_data<segas32_state>();
4200   segas32_common_init(machine, analog_custom_io_r, analog_custom_io_w);
4177   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
42014178   state->m_sw1_output = radm_sw1_output;
42024179   state->m_sw2_output = radr_sw2_output;
42034180}
r14896r14897
42074184{
42084185   segas32_state *state = machine.driver_data<segas32_state>();
42094186   multipcm_device *multipcm = machine.device<multipcm_device>("sega");
4210   segas32_common_init(machine, analog_custom_io_r, analog_custom_io_w);
4187   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
42114188   machine.device("soundcpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(*multipcm, 0xb0, 0xbf, FUNC(scross_bank_w));
42124189
42134190   state->m_sw1_output = scross_sw1_output;
r14896r14897
42174194
42184195static DRIVER_INIT( slipstrm )
42194196{
4220   segas32_common_init(machine, analog_custom_io_r, analog_custom_io_w);
4197   segas32_state *state = machine.driver_data<segas32_state>();
4198   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
42214199}
42224200
42234201
42244202static DRIVER_INIT( sonic )
42254203{
4226   segas32_common_init(machine, sonic_custom_io_r, sonic_custom_io_w);
4204   segas32_state *state = machine.driver_data<segas32_state>();
4205   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::sonic_custom_io_r),state), write16_delegate(FUNC(segas32_state::sonic_custom_io_w),state));
42274206
42284207   /* install protection handlers */
4229   segas32_state *state = machine.driver_data<segas32_state>();
42304208   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20E5C4, 0x20E5C5, write16_delegate(FUNC(segas32_state::sonic_level_load_protection),state));
42314209}
42324210
42334211
42344212static DRIVER_INIT( sonicp )
42354213{
4236   segas32_common_init(machine, sonic_custom_io_r, sonic_custom_io_w);
4214   segas32_state *state = machine.driver_data<segas32_state>();
4215   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::sonic_custom_io_r),state), write16_delegate(FUNC(segas32_state::sonic_custom_io_w),state));
42374216}
42384217
42394218
42404219static DRIVER_INIT( spidman )
42414220{
4242   segas32_common_init(machine, extra_custom_io_r, NULL);
4221   segas32_state *state = machine.driver_data<segas32_state>();
4222   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::extra_custom_io_r),state), write16_delegate());
42434223}
42444224
42454225
42464226static DRIVER_INIT( svf )
42474227{
4248   segas32_common_init(machine, NULL, NULL);
4228   segas32_common_init(machine, read16_delegate(), write16_delegate());
42494229}
42504230
42514231
42524232static DRIVER_INIT( jleague )
42534233{
4254   segas32_common_init(machine, NULL, NULL);
4234   segas32_common_init(machine, read16_delegate(), write16_delegate());
42554235   segas32_state *state = machine.driver_data<segas32_state>();
42564236   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20F700, 0x20F705, write16_delegate(FUNC(segas32_state::jleague_protection_w),state));
42574237}
r14896r14897
42604240static DRIVER_INIT( titlef )
42614241{
42624242   segas32_state *state = machine.driver_data<segas32_state>();
4263   segas32_common_init(machine, NULL, NULL);
4243   segas32_common_init(machine, read16_delegate(), write16_delegate());
42644244   state->m_sw1_output = titlef_sw1_output;
42654245   state->m_sw2_output = titlef_sw2_output;
42664246}
src/mame/drivers/looping.c
r14896r14897
9898{
9999public:
100100   looping_state(const machine_config &mconfig, device_type type, const char *tag)
101      : driver_device(mconfig, type, tag) { }
101      : driver_device(mconfig, type, tag) ,
102      m_videoram(*this, "videoram"),
103      m_colorram(*this, "colorram"),
104      m_spriteram(*this, "spriteram"){ }
102105
103106   /* memory pointers */
104   UINT8 *      m_videoram;
105   UINT8 *      m_colorram;
106   UINT8 *      m_spriteram;
107   required_shared_ptr<UINT8> m_videoram;
108   required_shared_ptr<UINT8> m_colorram;
109   required_shared_ptr<UINT8> m_spriteram;
107110   UINT8 *      m_cop_io;
108111
109112   /* tilemaps */
r14896r14897
189192static TILE_GET_INFO( get_tile_info )
190193{
191194   looping_state *state = machine.driver_data<looping_state>();
192   int tile_number = state->m_videoram[tile_index];
193   int color = state->m_colorram[(tile_index & 0x1f) * 2 + 1] & 0x07;
195   int tile_number = state->m_videoram.target()[tile_index];
196   int color = state->m_colorram.target()[(tile_index & 0x1f) * 2 + 1] & 0x07;
194197   SET_TILE_INFO(0, tile_number, color, 0);
195198}
196199
r14896r14897
214217
215218WRITE8_MEMBER(looping_state::flip_screen_x_w)
216219{
217   flip_screen_x_set(machine(), ~data & 0x01);
218   m_bg_tilemap->set_scrollx(0, flip_screen_get(machine()) ? 128 : 0);
220   flip_screen_x_set(~data & 0x01);
221   m_bg_tilemap->set_scrollx(0, flip_screen() ? 128 : 0);
219222}
220223
221224
222225WRITE8_MEMBER(looping_state::flip_screen_y_w)
223226{
224   flip_screen_y_set(machine(), ~data & 0x01);
225   m_bg_tilemap->set_scrollx(0, flip_screen_get(machine()) ? 128 : 0);
227   flip_screen_y_set(~data & 0x01);
228   m_bg_tilemap->set_scrollx(0, flip_screen() ? 128 : 0);
226229}
227230
228231
229232WRITE8_MEMBER(looping_state::looping_videoram_w)
230233{
231   m_videoram[offset] = data;
234   m_videoram.target()[offset] = data;
232235   m_bg_tilemap->mark_tile_dirty(offset);
233236}
234237
r14896r14897
237240{
238241   int i;
239242
240   m_colorram[offset] = data;
243   m_colorram.target()[offset] = data;
241244
242245   /* odd bytes are column color attribute */
243246   if (offset & 1)
r14896r14897
266269   const UINT8 *source;
267270   looping_state *state = machine.driver_data<looping_state>();
268271
269   for (source = state->m_spriteram; source < state->m_spriteram + 0x40; source += 4)
272   for (source = state->m_spriteram.target(); source < state->m_spriteram + 0x40; source += 4)
270273   {
271274      int sx = source[3];
272275      int sy = 240 - source[0];
r14896r14897
275278      int code  = source[1] & 0x3f;
276279      int color = source[2];
277280
278      if (flip_screen_x_get(machine))
281      if (state->flip_screen_x())
279282      {
280283         sx = 240 - sx;
281284         flipx = !flipx;
282285      }
283286
284      if (flip_screen_y_get(machine))
287      if (state->flip_screen_y())
285288      {
286289         sy = 240 - sy;
287290         flipy = !flipy;
r14896r14897
358361
359362WRITE8_MEMBER(looping_state::looping_soundlatch_w)
360363{
361   soundlatch_w(space, offset, data);
364   soundlatch_byte_w(space, offset, data);
362365   cputag_set_input_line_and_vector(machine(), "audiocpu", 0, ASSERT_LINE, 4);
363366}
364367
r14896r14897
496499static ADDRESS_MAP_START( looping_map, AS_PROGRAM, 8, looping_state )
497500   AM_RANGE(0x0000, 0x7fff) AM_ROM
498501
499   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(looping_videoram_w) AM_BASE(m_videoram)
502   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(looping_videoram_w) AM_SHARE("videoram")
500503
501   AM_RANGE(0x9800, 0x983f) AM_MIRROR(0x0700) AM_RAM_WRITE(looping_colorram_w) AM_BASE(m_colorram)
502   AM_RANGE(0x9840, 0x987f) AM_MIRROR(0x0700) AM_RAM AM_BASE(m_spriteram)
504   AM_RANGE(0x9800, 0x983f) AM_MIRROR(0x0700) AM_RAM_WRITE(looping_colorram_w) AM_SHARE("colorram")
505   AM_RANGE(0x9840, 0x987f) AM_MIRROR(0x0700) AM_RAM AM_SHARE("spriteram")
503506   AM_RANGE(0x9880, 0x98ff) AM_MIRROR(0x0700) AM_RAM
504507
505508   AM_RANGE(0xb001, 0xb001) AM_MIRROR(0x07f8) AM_WRITE(level2_irq_set)
r14896r14897
605608{
606609   AY8910_LEGACY_OUTPUT,
607610   AY8910_DEFAULT_LOADS,
608   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
611   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
609612   DEVCB_NULL,
610613   DEVCB_NULL,
611614   DEVCB_NULL
src/mame/drivers/1945kiii.c
r14896r14897
5353   k3_state(const machine_config &mconfig, device_type type, const char *tag)
5454      : driver_device(mconfig, type, tag),
5555        m_oki1(*this, "oki1"),
56        m_oki2(*this, "oki2") { }
56        m_oki2(*this, "oki2") ,
57      m_spriteram_1(*this, "spritera1"),
58      m_spriteram_2(*this, "spritera2"),
59      m_bgram(*this, "bgram"){ }
5760
61   /* devices */
62   required_device<okim6295_device> m_oki1;
63   required_device<okim6295_device> m_oki2;
5864   /* memory pointers */
59   UINT16 *  m_spriteram_1;
60   UINT16 *  m_spriteram_2;
61   UINT16 *  m_bgram;
65   required_shared_ptr<UINT16> m_spriteram_1;
66   required_shared_ptr<UINT16> m_spriteram_2;
67   required_shared_ptr<UINT16> m_bgram;
6268//  UINT16 *  m_paletteram16; // currently this uses generic palette handling
6369
6470   /* video-related */
6571   tilemap_t  *m_bg_tilemap;
6672
67   /* devices */
68   required_device<okim6295_device> m_oki1;
69   required_device<okim6295_device> m_oki2;
7073   DECLARE_WRITE16_MEMBER(k3_bgram_w);
7174   DECLARE_WRITE16_MEMBER(k3_scrollx_w);
7275   DECLARE_WRITE16_MEMBER(k3_scrolly_w);
r14896r14897
7679
7780WRITE16_MEMBER(k3_state::k3_bgram_w)
7881{
79   COMBINE_DATA(&m_bgram[offset]);
82   COMBINE_DATA(&m_bgram.target()[offset]);
8083   m_bg_tilemap->mark_tile_dirty(offset);
8184}
8285
8386static TILE_GET_INFO( get_k3_bg_tile_info )
8487{
8588   k3_state *state = machine.driver_data<k3_state>();
86   int tileno = state->m_bgram[tile_index];
89   int tileno = state->m_bgram.target()[tile_index];
8790   SET_TILE_INFO(1, tileno, 0, 0);
8891}
8992
r14896r14897
97100{
98101   k3_state *state = machine.driver_data<k3_state>();
99102   const gfx_element *gfx = machine.gfx[0];
100   UINT16 *source = state->m_spriteram_1;
101   UINT16 *source2 = state->m_spriteram_2;
103   UINT16 *source = state->m_spriteram_1.target();
104   UINT16 *source2 = state->m_spriteram_2.target();
102105   UINT16 *finish = source + 0x1000 / 2;
103106
104107   while (source < finish)
r14896r14897
150153
151154   AM_RANGE(0x000000, 0x0fffff) AM_ROM   // ROM
152155   AM_RANGE(0x100000, 0x10ffff) AM_RAM   // Main Ram
153   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   // palette
154   AM_RANGE(0x240000, 0x240fff) AM_RAM AM_BASE(m_spriteram_1)
155   AM_RANGE(0x280000, 0x280fff) AM_RAM AM_BASE(m_spriteram_2)
156   AM_RANGE(0x2c0000, 0x2c0fff) AM_RAM_WRITE(k3_bgram_w) AM_BASE(m_bgram)
156   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   // palette
157   AM_RANGE(0x240000, 0x240fff) AM_RAM AM_SHARE("spritera1")
158   AM_RANGE(0x280000, 0x280fff) AM_RAM AM_SHARE("spritera2")
159   AM_RANGE(0x2c0000, 0x2c0fff) AM_RAM_WRITE(k3_bgram_w) AM_SHARE("bgram")
157160   AM_RANGE(0x340000, 0x340001) AM_WRITE(k3_scrollx_w)
158161   AM_RANGE(0x380000, 0x380001) AM_WRITE(k3_scrolly_w)
159162   AM_RANGE(0x3c0000, 0x3c0001) AM_WRITE(k3_soundbanks_w)
src/mame/drivers/badlands.c
r14896r14897
254254 *
255255 *************************************/
256256
257static READ16_HANDLER( sound_busy_r )
257READ16_MEMBER(badlands_state::sound_busy_r)
258258{
259   badlands_state *state = space->machine().driver_data<badlands_state>();
260259   int temp = 0xfeff;
261   if (state->m_cpu_to_sound_ready) temp ^= 0x0100;
260   if (m_cpu_to_sound_ready) temp ^= 0x0100;
262261   return temp;
263262}
264263
265264
266static READ16_HANDLER( pedal_0_r )
265READ16_MEMBER(badlands_state::pedal_0_r)
267266{
268   badlands_state *state = space->machine().driver_data<badlands_state>();
269   return state->m_pedal_value[0];
267   return m_pedal_value[0];
270268}
271269
272270
273static READ16_HANDLER( pedal_1_r )
271READ16_MEMBER(badlands_state::pedal_1_r)
274272{
275   badlands_state *state = space->machine().driver_data<badlands_state>();
276   return state->m_pedal_value[1];
273   return m_pedal_value[1];
277274}
278275
279276
r14896r14897
284281 *
285282 *************************************/
286283
287static READ8_HANDLER( audio_io_r )
284READ8_MEMBER(badlands_state::audio_io_r)
288285{
289   badlands_state *state = space->machine().driver_data<badlands_state>();
290286   int result = 0xff;
291287
292288   switch (offset & 0x206)
r14896r14897
296292         break;
297293
298294      case 0x002:      /* /RDP */
299         result = atarigen_6502_sound_r(space, offset);
295         result = atarigen_6502_sound_r(&space, offset);
300296         break;
301297
302298      case 0x004:      /* /RDIO */
r14896r14897
310306                0x02 = coin 2
311307                0x01 = coin 1
312308            */
313         result = input_port_read(space->machine(), "AUDIO");
314         if (!(input_port_read(space->machine(), "FE4000") & 0x0080)) result ^= 0x90;
315         if (state->m_cpu_to_sound_ready) result ^= 0x40;
316         if (state->m_sound_to_cpu_ready) result ^= 0x20;
309         result = input_port_read(machine(), "AUDIO");
310         if (!(input_port_read(machine(), "FE4000") & 0x0080)) result ^= 0x90;
311         if (m_cpu_to_sound_ready) result ^= 0x40;
312         if (m_sound_to_cpu_ready) result ^= 0x20;
317313         result ^= 0x10;
318314         break;
319315
320316      case 0x006:      /* /IRQACK */
321         atarigen_6502_irq_ack_r(space, 0);
317         atarigen_6502_irq_ack_r(&space, 0);
322318         break;
323319
324320      case 0x200:      /* /VOICE */
r14896r14897
333329}
334330
335331
336static WRITE8_HANDLER( audio_io_w )
332WRITE8_MEMBER(badlands_state::audio_io_w)
337333{
338   badlands_state *state = space->machine().driver_data<badlands_state>();
339334
340335   switch (offset & 0x206)
341336   {
r14896r14897
346341         break;
347342
348343      case 0x006:      /* /IRQACK */
349         atarigen_6502_irq_ack_r(space, 0);
344         atarigen_6502_irq_ack_r(&space, 0);
350345         break;
351346
352347      case 0x200:      /* n/c */
r14896r14897
354349         break;
355350
356351      case 0x202:      /* /WRP */
357         atarigen_6502_sound_w(space, offset, data);
352         atarigen_6502_sound_w(&space, offset, data);
358353         break;
359354
360355      case 0x204:      /* WRIO */
r14896r14897
369364            */
370365
371366         /* update the bank */
372         memcpy(state->m_bank_base, &state->m_bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000);
367         memcpy(m_bank_base, &m_bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000);
373368         break;
374369   }
375370}
r14896r14897
384379
385380static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, badlands_state )
386381   AM_RANGE(0x000000, 0x03ffff) AM_ROM
387   AM_RANGE(0xfc0000, 0xfc1fff) AM_READWRITE_LEGACY(sound_busy_r, atarigen_sound_reset_w)
382   AM_RANGE(0xfc0000, 0xfc1fff) AM_READ(sound_busy_r) AM_WRITE_LEGACY(atarigen_sound_reset_w)
388383   AM_RANGE(0xfd0000, 0xfd1fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
389384   AM_RANGE(0xfe0000, 0xfe1fff) AM_WRITE(watchdog_reset16_w)
390385   AM_RANGE(0xfe2000, 0xfe3fff) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
391386   AM_RANGE(0xfe4000, 0xfe5fff) AM_READ_PORT("FE4000")
392387   AM_RANGE(0xfe6000, 0xfe6001) AM_READ_PORT("FE6000")
393388   AM_RANGE(0xfe6002, 0xfe6003) AM_READ_PORT("FE6002")
394   AM_RANGE(0xfe6004, 0xfe6005) AM_READ_LEGACY(pedal_0_r)
395   AM_RANGE(0xfe6006, 0xfe6007) AM_READ_LEGACY(pedal_1_r)
389   AM_RANGE(0xfe6004, 0xfe6005) AM_READ(pedal_0_r)
390   AM_RANGE(0xfe6006, 0xfe6007) AM_READ(pedal_1_r)
396391   AM_RANGE(0xfe8000, 0xfe9fff) AM_WRITE_LEGACY(atarigen_sound_upper_w)
397392   AM_RANGE(0xfea000, 0xfebfff) AM_READ_LEGACY(atarigen_sound_upper_r)
398393   AM_RANGE(0xfec000, 0xfedfff) AM_WRITE_LEGACY(badlands_pf_bank_w)
r14896r14897
414409static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, badlands_state )
415410   AM_RANGE(0x0000, 0x1fff) AM_RAM
416411   AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
417   AM_RANGE(0x2800, 0x2bff) AM_READWRITE_LEGACY(audio_io_r, audio_io_w)
412   AM_RANGE(0x2800, 0x2bff) AM_READWRITE(audio_io_r, audio_io_w)
418413   AM_RANGE(0x3000, 0xffff) AM_ROM
419414ADDRESS_MAP_END
420415
r14896r14897
632627
633628*/
634629
635static READ16_HANDLER( badlandsb_unk_r )
630READ16_MEMBER(badlands_state::badlandsb_unk_r)
636631{
637632
638633   return 0xffff;
r14896r14897
642637   AM_RANGE(0x000000, 0x03ffff) AM_ROM
643638
644639
645   AM_RANGE(0x400008, 0x400009) AM_READ_LEGACY(badlandsb_unk_r )
646   AM_RANGE(0x4000fe, 0x4000ff) AM_READ_LEGACY(badlandsb_unk_r )
640   AM_RANGE(0x400008, 0x400009) AM_READ(badlandsb_unk_r )
641   AM_RANGE(0x4000fe, 0x4000ff) AM_READ(badlandsb_unk_r )
647642
648   AM_RANGE(0xfc0000, 0xfc0001) AM_READ_LEGACY(badlandsb_unk_r )
643   AM_RANGE(0xfc0000, 0xfc0001) AM_READ(badlandsb_unk_r )
649644
650   AM_RANGE(0xfe4000, 0xfe4001) AM_READ_LEGACY(badlandsb_unk_r )
651   AM_RANGE(0xfe4004, 0xfe4005) AM_READ_LEGACY(badlandsb_unk_r )
652   AM_RANGE(0xfe4006, 0xfe4007) AM_READ_LEGACY(badlandsb_unk_r )
645   AM_RANGE(0xfe4000, 0xfe4001) AM_READ(badlandsb_unk_r )
646   AM_RANGE(0xfe4004, 0xfe4005) AM_READ(badlandsb_unk_r )
647   AM_RANGE(0xfe4006, 0xfe4007) AM_READ(badlandsb_unk_r )
653648
654649
655650   AM_RANGE(0xfd0000, 0xfd1fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
src/mame/drivers/astinvad.c
r14896r14897
4545{
4646public:
4747   astinvad_state(const machine_config &mconfig, device_type type, const char *tag)
48      : driver_device(mconfig, type, tag) { }
48      : driver_device(mconfig, type, tag) ,
49      m_videoram(*this, "videoram"){ }
4950
5051   UINT8 *    m_colorram;
51   UINT8 *    m_videoram;
52   size_t     m_videoram_size;
52   required_shared_ptr<UINT8> m_videoram;
5353
5454   emu_timer  *m_int_timer;
5555   UINT8      m_sound_state[2];
r14896r14897
111111static VIDEO_START( spaceint )
112112{
113113   astinvad_state *state = machine.driver_data<astinvad_state>();
114   state->m_colorram = auto_alloc_array(machine, UINT8, state->m_videoram_size);
114   state->m_colorram = auto_alloc_array(machine, UINT8, state->m_videoram.bytes());
115115
116116   state->save_item(NAME(state->m_color_latch));
117   state->save_pointer(NAME(state->m_colorram), state->m_videoram_size);
117   state->save_pointer(NAME(state->m_colorram), state->m_videoram.bytes());
118118}
119119
120120
r14896r14897
126126
127127WRITE8_MEMBER(astinvad_state::spaceint_videoram_w)
128128{
129   m_videoram[offset] = data;
129   m_videoram.target()[offset] = data;
130130   m_colorram[offset] = m_color_latch;
131131}
132132
r14896r14897
167167      for (x = cliprect.min_x & ~7; x <= cliprect.max_x; x += 8)
168168      {
169169         UINT8 color = color_prom[((y & 0xf8) << 2) | (x >> 3)] >> (state->m_screen_flip ? 0 : 4);
170         UINT8 data = state->m_videoram[(((y ^ state->m_screen_flip) + yoffs) << 5) | ((x ^ state->m_screen_flip) >> 3)];
170         UINT8 data = state->m_videoram.target()[(((y ^ state->m_screen_flip) + yoffs) << 5) | ((x ^ state->m_screen_flip) >> 3)];
171171         plot_byte(screen.machine(), bitmap, y, x, data, state->m_screen_red ? 1 : color);
172172      }
173173
r14896r14897
181181   const UINT8 *color_prom = screen.machine().region("proms")->base();
182182   int offs;
183183
184   for (offs = 0; offs < state->m_videoram_size; offs++)
184   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
185185   {
186      UINT8 data = state->m_videoram[offs];
186      UINT8 data = state->m_videoram.target()[offs];
187187      UINT8 color = state->m_colorram[offs];
188188
189189      UINT8 y = ~offs;
r14896r14897
398398   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
399399   AM_RANGE(0x0000, 0x1bff) AM_ROM
400400   AM_RANGE(0x1c00, 0x1fff) AM_RAM
401   AM_RANGE(0x2000, 0x3fff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
401   AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("videoram")
402402ADDRESS_MAP_END
403403
404404
405405static ADDRESS_MAP_START( spaceint_map, AS_PROGRAM, 8, astinvad_state )
406406   AM_RANGE(0x0000, 0x1fff) AM_ROM
407407   AM_RANGE(0x2000, 0x23ff) AM_RAM
408   AM_RANGE(0x4000, 0x5fff) AM_RAM_WRITE(spaceint_videoram_w) AM_BASE_SIZE(m_videoram, m_videoram_size)
408   AM_RANGE(0x4000, 0x5fff) AM_RAM_WRITE(spaceint_videoram_w) AM_SHARE("videoram")
409409ADDRESS_MAP_END
410410
411411
src/mame/drivers/boogwing.c
r14896r14897
134134   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
135135   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
136136   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
137   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
137   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
138138   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
139139   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
140140   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/offtwall.c
r14896r14897
7070 *
7171 *************************************/
7272
73static READ16_HANDLER( offtwall_atarivc_r )
73READ16_MEMBER(offtwall_state::offtwall_atarivc_r)
7474{
75   return atarivc_r(*space->machine().primary_screen, offset);
75   return atarivc_r(*machine().primary_screen, offset);
7676}
7777
7878
79static WRITE16_HANDLER( offtwall_atarivc_w )
79WRITE16_MEMBER(offtwall_state::offtwall_atarivc_w)
8080{
81   atarivc_w(*space->machine().primary_screen, offset, data, mem_mask);
81   atarivc_w(*machine().primary_screen, offset, data, mem_mask);
8282}
8383
8484
r14896r14897
8989 *
9090 *************************************/
9191
92static READ16_HANDLER( special_port3_r )
92READ16_MEMBER(offtwall_state::special_port3_r)
9393{
94   offtwall_state *state = space->machine().driver_data<offtwall_state>();
95   int result = input_port_read(space->machine(), "260010");
96   if (state->m_cpu_to_sound_ready) result ^= 0x0020;
94   int result = input_port_read(machine(), "260010");
95   if (m_cpu_to_sound_ready) result ^= 0x0020;
9796   return result;
9897}
9998
10099
101static WRITE16_HANDLER( io_latch_w )
100WRITE16_MEMBER(offtwall_state::io_latch_w)
102101{
103102   /* lower byte */
104103   if (ACCESSING_BITS_0_7)
105104   {
106105      /* bit 4 resets the sound CPU */
107      cputag_set_input_line(space->machine(), "jsa", INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
106      cputag_set_input_line(machine(), "jsa", INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
108107      if (!(data & 0x10)) atarijsa_reset();
109108   }
110109
r14896r14897
149148
150149
151150
152static READ16_HANDLER( bankswitch_r )
151READ16_MEMBER(offtwall_state::bankswitch_r)
153152{
154   offtwall_state *state = space->machine().driver_data<offtwall_state>();
155153
156154   /* this is the table lookup; the bank is determined by the address that was requested */
157   state->m_bank_offset = (offset & 3) * 0x1000;
158   logerror("Bankswitch index %d -> %04X\n", offset, state->m_bank_offset);
155   m_bank_offset = (offset & 3) * 0x1000;
156   logerror("Bankswitch index %d -> %04X\n", offset, m_bank_offset);
159157
160   return state->m_bankswitch_base[offset];
158   return m_bankswitch_base[offset];
161159}
162160
163161
164static READ16_HANDLER( bankrom_r )
162READ16_MEMBER(offtwall_state::bankrom_r)
165163{
166   offtwall_state *state = space->machine().driver_data<offtwall_state>();
167164
168165   /* this is the banked ROM read */
169   logerror("%06X: %04X\n", cpu_get_previouspc(&space->device()), offset);
166   logerror("%06X: %04X\n", cpu_get_previouspc(&space.device()), offset);
170167
171168   /* if the values are $3e000 or $3e002 are being read by code just below the
172169        ROM bank area, we need to return the correct value to give the proper checksum */
173   if ((offset == 0x3000 || offset == 0x3001) && cpu_get_previouspc(&space->device()) > 0x37000)
170   if ((offset == 0x3000 || offset == 0x3001) && cpu_get_previouspc(&space.device()) > 0x37000)
174171   {
175      UINT32 checksum = (space->read_word(0x3fd210) << 16) | space->read_word(0x3fd212);
172      UINT32 checksum = (space.read_word(0x3fd210) << 16) | space.read_word(0x3fd212);
176173      UINT32 us = 0xaaaa5555 - checksum;
177174      if (offset == 0x3001)
178175         return us & 0xffff;
r14896r14897
180177         return us >> 16;
181178   }
182179
183   return state->m_bankrom_base[(state->m_bank_offset + offset) & 0x3fff];
180   return m_bankrom_base[(m_bank_offset + offset) & 0x3fff];
184181}
185182
186183
r14896r14897
203200-------------------------------------------------------------------------*/
204201
205202
206static READ16_HANDLER( spritecache_count_r )
203READ16_MEMBER(offtwall_state::spritecache_count_r)
207204{
208   offtwall_state *state = space->machine().driver_data<offtwall_state>();
209   int prevpc = cpu_get_previouspc(&space->device());
205   int prevpc = cpu_get_previouspc(&space.device());
210206
211207   /* if this read is coming from $99f8 or $9992, it's in the sprite copy loop */
212208   if (prevpc == 0x99f8 || prevpc == 0x9992)
213209   {
214      UINT16 *data = &state->m_spritecache_count[-0x100];
215      int oldword = state->m_spritecache_count[0];
210      UINT16 *data = &m_spritecache_count[-0x100];
211      int oldword = m_spritecache_count[0];
216212      int count = oldword >> 8;
217213      int i, width = 0;
218214
r14896r14897
233229         }
234230
235231         /* update the final count in memory */
236         state->m_spritecache_count[0] = (count << 8) | (oldword & 0xff);
232         m_spritecache_count[0] = (count << 8) | (oldword & 0xff);
237233      }
238234   }
239235
240236   /* and then read the data */
241   return state->m_spritecache_count[offset];
237   return m_spritecache_count[offset];
242238}
243239
244240
r14896r14897
258254
259255
260256
261static READ16_HANDLER( unknown_verify_r )
257READ16_MEMBER(offtwall_state::unknown_verify_r)
262258{
263   offtwall_state *state = space->machine().driver_data<offtwall_state>();
264   int prevpc = cpu_get_previouspc(&space->device());
259   int prevpc = cpu_get_previouspc(&space.device());
265260   if (prevpc < 0x5c5e || prevpc > 0xc432)
266      return state->m_unknown_verify_base[offset];
261      return m_unknown_verify_base[offset];
267262   else
268      return state->m_unknown_verify_base[offset] | 0x100;
263      return m_unknown_verify_base[offset] | 0x100;
269264}
270265
271266
r14896r14897
278273
279274static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, offtwall_state )
280275   AM_RANGE(0x000000, 0x037fff) AM_ROM
281   AM_RANGE(0x038000, 0x03ffff) AM_READ_LEGACY(bankrom_r) AM_REGION("maincpu", 0x38000) AM_BASE(m_bankrom_base)
276   AM_RANGE(0x038000, 0x03ffff) AM_READ(bankrom_r) AM_REGION("maincpu", 0x38000) AM_BASE(m_bankrom_base)
282277   AM_RANGE(0x120000, 0x120fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
283278   AM_RANGE(0x260000, 0x260001) AM_READ_PORT("260000")
284279   AM_RANGE(0x260002, 0x260003) AM_READ_PORT("260002")
285   AM_RANGE(0x260010, 0x260011) AM_READ_LEGACY(special_port3_r)
280   AM_RANGE(0x260010, 0x260011) AM_READ(special_port3_r)
286281   AM_RANGE(0x260012, 0x260013) AM_READ_PORT("260012")
287282   AM_RANGE(0x260020, 0x260021) AM_READ_PORT("260020")
288283   AM_RANGE(0x260022, 0x260023) AM_READ_PORT("260022")
289284   AM_RANGE(0x260024, 0x260025) AM_READ_PORT("260024")
290285   AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
291286   AM_RANGE(0x260040, 0x260041) AM_WRITE_LEGACY(atarigen_sound_w)
292   AM_RANGE(0x260050, 0x260051) AM_WRITE_LEGACY(io_latch_w)
287   AM_RANGE(0x260050, 0x260051) AM_WRITE(io_latch_w)
293288   AM_RANGE(0x260060, 0x260061) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
294289   AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(watchdog_reset16_w)
295290   AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram_w) AM_SHARE("paletteram")
296   AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE_LEGACY(offtwall_atarivc_r, offtwall_atarivc_w) AM_BASE(m_atarivc_data)
291   AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(offtwall_atarivc_r, offtwall_atarivc_w) AM_BASE(m_atarivc_data)
297292   AM_RANGE(0x3f4000, 0x3f5eff) AM_RAM_WRITE_LEGACY(atarigen_playfield_latched_msb_w) AM_BASE(m_playfield)
298293   AM_RANGE(0x3f5f00, 0x3f5f7f) AM_RAM AM_BASE(m_atarivc_eof_data)
299294   AM_RANGE(0x3f5f80, 0x3f5fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
r14896r14897
497492   atarijsa_init(machine, "260010", 0x0040);
498493
499494   /* install son-of-slapstic workarounds */
500   state->m_spritecache_count = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3fde42, 0x3fde43, FUNC(spritecache_count_r));
501   state->m_bankswitch_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x037ec2, 0x037f39, FUNC(bankswitch_r));
502   state->m_unknown_verify_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3fdf1e, 0x3fdf1f, FUNC(unknown_verify_r));
495   state->m_spritecache_count = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),state));
496   state->m_bankswitch_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x037ec2, 0x037f39, read16_delegate(FUNC(offtwall_state::bankswitch_r),state));
497   state->m_unknown_verify_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3fdf1e, 0x3fdf1f, read16_delegate(FUNC(offtwall_state::unknown_verify_r),state));
503498}
504499
505500
r14896r14897
510505   atarijsa_init(machine, "260010", 0x0040);
511506
512507   /* install son-of-slapstic workarounds */
513   state->m_spritecache_count = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3fde42, 0x3fde43, FUNC(spritecache_count_r));
514   state->m_bankswitch_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x037eca, 0x037f43, FUNC(bankswitch_r));
515   state->m_unknown_verify_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3fdf24, 0x3fdf25, FUNC(unknown_verify_r));
508   state->m_spritecache_count = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),state));
509   state->m_bankswitch_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x037eca, 0x037f43, read16_delegate(FUNC(offtwall_state::bankswitch_r),state));
510   state->m_unknown_verify_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3fdf24, 0x3fdf25, read16_delegate(FUNC(offtwall_state::unknown_verify_r),state));
516511}
517512
518513
src/mame/drivers/esh.c
r14896r14897
3333public:
3434   esh_state(const machine_config &mconfig, device_type type, const char *tag)
3535      : driver_device(mconfig, type, tag),
36        m_laserdisc(*this, "laserdisc") { }
36        m_laserdisc(*this, "laserdisc") ,
37      m_tile_ram(*this, "tile_ram"),
38      m_tile_control_ram(*this, "tile_control_ram"){ }
3739
3840   required_device<pioneer_ldv1000_device> m_laserdisc;
39   UINT8 *m_tile_ram;
40   UINT8 *m_tile_control_ram;
41   required_shared_ptr<UINT8> m_tile_ram;
42   required_shared_ptr<UINT8> m_tile_control_ram;
4143   UINT8 m_ld_video_visible;
4244   DECLARE_READ8_MEMBER(ldp_read);
4345   DECLARE_WRITE8_MEMBER(ldp_write);
r14896r14897
6769      {
6870         int current_screen_character = (chary*32) + charx;
6971
70         int palIndex  = (state->m_tile_control_ram[current_screen_character] & 0x0f);
71         int tileOffs  = (state->m_tile_control_ram[current_screen_character] & 0x10) >> 4;
72         //int blinkLine = (state->m_tile_control_ram[current_screen_character] & 0x40) >> 6;
73         //int blinkChar = (state->m_tile_control_ram[current_screen_character] & 0x80) >> 7;
72         int palIndex  = (state->m_tile_control_ram.target()[current_screen_character] & 0x0f);
73         int tileOffs  = (state->m_tile_control_ram.target()[current_screen_character] & 0x10) >> 4;
74         //int blinkLine = (state->m_tile_control_ram.target()[current_screen_character] & 0x40) >> 6;
75         //int blinkChar = (state->m_tile_control_ram.target()[current_screen_character] & 0x80) >> 7;
7476
7577         drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[0],
76               state->m_tile_ram[current_screen_character] + (0x100 * tileOffs),
78               state->m_tile_ram.target()[current_screen_character] + (0x100 * tileOffs),
7779               palIndex,
7880               0, 0, charx*8, chary*8, 0);
7981      }
r14896r14897
157159static ADDRESS_MAP_START( z80_0_mem, AS_PROGRAM, 8, esh_state )
158160   AM_RANGE(0x0000,0x3fff) AM_ROM
159161   AM_RANGE(0xe000,0xe7ff) AM_RAM AM_SHARE("nvram")
160   AM_RANGE(0xf000,0xf3ff) AM_RAM AM_BASE(m_tile_ram)
161   AM_RANGE(0xf400,0xf7ff) AM_RAM AM_BASE(m_tile_control_ram)
162   AM_RANGE(0xf000,0xf3ff) AM_RAM AM_SHARE("tile_ram")
163   AM_RANGE(0xf400,0xf7ff) AM_RAM AM_SHARE("tile_control_ram")
162164ADDRESS_MAP_END
163165
164166
src/mame/drivers/halleys.c
r14896r14897
210210{
211211public:
212212   halleys_state(const machine_config &mconfig, device_type type, const char *tag)
213      : driver_device(mconfig, type, tag) { }
213      : driver_device(mconfig, type, tag) ,
214      m_blitter_ram(*this, "blitter_ram"),
215      m_io_ram(*this, "io_ram"){ }
214216
215217   UINT16 *m_render_layer[MAX_LAYERS];
216218   UINT8 m_sound_fifo[MAX_SOUNDS];
r14896r14897
225227   UINT32 *m_alpha_table;
226228   UINT8 *m_cpu1_base;
227229   UINT8 *m_gfx1_base;
228   UINT8 *m_blitter_ram;
229   UINT8 *m_io_ram;
230   size_t m_blitter_ramsize;
231   size_t m_io_ramsize;
230   required_shared_ptr<UINT8> m_blitter_ram;
231   required_shared_ptr<UINT8> m_io_ram;
232232   int m_game_id;
233233   int m_blitter_busy;
234234   int m_collision_count;
r14896r14897
10271027
10281028   if (i==0 || i==4) return(1);
10291029
1030   return(m_blitter_ram[offset]);
1030   return(m_blitter_ram.target()[offset]);
10311031}
10321032
10331033
r14896r14897
10421042{
10431043   int i = offset & 0xf;
10441044
1045   m_blitter_ram[offset] = data;
1045   m_blitter_ram.target()[offset] = data;
10461046
10471047   if (i==0) blit(offset);
10481048
r14896r14897
10931093      return(0);
10941094   }
10951095
1096   return(m_io_ram[0x66]);
1096   return(m_io_ram.target()[0x66]);
10971097}
10981098
10991099
r14896r14897
14961496   copy_fixed_xp (bitmap, state->m_render_layer[0]);
14971497
14981498   // HALF-HACK: apply RGB filter when the following conditions are met
1499   i = state->m_io_ram[0xa0];
1500   j = state->m_io_ram[0xa1];
1501   if (state->m_io_ram[0x2b] && (i>0xc6 && i<0xfe) && (j==0xc0 || j==0xed)) filter_bitmap(screen.machine(), bitmap, i);
1499   i = state->m_io_ram.target()[0xa0];
1500   j = state->m_io_ram.target()[0xa1];
1501   if (state->m_io_ram.target()[0x2b] && (i>0xc6 && i<0xfe) && (j==0xc0 || j==0xed)) filter_bitmap(screen.machine(), bitmap, i);
15021502   return 0;
15031503}
15041504
r14896r14897
15061506static SCREEN_UPDATE_IND16( benberob )
15071507{
15081508   halleys_state *state = screen.machine().driver_data<halleys_state>();
1509   if (state->m_io_ram[0xa0] & 0x80)
1509   if (state->m_io_ram.target()[0xa0] & 0x80)
15101510      copy_scroll_op(bitmap, state->m_render_layer[2], *state->m_scrollx1, *state->m_scrolly1);
15111511   else
15121512      bitmap.fill(state->m_bgcolor, cliprect);
r14896r14897
15261526
15271527READ8_MEMBER(halleys_state::debug_r)
15281528{
1529   return(m_io_ram[offset]);
1529   return(m_io_ram.target()[offset]);
15301530}
15311531
15321532#endif
r14896r14897
15981598
15991599WRITE8_MEMBER(halleys_state::firq_ack_w)
16001600{
1601   m_io_ram[0x9c] = data;
1601   m_io_ram.target()[0x9c] = data;
16021602
16031603   if (m_firq_level) m_firq_level--;
16041604   cputag_set_input_line(machine(), "maincpu", M6809_FIRQ_LINE, CLEAR_LINE);
r14896r14897
16151615WRITE8_MEMBER(halleys_state::soundcommand_w)
16161616{
16171617
1618   m_io_ram[0x8a] = data;
1619   soundlatch_w(space,offset,data);
1618   m_io_ram.target()[0x8a] = data;
1619   soundlatch_byte_w(space,offset,data);
16201620   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
16211621}
16221622
r14896r14897
16501650// Memory Maps
16511651
16521652static ADDRESS_MAP_START( halleys_map, AS_PROGRAM, 8, halleys_state )
1653   AM_RANGE(0x0000, 0x0fff) AM_READWRITE(blitter_r, blitter_w) AM_BASE(m_blitter_ram) AM_SIZE(m_blitter_ramsize)
1653   AM_RANGE(0x0000, 0x0fff) AM_READWRITE(blitter_r, blitter_w) AM_SHARE("blitter_ram")
16541654   AM_RANGE(0x1f00, 0x1fff) AM_WRITE(bgtile_w)      // background tiles?(Ben Bero Beh only)
16551655   AM_RANGE(0x1000, 0xefff) AM_ROM
16561656   AM_RANGE(0xf000, 0xfeff) AM_RAM               // work ram
r14896r14897
16681668   AM_RANGE(0xff96, 0xff96) AM_READ_PORT("DSW2")   // dipswitch 3
16691669   AM_RANGE(0xff97, 0xff97) AM_READ_PORT("DSW3")   // dipswitch 2
16701670   AM_RANGE(0xff9c, 0xff9c) AM_WRITE(firq_ack_w)
1671   AM_RANGE(0xff00, 0xffbf) AM_RAM AM_BASE(m_io_ram) AM_SIZE(m_io_ramsize)   // I/O write fall-through
1671   AM_RANGE(0xff00, 0xffbf) AM_RAM AM_SHARE("io_ram")   // I/O write fall-through
16721672
16731673   AM_RANGE(0xffc0, 0xffdf) AM_RAM_WRITE(halleys_paletteram_IIRRGGBB_w) AM_SHARE("paletteram")
16741674   AM_RANGE(0xffe0, 0xffff) AM_READ(vector_r)
r14896r14897
16841684   AM_RANGE(0x4803, 0x4803) AM_DEVREAD_LEGACY("ay3", ay8910_r)
16851685   AM_RANGE(0x4804, 0x4805) AM_DEVWRITE_LEGACY("ay4", ay8910_address_data_w)
16861686   AM_RANGE(0x4805, 0x4805) AM_DEVREAD_LEGACY("ay4", ay8910_r)
1687   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_r)
1687   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_byte_r)
16881688   AM_RANGE(0xe000, 0xefff) AM_ROM // space for diagnostic ROM
16891689ADDRESS_MAP_END
16901690
r14896r14897
19371937   state->m_bgcolor         = get_black_pen(machine);
19381938   state->m_fftail = state->m_ffhead = state->m_ffcount = 0;
19391939
1940   memset(state->m_io_ram, 0xff, state->m_io_ramsize);
1940   memset(state->m_io_ram.target(), 0xff, state->m_io_ram.bytes());
19411941   memset(state->m_render_layer[0], 0, SCREEN_BYTESIZE * MAX_LAYERS);
19421942}
19431943
src/mame/drivers/segas16a.c
r14896r14897
194194   DEVCB_NULL,
195195   DEVCB_NULL,
196196   DEVCB_NULL,
197   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_w),
197   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),
198198   DEVCB_HANDLER(video_control_w),
199199   DEVCB_HANDLER(tilemap_sound_w)
200200};
r14896r14897
433433
434434   /* assert ACK */
435435   ppi8255_set_port_c(state->m_ppi8255, 0x00);
436   return state->soundlatch_r(*space, offset);
436   return state->soundlatch_byte_r(*space, offset);
437437}
438438
439439
src/mame/drivers/neogeo.c
r14896r14897
571571   /* accessing the LSB only is not mapped */
572572   if (mem_mask != 0x00ff)
573573   {
574      soundlatch_w(space, 0, data >> 8);
574      soundlatch_byte_w(space, 0, data >> 8);
575575
576576      audio_cpu_assert_nmi(machine());
577577
r14896r14897
585585
586586READ8_MEMBER(neogeo_state::audio_command_r)
587587{
588   UINT8 ret = soundlatch_r(space, 0);
588   UINT8 ret = soundlatch_byte_r(space, 0);
589589
590590   if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", cpu_get_pc(&space.device()), ret);
591591
src/mame/drivers/segahang.c
r14896r14897
290290{
291291   segas1x_state *state = device->machine().driver_data<segas1x_state>();
292292   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
293   state->soundlatch_w(*space, offset, data);
293   state->soundlatch_byte_w(*space, offset, data);
294294}
295295
296296
r14896r14897
417417
418418   /* assert ACK */
419419   ppi8255_set_port_c(state->m_ppi8255_1, 0x00);
420   return state->soundlatch_r(*space, offset);
420   return state->soundlatch_byte_r(*space, offset);
421421}
422422
423423
src/mame/drivers/statriv2.c
r14896r14897
8080{
8181public:
8282   statriv2_state(const machine_config &mconfig, device_type type, const char *tag)
83      : driver_device(mconfig, type, tag) { }
83      : driver_device(mconfig, type, tag) ,
84      m_videoram(*this, "videoram"),
85      m_question_offset(*this, "question_offset"){ }
8486
85   UINT8 *m_videoram;
87   required_shared_ptr<UINT8> m_videoram;
8688   tilemap_t *m_tilemap;
87   UINT8 *m_question_offset;
89   required_shared_ptr<UINT8> m_question_offset;
8890   UINT8 m_question_offset_low;
8991   UINT8 m_question_offset_mid;
9092   UINT8 m_question_offset_high;
r14896r14897
110112static TILE_GET_INFO( horizontal_tile_info )
111113{
112114   statriv2_state *state = machine.driver_data<statriv2_state>();
113   UINT8 *videoram = state->m_videoram;
115   UINT8 *videoram = state->m_videoram.target();
114116   int code = videoram[0x400+tile_index];
115117   int attr = videoram[tile_index] & 0x3f;
116118
r14896r14897
120122static TILE_GET_INFO( vertical_tile_info )
121123{
122124   statriv2_state *state = machine.driver_data<statriv2_state>();
123   UINT8 *videoram = state->m_videoram;
125   UINT8 *videoram = state->m_videoram.target();
124126   int code = videoram[0x400+tile_index];
125127   int attr = videoram[tile_index] & 0x3f;
126128
r14896r14897
168170
169171WRITE8_MEMBER(statriv2_state::statriv2_videoram_w)
170172{
171   UINT8 *videoram = m_videoram;
173   UINT8 *videoram = m_videoram.target();
172174   videoram[offset] = data;
173175   m_tilemap->mark_tile_dirty(offset & 0x3ff);
174176}
r14896r14897
227229   UINT32 address;
228230
229231   if (m_question_offset_high == 0xff)
230      m_question_offset[m_question_offset_low]++;
232      m_question_offset.target()[m_question_offset_low]++;
231233
232   address = m_question_offset[m_question_offset_low];
233   address |= m_question_offset[m_question_offset_mid] << 8;
234   address = m_question_offset.target()[m_question_offset_low];
235   address |= m_question_offset.target()[m_question_offset_mid] << 8;
234236   if (m_question_offset_high != 0xff)
235      address |= m_question_offset[m_question_offset_high] << 16;
237      address |= m_question_offset.target()[m_question_offset_high] << 16;
236238
237239   return (address < qromsize) ? qrom[address] : 0xff;
238240}
r14896r14897
294296   AM_RANGE(0x0000, 0x3fff) AM_ROM
295297   AM_RANGE(0x4000, 0x43ff) AM_RAM
296298   AM_RANGE(0x4800, 0x48ff) AM_RAM AM_SHARE("nvram")
297   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(statriv2_videoram_w) AM_BASE(m_videoram)
299   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(statriv2_videoram_w) AM_SHARE("videoram")
298300ADDRESS_MAP_END
299301
300302static ADDRESS_MAP_START( statriv2_io_map, AS_IO, 8, statriv2_state )
301303   AM_RANGE(0x20, 0x23) AM_DEVREADWRITE_LEGACY("ppi", ppi8255_r, ppi8255_w)
302   AM_RANGE(0x28, 0x2b) AM_READ(question_data_r) AM_WRITEONLY AM_BASE(m_question_offset)
304   AM_RANGE(0x28, 0x2b) AM_READ(question_data_r) AM_WRITEONLY AM_SHARE("question_offset")
303305   AM_RANGE(0xb0, 0xb1) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
304306   AM_RANGE(0xb1, 0xb1) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
305307   AM_RANGE(0xc0, 0xcf) AM_DEVREADWRITE_LEGACY("tms", tms9927_r, tms9927_w)
src/mame/drivers/carrera.c
r14896r14897
5656{
5757public:
5858   carrera_state(const machine_config &mconfig, device_type type, const char *tag)
59      : driver_device(mconfig, type, tag) { }
59      : driver_device(mconfig, type, tag) ,
60      m_tileram(*this, "tileram"){ }
6061
61   UINT8* m_tileram;
62   required_shared_ptr<UINT8> m_tileram;
6263};
6364
6465
r14896r14897
6768   AM_RANGE(0xe000, 0xe7ff) AM_RAM
6869   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("crtc", mc6845_device, address_w)
6970   AM_RANGE(0xe801, 0xe801) AM_DEVWRITE("crtc", mc6845_device, register_w)
70   AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE(m_tileram)
71   AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("tileram")
7172ADDRESS_MAP_END
7273
7374static ADDRESS_MAP_START( io_map, AS_IO, 8, carrera_state )
r14896r14897
255256   {
256257      for (x=0;x<64;x++)
257258      {
258         int tile = state->m_tileram[count&0x7ff] | state->m_tileram[(count&0x7ff)+0x800]<<8;
259         int tile = state->m_tileram.target()[count&0x7ff] | state->m_tileram.target()[(count&0x7ff)+0x800]<<8;
259260
260261         drawgfx_opaque(bitmap,cliprect,screen.machine().gfx[0],tile,0,0,0,x*8,y*8);
261262         count++;
src/mame/drivers/vectrex.c
r14896r14897
2121
2222static ADDRESS_MAP_START(vectrex_map, AS_PROGRAM, 8, vectrex_state )
2323   AM_RANGE(0x0000, 0x7fff) AM_ROM
24   AM_RANGE(0xc800, 0xcbff) AM_RAM AM_MIRROR(0x0400) AM_BASE(m_gce_vectorram) AM_SIZE(m_gce_vectorram_size)
24   AM_RANGE(0xc800, 0xcbff) AM_RAM AM_MIRROR(0x0400) AM_BASE_SIZE(m_gce_vectorram,m_gce_vectorram_size)
2525   AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(vectrex_via_r, vectrex_via_w)
2626   AM_RANGE(0xe000, 0xffff) AM_ROM
2727ADDRESS_MAP_END
r14896r14897
177177   AM_RANGE(0x0000, 0x7fff) AM_ROM
178178   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("nvram")
179179   AM_RANGE(0xa000, 0xa000) AM_WRITE(raaspec_led_w)
180   AM_RANGE(0xc800, 0xcbff) AM_RAM AM_MIRROR(0x0400) AM_BASE(m_gce_vectorram) AM_SIZE(m_gce_vectorram_size)
180   AM_RANGE(0xc800, 0xcbff) AM_RAM AM_MIRROR(0x0400) AM_BASE_SIZE(m_gce_vectorram,m_gce_vectorram_size)
181181   AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(vectrex_via_r, vectrex_via_w)
182182   AM_RANGE(0xe000, 0xffff) AM_ROM
183183ADDRESS_MAP_END
src/mame/drivers/ultraman.c
r14896r14897
2020WRITE16_MEMBER(ultraman_state::sound_cmd_w)
2121{
2222   if (ACCESSING_BITS_0_7)
23      soundlatch_w(space, 0, data & 0xff);
23      soundlatch_byte_w(space, 0, data & 0xff);
2424}
2525
2626WRITE16_MEMBER(ultraman_state::sound_irq_trigger_w)
r14896r14897
3434static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, ultraman_state )
3535   AM_RANGE(0x000000, 0x03ffff) AM_ROM
3636   AM_RANGE(0x080000, 0x08ffff) AM_RAM
37   AM_RANGE(0x180000, 0x183fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")/* Palette */
37   AM_RANGE(0x180000, 0x183fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")/* Palette */
3838   AM_RANGE(0x1c0000, 0x1c0001) AM_READ_PORT("SYSTEM")
3939   AM_RANGE(0x1c0002, 0x1c0003) AM_READ_PORT("P1")
4040   AM_RANGE(0x1c0004, 0x1c0005) AM_READ_PORT("P2")
r14896r14897
5757static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, ultraman_state )
5858   AM_RANGE(0x0000, 0x7fff) AM_ROM
5959   AM_RANGE(0x8000, 0xbfff) AM_RAM
60   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r)   /* Sound latch read */
60   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r)   /* Sound latch read */
6161//  AM_RANGE(0xd000, 0xd000) AM_WRITENOP      /* ??? */
6262   AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE("oki", okim6295_device, read, write)      /* M6295 */
6363   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)   /* YM2151 */
src/mame/drivers/d9final.c
r14896r14897
2828{
2929public:
3030   d9final_state(const machine_config &mconfig, device_type type, const char *tag)
31      : driver_device(mconfig, type, tag) { }
31      : driver_device(mconfig, type, tag) ,
32      m_lo_vram(*this, "lo_vram"),
33      m_hi_vram(*this, "hi_vram"),
34      m_cram(*this, "cram"){ }
3235
33   UINT8 *m_lo_vram;
34   UINT8 *m_hi_vram;
35   UINT8 *m_cram;
36   required_shared_ptr<UINT8> m_lo_vram;
37   required_shared_ptr<UINT8> m_hi_vram;
38   required_shared_ptr<UINT8> m_cram;
3639   tilemap_t *m_sc0_tilemap;
3740   DECLARE_WRITE8_MEMBER(sc0_lovram);
3841   DECLARE_WRITE8_MEMBER(sc0_hivram);
r14896r14897
4649static TILE_GET_INFO( get_sc0_tile_info )
4750{
4851   d9final_state *state = machine.driver_data<d9final_state>();
49   int tile = ((state->m_hi_vram[tile_index] & 0x3f)<<8) | state->m_lo_vram[tile_index];
50   int color = state->m_cram[tile_index] & 0x3f;
52   int tile = ((state->m_hi_vram.target()[tile_index] & 0x3f)<<8) | state->m_lo_vram.target()[tile_index];
53   int color = state->m_cram.target()[tile_index] & 0x3f;
5154
5255   SET_TILE_INFO(
5356         0,
r14896r14897
7174
7275WRITE8_MEMBER(d9final_state::sc0_lovram)
7376{
74   m_lo_vram[offset] = data;
77   m_lo_vram.target()[offset] = data;
7578   m_sc0_tilemap->mark_tile_dirty(offset);
7679}
7780
7881WRITE8_MEMBER(d9final_state::sc0_hivram)
7982{
80   m_hi_vram[offset] = data;
83   m_hi_vram.target()[offset] = data;
8184   m_sc0_tilemap->mark_tile_dirty(offset);
8285}
8386
8487WRITE8_MEMBER(d9final_state::sc0_cram)
8588{
86   m_cram[offset] = data;
89   m_cram.target()[offset] = data;
8790   m_sc0_tilemap->mark_tile_dirty(offset);
8891}
8992
r14896r14897
109112   AM_RANGE(0x0000, 0x7fff) AM_ROM
110113   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
111114   AM_RANGE(0xc000, 0xc7ff) AM_RAM
112   AM_RANGE(0xc800, 0xcbff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split1_w) AM_SHARE("paletteram")
113   AM_RANGE(0xcc00, 0xcfff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split2_w) AM_SHARE("paletteram2")
114   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(sc0_lovram) AM_BASE(m_lo_vram)
115   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(sc0_hivram) AM_BASE(m_hi_vram)
116   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(sc0_cram) AM_BASE(m_cram)
115   AM_RANGE(0xc800, 0xcbff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_lo_w) AM_SHARE("paletteram")
116   AM_RANGE(0xcc00, 0xcfff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_hi_w) AM_SHARE("paletteram2")
117   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(sc0_lovram) AM_SHARE("lo_vram")
118   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(sc0_hivram) AM_SHARE("hi_vram")
119   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(sc0_cram) AM_SHARE("cram")
117120   AM_RANGE(0xf000, 0xf000) AM_READ(prot_latch_r)
118121ADDRESS_MAP_END
119122
src/mame/drivers/blueprnt.c
r14896r14897
7070
7171WRITE8_MEMBER(blueprnt_state::blueprnt_sound_command_w)
7272{
73   soundlatch_w(space, offset, data);
73   soundlatch_byte_w(space, offset, data);
7474   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
7575}
7676
r14896r14897
254254   AY8910_LEGACY_OUTPUT,
255255   AY8910_DEFAULT_LOADS,
256256   DEVCB_NULL,
257   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
257   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
258258   DEVCB_HANDLER(dipsw_w),
259259   DEVCB_NULL
260260};
src/mame/drivers/ttchamp.c
r14896r14897
4949{
5050public:
5151   ttchamp_state(const machine_config &mconfig, device_type type, const char *tag)
52      : driver_device(mconfig, type, tag) { }
52      : driver_device(mconfig, type, tag) ,
53      m_peno_vram(*this, "peno_vram"){ }
5354
54   UINT16 *m_peno_vram;
55   required_shared_ptr<UINT16> m_peno_vram;
5556   UINT16 m_paloff;
5657   DECLARE_WRITE16_MEMBER(paloff_w);
5758   DECLARE_WRITE16_MEMBER(pcup_prgbank_w);
r14896r14897
9091   {
9192      for(x=0;x<xxx;x++)
9293      {
93         /*if(hotblock_port0&0x40)*/bitmap.pix16(y, x) = ((UINT8 *)state->m_peno_vram)[BYTE_XOR_LE(count)]+0x300;
94         /*if(hotblock_port0&0x40)*/bitmap.pix16(y, x) = ((UINT8 *)state->m_peno_vram.target())[BYTE_XOR_LE(count)]+0x300;
9495            count++;
9596        }
9697    }
r14896r14897
136137
137138static ADDRESS_MAP_START( ttchamp_map, AS_PROGRAM, 16, ttchamp_state )
138139    AM_RANGE(0x00000, 0x0ffff) AM_RAM
139    AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_BASE(m_peno_vram)
140    AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_SHARE("peno_vram")
140141    AM_RANGE(0x20000, 0x7ffff) AM_ROMBANK("bank1") // ?
141142    AM_RANGE(0x80000, 0xfffff) AM_ROMBANK("bank2") // ?
142143ADDRESS_MAP_END
src/mame/drivers/buggychl.c
r14896r14897
103103
104104WRITE8_MEMBER(buggychl_state::sound_command_w)
105105{
106   soundlatch_w(space, 0, data);
106   soundlatch_byte_w(space, 0, data);
107107   machine().scheduler().synchronize(FUNC(nmi_callback), data);
108108}
109109
r14896r14897
154154//  AM_RANGE(0xd60b, 0xd60b) // other inputs, not used?
155155   AM_RANGE(0xd610, 0xd610) AM_WRITE(sound_command_w)
156156   AM_RANGE(0xd618, 0xd618) AM_WRITENOP   /* accelerator clear */
157   AM_RANGE(0xd700, 0xd7ff) AM_WRITE(paletteram_xxxxRRRRGGGGBBBB_be_w) AM_SHARE("paletteram")
157   AM_RANGE(0xd700, 0xd7ff) AM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_be_w) AM_SHARE("paletteram")
158158   AM_RANGE(0xd840, 0xd85f) AM_WRITEONLY AM_BASE(m_scrollv)
159159   AM_RANGE(0xdb00, 0xdbff) AM_WRITEONLY AM_BASE(m_scrollh)
160160   AM_RANGE(0xdc04, 0xdc04) AM_WRITEONLY /* should be fg scroll */
r14896r14897
169169   AM_RANGE(0x4810, 0x481d) AM_DEVWRITE_LEGACY("msm", msm5232_w)
170170   AM_RANGE(0x4820, 0x4820) AM_RAM   /* VOL/BAL   for the 7630 on the MSM5232 output */
171171   AM_RANGE(0x4830, 0x4830) AM_RAM   /* TRBL/BASS for the 7630 on the MSM5232 output  */
172   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_r)
172   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_byte_r)
173173//  AM_RANGE(0x5001, 0x5001) AM_READNOP /* is command pending? */
174174   AM_RANGE(0x5001, 0x5001) AM_WRITE(nmi_enable_w)
175175   AM_RANGE(0x5002, 0x5002) AM_WRITE(nmi_disable_w)
src/mame/drivers/gotcha.c
r14896r14897
101101   AM_RANGE(0x100002, 0x100003) AM_WRITE(gotcha_lamps_w)
102102   AM_RANGE(0x100004, 0x100005) AM_DEVWRITE_LEGACY("oki", gotcha_oki_bank_w)
103103   AM_RANGE(0x120000, 0x12ffff) AM_RAM
104   AM_RANGE(0x140000, 0x1405ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
104   AM_RANGE(0x140000, 0x1405ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
105105   AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
106106   AM_RANGE(0x180000, 0x180001) AM_READ_PORT("INPUTS")
107107   AM_RANGE(0x180002, 0x180003) AM_READ_PORT("SYSTEM")
r14896r14897
119119   AM_RANGE(0x0000, 0x7fff) AM_ROM
120120   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
121121   AM_RANGE(0xc002, 0xc003) AM_DEVWRITE("oki", okim6295_device, write)   // TWO addresses!
122   AM_RANGE(0xc006, 0xc006) AM_READ(soundlatch_r)
122   AM_RANGE(0xc006, 0xc006) AM_READ(soundlatch_byte_r)
123123   AM_RANGE(0xd000, 0xd7ff) AM_RAM
124124ADDRESS_MAP_END
125125
src/mame/drivers/taito_f2.c
r14896r14897
702702static ADDRESS_MAP_START( dondokod_map, AS_PROGRAM, 16, taitof2_state )
703703   AM_RANGE(0x000000, 0x07ffff) AM_ROM
704704   AM_RANGE(0x100000, 0x10ffff) AM_RAM
705   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
705   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
706706   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0x00ff)
707707   AM_RANGE(0x320000, 0x320001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
708708   AM_RANGE(0x320002, 0x320003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
r14896r14897
721721   AM_RANGE(0x120000, 0x12000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0x00ff)
722722   AM_RANGE(0x180000, 0x180fff) AM_READWRITE(cchip2_word_r, cchip2_word_w) AM_BASE(m_cchip2_ram)
723723   AM_RANGE(0x200000, 0x20ffff) AM_RAM
724   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
724   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
725725   AM_RANGE(0x400000, 0x40001f) AM_DEVWRITE8_LEGACY("tc0360pri", tc0360pri_w, 0x00ff)   /* ?? */
726726   AM_RANGE(0x600000, 0x60ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
727727   AM_RANGE(0x610000, 0x61ffff) AM_RAM   /* unused? */
r14896r14897
731731
732732static ADDRESS_MAP_START( thundfox_map, AS_PROGRAM, 16, taitof2_state )
733733   AM_RANGE(0x000000, 0x07ffff) AM_ROM
734   AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
734   AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
735735   AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0x00ff)
736736   AM_RANGE(0x220000, 0x220001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
737737   AM_RANGE(0x220002, 0x220003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
r14896r14897
747747static ADDRESS_MAP_START( cameltry_map, AS_PROGRAM, 16, taitof2_state )
748748   AM_RANGE(0x000000, 0x03ffff) AM_ROM
749749   AM_RANGE(0x100000, 0x10ffff) AM_RAM
750   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
750   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
751751   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0x00ff)
752752   AM_RANGE(0x300018, 0x30001f) AM_READ(cameltry_paddle_r)
753753   AM_RANGE(0x320000, 0x320001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
r14896r14897
776776static ADDRESS_MAP_START( liquidk_map, AS_PROGRAM, 16, taitof2_state )
777777   AM_RANGE(0x000000, 0x07ffff) AM_ROM
778778   AM_RANGE(0x100000, 0x10ffff) AM_RAM
779   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
779   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
780780   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0x00ff)
781781   AM_RANGE(0x320000, 0x320001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
782782   AM_RANGE(0x320002, 0x320003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
r14896r14897
811811   AM_RANGE(0x000000, 0x07ffff) AM_ROM
812812   AM_RANGE(0x100000, 0x10000f) AM_DEVREADWRITE_LEGACY("tc0510nio", tc0510nio_halfword_r, tc0510nio_halfword_w)
813813   AM_RANGE(0x200000, 0x20ffff) AM_RAM
814   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
814   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
815815   AM_RANGE(0x400000, 0x400001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
816816   AM_RANGE(0x400002, 0x400003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
817817//  AM_RANGE(0x500000, 0x500001) AM_WRITENOP   /* ?? */
r14896r14897
823823static ADDRESS_MAP_START( gunfront_map, AS_PROGRAM, 16, taitof2_state )
824824   AM_RANGE(0x000000, 0x0bffff) AM_ROM
825825   AM_RANGE(0x100000, 0x10ffff) AM_RAM
826   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
826   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
827827   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE_LEGACY("tc0510nio", tc0510nio_halfword_wordswap_r, tc0510nio_halfword_wordswap_w)
828828   AM_RANGE(0x320000, 0x320001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
829829   AM_RANGE(0x320002, 0x320003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
r14896r14897
837837static ADDRESS_MAP_START( growl_map, AS_PROGRAM, 16, taitof2_state )
838838   AM_RANGE(0x000000, 0x0fffff) AM_ROM
839839   AM_RANGE(0x100000, 0x10ffff) AM_RAM
840   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
840   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
841841   AM_RANGE(0x300004, 0x300005) AM_WRITE(growl_coin_word_w)
842842   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("DSWA")
843843   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("DSWB")
r14896r14897
883883   AM_RANGE(0x400000, 0x40ffff) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_word_r, tc0480scp_word_w)    /* tilemaps */
884884   AM_RANGE(0x430000, 0x43002f) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_ctrl_word_r, tc0480scp_ctrl_word_w)
885885   AM_RANGE(0x500000, 0x50001f) AM_DEVWRITE8_LEGACY("tc0360pri", tc0360pri_w, 0x00ff)   /* 500002 written like a watchdog?! */
886   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
886   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
887887   AM_RANGE(0x700006, 0x700007) AM_WRITE(taitof2_4p_coin_word_w)
888888   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSWA")
889889   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSWB")
r14896r14897
900900static ADDRESS_MAP_START( koshien_map, AS_PROGRAM, 16, taitof2_state )
901901   AM_RANGE(0x000000, 0x0fffff) AM_ROM
902902   AM_RANGE(0x100000, 0x10ffff) AM_RAM
903   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
903   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
904904   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE_LEGACY("tc0510nio", tc0510nio_halfword_r, tc0510nio_halfword_w)
905905   AM_RANGE(0x320000, 0x320001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
906906   AM_RANGE(0x320002, 0x320003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
r14896r14897
919919   AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
920920   AM_RANGE(0x820000, 0x82000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
921921   AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
922   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
922   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
923923   AM_RANGE(0xb00000, 0xb10fff) AM_RAM   /* deliberate writes to $b10xxx, I think */
924924   AM_RANGE(0xc00000, 0xc01fff) AM_WRITE(taitof2_sprite_extension_w) AM_BASE_SIZE(m_sprite_extension, m_spriteext_size)
925925   AM_RANGE(0xd00000, 0xdfffff) AM_ROM AM_REGION("extra", 0)
r14896r14897
928928static ADDRESS_MAP_START( ninjak_map, AS_PROGRAM, 16, taitof2_state )
929929   AM_RANGE(0x000000, 0x07ffff) AM_ROM
930930   AM_RANGE(0x100000, 0x10ffff) AM_RAM
931   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
931   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
932932   AM_RANGE(0x300000, 0x30000f) AM_READ(ninjak_input_r)
933933   AM_RANGE(0x30000e, 0x30000f) AM_WRITE(ninjak_coin_word_w)
934934   AM_RANGE(0x380000, 0x380001) AM_WRITE(watchdog_reset16_w)   /* ??? */
r14896r14897
944944static ADDRESS_MAP_START( solfigtr_map, AS_PROGRAM, 16, taitof2_state )
945945   AM_RANGE(0x000000, 0x07ffff) AM_ROM
946946   AM_RANGE(0x100000, 0x10ffff) AM_RAM
947   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
947   AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
948948   AM_RANGE(0x300004, 0x300005) AM_WRITE(growl_coin_word_w)   /* NOT VERIFIED */
949949   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("DSWA")
950950   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("DSWB")
r14896r14897
967967   AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE_LEGACY("tc0510nio", tc0510nio_halfword_r, tc0510nio_halfword_w)
968968   AM_RANGE(0x300000, 0x300001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
969969   AM_RANGE(0x300002, 0x300003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
970   AM_RANGE(0x400000, 0x401fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
970   AM_RANGE(0x400000, 0x401fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
971971   AM_RANGE(0x500000, 0x50ffff) AM_RAM
972972   AM_RANGE(0x600000, 0x60ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
973973   AM_RANGE(0x700000, 0x70ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
r14896r14897
983983   AM_RANGE(0x402000, 0x40200f) AM_DEVWRITE_LEGACY("tc0430grw", tc0430grw_ctrl_word_w)
984984//  AM_RANGE(0x500000, 0x500001) AM_WRITENOP   /* ??? */
985985   AM_RANGE(0x600000, 0x603fff) AM_WRITE(taitof2_sprite_extension_w) AM_BASE_SIZE(m_sprite_extension, m_spriteext_size)
986   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
986   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
987987   AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
988988   AM_RANGE(0x820000, 0x82000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
989989   AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
999999   AM_RANGE(0x500000, 0x50ffff) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_word_r, tc0480scp_word_w)    /* tilemaps */
10001000   AM_RANGE(0x530000, 0x53002f) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_ctrl_word_r, tc0480scp_ctrl_word_w)
10011001   AM_RANGE(0x600000, 0x60001f) AM_DEVWRITE8_LEGACY("tc0360pri", tc0360pri_w, 0x00ff)
1002   AM_RANGE(0x700000, 0x703fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
1002   AM_RANGE(0x700000, 0x703fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
10031003   AM_RANGE(0x800000, 0x80000f) AM_DEVREADWRITE_LEGACY("tc0510nio", tc0510nio_halfword_wordswap_r, tc0510nio_halfword_wordswap_w)
10041004   AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
10051005   AM_RANGE(0x900002, 0x900003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
r14896r14897
10111011   AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE_LEGACY("tc0510nio", tc0510nio_halfword_r, tc0510nio_halfword_w)
10121012   AM_RANGE(0x300000, 0x300001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
10131013   AM_RANGE(0x300002, 0x300003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
1014   AM_RANGE(0x400000, 0x401fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
1014   AM_RANGE(0x400000, 0x401fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
10151015   AM_RANGE(0x500000, 0x50ffff) AM_RAM
10161016   AM_RANGE(0x600000, 0x60ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
10171017   AM_RANGE(0x700000, 0x70ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
r14896r14897
10241024   AM_RANGE(0x400000, 0x40ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
10251025   AM_RANGE(0x500000, 0x50ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
10261026   AM_RANGE(0x520000, 0x52000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
1027   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
1027   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
10281028//  AM_RANGE(0x700000, 0x70000b) AM_READ_LEGACY(yesnoj_unknown_r)   /* what's this? */
10291029   AM_RANGE(0x800000, 0x800001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
10301030   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
r14896r14897
10461046//    AM_RANGE(0x42000c, 0x42000f) AM_WRITENOP   /* zeroed */
10471047   AM_RANGE(0x430000, 0x43002f) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_ctrl_word_r, tc0480scp_ctrl_word_w)
10481048   AM_RANGE(0x500000, 0x50001f) AM_DEVWRITE8_LEGACY("tc0360pri", tc0360pri_w, 0x00ff)   /* uses 500002 like a watchdog !? */
1049   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
1049   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
10501050   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSWA")
10511051   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSWB")
10521052   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("IN2")
r14896r14897
10621062   AM_RANGE(0x000000, 0x2fffff) AM_ROM
10631063   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE_LEGACY("tc0510nio", tc0510nio_halfword_r, tc0510nio_halfword_w)
10641064   AM_RANGE(0x400000, 0x400fff) AM_WRITE(taitof2_sprite_extension_w) AM_BASE_SIZE(m_sprite_extension, m_spriteext_size)
1065   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
1065   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
10661066   AM_RANGE(0x600000, 0x60ffff) AM_RAM
10671067   AM_RANGE(0x700000, 0x70001f) AM_DEVWRITE8_LEGACY("tc0360pri", tc0360pri_w, 0x00ff)   /* ?? */
10681068   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
10801080   AM_RANGE(0x300000, 0x30ffff) AM_RAM
10811081   AM_RANGE(0x500000, 0x500001) AM_WRITENOP   /* watchdog ? */
10821082   AM_RANGE(0x600000, 0x603fff) AM_WRITE(taitof2_sprite_extension_w) AM_BASE_SIZE(m_sprite_extension, m_spriteext_size)
1083   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
1083   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
10841084   AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
10851085   AM_RANGE(0x820000, 0x82000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
10861086   AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
10961096   AM_RANGE(0x500000, 0x500001) AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0xff00)
10971097   AM_RANGE(0x500002, 0x500003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
10981098   AM_RANGE(0x600000, 0x603fff) AM_WRITE(taitof2_sprite_extension_w) AM_BASE_SIZE(m_sprite_extension, m_spriteext_size)
1099   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
1099   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
11001100   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
11011101   AM_RANGE(0x900000, 0x90ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
11021102   AM_RANGE(0x920000, 0x92000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
r14896r14897
11071107static ADDRESS_MAP_START( qcrayon2_map, AS_PROGRAM, 16, taitof2_state )
11081108   AM_RANGE(0x000000, 0x07ffff) AM_ROM
11091109   AM_RANGE(0x200000, 0x20ffff) AM_RAM
1110   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
1110   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
11111111   AM_RANGE(0x400000, 0x40ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
11121112   AM_RANGE(0x500000, 0x50ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
11131113   AM_RANGE(0x520000, 0x52000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
r14896r14897
11261126   AM_RANGE(0x300000, 0x30ffff) AM_RAM
11271127   AM_RANGE(0x400000, 0x401fff) AM_DEVREADWRITE_LEGACY("tc0430grw", tc0430grw_word_r, tc0430grw_word_w)   /* ROZ tilemap */
11281128   AM_RANGE(0x402000, 0x40200f) AM_DEVWRITE_LEGACY("tc0430grw", tc0430grw_ctrl_word_w)
1129   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
1129   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
11301130   AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
11311131   AM_RANGE(0x820000, 0x82000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
11321132   AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
11431143   AM_RANGE(0x300000, 0x30ffff) AM_RAM
11441144   AM_RANGE(0x400000, 0x401fff) AM_DEVREADWRITE_LEGACY("tc0430grw", tc0430grw_word_r, tc0430grw_word_w)   /* ROZ tilemap */
11451145   AM_RANGE(0x402000, 0x40200f) AM_DEVWRITE_LEGACY("tc0430grw", tc0430grw_ctrl_word_w)
1146   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
1146   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
11471147   AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
11481148   AM_RANGE(0x820000, 0x82000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
11491149   AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
src/mame/drivers/pandoras.c
r14896r14897
135135   AM_RANGE(0x1800, 0x1807) AM_WRITE(pandoras_int_control_w)                        /* INT control */
136136   AM_RANGE(0x1a00, 0x1a00) AM_WRITE(pandoras_scrolly_w)                           /* bg scroll */
137137   AM_RANGE(0x1c00, 0x1c00) AM_WRITE(pandoras_z80_irqtrigger_w)                     /* cause INT on the Z80 */
138   AM_RANGE(0x1e00, 0x1e00) AM_WRITE(soundlatch_w)                                 /* sound command to the Z80 */
138   AM_RANGE(0x1e00, 0x1e00) AM_WRITE(soundlatch_byte_w)                                 /* sound command to the Z80 */
139139   AM_RANGE(0x2000, 0x2000) AM_WRITE(pandoras_cpub_irqtrigger_w)                     /* cause FIRQ on CPU B */
140140   AM_RANGE(0x2001, 0x2001) AM_WRITE(watchdog_reset_w)                              /* watchdog reset */
141141   AM_RANGE(0x4000, 0x5fff) AM_ROM                                             /* space for diagnostic ROM */
r14896r14897
164164static ADDRESS_MAP_START( pandoras_sound_map, AS_PROGRAM, 8, pandoras_state )
165165   AM_RANGE(0x0000, 0x1fff) AM_ROM                                             /* ROM */
166166   AM_RANGE(0x2000, 0x23ff) AM_RAM                                             /* RAM */
167   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r)                                 /* soundlatch_r */
167   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r)                                 /* soundlatch_byte_r */
168168   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)                     /* AY-8910 */
169169   AM_RANGE(0x6001, 0x6001) AM_DEVREAD_LEGACY("aysnd", ay8910_r)                           /* AY-8910 */
170170   AM_RANGE(0x6002, 0x6002) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)                     /* AY-8910 */
171171   AM_RANGE(0x8000, 0x8000) AM_WRITE(pandoras_i8039_irqtrigger_w)                     /* cause INT on the 8039 */
172   AM_RANGE(0xa000, 0xa000) AM_WRITE(soundlatch2_w)                              /* sound command to the 8039 */
172   AM_RANGE(0xa000, 0xa000) AM_WRITE(soundlatch2_byte_w)                              /* sound command to the 8039 */
173173ADDRESS_MAP_END
174174
175175static ADDRESS_MAP_START( pandoras_i8039_map, AS_PROGRAM, 8, pandoras_state )
r14896r14897
177177ADDRESS_MAP_END
178178
179179static ADDRESS_MAP_START( pandoras_i8039_io_map, AS_IO, 8, pandoras_state )
180   AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_r)
180   AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_byte_r)
181181   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE_LEGACY("dac", dac_w)
182182   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(i8039_irqen_and_status_w)
183183ADDRESS_MAP_END
src/mame/drivers/ddragon.c
r14896r14897
190190 *
191191 *************************************/
192192
193static WRITE8_HANDLER( ddragon_bankswitch_w )
193WRITE8_MEMBER(ddragon_state::ddragon_bankswitch_w)
194194{
195   ddragon_state *state = space->machine().driver_data<ddragon_state>();
196   state->m_scrollx_hi = (data & 0x01);
197   state->m_scrolly_hi = ((data & 0x02) >> 1);
198   flip_screen_set(space->machine(), ~data & 0x04);
195   m_scrollx_hi = (data & 0x01);
196   m_scrolly_hi = ((data & 0x02) >> 1);
197   flip_screen_set(~data & 0x04);
199198
200199   /* bit 3 unknown */
201200
202201   if (data & 0x10)
203      state->m_dd_sub_cpu_busy = 0;
204   else if (state->m_dd_sub_cpu_busy == 0)
205      device_set_input_line(state->m_sub_cpu, state->m_sprite_irq, (state->m_sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
202      m_dd_sub_cpu_busy = 0;
203   else if (m_dd_sub_cpu_busy == 0)
204      device_set_input_line(m_sub_cpu, m_sprite_irq, (m_sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
206205
207   memory_set_bank(space->machine(), "bank1", (data & 0xe0) >> 5);
206   memory_set_bank(machine(), "bank1", (data & 0xe0) >> 5);
208207}
209208
210209
211static WRITE8_HANDLER( toffy_bankswitch_w )
210WRITE8_MEMBER(ddragon_state::toffy_bankswitch_w)
212211{
213   ddragon_state *state = space->machine().driver_data<ddragon_state>();
214   state->m_scrollx_hi = (data & 0x01);
215   state->m_scrolly_hi = ((data & 0x02) >> 1);
212   m_scrollx_hi = (data & 0x01);
213   m_scrolly_hi = ((data & 0x02) >> 1);
216214
217//  flip_screen_set(space->machine(), ~data & 0x04);
215//  flip_screen_set(machine(), ~data & 0x04);
218216
219217   /* bit 3 unknown */
220218
221219   /* I don't know ... */
222   memory_set_bank(space->machine(), "bank1", (data & 0x20) >> 5);
220   memory_set_bank(machine(), "bank1", (data & 0x20) >> 5);
223221}
224222
225223
226static READ8_HANDLER( darktowr_mcu_bank_r )
224READ8_MEMBER(ddragon_state::darktowr_mcu_bank_r)
227225{
228   ddragon_state *state = space->machine().driver_data<ddragon_state>();
229   // logerror("BankRead %05x %08x\n",cpu_get_pc(&space->device()),offset);
226   // logerror("BankRead %05x %08x\n",cpu_get_pc(&space.device()),offset);
230227
231228   /* Horrible hack - the alternate TStrike set is mismatched against the MCU,
232229   so just hack around the protection here.  (The hacks are 'right' as I have
233230   the original source code & notes to this version of TStrike to examine).
234231   */
235   if (!strcmp(space->machine().system().name, "tstrike"))
232   if (!strcmp(machine().system().name, "tstrike"))
236233   {
237234      /* Static protection checks at boot-up */
238      if (cpu_get_pc(&space->device()) == 0x9ace)
235      if (cpu_get_pc(&space.device()) == 0x9ace)
239236         return 0;
240      if (cpu_get_pc(&space->device()) == 0x9ae4)
237      if (cpu_get_pc(&space.device()) == 0x9ae4)
241238         return 0x63;
242239
243240      /* Just return whatever the code is expecting */
244      return state->m_rambase[0xbe1];
241      return m_rambase[0xbe1];
245242   }
246243
247244   if (offset == 0x1401 || offset == 1)
248      return state->m_darktowr_mcu_ports[0];
245      return m_darktowr_mcu_ports[0];
249246
250247   logerror("Unmapped mcu bank read %04x\n",offset);
251248   return 0xff;
252249}
253250
254251
255static WRITE8_HANDLER( darktowr_mcu_bank_w )
252WRITE8_MEMBER(ddragon_state::darktowr_mcu_bank_w)
256253{
257   ddragon_state *state = space->machine().driver_data<ddragon_state>();
258   logerror("BankWrite %05x %08x %08x\n", cpu_get_pc(&space->device()), offset, data);
254   logerror("BankWrite %05x %08x %08x\n", cpu_get_pc(&space.device()), offset, data);
259255
260256   if (offset == 0x1400 || offset == 0)
261257   {
262      state->m_darktowr_mcu_ports[1] = BITSWAP8(data,0,1,2,3,4,5,6,7);
258      m_darktowr_mcu_ports[1] = BITSWAP8(data,0,1,2,3,4,5,6,7);
263259      logerror("MCU PORT 1 -> %04x (from %04x)\n", BITSWAP8(data,0,1,2,3,4,5,6,7), data);
264260   }
265261}
266262
267263
268static WRITE8_HANDLER( darktowr_bankswitch_w )
264WRITE8_MEMBER(ddragon_state::darktowr_bankswitch_w)
269265{
270   ddragon_state *state = space->machine().driver_data<ddragon_state>();
271   int oldbank = space->machine().memory().bank("bank1");
266   int oldbank = machine().memory().bank("bank1");
272267   int newbank = (data & 0xe0) >> 5;
273268
274   state->m_scrollx_hi = (data & 0x01);
275   state->m_scrolly_hi = ((data & 0x02) >> 1);
269   m_scrollx_hi = (data & 0x01);
270   m_scrolly_hi = ((data & 0x02) >> 1);
276271
277//  flip_screen_set(space->machine(), ~data & 0x04);
272//  flip_screen_set(machine(), ~data & 0x04);
278273
279274   /* bit 3 unknown */
280275
281276   if (data & 0x10)
282      state->m_dd_sub_cpu_busy = 0;
283   else if (state->m_dd_sub_cpu_busy == 0)
284      device_set_input_line(state->m_sub_cpu, state->m_sprite_irq, (state->m_sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
277      m_dd_sub_cpu_busy = 0;
278   else if (m_dd_sub_cpu_busy == 0)
279      device_set_input_line(m_sub_cpu, m_sprite_irq, (m_sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
285280
286   memory_set_bank(space->machine(), "bank1", newbank);
281   memory_set_bank(machine(), "bank1", newbank);
287282   if (newbank == 4 && oldbank != 4)
288      space->install_legacy_readwrite_handler(0x4000, 0x7fff, FUNC(darktowr_mcu_bank_r), FUNC(darktowr_mcu_bank_w));
283      space.install_readwrite_handler(0x4000, 0x7fff, read8_delegate(FUNC(ddragon_state::darktowr_mcu_bank_r),this), write8_delegate(FUNC(ddragon_state::darktowr_mcu_bank_w),this));
289284   else if (newbank != 4 && oldbank == 4)
290      space->install_readwrite_bank(0x4000, 0x7fff, "bank1");
285      space.install_readwrite_bank(0x4000, 0x7fff, "bank1");
291286}
292287
293288
r14896r14897
298293 *
299294 *************************************/
300295
301static WRITE8_HANDLER( ddragon_interrupt_w )
296WRITE8_MEMBER(ddragon_state::ddragon_interrupt_w)
302297{
303   ddragon_state *state = space->machine().driver_data<ddragon_state>();
304298   switch (offset)
305299   {
306300      case 0: /* 380b - NMI ack */
307         device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, CLEAR_LINE);
301         device_set_input_line(m_maincpu, INPUT_LINE_NMI, CLEAR_LINE);
308302         break;
309303
310304      case 1: /* 380c - FIRQ ack */
311         device_set_input_line(state->m_maincpu, M6809_FIRQ_LINE, CLEAR_LINE);
305         device_set_input_line(m_maincpu, M6809_FIRQ_LINE, CLEAR_LINE);
312306         break;
313307
314308      case 2: /* 380d - IRQ ack */
315         device_set_input_line(state->m_maincpu, M6809_IRQ_LINE, CLEAR_LINE);
309         device_set_input_line(m_maincpu, M6809_IRQ_LINE, CLEAR_LINE);
316310         break;
317311
318312      case 3: /* 380e - SND irq */
319         state->soundlatch_w(*space, 0, data);
320         device_set_input_line(state->m_snd_cpu, state->m_sound_irq, (state->m_sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
313         soundlatch_byte_w(*&space, 0, data);
314         device_set_input_line(m_snd_cpu, m_sound_irq, (m_sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
321315         break;
322316
323317      case 4: /* 380f - ? */
r14896r14897
327321}
328322
329323
330static WRITE8_HANDLER( ddragon2_sub_irq_ack_w )
324WRITE8_MEMBER(ddragon_state::ddragon2_sub_irq_ack_w)
331325{
332   ddragon_state *state = space->machine().driver_data<ddragon_state>();
333   device_set_input_line(state->m_sub_cpu, state->m_sprite_irq, CLEAR_LINE );
326   device_set_input_line(m_sub_cpu, m_sprite_irq, CLEAR_LINE );
334327}
335328
336329
337static WRITE8_HANDLER( ddragon2_sub_irq_w )
330WRITE8_MEMBER(ddragon_state::ddragon2_sub_irq_w)
338331{
339   ddragon_state *state = space->machine().driver_data<ddragon_state>();
340   device_set_input_line(state->m_maincpu, M6809_IRQ_LINE, ASSERT_LINE);
332   device_set_input_line(m_maincpu, M6809_IRQ_LINE, ASSERT_LINE);
341333}
342334
343335
r14896r14897
361353}
362354
363355
364static WRITE8_HANDLER( darktowr_mcu_w )
356WRITE8_MEMBER(ddragon_state::darktowr_mcu_w)
365357{
366   ddragon_state *state = space->machine().driver_data<ddragon_state>();
367   logerror("McuWrite %05x %08x %08x\n",cpu_get_pc(&space->device()), offset, data);
368   state->m_darktowr_mcu_ports[offset] = data;
358   logerror("McuWrite %05x %08x %08x\n",cpu_get_pc(&space.device()), offset, data);
359   m_darktowr_mcu_ports[offset] = data;
369360}
370361
371362
372static READ8_HANDLER( ddragon_hd63701_internal_registers_r )
363READ8_MEMBER(ddragon_state::ddragon_hd63701_internal_registers_r)
373364{
374   logerror("%04x: read %d\n", cpu_get_pc(&space->device()), offset);
365   logerror("%04x: read %d\n", cpu_get_pc(&space.device()), offset);
375366   return 0;
376367}
377368
378369
379static WRITE8_HANDLER( ddragon_hd63701_internal_registers_w )
370WRITE8_MEMBER(ddragon_state::ddragon_hd63701_internal_registers_w)
380371{
381   ddragon_state *state = space->machine().driver_data<ddragon_state>();
382372
383373   /* I don't know why port 0x17 is used..  Doesn't seem to be a standard MCU port */
384374   if (offset == 0x17)
r14896r14897
388378        it's quite obvious from the Double Dragon 2 code, below). */
389379      if (data & 3)
390380      {
391         device_set_input_line(state->m_maincpu, M6809_IRQ_LINE, ASSERT_LINE);
392         device_set_input_line(state->m_sub_cpu, state->m_sprite_irq, CLEAR_LINE);
381         device_set_input_line(m_maincpu, M6809_IRQ_LINE, ASSERT_LINE);
382         device_set_input_line(m_sub_cpu, m_sprite_irq, CLEAR_LINE);
393383      }
394384   }
395385}
r14896r14897
402392 *
403393 *************************************/
404394
405static READ8_HANDLER( ddragon_spriteram_r )
395READ8_MEMBER(ddragon_state::ddragon_spriteram_r)
406396{
407   ddragon_state *state = space->machine().driver_data<ddragon_state>();
408397
409398   /* Double Dragon crash fix - see notes above */
410   if (offset == 0x49 && cpu_get_pc(&space->device()) == 0x6261 && state->m_spriteram[offset] == 0x1f)
399   if (offset == 0x49 && cpu_get_pc(&space.device()) == 0x6261 && m_spriteram[offset] == 0x1f)
411400      return 0x1;
412401
413   return state->m_spriteram[offset];
402   return m_spriteram[offset];
414403}
415404
416405
417static WRITE8_HANDLER( ddragon_spriteram_w )
406WRITE8_MEMBER(ddragon_state::ddragon_spriteram_w)
418407{
419   ddragon_state *state = space->machine().driver_data<ddragon_state>();
420408
421   if (&space->device() == state->m_sub_cpu && offset == 0)
422      state->m_dd_sub_cpu_busy = 1;
409   if (&space.device() == m_sub_cpu && offset == 0)
410      m_dd_sub_cpu_busy = 1;
423411
424   state->m_spriteram[offset] = data;
412   m_spriteram[offset] = data;
425413}
426414
427415
r14896r14897
432420 *
433421 *************************************/
434422
435static WRITE8_HANDLER( dd_adpcm_w )
423WRITE8_MEMBER(ddragon_state::dd_adpcm_w)
436424{
437   ddragon_state *state = space->machine().driver_data<ddragon_state>();
438   device_t *adpcm = (offset & 1) ? state->m_adpcm_2 : state->m_adpcm_1;
439   int chip = (adpcm == state->m_adpcm_1) ? 0 : 1;
425   device_t *adpcm = (offset & 1) ? m_adpcm_2 : m_adpcm_1;
426   int chip = (adpcm == m_adpcm_1) ? 0 : 1;
440427
441428   switch (offset / 2)
442429   {
443430      case 3:
444         state->m_adpcm_idle[chip] = 1;
431         m_adpcm_idle[chip] = 1;
445432         msm5205_reset_w(adpcm, 1);
446433         break;
447434
448435      case 2:
449         state->m_adpcm_pos[chip] = (data & 0x7f) * 0x200;
436         m_adpcm_pos[chip] = (data & 0x7f) * 0x200;
450437         break;
451438
452439      case 1:
453         state->m_adpcm_end[chip] = (data & 0x7f) * 0x200;
440         m_adpcm_end[chip] = (data & 0x7f) * 0x200;
454441         break;
455442
456443      case 0:
457         state->m_adpcm_idle[chip] = 0;
444         m_adpcm_idle[chip] = 0;
458445         msm5205_reset_w(adpcm, 0);
459446         break;
460447   }
r14896r14897
486473}
487474
488475
489static READ8_HANDLER( dd_adpcm_status_r )
476READ8_MEMBER(ddragon_state::dd_adpcm_status_r)
490477{
491   ddragon_state *state = space->machine().driver_data<ddragon_state>();
492   return state->m_adpcm_idle[0] + (state->m_adpcm_idle[1] << 1);
478   return m_adpcm_idle[0] + (m_adpcm_idle[1] << 1);
493479}
494480
495481
r14896r14897
502488
503489static ADDRESS_MAP_START( ddragon_map, AS_PROGRAM, 8, ddragon_state )
504490   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE(m_rambase)
505   AM_RANGE(0x1000, 0x11ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("paletteram")
506   AM_RANGE(0x1200, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("paletteram2")
491   AM_RANGE(0x1000, 0x11ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram")
492   AM_RANGE(0x1200, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
507493   AM_RANGE(0x1400, 0x17ff) AM_RAM
508494   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(ddragon_fgvideoram_w) AM_BASE(m_fgvideoram)
509   AM_RANGE(0x2000, 0x2fff) AM_READWRITE_LEGACY(ddragon_spriteram_r, ddragon_spriteram_w) AM_BASE(m_spriteram)
495   AM_RANGE(0x2000, 0x2fff) AM_READWRITE(ddragon_spriteram_r, ddragon_spriteram_w) AM_BASE(m_spriteram)
510496   AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(ddragon_bgvideoram_w) AM_BASE(m_bgvideoram)
511497   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1")
512498   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2")
513499   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("EXTRA")
514500   AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW0")
515501   AM_RANGE(0x3804, 0x3804) AM_READ_PORT("DSW1")
516   AM_RANGE(0x3808, 0x3808) AM_WRITE_LEGACY(ddragon_bankswitch_w)
502   AM_RANGE(0x3808, 0x3808) AM_WRITE(ddragon_bankswitch_w)
517503   AM_RANGE(0x3809, 0x3809) AM_WRITEONLY AM_BASE(m_scrollx_lo)
518504   AM_RANGE(0x380a, 0x380a) AM_WRITEONLY AM_BASE(m_scrolly_lo)
519   AM_RANGE(0x380b, 0x380f) AM_WRITE_LEGACY(ddragon_interrupt_w)
505   AM_RANGE(0x380b, 0x380f) AM_WRITE(ddragon_interrupt_w)
520506   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
521507   AM_RANGE(0x8000, 0xffff) AM_ROM
522508ADDRESS_MAP_END
r14896r14897
525511static ADDRESS_MAP_START( dd2_map, AS_PROGRAM, 8, ddragon_state )
526512   AM_RANGE(0x0000, 0x17ff) AM_RAM
527513   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(ddragon_fgvideoram_w) AM_BASE(m_fgvideoram)
528   AM_RANGE(0x2000, 0x2fff) AM_READWRITE_LEGACY(ddragon_spriteram_r, ddragon_spriteram_w) AM_BASE(m_spriteram)
514   AM_RANGE(0x2000, 0x2fff) AM_READWRITE(ddragon_spriteram_r, ddragon_spriteram_w) AM_BASE(m_spriteram)
529515   AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(ddragon_bgvideoram_w) AM_BASE(m_bgvideoram)
530516   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1")
531517   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2")
532518   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("EXTRA")
533519   AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW0")
534520   AM_RANGE(0x3804, 0x3804) AM_READ_PORT("DSW1")
535   AM_RANGE(0x3808, 0x3808) AM_WRITE_LEGACY(ddragon_bankswitch_w)
521   AM_RANGE(0x3808, 0x3808) AM_WRITE(ddragon_bankswitch_w)
536522   AM_RANGE(0x3809, 0x3809) AM_WRITEONLY AM_BASE(m_scrollx_lo)
537523   AM_RANGE(0x380a, 0x380a) AM_WRITEONLY AM_BASE(m_scrolly_lo)
538   AM_RANGE(0x380b, 0x380f) AM_WRITE_LEGACY(ddragon_interrupt_w)
539   AM_RANGE(0x3c00, 0x3dff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("paletteram")
540   AM_RANGE(0x3e00, 0x3fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("paletteram2")
524   AM_RANGE(0x380b, 0x380f) AM_WRITE(ddragon_interrupt_w)
525   AM_RANGE(0x3c00, 0x3dff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram")
526   AM_RANGE(0x3e00, 0x3fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
541527   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
542528   AM_RANGE(0x8000, 0xffff) AM_ROM
543529ADDRESS_MAP_END
r14896r14897
551537 *************************************/
552538
553539static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, ddragon_state )
554   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(ddragon_hd63701_internal_registers_r, ddragon_hd63701_internal_registers_w)
540   AM_RANGE(0x0000, 0x001f) AM_READWRITE(ddragon_hd63701_internal_registers_r, ddragon_hd63701_internal_registers_w)
555541   AM_RANGE(0x001f, 0x0fff) AM_RAM
556   AM_RANGE(0x8000, 0x8fff) AM_READWRITE_LEGACY(ddragon_spriteram_r, ddragon_spriteram_w)
542   AM_RANGE(0x8000, 0x8fff) AM_READWRITE(ddragon_spriteram_r, ddragon_spriteram_w)
557543   AM_RANGE(0xc000, 0xffff) AM_ROM
558544ADDRESS_MAP_END
559545
560546
561547static ADDRESS_MAP_START( ddragonba_sub_map, AS_PROGRAM, 8, ddragon_state )
562548   AM_RANGE(0x0000, 0x0fff) AM_RAM
563   AM_RANGE(0x8000, 0x8fff) AM_READWRITE_LEGACY(ddragon_spriteram_r, ddragon_spriteram_w)
549   AM_RANGE(0x8000, 0x8fff) AM_READWRITE(ddragon_spriteram_r, ddragon_spriteram_w)
564550   AM_RANGE(0xc000, 0xffff) AM_ROM
565551ADDRESS_MAP_END
566552
567553
568554static ADDRESS_MAP_START( dd2_sub_map, AS_PROGRAM, 8, ddragon_state )
569555   AM_RANGE(0x0000, 0xbfff) AM_ROM
570   AM_RANGE(0xc000, 0xc3ff) AM_READWRITE_LEGACY(ddragon_spriteram_r, ddragon_spriteram_w)
571   AM_RANGE(0xd000, 0xd000) AM_WRITE_LEGACY(ddragon2_sub_irq_ack_w)
572   AM_RANGE(0xe000, 0xe000) AM_WRITE_LEGACY(ddragon2_sub_irq_w)
556   AM_RANGE(0xc000, 0xc3ff) AM_READWRITE(ddragon_spriteram_r, ddragon_spriteram_w)
557   AM_RANGE(0xd000, 0xd000) AM_WRITE(ddragon2_sub_irq_ack_w)
558   AM_RANGE(0xe000, 0xe000) AM_WRITE(ddragon2_sub_irq_w)
573559ADDRESS_MAP_END
574560
575561/* might not be 100% accurate, check bits written */
576static WRITE8_HANDLER( ddragonba_port_w )
562WRITE8_MEMBER(ddragon_state::ddragonba_port_w)
577563{
578   ddragon_state *state = space->machine().driver_data<ddragon_state>();
579   device_set_input_line(state->m_maincpu, M6809_IRQ_LINE, ASSERT_LINE);
580   device_set_input_line(state->m_sub_cpu, state->m_sprite_irq, CLEAR_LINE );
564   device_set_input_line(m_maincpu, M6809_IRQ_LINE, ASSERT_LINE);
565   device_set_input_line(m_sub_cpu, m_sprite_irq, CLEAR_LINE );
581566}
582567
583568static ADDRESS_MAP_START( ddragonba_sub_portmap, AS_IO, 8, ddragon_state )
584   AM_RANGE(0x0000, 0xffff) AM_WRITE_LEGACY(ddragonba_port_w)
569   AM_RANGE(0x0000, 0xffff) AM_WRITE(ddragonba_port_w)
585570ADDRESS_MAP_END
586571
587572
r14896r14897
594579
595580static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, ddragon_state )
596581   AM_RANGE(0x0000, 0x0fff) AM_RAM
597   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_r)
598   AM_RANGE(0x1800, 0x1800) AM_READ_LEGACY(dd_adpcm_status_r)
582   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_byte_r)
583   AM_RANGE(0x1800, 0x1800) AM_READ(dd_adpcm_status_r)
599584   AM_RANGE(0x2800, 0x2801) AM_DEVREADWRITE_LEGACY("fmsnd", ym2151_r, ym2151_w)
600   AM_RANGE(0x3800, 0x3807) AM_WRITE_LEGACY(dd_adpcm_w)
585   AM_RANGE(0x3800, 0x3807) AM_WRITE(dd_adpcm_w)
601586   AM_RANGE(0x8000, 0xffff) AM_ROM
602587ADDRESS_MAP_END
603588
r14896r14897
607592   AM_RANGE(0x8000, 0x87ff) AM_RAM
608593   AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("fmsnd", ym2151_r, ym2151_w)
609594   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
610   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
595   AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_byte_r)
611596ADDRESS_MAP_END
612597
613598
r14896r14897
620605
621606static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, ddragon_state )
622607   ADDRESS_MAP_GLOBAL_MASK(0x7ff)
623   AM_RANGE(0x0000, 0x0007) AM_RAM_WRITE_LEGACY(darktowr_mcu_w) AM_BASE(m_darktowr_mcu_ports)
608   AM_RANGE(0x0000, 0x0007) AM_RAM_WRITE(darktowr_mcu_w) AM_BASE(m_darktowr_mcu_ports)
624609   AM_RANGE(0x0008, 0x007f) AM_RAM
625610   AM_RANGE(0x0080, 0x07ff) AM_ROM
626611ADDRESS_MAP_END
r14896r14897
20222007   state->m_sound_irq = M6809_IRQ_LINE;
20232008   state->m_ym_irq = M6809_FIRQ_LINE;
20242009   state->m_technos_video_hw = 0;
2025   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x3808, 0x3808, FUNC(darktowr_bankswitch_w));
2010   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::darktowr_bankswitch_w),state));
20262011}
20272012
20282013
r14896r14897
20352020   state->m_sound_irq = M6809_IRQ_LINE;
20362021   state->m_ym_irq = M6809_FIRQ_LINE;
20372022   state->m_technos_video_hw = 0;
2038   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x3808, 0x3808, FUNC(toffy_bankswitch_w));
2023   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::toffy_bankswitch_w),state));
20392024
20402025   /* the program rom has a simple bitswap encryption */
20412026   rom = machine.region("maincpu")->base();
src/mame/drivers/acommand.c
r14896r14897
6464{
6565public:
6666   acommand_state(const machine_config &mconfig, device_type type, const char *tag)
67      : driver_device(mconfig, type, tag) { }
67      : driver_device(mconfig, type, tag) ,
68      m_ac_bgvram(*this, "ac_bgvram"),
69      m_ac_txvram(*this, "ac_txvram"),
70      m_spriteram(*this, "spriteram"),
71      m_ac_devram(*this, "ac_devram"){ }
6872
73   required_shared_ptr<UINT16> m_ac_bgvram;
74   required_shared_ptr<UINT16> m_ac_txvram;
75   required_shared_ptr<UINT16> m_spriteram;
76   required_shared_ptr<UINT16> m_ac_devram;
6977   tilemap_t *m_tx_tilemap;
7078   tilemap_t *m_bg_tilemap;
71   UINT16 *m_ac_txvram;
72   UINT16 *m_ac_bgvram;
7379   UINT16 *m_ac_vregs;
7480   UINT16 m_led0;
7581   UINT16 m_led1;
76   UINT16 *m_ac_devram;
7782   UINT16 m_ufo_sw1;
7883   UINT16 m_ufo_sw2;
79   UINT16 *m_spriteram;
80   size_t m_spriteram_size;
8184   DECLARE_WRITE16_MEMBER(ac_bgvram_w);
8285   DECLARE_WRITE16_MEMBER(ac_txvram_w);
8386   DECLARE_WRITE16_MEMBER(ac_bgscroll_w);
r14896r14897
98101static TILE_GET_INFO( ac_get_bg_tile_info )
99102{
100103   acommand_state *state = machine.driver_data<acommand_state>();
101   int code = state->m_ac_bgvram[tile_index];
104   int code = state->m_ac_bgvram.target()[tile_index];
102105   SET_TILE_INFO(
103106         1,
104107         code & 0xfff,
r14896r14897
109112static TILE_GET_INFO( ac_get_tx_tile_info )
110113{
111114   acommand_state *state = machine.driver_data<acommand_state>();
112   int code = state->m_ac_txvram[tile_index];
115   int code = state->m_ac_txvram.target()[tile_index];
113116   SET_TILE_INFO(
114117         0,
115118         code & 0xfff,
r14896r14897
120123static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int pri_mask)
121124{
122125   acommand_state *state = machine.driver_data<acommand_state>();
123   UINT16 *spriteram16 = state->m_spriteram;
126   UINT16 *spriteram16 = state->m_spriteram.target();
124127   int offs;
125128
126   for (offs = 0;offs < state->m_spriteram_size/2;offs += 8)
129   for (offs = 0;offs < state->m_spriteram.bytes()/2;offs += 8)
127130   {
128131      if (!(spriteram16[offs+0] & 0x1000))
129132      {
r14896r14897
140143         int xx,yy,x;
141144         int delta = 16;
142145
143         flipx ^= flip_screen_get(machine);
144         flipy ^= flip_screen_get(machine);
146         flipx ^= state->flip_screen();
147         flipy ^= state->flip_screen();
145148
146149         if ((pri&pri_mask)!=priority) continue;
147150
148         if (flip_screen_get(machine))
151         if (state->flip_screen())
149152         {
150153            sx = 368 - sx;
151154            sy = 240 - sy;
r14896r14897
266269
267270WRITE16_MEMBER(acommand_state::ac_bgvram_w)
268271{
269   COMBINE_DATA(&m_ac_bgvram[offset]);
272   COMBINE_DATA(&m_ac_bgvram.target()[offset]);
270273   m_bg_tilemap->mark_tile_dirty(offset);
271274}
272275
273276WRITE16_MEMBER(acommand_state::ac_txvram_w)
274277{
275   COMBINE_DATA(&m_ac_txvram[offset]);
278   COMBINE_DATA(&m_ac_txvram.target()[offset]);
276279   m_tx_tilemap->mark_tile_dirty(offset);
277280}
278281
r14896r14897
342345            */
343346        //22dc8
344347      {
345         m_ufo_sw1 = m_ac_devram[offset] & 3;
346         if(m_ac_devram[offset] & 0x10)
348         m_ufo_sw1 = m_ac_devram.target()[offset] & 3;
349         if(m_ac_devram.target()[offset] & 0x10)
347350            m_ufo_sw1|= 0x10;
348         if(m_ac_devram[offset] & 0x40)
351         if(m_ac_devram.target()[offset] & 0x40)
349352            m_ufo_sw1|= 0x20;
350         if(m_ac_devram[offset] & 0x100)
353         if(m_ac_devram.target()[offset] & 0x100)
351354            m_ufo_sw1|=0x100;
352         if(m_ac_devram[offset] & 0x400)
355         if(m_ac_devram.target()[offset] & 0x400)
353356            m_ufo_sw1|=0x200;
354         if(m_ac_devram[offset] & 0x1000)
357         if(m_ac_devram.target()[offset] & 0x1000)
355358            m_ufo_sw1|=0x1000;
356         if(m_ac_devram[offset] & 0x4000)
359         if(m_ac_devram.target()[offset] & 0x4000)
357360            m_ufo_sw1|=0x2000;
358//          if(m_ac_devram[0x0048/2] & 0x0001)
361//          if(m_ac_devram.target()[0x0048/2] & 0x0001)
359362//              m_ufo_sw1|=0x0040;
360//          if(m_ac_devram[0x0048/2] & 0x0004)
363//          if(m_ac_devram.target()[0x0048/2] & 0x0004)
361364//              m_ufo_sw1|=0x0400;
362//          if(m_ac_devram[0x0048/2] & 0x0100)
365//          if(m_ac_devram.target()[0x0048/2] & 0x0100)
363366//              m_ufo_sw1|=0x4000;
364367         return m_ufo_sw1;
365368      }
r14896r14897
372375            */
373376      {
374377         m_ufo_sw2 = 0;
375         if(m_ac_devram[offset] & 0x01)
378         if(m_ac_devram.target()[offset] & 0x01)
376379            m_ufo_sw2|= 1;
377         if(m_ac_devram[offset] & 0x04)
380         if(m_ac_devram.target()[offset] & 0x04)
378381            m_ufo_sw2|= 2;
379         if(m_ac_devram[offset] & 0x10)
382         if(m_ac_devram.target()[offset] & 0x10)
380383            m_ufo_sw2|=0x10;
381         if(m_ac_devram[offset] & 0x40)
384         if(m_ac_devram.target()[offset] & 0x40)
382385            m_ufo_sw2|=0x20;
383386         return m_ufo_sw2;
384387      }
385388      case 0x0048/2:
386         return m_ac_devram[offset];
389         return m_ac_devram.target()[offset];
387390      case 0x005c/2:
388391         /*
389392                xxxx xxxx ---- ---- DIPSW4
r14896r14897
391394            */
392395         return input_port_read(machine(), "IN1");
393396   }
394   return m_ac_devram[offset];
397   return m_ac_devram.target()[offset];
395398}
396399
397400WRITE16_MEMBER(acommand_state::ac_devices_w)
398401{
399   COMBINE_DATA(&m_ac_devram[offset]);
402   COMBINE_DATA(&m_ac_devram.target()[offset]);
400403   switch(offset)
401404   {
402405      case 0x00/2:
r14896r14897
434437      case 0x48/2:
435438         break;
436439      case 0x50/2:
437         m_led0 = m_ac_devram[offset];
440         m_led0 = m_ac_devram.target()[offset];
438441         //popmessage("%04x",m_led0);
439442         break;
440443      case 0x54/2:
441         m_led1 = m_ac_devram[offset];
444         m_led1 = m_ac_devram.target()[offset];
442445         //popmessage("%04x",m_led0);
443446         break;
444447   }
r14896r14897
456459   AM_RANGE(0x082000, 0x082005) AM_WRITE(ac_bgscroll_w)
457460   AM_RANGE(0x082100, 0x082105) AM_WRITE(ac_txscroll_w)
458461   AM_RANGE(0x082208, 0x082209) AM_WRITE(ac_unk2_w)
459   AM_RANGE(0x0a0000, 0x0a3fff) AM_RAM_WRITE(ac_bgvram_w) AM_BASE(m_ac_bgvram)
460   AM_RANGE(0x0b0000, 0x0b3fff) AM_RAM_WRITE(ac_txvram_w) AM_BASE(m_ac_txvram)
461   AM_RANGE(0x0b8000, 0x0bffff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
462   AM_RANGE(0x0a0000, 0x0a3fff) AM_RAM_WRITE(ac_bgvram_w) AM_SHARE("ac_bgvram")
463   AM_RANGE(0x0b0000, 0x0b3fff) AM_RAM_WRITE(ac_txvram_w) AM_SHARE("ac_txvram")
464   AM_RANGE(0x0b8000, 0x0bffff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
462465   AM_RANGE(0x0f0000, 0x0f7fff) AM_RAM
463   AM_RANGE(0x0f8000, 0x0f8fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
466   AM_RANGE(0x0f8000, 0x0f8fff) AM_RAM AM_SHARE("spriteram")
464467   AM_RANGE(0x0f9000, 0x0fffff) AM_RAM
465   AM_RANGE(0x100000, 0x1000ff) AM_READ(ac_devices_r) AM_WRITE(ac_devices_w) AM_BASE(m_ac_devram)
468   AM_RANGE(0x100000, 0x1000ff) AM_READ(ac_devices_r) AM_WRITE(ac_devices_w) AM_SHARE("ac_devram")
466469ADDRESS_MAP_END
467470
468471static INPUT_PORTS_START( acommand )
src/mame/drivers/asterix.c
r14896r14897
174174   AM_RANGE(0x180000, 0x1807ff) AM_DEVREADWRITE_LEGACY("k053244", k053245_word_r, k053245_word_w)
175175   AM_RANGE(0x180800, 0x180fff) AM_RAM                        // extra RAM, or mirror for the above?
176176   AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE_LEGACY("k053244", k053244_word_r, k053244_word_w)
177   AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
177   AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
178178   AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE_LEGACY("k053244", k053244_lsb_r, k053244_lsb_w)
179179   AM_RANGE(0x380000, 0x380001) AM_READ_PORT("IN0")
180180   AM_RANGE(0x380002, 0x380003) AM_READ_PORT("IN1")
src/mame/drivers/goldnpkr.c
r14896r14897
959959{
960960public:
961961   goldnpkr_state(const machine_config &mconfig, device_type type, const char *tag)
962      : driver_device(mconfig, type, tag) { }
962      : driver_device(mconfig, type, tag) ,
963      m_videoram(*this, "videoram"),
964      m_colorram(*this, "colorram"){ }
963965
964   UINT8 *m_videoram;
965   UINT8 *m_colorram;
966   required_shared_ptr<UINT8> m_videoram;
967   required_shared_ptr<UINT8> m_colorram;
966968   tilemap_t *m_bg_tilemap;
967969   UINT8 m_mux_data;
968970   UINT8 m_pia0_PA_data;
r14896r14897
978980
979981WRITE8_MEMBER(goldnpkr_state::goldnpkr_videoram_w)
980982{
981   m_videoram[offset] = data;
983   m_videoram.target()[offset] = data;
982984   m_bg_tilemap->mark_tile_dirty(offset);
983985}
984986
985987WRITE8_MEMBER(goldnpkr_state::goldnpkr_colorram_w)
986988{
987   m_colorram[offset] = data;
989   m_colorram.target()[offset] = data;
988990   m_bg_tilemap->mark_tile_dirty(offset);
989991}
990992
r14896r14897
9991001    xx-- ----   unused.
10001002*/
10011003
1002   int attr = state->m_colorram[tile_index];
1003   int code = ((attr & 1) << 8) | state->m_videoram[tile_index];
1004   int attr = state->m_colorram.target()[tile_index];
1005   int code = ((attr & 1) << 8) | state->m_videoram.target()[tile_index];
10041006   int bank = (attr & 0x02) >> 1;   /* bit 1 switch the gfx banks */
10051007   int color = (attr & 0x3c) >> 2;   /* bits 2-3-4-5 for color */
10061008
r14896r14897
10181020    xx-- --xx   tiles bank.
10191021*/
10201022
1021   int attr = state->m_colorram[tile_index];
1022   int code = ((attr & 1) << 8) | state->m_videoram[tile_index];
1023   int attr = state->m_colorram.target()[tile_index];
1024   int code = ((attr & 1) << 8) | state->m_videoram.target()[tile_index];
10231025   int bank = (attr & 0x03) + ((attr & 0xc0) >> 4);   /* bits 0, 1, 6 & 7 switch the gfx banks */
10241026   int color = (attr & 0x3c) >> 2;   /* bits 2-3-4-5 for color */
10251027
r14896r14897
13451347   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
13461348   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
13471349   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
1348   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(m_videoram)
1349   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(m_colorram)
1350   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_SHARE("videoram")
1351   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_SHARE("colorram")
13501352   AM_RANGE(0x2000, 0x7fff) AM_ROM /* superdbl uses 0x2000..0x3fff address space */
13511353ADDRESS_MAP_END
13521354
r14896r14897
13571359   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
13581360   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
13591361   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
1360   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(m_videoram)
1361   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(m_colorram)
1362   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_SHARE("videoram")
1363   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_SHARE("colorram")
13621364   AM_RANGE(0x2000, 0x3fff) AM_ROM
13631365ADDRESS_MAP_END
13641366
r14896r14897
13691371   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
13701372   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
13711373   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
1372   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(m_videoram)
1373   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(m_colorram)
1374   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_SHARE("videoram")
1375   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_SHARE("colorram")
13741376   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2")
13751377//  AM_RANGE(0x2108, 0x210b) AM_NOP /* unknown 40-pin device */
13761378   AM_RANGE(0x2800, 0x2fff) AM_RAM
r14896r14897
13941396   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")   /* battery backed RAM */
13951397   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
13961398   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
1397   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(m_videoram)
1398   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(m_colorram)
1399   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_SHARE("videoram")
1400   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_SHARE("colorram")
13991401   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2")
14001402   AM_RANGE(0x2100, 0x2100) AM_DEVWRITE("crtc", mc6845_device, address_w)
14011403   AM_RANGE(0x2101, 0x2101) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
r14896r14897
14091411   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
14101412   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
14111413   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
1412   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(m_videoram)
1413   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(m_colorram)
1414   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_SHARE("videoram")
1415   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_SHARE("colorram")
14141416   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2")
14151417   AM_RANGE(0x2200, 0x27ff) AM_ROM   /* for VK set */
14161418   AM_RANGE(0x2800, 0x2fff) AM_RAM   /* for VK set */
r14896r14897
14301432   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
14311433   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
14321434   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
1433   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(m_videoram)
1434   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(m_colorram)
1435   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_SHARE("videoram")
1436   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_SHARE("colorram")
14351437   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2")
14361438   AM_RANGE(0x2200, 0x27ff) AM_ROM   /* for VK hardware */
14371439   AM_RANGE(0x2800, 0x2fff) AM_RAM   AM_SHARE("nvram")   /* Dallas ds1210 + battery backed RAM */
r14896r14897
14491451   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")   /* battery backed RAM */
14501452   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
14511453   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
1452   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(m_videoram)
1453   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(m_colorram)
1454   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_SHARE("videoram")
1455   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_SHARE("colorram")
14541456   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SW2")
14551457   AM_RANGE(0x2100, 0x2100) AM_DEVWRITE("crtc", mc6845_device, address_w)
14561458   AM_RANGE(0x2101, 0x2101) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
r14896r14897
14841486   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
14851487   AM_RANGE(0x0844, 0x0847) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
14861488   AM_RANGE(0x0848, 0x084b) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
1487   AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_BASE(m_videoram)
1488   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_BASE(m_colorram)
1489   AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(goldnpkr_videoram_w) AM_SHARE("videoram")
1490   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(goldnpkr_colorram_w) AM_SHARE("colorram")
14891491   AM_RANGE(0x2000, 0x3fff) AM_ROM
14901492ADDRESS_MAP_END
14911493
src/mame/drivers/ppmast93.c
r14896r14897
140140{
141141public:
142142   ppmast93_state(const machine_config &mconfig, device_type type, const char *tag)
143      : driver_device(mconfig, type, tag) { }
143      : driver_device(mconfig, type, tag) ,
144      m_bgram(*this, "bgram"),
145      m_fgram(*this, "fgram"){ }
144146
145147   tilemap_t *m_fg_tilemap;
146148   tilemap_t *m_bg_tilemap;
147   UINT8 *m_fgram;
148   UINT8 *m_bgram;
149   required_shared_ptr<UINT8> m_bgram;
150   required_shared_ptr<UINT8> m_fgram;
149151   DECLARE_WRITE8_MEMBER(ppmast93_fgram_w);
150152   DECLARE_WRITE8_MEMBER(ppmast93_bgram_w);
151153   DECLARE_WRITE8_MEMBER(ppmast93_port4_w);
r14896r14897
157159
158160WRITE8_MEMBER(ppmast93_state::ppmast93_fgram_w)
159161{
160   m_fgram[offset] = data;
162   m_fgram.target()[offset] = data;
161163   m_fg_tilemap->mark_tile_dirty(offset/2);
162164}
163165
164166WRITE8_MEMBER(ppmast93_state::ppmast93_bgram_w)
165167{
166   m_bgram[offset] = data;
168   m_bgram.target()[offset] = data;
167169   m_bg_tilemap->mark_tile_dirty(offset/2);
168170}
169171
r14896r14897
182184static ADDRESS_MAP_START( ppmast93_cpu1_map, AS_PROGRAM, 8, ppmast93_state )
183185   AM_RANGE(0x0000, 0x7fff) AM_ROM AM_WRITENOP AM_REGION("maincpu", 0x10000)
184186   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
185   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(ppmast93_bgram_w) AM_BASE(m_bgram) AM_SHARE("share1")
187   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(ppmast93_bgram_w) AM_SHARE("bgram") AM_SHARE("share1")
186188   AM_RANGE(0xd800, 0xdfff) AM_WRITENOP
187   AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(ppmast93_fgram_w) AM_BASE(m_fgram) AM_SHARE("share2")
189   AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(ppmast93_fgram_w) AM_SHARE("fgram") AM_SHARE("share2")
188190   AM_RANGE(0xf800, 0xffff) AM_RAM
189191ADDRESS_MAP_END
190192
r14896r14897
196198   AM_RANGE(0x06, 0x06) AM_READ_PORT("DSW1")
197199   AM_RANGE(0x08, 0x08) AM_READ_PORT("DSW2")
198200
199   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_w)
201   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_byte_w)
200202   AM_RANGE(0x04, 0x04) AM_WRITE(ppmast93_port4_w)
201203ADDRESS_MAP_END
202204
203205static ADDRESS_MAP_START( ppmast93_cpu2_map, AS_PROGRAM, 8, ppmast93_state )
204206   AM_RANGE(0x0000, 0xfbff) AM_ROM AM_REGION("sub", 0x10000)
205   AM_RANGE(0xfc00, 0xfc00) AM_READ(soundlatch_r)
207   AM_RANGE(0xfc00, 0xfc00) AM_READ(soundlatch_byte_r)
206208   AM_RANGE(0xfd00, 0xffff) AM_RAM
207209ADDRESS_MAP_END
208210
r14896r14897
323325static TILE_GET_INFO( get_ppmast93_bg_tile_info )
324326{
325327   ppmast93_state *state = machine.driver_data<ppmast93_state>();
326   int code = (state->m_bgram[tile_index*2+1] << 8) | state->m_bgram[tile_index*2];
328   int code = (state->m_bgram.target()[tile_index*2+1] << 8) | state->m_bgram.target()[tile_index*2];
327329   SET_TILE_INFO(
328330         0,
329331         code & 0x0fff,
r14896r14897
334336static TILE_GET_INFO( get_ppmast93_fg_tile_info )
335337{
336338   ppmast93_state *state = machine.driver_data<ppmast93_state>();
337   int code = (state->m_fgram[tile_index*2+1] << 8) | state->m_fgram[tile_index*2];
339   int code = (state->m_fgram.target()[tile_index*2+1] << 8) | state->m_fgram.target()[tile_index*2];
338340   SET_TILE_INFO(
339341         0,
340342         (code & 0x0fff)+0x1000,
src/mame/drivers/moo.c
r14896r14897
158158   if ((data & 0x00ff0000) == 0)
159159   {
160160      data &= 0xff;
161      soundlatch_w(space, 0, data);
161      soundlatch_byte_w(space, 0, data);
162162   }
163163}
164164
165165WRITE16_MEMBER(moo_state::sound_cmd2_w)
166166{
167167   if ((data & 0x00ff0000) == 0)
168      soundlatch2_w(space, 0, data & 0xff);
168      soundlatch2_byte_w(space, 0, data & 0xff);
169169}
170170
171171WRITE16_MEMBER(moo_state::sound_irq_w)
r14896r14897
175175
176176READ16_MEMBER(moo_state::sound_status_r)
177177{
178   return soundlatch3_r(space, 0);
178   return soundlatch3_byte_r(space, 0);
179179}
180180
181181WRITE8_MEMBER(moo_state::sound_bankswitch_w)
r14896r14897
280280   AM_RANGE(0x1a0000, 0x1a1fff) AM_DEVREADWRITE_LEGACY("k056832", k056832_ram_word_r, k056832_ram_word_w)   /* Graphic planes */
281281   AM_RANGE(0x1a2000, 0x1a3fff) AM_DEVREADWRITE_LEGACY("k056832", k056832_ram_word_r, k056832_ram_word_w)   /* Graphic planes mirror */
282282   AM_RANGE(0x1b0000, 0x1b1fff) AM_DEVREAD_LEGACY("k056832", k056832_rom_word_r)   /* Passthrough to tile roms */
283   AM_RANGE(0x1c0000, 0x1c1fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")
283   AM_RANGE(0x1c0000, 0x1c1fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")
284284#if MOO_DEBUG
285285   AM_RANGE(0x0c0000, 0x0c003f) AM_DEVREAD_LEGACY("k056832", k056832_word_r)
286286   AM_RANGE(0x0c2000, 0x0c2007) AM_DEVREAD_LEGACY("k053246", k053246_reg_word_r)
r14896r14897
313313   AM_RANGE(0x1a0000, 0x1a1fff) AM_DEVREADWRITE_LEGACY("k056832", k056832_ram_word_r, k056832_ram_word_w) /* Graphic planes */
314314   AM_RANGE(0x1a2000, 0x1a3fff) AM_DEVREADWRITE_LEGACY("k056832", k056832_ram_word_r, k056832_ram_word_w)   /* Graphic planes mirror */
315315   AM_RANGE(0x1b0000, 0x1b1fff) AM_DEVREAD_LEGACY("k056832", k056832_rom_word_r)   /* Passthrough to tile roms */
316   AM_RANGE(0x1c0000, 0x1c1fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")
316   AM_RANGE(0x1c0000, 0x1c1fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")
317317ADDRESS_MAP_END
318318
319319static ADDRESS_MAP_START( bucky_map, AS_PROGRAM, 16, moo_state )
r14896r14897
344344   AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE_LEGACY("k056832", k056832_ram_word_r, k056832_ram_word_w)   /* Graphic planes mirror */
345345   AM_RANGE(0x184000, 0x187fff) AM_RAM                     /* extra tile RAM? */
346346   AM_RANGE(0x190000, 0x191fff) AM_DEVREAD_LEGACY("k056832", k056832_rom_word_r)   /* Passthrough to tile roms */
347   AM_RANGE(0x1b0000, 0x1b3fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")
347   AM_RANGE(0x1b0000, 0x1b3fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")
348348   AM_RANGE(0x200000, 0x23ffff) AM_ROM                     /* data */
349349#if MOO_DEBUG
350350   AM_RANGE(0x0c0000, 0x0c003f) AM_DEVREAD_LEGACY("k056832", k056832_word_r)
r14896r14897
361361   AM_RANGE(0xc000, 0xdfff) AM_RAM
362362   AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("k054539", k054539_device, read, write)
363363   AM_RANGE(0xec00, 0xec01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)
364   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
365   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
366   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
364   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_byte_w)
365   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_byte_r)
366   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_byte_r)
367367   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
368368ADDRESS_MAP_END
369369
src/mame/drivers/segald.c
r14896r14897
2929public:
3030   segald_state(const machine_config &mconfig, device_type type, const char *tag)
3131      : driver_device(mconfig, type, tag),
32        m_laserdisc(*this, "laserdisc") { }
32        m_laserdisc(*this, "laserdisc") ,
33      m_obj_RAM(*this, "obj_RAM"),
34      m_out_RAM(*this, "out_RAM"),
35      m_color_RAM(*this, "color_RAM"),
36      m_fix_RAM(*this, "fix_RAM"){ }
3337
3438   UINT8 m_nmi_enable;
3539
36   UINT8* m_obj_RAM;
37   UINT8* m_color_RAM;
38   UINT8* m_fix_RAM;
39   UINT8* m_out_RAM;
40   required_device<pioneer_ldv1000_device> m_laserdisc;
41   required_shared_ptr<UINT8> m_obj_RAM;
42   required_shared_ptr<UINT8> m_out_RAM;
43   required_shared_ptr<UINT8> m_color_RAM;
44   required_shared_ptr<UINT8> m_fix_RAM;
4045
41   required_device<pioneer_ldv1000_device> m_laserdisc;
4246   UINT8 m_ldv1000_input_latch;
4347   UINT8 m_ldv1000_output_latch;
4448
r14896r14897
6569      for (characterY = 0; characterY < 32; characterY++)
6670      {
6771         int current_screen_character = (characterY*32) + characterX;
68         drawgfx_transpen(bitmap, cliprect, machine.gfx[0], state->m_fix_RAM[current_screen_character],
72         drawgfx_transpen(bitmap, cliprect, machine.gfx[0], state->m_fix_RAM.target()[current_screen_character],
6973               1, 0, 0, characterX*8, characterY*8, 0);
7074      }
7175   }
r14896r14897
9195   for (spr_number = 0; spr_number < 32; spr_number++)
9296   {
9397      spr_base = 0x10 * spr_number;
94      sy = state->m_obj_RAM[spr_base + SPR_Y_TOP];
95      sx = state->m_obj_RAM[spr_base + SPR_X_LO];
98      sy = state->m_obj_RAM.target()[spr_base + SPR_Y_TOP];
99      sx = state->m_obj_RAM.target()[spr_base + SPR_X_LO];
96100
97101      if (sx != 0 || sy != 0)
98102         logerror("Hey!  A sprite's not at 0,0 : %d %d", sx, sy);
r14896r14897
128132READ8_MEMBER(segald_state::astron_OUT_read)
129133{
130134
131   logerror("OUT read   (0x%04x) @ 0x%04x [0x%x]\n", m_out_RAM[offset], offset, cpu_get_pc(&space.device()));
132   return m_out_RAM[offset];
135   logerror("OUT read   (0x%04x) @ 0x%04x [0x%x]\n", m_out_RAM.target()[offset], offset, cpu_get_pc(&space.device()));
136   return m_out_RAM.target()[offset];
133137}
134138
135139READ8_MEMBER(segald_state::astron_OBJ_read)
136140{
137141
138   logerror("OBJ read   (0x%04x) @ 0x%04x [0x%x]\n", m_obj_RAM[offset], offset, cpu_get_pc(&space.device()));
139   return m_obj_RAM[offset];
142   logerror("OBJ read   (0x%04x) @ 0x%04x [0x%x]\n", m_obj_RAM.target()[offset], offset, cpu_get_pc(&space.device()));
143   return m_obj_RAM.target()[offset];
140144}
141145
142146READ8_MEMBER(segald_state::astron_COLOR_read)
143147{
144148
145   logerror("COLOR read   (0x%04x) @ 0x%04x [0x%x]\n", m_color_RAM[offset], offset, cpu_get_pc(&space.device()));
146   return m_color_RAM[offset];
149   logerror("COLOR read   (0x%04x) @ 0x%04x [0x%x]\n", m_color_RAM.target()[offset], offset, cpu_get_pc(&space.device()));
150   return m_color_RAM.target()[offset];
147151}
148152
149153
r14896r14897
193197         break;
194198   }
195199
196   m_out_RAM[offset] = data;
200   m_out_RAM.target()[offset] = data;
197201}
198202
199203WRITE8_MEMBER(segald_state::astron_OBJ_write)
200204{
201205
202   m_obj_RAM[offset] = data;
206   m_obj_RAM.target()[offset] = data;
203207   logerror("OBJ write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device()));
204208}
205209
r14896r14897
210214   const UINT8 palIndex = offset >> 1;
211215
212216   /* Combine */
213   m_color_RAM[offset] = data;
217   m_color_RAM.target()[offset] = data;
214218
215219   /* Easy access */
216   highBits = m_color_RAM[(palIndex<<1)+1] & 0x0f;
217   lowBits  = m_color_RAM[(palIndex<<1)];
220   highBits = m_color_RAM.target()[(palIndex<<1)+1] & 0x0f;
221   lowBits  = m_color_RAM.target()[(palIndex<<1)];
218222
219223   /* 4-bit RGB */
220224   r = (lowBits  & 0x0f);
r14896r14897
229233WRITE8_MEMBER(segald_state::astron_FIX_write)
230234{
231235
232   m_fix_RAM[offset] = data;
236   m_fix_RAM.target()[offset] = data;
233237   /* logerror("FIX write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device())); */
234238}
235239
r14896r14897
247251   AM_RANGE(0x0000, 0x7fff) AM_ROM
248252   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
249253
250   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(astron_OBJ_read, astron_OBJ_write) AM_BASE(m_obj_RAM)   /* OBJ according to the schematics (sprite) */
254   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(astron_OBJ_read, astron_OBJ_write) AM_SHARE("obj_RAM")   /* OBJ according to the schematics (sprite) */
251255   AM_RANGE(0xc800, 0xcfff) AM_READWRITE(astron_DISC_read, astron_DISC_write)               /* DISC interface according to schematics */
252256   AM_RANGE(0xd000, 0xd000) AM_READ_PORT("DSWA")                        /* SW bank 2 (DIPs) */
253257   AM_RANGE(0xd001, 0xd001) AM_READ_PORT("DSWB")                        /* SW bank 3 (DIPs) */
254258   AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN0")                        /* SW bank 0 (IO) */
255259   AM_RANGE(0xd003, 0xd003) AM_READ_PORT("IN1")                        /* SW bank 1 (IO) */
256   AM_RANGE(0xd800, 0xd803) AM_READWRITE(astron_OUT_read, astron_OUT_write) AM_BASE(m_out_RAM)   /* OUT according to schematics (output port) */
257   AM_RANGE(0xe000, 0xe1ff) AM_READWRITE(astron_COLOR_read, astron_COLOR_write) AM_BASE(m_color_RAM) /* COLOR according to the schematics */
258   AM_RANGE(0xf000, 0xf7ff) AM_WRITE(astron_FIX_write) AM_BASE(m_fix_RAM)                  /* FIX according to schematics (characters) */
260   AM_RANGE(0xd800, 0xd803) AM_READWRITE(astron_OUT_read, astron_OUT_write) AM_SHARE("out_RAM")   /* OUT according to schematics (output port) */
261   AM_RANGE(0xe000, 0xe1ff) AM_READWRITE(astron_COLOR_read, astron_COLOR_write) AM_SHARE("color_RAM") /* COLOR according to the schematics */
262   AM_RANGE(0xf000, 0xf7ff) AM_WRITE(astron_FIX_write) AM_SHARE("fix_RAM")                  /* FIX according to schematics (characters) */
259263   AM_RANGE(0xf800, 0xffff) AM_RAM                                                /* RAM according to schematics */
260264ADDRESS_MAP_END
261265
src/mame/drivers/tickee.c
r14896r14897
3333{
3434public:
3535   tickee_state(const machine_config &mconfig, device_type type, const char *tag)
36      : driver_device(mconfig, type, tag) { }
36      : driver_device(mconfig, type, tag) ,
37      m_vram(*this, "vram"),
38      m_control(*this, "control"){ }
3739
38   UINT16 *m_control;
39   UINT16 *m_vram;
40   required_shared_ptr<UINT16> m_vram;
41   required_shared_ptr<UINT16> m_control;
4042   emu_timer *m_setup_gun_timer;
4143   int m_beamxadd;
4244   int m_beamyadd;
r14896r14897
111113   state->m_setup_gun_timer->adjust(machine.primary_screen->time_until_pos(0));
112114
113115   /* only do work if the palette is flashed */
114   if (state->m_control)
115      if (!state->m_control[2])
116   if (state->m_control.target())
117      if (!state->m_control.target()[2])
116118         return;
117119
118120   /* generate interrupts for player 1's gun */
r14896r14897
153155static void scanline_update(screen_device &screen, bitmap_rgb32 &bitmap, int scanline, const tms34010_display_params *params)
154156{
155157   tickee_state *state = screen.machine().driver_data<tickee_state>();
156   UINT16 *src = &state->m_vram[(params->rowaddr << 8) & 0x3ff00];
158   UINT16 *src = &state->m_vram.target()[(params->rowaddr << 8) & 0x3ff00];
157159   UINT32 *dest = &bitmap.pix32(scanline);
158160   const rgb_t *pens = tlc34076_get_pens(screen.machine().device("tlc34076"));
159161   int coladdr = params->coladdr << 1;
160162   int x;
161163
162164   /* blank palette: fill with pen 255 */
163   if (state->m_control[2])
165   if (state->m_control.target()[2])
164166   {
165167      for (x = params->heblnk; x < params->hsblnk; x++)
166168         dest[x] = pens[0xff];
r14896r14897
179181static void rapidfir_scanline_update(screen_device &screen, bitmap_rgb32 &bitmap, int scanline, const tms34010_display_params *params)
180182{
181183   tickee_state *state = screen.machine().driver_data<tickee_state>();
182   UINT16 *src = &state->m_vram[(params->rowaddr << 8) & 0x3ff00];
184   UINT16 *src = &state->m_vram.target()[(params->rowaddr << 8) & 0x3ff00];
183185   UINT32 *dest = &bitmap.pix32(scanline);
184186   const rgb_t *pens = tlc34076_get_pens(screen.machine().device("tlc34076"));
185187   int coladdr = params->coladdr << 1;
r14896r14897
238240{
239241   if (!(data & 0xff00)) mem_mask &= 0x00ff;
240242   if (!(data & 0x00ff)) mem_mask &= 0xff00;
241   COMBINE_DATA(&m_vram[offset]);
243   COMBINE_DATA(&m_vram.target()[offset]);
242244}
243245
244246
245247READ16_MEMBER(tickee_state::rapidfir_transparent_r)
246248{
247   return m_vram[offset];
249   return m_vram.target()[offset];
248250}
249251
250252
r14896r14897
252254{
253255   tickee_state *state = space->machine().driver_data<tickee_state>();
254256   if (address < 0x800000)
255      memcpy(shiftreg, &state->m_vram[TOWORD(address)], TOBYTE(0x2000));
257      memcpy(shiftreg, &state->m_vram.target()[TOWORD(address)], TOBYTE(0x2000));
256258}
257259
258260
r14896r14897
260262{
261263   tickee_state *state = space->machine().driver_data<tickee_state>();
262264   if (address < 0x800000)
263      memcpy(&state->m_vram[TOWORD(address)], shiftreg, TOBYTE(0x2000));
265      memcpy(&state->m_vram.target()[TOWORD(address)], shiftreg, TOBYTE(0x2000));
264266}
265267
266268
r14896r14897
273275
274276WRITE16_MEMBER(tickee_state::tickee_control_w)
275277{
276   UINT16 olddata = m_control[offset];
278   UINT16 olddata = m_control.target()[offset];
277279
278280   /* offsets:
279281
r14896r14897
282284        6 = lamps? (changing all the time)
283285    */
284286
285   COMBINE_DATA(&m_control[offset]);
287   COMBINE_DATA(&m_control.target()[offset]);
286288
287289   if (offset == 3)
288290   {
289      ticket_dispenser_w(machine().device("ticket1"), 0, (data & 8) << 4);
290      ticket_dispenser_w(machine().device("ticket2"), 0, (data & 4) << 5);
291      machine().device<ticket_dispenser_device>("ticket1")->write(space, 0, (data & 8) << 4);
292      machine().device<ticket_dispenser_device>("ticket2")->write(space, 0, (data & 4) << 5);
291293   }
292294
293   if (olddata != m_control[offset])
294      logerror("%08X:tickee_control_w(%d) = %04X (was %04X)\n", cpu_get_pc(&space.device()), offset, m_control[offset], olddata);
295   if (olddata != m_control.target()[offset])
296      logerror("%08X:tickee_control_w(%d) = %04X (was %04X)\n", cpu_get_pc(&space.device()), offset, m_control.target()[offset], olddata);
295297}
296298
297299
r14896r14897
381383 *************************************/
382384
383385static ADDRESS_MAP_START( tickee_map, AS_PROGRAM, 16, tickee_state )
384   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(m_vram)
386   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("vram")
385387   AM_RANGE(0x02000000, 0x02ffffff) AM_ROM AM_REGION("user1", 0)
386388   AM_RANGE(0x04000000, 0x04003fff) AM_RAM AM_SHARE("nvram")
387389   AM_RANGE(0x04100000, 0x041000ff) AM_DEVREADWRITE8_LEGACY("tlc34076", tlc34076_r, tlc34076_w, 0x00ff)
r14896r14897
389391   AM_RANGE(0x04200000, 0x0420001f) AM_DEVWRITE8_LEGACY("ym1", ay8910_address_data_w, 0x00ff)
390392   AM_RANGE(0x04200100, 0x0420010f) AM_DEVREAD8_LEGACY("ym2", ay8910_r, 0x00ff)
391393   AM_RANGE(0x04200100, 0x0420011f) AM_DEVWRITE8_LEGACY("ym2", ay8910_address_data_w, 0x00ff)
392   AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_BASE(m_control)
394   AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_SHARE("control")
393395   AM_RANGE(0x04400040, 0x0440004f) AM_READ_PORT("IN2")
394396   AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE_LEGACY(tms34010_io_register_r, tms34010_io_register_w)
395397   AM_RANGE(0xc0000240, 0xc000025f) AM_WRITENOP      /* seems to be a bug in their code */
r14896r14897
399401
400402/* addreses in the 04x range shifted slightly...*/
401403static ADDRESS_MAP_START( ghoshunt_map, AS_PROGRAM, 16, tickee_state )
402   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(m_vram)
404   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("vram")
403405   AM_RANGE(0x02000000, 0x02ffffff) AM_ROM AM_REGION("user1", 0)
404406   AM_RANGE(0x04100000, 0x04103fff) AM_RAM AM_SHARE("nvram")
405407   AM_RANGE(0x04200000, 0x042000ff) AM_DEVREADWRITE8_LEGACY("tlc34076", tlc34076_r, tlc34076_w, 0x00ff)
r14896r14897
407409   AM_RANGE(0x04300000, 0x0430001f) AM_DEVWRITE8_LEGACY("ym1", ay8910_address_data_w, 0x00ff)
408410   AM_RANGE(0x04300100, 0x0430010f) AM_DEVREAD8_LEGACY("ym2", ay8910_r, 0x00ff)
409411   AM_RANGE(0x04300100, 0x0430011f) AM_DEVWRITE8_LEGACY("ym2", ay8910_address_data_w, 0x00ff)
410   AM_RANGE(0x04500000, 0x0450007f) AM_WRITE(tickee_control_w) AM_BASE(m_control)
412   AM_RANGE(0x04500000, 0x0450007f) AM_WRITE(tickee_control_w) AM_SHARE("control")
411413   AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE_LEGACY(tms34010_io_register_r, tms34010_io_register_w)
412414   AM_RANGE(0xc0000240, 0xc000025f) AM_WRITENOP      /* seems to be a bug in their code */
413415   AM_RANGE(0xff000000, 0xffffffff) AM_ROM AM_REGION("user1", 0)
r14896r14897
415417
416418
417419static ADDRESS_MAP_START( mouseatk_map, AS_PROGRAM, 16, tickee_state )
418   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(m_vram)
420   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("vram")
419421   AM_RANGE(0x02000000, 0x02ffffff) AM_ROM AM_REGION("user1", 0)
420422   AM_RANGE(0x04000000, 0x04003fff) AM_RAM AM_SHARE("nvram")
421423   AM_RANGE(0x04100000, 0x041000ff) AM_DEVREADWRITE8_LEGACY("tlc34076", tlc34076_r, tlc34076_w, 0x00ff)
422424   AM_RANGE(0x04200000, 0x0420000f) AM_DEVREAD8_LEGACY("ym", ay8910_r, 0x00ff)
423425   AM_RANGE(0x04200000, 0x0420000f) AM_DEVWRITE8_LEGACY("ym", ay8910_address_data_w, 0x00ff)
424426   AM_RANGE(0x04200100, 0x0420010f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
425   AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_BASE(m_control)
427   AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_SHARE("control")
426428   AM_RANGE(0x04400040, 0x0440004f) AM_READ_PORT("IN2") // ?
427429   AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE_LEGACY(tms34010_io_register_r, tms34010_io_register_w)
428430   AM_RANGE(0xc0000240, 0xc000025f) AM_WRITENOP      /* seems to be a bug in their code */
r14896r14897
432434
433435/* newer hardware */
434436static ADDRESS_MAP_START( rapidfir_map, AS_PROGRAM, 16, tickee_state )
435   AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_BASE(m_vram)
437   AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("vram")
436438   AM_RANGE(0x02000000, 0x027fffff) AM_READWRITE(rapidfir_transparent_r, rapidfir_transparent_w)
437439   AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE_LEGACY(tms34010_io_register_r, tms34010_io_register_w)
438440   AM_RANGE(0xfc000000, 0xfc00000f) AM_READ(rapidfir_gun1_r)
r14896r14897
488490
489491   PORT_START("IN0")
490492   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
491   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket2", ticket_dispenser_line_r) /* right ticket status */
492   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket1", ticket_dispenser_line_r)   /* left ticket status */
493   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket2", ticket_dispenser_device, line_r) /* right ticket status */
494   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket1", ticket_dispenser_device, line_r)   /* left ticket status */
493495   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
494496
495497   PORT_START("IN1")
r14896r14897
546548
547549   PORT_START("IN0")
548550   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
549   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket2", ticket_dispenser_line_r)   /* right ticket status */
550   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket1", ticket_dispenser_line_r)   /* left ticket status */
551   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket2", ticket_dispenser_device, line_r)   /* right ticket status */
552   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket1", ticket_dispenser_device, line_r)   /* left ticket status */
551553   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
552554   PORT_BIT( 0xd8, IP_ACTIVE_LOW, IPT_UNUSED )
553555
r14896r14897
562564
563565   PORT_START("IN2")
564566   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
565   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket2", ticket_dispenser_line_r)   /* right ticket status */
566   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket1", ticket_dispenser_line_r)   /* left ticket status */
567   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket2", ticket_dispenser_device, line_r)   /* right ticket status */
568   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket1", ticket_dispenser_device, line_r)   /* left ticket status */
567569   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
568570   PORT_BIT( 0xd8, IP_ACTIVE_LOW, IPT_UNUSED )
569571
r14896r14897
607609
608610   PORT_START("IN0")
609611   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
610   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket2", ticket_dispenser_line_r) /* right ticket status */
611   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket1", ticket_dispenser_line_r)   /* left ticket status */
612   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket2", ticket_dispenser_device, line_r) /* right ticket status */
613   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket1", ticket_dispenser_device, line_r)   /* left ticket status */
612614   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
613615
614616   PORT_START("IN1")
r14896r14897
767769   MCFG_MACHINE_RESET(tickee)
768770   MCFG_NVRAM_ADD_1FILL("nvram")
769771
770   MCFG_TICKET_DISPENSER_ADD("ticket1", 100, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
771   MCFG_TICKET_DISPENSER_ADD("ticket2", 100, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
772   MCFG_TICKET_DISPENSER_ADD("ticket1", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
773   MCFG_TICKET_DISPENSER_ADD("ticket2", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
772774
773775   /* video hardware */
774776   MCFG_TLC34076_ADD("tlc34076", TLC34076_6_BIT)
r14896r14897
837839   MCFG_MACHINE_RESET(tickee)
838840   MCFG_NVRAM_ADD_1FILL("nvram")
839841
840   MCFG_TICKET_DISPENSER_ADD("ticket1", 100, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
841   MCFG_TICKET_DISPENSER_ADD("ticket2", 100, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
842   MCFG_TICKET_DISPENSER_ADD("ticket1", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
843   MCFG_TICKET_DISPENSER_ADD("ticket2", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
842844
843845   /* video hardware */
844846   MCFG_TLC34076_ADD("tlc34076", TLC34076_6_BIT)
src/mame/drivers/suprloco.c
r14896r14897
1919
2020WRITE8_MEMBER(suprloco_state::suprloco_soundport_w)
2121{
22   soundlatch_w(space, 0, data);
22   soundlatch_byte_w(space, 0, data);
2323   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
2424   /* spin for a while to let the Z80 read the command (fixes hanging sound in Regulus) */
2525   device_spin_until_time(&space.device(), attotime::from_usec(50));
r14896r14897
4747   AM_RANGE(0x8000, 0x87ff) AM_RAM
4848   AM_RANGE(0xa000, 0xa003) AM_DEVWRITE_LEGACY("sn1", sn76496_w)
4949   AM_RANGE(0xc000, 0xc003) AM_DEVWRITE_LEGACY("sn2", sn76496_w)
50   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
50   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
5151ADDRESS_MAP_END
5252
5353
src/mame/drivers/srmp5.c
r14896r14897
411411   AM_RANGE(0xc0, 0xc0) AM_READ(cmd1_r)
412412   AM_RANGE(0xc1, 0xc1) AM_READ(cmd2_r)
413413   AM_RANGE(0xc2, 0xc2) AM_READ(cmd_stat8_r)
414   AM_RANGE(0xe1, 0xe1) AM_WRITE_LEGACY(st0016_rom_bank_w)
415   AM_RANGE(0xe7, 0xe7) AM_WRITE_LEGACY(st0016_rom_bank_w)
414   AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
415   AM_RANGE(0xe7, 0xe7) AM_WRITE(st0016_rom_bank_w)
416416   AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
417417ADDRESS_MAP_END
418418
src/mame/drivers/m92.c
r14896r14897
297297WRITE16_MEMBER(m92_state::m92_soundlatch_w)
298298{
299299   cputag_set_input_line(machine(), "soundcpu", NEC_INPUT_LINE_INTP1, ASSERT_LINE);
300   soundlatch_w(space, 0, data & 0xff);
300   soundlatch_byte_w(space, 0, data & 0xff);
301301}
302302
303303READ16_MEMBER(m92_state::m92_sound_status_r)
r14896r14897
309309READ16_MEMBER(m92_state::m92_soundlatch_r)
310310{
311311   cputag_set_input_line(machine(), "soundcpu", NEC_INPUT_LINE_INTP1, CLEAR_LINE);
312   return soundlatch_r(space, offset) | 0xff00;
312   return soundlatch_byte_r(space, offset) | 0xff00;
313313}
314314
315315WRITE16_MEMBER(m92_state::m92_sound_irq_ack_w)
src/mame/drivers/fcombat.c
r14896r14897
126126   AM_RANGE(0xec00, 0xec00) AM_WRITE(ec00_w)
127127   AM_RANGE(0xed00, 0xed00) AM_WRITE(ed00_w)
128128   AM_RANGE(0xee00, 0xee00) AM_WRITE(ee00_w)   // related to protection ? - doesn't seem to have any effect
129   AM_RANGE(0xef00, 0xef00) AM_WRITE(soundlatch_w)
129   AM_RANGE(0xef00, 0xef00) AM_WRITE(soundlatch_byte_w)
130130ADDRESS_MAP_END
131131
132132
133133static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, fcombat_state )
134134   AM_RANGE(0x0000, 0x3fff) AM_ROM
135135   AM_RANGE(0x4000, 0x47ff) AM_RAM
136   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
136   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
137137   AM_RANGE(0x8001, 0x8001) AM_DEVREAD_LEGACY("ay1", ay8910_r)
138138   AM_RANGE(0x8002, 0x8003) AM_DEVWRITE_LEGACY("ay1", ay8910_data_address_w)
139139   AM_RANGE(0xa001, 0xa001) AM_DEVREAD_LEGACY("ay2", ay8910_r)
src/mame/drivers/destroyr.c
r14896r14897
1919{
2020public:
2121   destroyr_state(const machine_config &mconfig, device_type type, const char *tag)
22      : driver_device(mconfig, type, tag) { }
22      : driver_device(mconfig, type, tag) ,
23      m_alpha_num_ram(*this, "alpha_nuram"),
24      m_major_obj_ram(*this, "major_obj_ram"),
25      m_minor_obj_ram(*this, "minor_obj_ram"){ }
2326
2427   /* memory pointers */
25   UINT8 *        m_major_obj_ram;
26   UINT8 *        m_minor_obj_ram;
27   UINT8 *        m_alpha_num_ram;
28   required_shared_ptr<UINT8> m_alpha_num_ram;
29   required_shared_ptr<UINT8> m_major_obj_ram;
30   required_shared_ptr<UINT8> m_minor_obj_ram;
2831
2932   /* video-related */
3033   int            m_cursor;
r14896r14897
5861   /* draw major objects */
5962   for (i = 0; i < 16; i++)
6063   {
61      int attr = state->m_major_obj_ram[2 * i + 0] ^ 0xff;
62      int horz = state->m_major_obj_ram[2 * i + 1];
64      int attr = state->m_major_obj_ram.target()[2 * i + 0] ^ 0xff;
65      int horz = state->m_major_obj_ram.target()[2 * i + 1];
6366
6467      int num = attr & 3;
6568      int scan = attr & 4;
r14896r14897
8487   {
8588      for (j = 0; j < 32; j++)
8689      {
87         int num = state->m_alpha_num_ram[32 * i + j];
90         int num = state->m_alpha_num_ram.target()[32 * i + j];
8891
8992         drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[0], num, 0, 0, 0, 8 * j, 8 * i, 0);
9093      }
r14896r14897
9396   /* draw minor objects */
9497   for (i = 0; i < 2; i++)
9598   {
96      int num = i << 4 | (state->m_minor_obj_ram[i + 0] & 0xf);
97      int horz = 256 - state->m_minor_obj_ram[i + 2];
98      int vert = 256 - state->m_minor_obj_ram[i + 4];
99      int num = i << 4 | (state->m_minor_obj_ram.target()[i + 0] & 0xf);
100      int horz = 256 - state->m_minor_obj_ram.target()[i + 2];
101      int vert = 256 - state->m_minor_obj_ram.target()[i + 4];
99102
100103      drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[1], num, 0, 0, 0, horz, vert, 0);
101104   }
r14896r14897
262265   AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0xf00) AM_RAM
263266   AM_RANGE(0x1000, 0x1fff) AM_READWRITE(destroyr_input_r, destroyr_output_w)
264267   AM_RANGE(0x2000, 0x2fff) AM_READ_PORT("IN2")
265   AM_RANGE(0x3000, 0x30ff) AM_MIRROR(0xf00) AM_WRITEONLY AM_BASE(m_alpha_num_ram)
266   AM_RANGE(0x4000, 0x401f) AM_MIRROR(0xfe0) AM_WRITEONLY AM_BASE(m_major_obj_ram)
268   AM_RANGE(0x3000, 0x30ff) AM_MIRROR(0xf00) AM_WRITEONLY AM_SHARE("alpha_nuram")
269   AM_RANGE(0x4000, 0x401f) AM_MIRROR(0xfe0) AM_WRITEONLY AM_SHARE("major_obj_ram")
267270   AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xff8) AM_WRITE(destroyr_cursor_load_w)
268271   AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xff8) AM_WRITE(destroyr_interrupt_ack_w)
269   AM_RANGE(0x5002, 0x5007) AM_MIRROR(0xff8) AM_WRITEONLY AM_BASE(m_minor_obj_ram)
272   AM_RANGE(0x5002, 0x5007) AM_MIRROR(0xff8) AM_WRITEONLY AM_SHARE("minor_obj_ram")
270273   AM_RANGE(0x6000, 0x6fff) AM_READ(destroyr_scanline_r)
271274   AM_RANGE(0x7000, 0x7fff) AM_ROM
272275ADDRESS_MAP_END
src/mame/drivers/wwfwfest.c
r14896r14897
8888   AM_RANGE(0xc000, 0xc7ff) AM_RAM
8989   AM_RANGE(0xc800, 0xc801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
9090   AM_RANGE(0xd800, 0xd800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
91   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
91   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
9292   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE_LEGACY("oki", oki_bankswitch_w)
9393ADDRESS_MAP_END
9494
r14896r14897
109109
110110WRITE16_MEMBER(wwfwfest_state::wwfwfest_flipscreen_w)
111111{
112   flip_screen_set(machine(), data&1);
112   flip_screen_set(data&1);
113113}
114114
115115/*- Palette Reads/Writes -*/
r14896r14897
123123WRITE16_MEMBER(wwfwfest_state::wwfwfest_paletteram16_xxxxBBBBGGGGRRRR_word_w)
124124{
125125   offset = (offset & 0x000f) | (offset & 0x7fc0) >> 2;
126   paletteram16_xxxxBBBBGGGGRRRR_word_w (space, offset, data, mem_mask);
126   paletteram_xxxxBBBBGGGGRRRR_word_w (space, offset, data, mem_mask);
127127}
128128
129129/*- Priority Control -*/
r14896r14897
163163
164164WRITE16_MEMBER(wwfwfest_state::wwfwfest_soundwrite)
165165{
166   soundlatch_w(space,1,data & 0xff);
166   soundlatch_byte_w(space,1,data & 0xff);
167167   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE );
168168}
169169
src/mame/drivers/feversoc.c
r14896r14897
6868{
6969public:
7070   feversoc_state(const machine_config &mconfig, device_type type, const char *tag)
71      : driver_device(mconfig, type, tag) { }
71      : driver_device(mconfig, type, tag) ,
72      m_spriteram(*this, "spriteram"){ }
7273
7374   UINT16 m_x;
74   UINT32 *m_spriteram;
75   required_shared_ptr<UINT32> m_spriteram;
7576   DECLARE_WRITE32_MEMBER(fs_paletteram_w);
7677   DECLARE_READ32_MEMBER(in0_r);
7778   DECLARE_WRITE32_MEMBER(output_w);
r14896r14897
8889static SCREEN_UPDATE_IND16( feversoc )
8990{
9091   feversoc_state *state = screen.machine().driver_data<feversoc_state>();
91   UINT32 *spriteram32 = state->m_spriteram;
92   UINT32 *spriteram32 = state->m_spriteram.target();
9293   int offs,spr_offs,colour,sx,sy,h,w,dx,dy;
9394
9495   bitmap.fill(screen.machine().pens[0], cliprect); //black pen
r14896r14897
165166static ADDRESS_MAP_START( feversoc_map, AS_PROGRAM, 32, feversoc_state )
166167   AM_RANGE(0x00000000, 0x0003ffff) AM_ROM
167168   AM_RANGE(0x02000000, 0x0203dfff) AM_RAM //work ram
168   AM_RANGE(0x0203e000, 0x0203ffff) AM_RAM AM_BASE(m_spriteram)
169   AM_RANGE(0x0203e000, 0x0203ffff) AM_RAM AM_SHARE("spriteram")
169170   AM_RANGE(0x06000000, 0x06000003) AM_WRITE(output_w)
170171   AM_RANGE(0x06000004, 0x06000007) AM_WRITENOP //???
171172   AM_RANGE(0x06000008, 0x0600000b) AM_READ(in0_r)
src/mame/drivers/multigam.c
r14896r14897
113113   UINT8 m_supergm3_prg_bank;
114114   UINT8 m_supergm3_chr_bank;
115115   DECLARE_CUSTOM_INPUT_MEMBER(multigam_inputs_r);
116   DECLARE_WRITE8_MEMBER(multigam_nt_w);
117   DECLARE_READ8_MEMBER(multigam_nt_r);
118   DECLARE_WRITE8_MEMBER(sprite_dma_w);
119   DECLARE_READ8_MEMBER(multigam_IN0_r);
120   DECLARE_WRITE8_MEMBER(multigam_IN0_w);
121   DECLARE_READ8_MEMBER(multigam_IN1_r);
122   DECLARE_WRITE8_MEMBER(multigam_switch_prg_rom);
123   DECLARE_WRITE8_MEMBER(multigam_switch_gfx_rom);
124   DECLARE_WRITE8_MEMBER(multigam_mapper2_w);
125   DECLARE_WRITE8_MEMBER(multigam3_mmc3_rom_switch_w);
126   DECLARE_WRITE8_MEMBER(multigm3_mapper2_w);
127   DECLARE_WRITE8_MEMBER(multigm3_switch_gfx_rom);
128   DECLARE_WRITE8_MEMBER(multigm3_switch_prg_rom);
129   DECLARE_WRITE8_MEMBER(multigam3_mapper02_rom_switch_w);
130   DECLARE_WRITE8_MEMBER(mmc1_rom_switch_w);
131   DECLARE_WRITE8_MEMBER(supergm3_prg_bank_w);
132   DECLARE_WRITE8_MEMBER(supergm3_chr_bank_w);
133   void set_mirroring(int mirroring);
116134};
117135
118136
r14896r14897
123141*******************************************************/
124142
125143
126static void set_mirroring(multigam_state *state, int mirroring)
144void multigam_state::set_mirroring(int mirroring)
127145{
128146   switch(mirroring)
129147   {
130148   case PPU_MIRROR_LOW:
131      state->m_nt_page[0] = state->m_nt_page[1] = state->m_nt_page[2] = state->m_nt_page[3] = state->m_nt_ram;
149      m_nt_page[0] = m_nt_page[1] = m_nt_page[2] = m_nt_page[3] = m_nt_ram;
132150      break;
133151   case PPU_MIRROR_HIGH:
134      state->m_nt_page[0] = state->m_nt_page[1] = state->m_nt_page[2] = state->m_nt_page[3] = state->m_nt_ram + 0x400;
152      m_nt_page[0] = m_nt_page[1] = m_nt_page[2] = m_nt_page[3] = m_nt_ram + 0x400;
135153      break;
136154   case PPU_MIRROR_HORZ:
137      state->m_nt_page[0] = state->m_nt_ram;
138      state->m_nt_page[1] = state->m_nt_ram;
139      state->m_nt_page[2] = state->m_nt_ram + 0x400;
140      state->m_nt_page[3] = state->m_nt_ram + 0x400;
155      m_nt_page[0] = m_nt_ram;
156      m_nt_page[1] = m_nt_ram;
157      m_nt_page[2] = m_nt_ram + 0x400;
158      m_nt_page[3] = m_nt_ram + 0x400;
141159      break;
142160   case PPU_MIRROR_VERT:
143      state->m_nt_page[0] = state->m_nt_ram;
144      state->m_nt_page[1] = state->m_nt_ram + 0x400;
145      state->m_nt_page[2] = state->m_nt_ram;
146      state->m_nt_page[3] = state->m_nt_ram + 0x400;
161      m_nt_page[0] = m_nt_ram;
162      m_nt_page[1] = m_nt_ram + 0x400;
163      m_nt_page[2] = m_nt_ram;
164      m_nt_page[3] = m_nt_ram + 0x400;
147165      break;
148166   case PPU_MIRROR_NONE:
149167   default:
150      state->m_nt_page[0] = state->m_nt_ram;
151      state->m_nt_page[1] = state->m_nt_ram + 0x400;
152      state->m_nt_page[2] = state->m_nt_ram + 0x800;
153      state->m_nt_page[3] = state->m_nt_ram + 0xc00;
168      m_nt_page[0] = m_nt_ram;
169      m_nt_page[1] = m_nt_ram + 0x400;
170      m_nt_page[2] = m_nt_ram + 0x800;
171      m_nt_page[3] = m_nt_ram + 0xc00;
154172      break;
155173   }
156174}
157175
158static WRITE8_HANDLER (multigam_nt_w)
176WRITE8_MEMBER(multigam_state::multigam_nt_w)
159177{
160   multigam_state *state = space->machine().driver_data<multigam_state>();
161178   int page = ((offset & 0xc00) >> 10);
162   state->m_nt_page[page][offset & 0x3ff] = data;
179   m_nt_page[page][offset & 0x3ff] = data;
163180}
164181
165182
166static READ8_HANDLER (multigam_nt_r)
183READ8_MEMBER(multigam_state::multigam_nt_r)
167184{
168   multigam_state *state = space->machine().driver_data<multigam_state>();
169185   int page = ((offset & 0xc00) >> 10);
170   return state->m_nt_page[page][offset & 0x3ff];
186   return m_nt_page[page][offset & 0x3ff];
171187}
172188
173189static const char * const banknames[] = { "bank2", "bank3", "bank4", "bank5", "bank6", "bank7", "bank8", "bank9" };
r14896r14897
203219
204220*******************************************************/
205221
206static WRITE8_HANDLER( sprite_dma_w )
222WRITE8_MEMBER(multigam_state::sprite_dma_w)
207223{
208224   int source = (data & 7);
209   ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu");
210   ppu->spriteram_dma(space, source);
225   ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
226   ppu->spriteram_dma(&space, source);
211227}
212228
213229static READ8_DEVICE_HANDLER( psg_4015_r )
r14896r14897
232248*******************************************************/
233249
234250
235static READ8_HANDLER( multigam_IN0_r )
251READ8_MEMBER(multigam_state::multigam_IN0_r)
236252{
237   multigam_state *state = space->machine().driver_data<multigam_state>();
238   return ((state->m_in_0 >> state->m_in_0_shift++) & 0x01) | 0x40;
253   return ((m_in_0 >> m_in_0_shift++) & 0x01) | 0x40;
239254}
240255
241static WRITE8_HANDLER( multigam_IN0_w )
256WRITE8_MEMBER(multigam_state::multigam_IN0_w)
242257{
243   multigam_state *state = space->machine().driver_data<multigam_state>();
244258   if (data & 0x01)
245259   {
246260      return;
247261   }
248262
249   state->m_in_0_shift = 0;
250   state->m_in_1_shift = 0;
263   m_in_0_shift = 0;
264   m_in_1_shift = 0;
251265
252   state->m_in_0 = input_port_read(space->machine(), "P1");
253   state->m_in_1 = input_port_read(space->machine(), "P2");
266   m_in_0 = input_port_read(machine(), "P1");
267   m_in_1 = input_port_read(machine(), "P2");
254268
255   state->m_in_dsw_shift = 0;
256   state->m_in_dsw = input_port_read_safe(space->machine(), "DSW", 0);
269   m_in_dsw_shift = 0;
270   m_in_dsw = input_port_read_safe(machine(), "DSW", 0);
257271}
258272
259static READ8_HANDLER( multigam_IN1_r )
273READ8_MEMBER(multigam_state::multigam_IN1_r)
260274{
261   multigam_state *state = space->machine().driver_data<multigam_state>();
262   return ((state->m_in_1 >> state->m_in_1_shift++) & 0x01) | 0x40;
275   return ((m_in_1 >> m_in_1_shift++) & 0x01) | 0x40;
263276}
264277
265278CUSTOM_INPUT_MEMBER(multigam_state::multigam_inputs_r)
r14896r14897
277290*******************************************************/
278291
279292
280static WRITE8_HANDLER(multigam_switch_prg_rom)
293WRITE8_MEMBER(multigam_state::multigam_switch_prg_rom)
281294{
282295   /* switch PRG rom */
283   UINT8* dst = space->machine().region("maincpu")->base();
284   UINT8* src = space->machine().region("user1")->base();
296   UINT8* dst = machine().region("maincpu")->base();
297   UINT8* src = machine().region("user1")->base();
285298
286299   if (data & 0x80)
287300   {
r14896r14897
298311   }
299312};
300313
301static WRITE8_HANDLER(multigam_switch_gfx_rom)
314WRITE8_MEMBER(multigam_state::multigam_switch_gfx_rom)
302315{
303   multigam_state *state = space->machine().driver_data<multigam_state>();
304   memory_set_bankptr(space->machine(), "bank1", space->machine().region("gfx1")->base() + (0x2000 * (data & 0x3f)));
305   set_mirroring(state, data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
306   state->m_game_gfx_bank = data;
316   memory_set_bankptr(machine(), "bank1", machine().region("gfx1")->base() + (0x2000 * (data & 0x3f)));
317   set_mirroring(data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
318   m_game_gfx_bank = data;
307319};
308320
309321
310static WRITE8_HANDLER(multigam_mapper2_w)
322WRITE8_MEMBER(multigam_state::multigam_mapper2_w)
311323{
312   multigam_state *state = space->machine().driver_data<multigam_state>();
313   if (state->m_game_gfx_bank & 0x80)
324   if (m_game_gfx_bank & 0x80)
314325   {
315      memory_set_bankptr(space->machine(), "bank1", space->machine().region("gfx1")->base() + (0x2000 * ((data & 0x3) + (state->m_game_gfx_bank & 0x3c))));
326      memory_set_bankptr(machine(), "bank1", machine().region("gfx1")->base() + (0x2000 * ((data & 0x3) + (m_game_gfx_bank & 0x3c))));
316327   }
317328   else
318329   {
r14896r14897
331342   AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
332343   AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
333344   AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE_LEGACY("nes", nes_psg_r, nes_psg_w)         /* PSG primary registers */
334   AM_RANGE(0x4014, 0x4014) AM_WRITE_LEGACY(sprite_dma_w)
345   AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
335346   AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE_LEGACY("nes", psg_4015_r, psg_4015_w)         /* PSG status / first control register */
336   AM_RANGE(0x4016, 0x4016) AM_READWRITE_LEGACY(multigam_IN0_r, multigam_IN0_w)   /* IN0 - input port 1 */
337   AM_RANGE(0x4017, 0x4017) AM_READ_LEGACY(multigam_IN1_r) AM_DEVWRITE_LEGACY("nes", psg_4017_w)      /* IN1 - input port 2 / PSG second control register */
347   AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w)   /* IN0 - input port 1 */
348   AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_DEVWRITE_LEGACY("nes", psg_4017_w)      /* IN1 - input port 2 / PSG second control register */
338349   AM_RANGE(0x5002, 0x5002) AM_WRITENOP
339350   AM_RANGE(0x5000, 0x5ffe) AM_ROM
340351   AM_RANGE(0x5fff, 0x5fff) AM_READ_PORT("IN0")
341352   AM_RANGE(0x6000, 0x7fff) AM_ROM
342   AM_RANGE(0x6fff, 0x6fff) AM_WRITE_LEGACY(multigam_switch_prg_rom)
343   AM_RANGE(0x7fff, 0x7fff) AM_WRITE_LEGACY(multigam_switch_gfx_rom)
344   AM_RANGE(0x8000, 0xffff) AM_ROM AM_WRITE_LEGACY(multigam_mapper2_w)
353   AM_RANGE(0x6fff, 0x6fff) AM_WRITE(multigam_switch_prg_rom)
354   AM_RANGE(0x7fff, 0x7fff) AM_WRITE(multigam_switch_gfx_rom)
355   AM_RANGE(0x8000, 0xffff) AM_ROM AM_WRITE(multigam_mapper2_w)
345356ADDRESS_MAP_END
346357
347358static ADDRESS_MAP_START( multigmt_map, AS_PROGRAM, 8, multigam_state )
348359   AM_RANGE(0x0000, 0x07ff) AM_RAM   /* NES RAM */
349360   AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
350   AM_RANGE(0x3000, 0x3000) AM_WRITE_LEGACY(multigam_switch_prg_rom)
351   AM_RANGE(0x3fff, 0x3fff) AM_WRITE_LEGACY(multigam_switch_gfx_rom)
361   AM_RANGE(0x3000, 0x3000) AM_WRITE(multigam_switch_prg_rom)
362   AM_RANGE(0x3fff, 0x3fff) AM_WRITE(multigam_switch_gfx_rom)
352363   AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
353364   AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE_LEGACY("nes", nes_psg_r, nes_psg_w)         /* PSG primary registers */
354   AM_RANGE(0x4014, 0x4014) AM_WRITE_LEGACY(sprite_dma_w)
365   AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
355366   AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE_LEGACY("nes", psg_4015_r, psg_4015_w)         /* PSG status / first control register */
356   AM_RANGE(0x4016, 0x4016) AM_READWRITE_LEGACY(multigam_IN0_r, multigam_IN0_w)   /* IN0 - input port 1 */
357   AM_RANGE(0x4017, 0x4017) AM_READ_LEGACY(multigam_IN1_r) AM_DEVWRITE_LEGACY("nes", psg_4017_w)      /* IN1 - input port 2 / PSG second control register */
367   AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w)   /* IN0 - input port 1 */
368   AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_DEVWRITE_LEGACY("nes", psg_4017_w)      /* IN1 - input port 2 / PSG second control register */
358369   AM_RANGE(0x5002, 0x5002) AM_WRITENOP
359370   AM_RANGE(0x5000, 0x5ffe) AM_ROM
360371   AM_RANGE(0x5fff, 0x5fff) AM_READ_PORT("IN0")
361372   AM_RANGE(0x6000, 0x7fff) AM_ROM
362   AM_RANGE(0x8000, 0xffff) AM_ROM AM_WRITE_LEGACY(multigam_mapper2_w)
373   AM_RANGE(0x8000, 0xffff) AM_ROM AM_WRITE(multigam_mapper2_w)
363374ADDRESS_MAP_END
364375
365376/******************************************************
r14896r14897
382393   }
383394}
384395
385static WRITE8_HANDLER( multigam3_mmc3_rom_switch_w )
396WRITE8_MEMBER(multigam_state::multigam3_mmc3_rom_switch_w)
386397{
387   multigam_state *state = space->machine().driver_data<multigam_state>();
388   ppu2c0x_device *ppu = space->machine().device<ppu2c0x_device>("ppu");
398   ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
389399
390400   /* basically, a MMC3 mapper from the nes */
391   int bankmask = state->m_multigam3_mmc3_prg_size == 0x40000 ? 0x1f : 0x0f;
401   int bankmask = m_multigam3_mmc3_prg_size == 0x40000 ? 0x1f : 0x0f;
392402
393403   switch(offset & 0x7001)
394404   {
395405      case 0x0000:
396         state->m_multigam3_mmc3_command = data;
406         m_multigam3_mmc3_command = data;
397407
398         if (state->m_multigam3_mmc3_last_bank != (data & 0xc0))
408         if (m_multigam3_mmc3_last_bank != (data & 0xc0))
399409         {
400410            int bank;
401            UINT8 *prg = space->machine().region("maincpu")->base();
411            UINT8 *prg = machine().region("maincpu")->base();
402412
403413            /* reset the banks */
404            if (state->m_multigam3_mmc3_command & 0x40)
414            if (m_multigam3_mmc3_command & 0x40)
405415            {
406416               /* high bank */
407               bank = (state->m_multigam3_mmc3_banks[0] & bankmask) * 0x2000;
417               bank = (m_multigam3_mmc3_banks[0] & bankmask) * 0x2000;
408418
409               memcpy(&prg[0x0c000], &state->m_multigam3_mmc3_prg_base[bank], 0x2000);
410               memcpy(&prg[0x08000], &state->m_multigam3_mmc3_prg_base[state->m_multigam3_mmc3_prg_size - 0x4000], 0x2000);
419               memcpy(&prg[0x0c000], &m_multigam3_mmc3_prg_base[bank], 0x2000);
420               memcpy(&prg[0x08000], &m_multigam3_mmc3_prg_base[m_multigam3_mmc3_prg_size - 0x4000], 0x2000);
411421            }
412422            else
413423            {
414424               /* low bank */
415               bank = (state->m_multigam3_mmc3_banks[0] & bankmask) * 0x2000;
425               bank = (m_multigam3_mmc3_banks[0] & bankmask) * 0x2000;
416426
417               memcpy(&prg[0x08000], &state->m_multigam3_mmc3_prg_base[bank], 0x2000);
418               memcpy(&prg[0x0c000], &state->m_multigam3_mmc3_prg_base[state->m_multigam3_mmc3_prg_size - 0x4000], 0x2000);
427               memcpy(&prg[0x08000], &m_multigam3_mmc3_prg_base[bank], 0x2000);
428               memcpy(&prg[0x0c000], &m_multigam3_mmc3_prg_base[m_multigam3_mmc3_prg_size - 0x4000], 0x2000);
419429            }
420430
421431            /* mid bank */
422            bank = (state->m_multigam3_mmc3_banks[1] & bankmask) * 0x2000;
423            memcpy(&prg[0x0a000], &state->m_multigam3_mmc3_prg_base[bank], 0x2000);
432            bank = (m_multigam3_mmc3_banks[1] & bankmask) * 0x2000;
433            memcpy(&prg[0x0a000], &m_multigam3_mmc3_prg_base[bank], 0x2000);
424434
425            state->m_multigam3_mmc3_last_bank = data & 0xc0;
435            m_multigam3_mmc3_last_bank = data & 0xc0;
426436         }
427437      break;
428438
429439      case 0x0001:
430440         {
431            UINT8 cmd = state->m_multigam3_mmc3_command & 0x07;
432            int page = (state->m_multigam3_mmc3_command & 0x80) >> 5;
441            UINT8 cmd = m_multigam3_mmc3_command & 0x07;
442            int page = (m_multigam3_mmc3_command & 0x80) >> 5;
433443            int bank;
434444
435445            switch (cmd)
r14896r14897
438448               case 1: /* char banking */
439449                  data &= 0xfe;
440450                  page ^= (cmd << 1);
441                  set_videorom_bank(space->machine(), page, 2, state->m_multigam3_mmc3_chr_bank_base + data, 1);
451                  set_videorom_bank(machine(), page, 2, m_multigam3_mmc3_chr_bank_base + data, 1);
442452               break;
443453
444454               case 2: /* char banking */
r14896r14897
446456               case 4: /* char banking */
447457               case 5: /* char banking */
448458                  page ^= cmd + 2;
449                  set_videorom_bank(space->machine(), page, 1, state->m_multigam3_mmc3_chr_bank_base + data, 1);
459                  set_videorom_bank(machine(), page, 1, m_multigam3_mmc3_chr_bank_base + data, 1);
450460               break;
451461
452462               case 6: /* program banking */
453463               {
454                  UINT8 *prg = space->machine().region("maincpu")->base();
455                  if (state->m_multigam3_mmc3_command & 0x40)
464                  UINT8 *prg = machine().region("maincpu")->base();
465                  if (m_multigam3_mmc3_command & 0x40)
456466                  {
457467                     /* high bank */
458                     state->m_multigam3_mmc3_banks[0] = data & bankmask;
459                     bank = (state->m_multigam3_mmc3_banks[0]) * 0x2000;
468                     m_multigam3_mmc3_banks[0] = data & bankmask;
469                     bank = (m_multigam3_mmc3_banks[0]) * 0x2000;
460470
461                     memcpy(&prg[0x0c000], &state->m_multigam3_mmc3_prg_base[bank], 0x2000);
462                     memcpy(&prg[0x08000], &state->m_multigam3_mmc3_prg_base[state->m_multigam3_mmc3_prg_size - 0x4000], 0x2000);
471                     memcpy(&prg[0x0c000], &m_multigam3_mmc3_prg_base[bank], 0x2000);
472                     memcpy(&prg[0x08000], &m_multigam3_mmc3_prg_base[m_multigam3_mmc3_prg_size - 0x4000], 0x2000);
463473                  }
464474                  else
465475                  {
466476                     /* low bank */
467                     state->m_multigam3_mmc3_banks[0] = data & bankmask;
468                     bank = (state->m_multigam3_mmc3_banks[0]) * 0x2000;
477                     m_multigam3_mmc3_banks[0] = data & bankmask;
478                     bank = (m_multigam3_mmc3_banks[0]) * 0x2000;
469479
470                     memcpy(&prg[0x08000], &state->m_multigam3_mmc3_prg_base[bank], 0x2000);
471                     memcpy(&prg[0x0c000], &state->m_multigam3_mmc3_prg_base[state->m_multigam3_mmc3_prg_size - 0x4000], 0x2000);
480                     memcpy(&prg[0x08000], &m_multigam3_mmc3_prg_base[bank], 0x2000);
481                     memcpy(&prg[0x0c000], &m_multigam3_mmc3_prg_base[m_multigam3_mmc3_prg_size - 0x4000], 0x2000);
472482                  }
473483               }
474484               break;
r14896r14897
476486               case 7: /* program banking */
477487                  {
478488                     /* mid bank */
479                     UINT8 *prg = space->machine().region("maincpu")->base();
489                     UINT8 *prg = machine().region("maincpu")->base();
480490
481                     state->m_multigam3_mmc3_banks[1] = data & bankmask;
482                     bank = state->m_multigam3_mmc3_banks[1] * 0x2000;
491                     m_multigam3_mmc3_banks[1] = data & bankmask;
492                     bank = m_multigam3_mmc3_banks[1] * 0x2000;
483493
484                     memcpy(&prg[0x0a000], &state->m_multigam3_mmc3_prg_base[bank], 0x2000);
494                     memcpy(&prg[0x0a000], &m_multigam3_mmc3_prg_base[bank], 0x2000);
485495                  }
486496               break;
487497            }
r14896r14897
489499      break;
490500
491501      case 0x2000: /* mirroring */
492         if (!state->m_multigam3_mmc3_4screen)
502         if (!m_multigam3_mmc3_4screen)
493503         {
494504            if (data & 0x40)
495               set_mirroring(state, PPU_MIRROR_HIGH);
505               set_mirroring(PPU_MIRROR_HIGH);
496506            else
497               set_mirroring(state, (data & 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
507               set_mirroring((data & 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
498508         }
499509      break;
500510
501511      case 0x2001: /* enable ram at $6000 */
502512         if (data & 0x80)
503513         {
504            memory_set_bankptr(space->machine(), "bank10", state->m_multigmc_mmc3_6000_ram);
514            memory_set_bankptr(machine(), "bank10", m_multigmc_mmc3_6000_ram);
505515         }
506516         else
507517         {
508            memory_set_bankptr(space->machine(), "bank10", space->machine().region("maincpu")->base() + 0x6000);
518            memory_set_bankptr(machine(), "bank10", machine().region("maincpu")->base() + 0x6000);
509519         }
510520         if (data & 0x40)
511521         {
r14896r14897
514524      break;
515525
516526      case 0x4000: /* scanline counter */
517         state->m_multigam3_mmc3_scanline_counter = data;
527         m_multigam3_mmc3_scanline_counter = data;
518528      break;
519529
520530      case 0x4001: /* scanline latch */
521         state->m_multigam3_mmc3_scanline_latch = data;
531         m_multigam3_mmc3_scanline_latch = data;
522532      break;
523533
524534      case 0x6000: /* disable irqs */
r14896r14897
543553   memcpy(&dst[0x8000], prg_base + (prg_size - 0x4000), 0x4000);
544554   memcpy(&dst[0xc000], prg_base + (prg_size - 0x4000), 0x4000);
545555
546   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x8000, 0xffff, FUNC(multigam3_mmc3_rom_switch_w) );
556   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigam3_mmc3_rom_switch_w),state));
547557
548558   state->m_multigam3_mmc3_banks[0] = 0x1e;
549559   state->m_multigam3_mmc3_banks[1] = 0x1f;
r14896r14897
556566   state->m_multigam3_mmc3_prg_size = prg_size;
557567};
558568
559static WRITE8_HANDLER(multigm3_mapper2_w)
569WRITE8_MEMBER(multigam_state::multigm3_mapper2_w)
560570{
561   multigam_state *state = space->machine().driver_data<multigam_state>();
562   if (state->m_game_gfx_bank & 0x80)
571   if (m_game_gfx_bank & 0x80)
563572   {
564      set_videorom_bank(space->machine(), 0, 8, (state->m_game_gfx_bank & 0x3c)  + (data & 0x3), 8);
573      set_videorom_bank(machine(), 0, 8, (m_game_gfx_bank & 0x3c)  + (data & 0x3), 8);
565574   }
566575   else
567576   {
r14896r14897
569578   }
570579};
571580
572static WRITE8_HANDLER(multigm3_switch_gfx_rom)
581WRITE8_MEMBER(multigam_state::multigm3_switch_gfx_rom)
573582{
574   multigam_state *state = space->machine().driver_data<multigam_state>();
575   set_videorom_bank(space->machine(), 0, 8, data & 0x3f, 8);
576   set_mirroring(state, data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
577   state->m_game_gfx_bank = data;
583   set_videorom_bank(machine(), 0, 8, data & 0x3f, 8);
584   set_mirroring(data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
585   m_game_gfx_bank = data;
578586};
579587
580static WRITE8_HANDLER(multigm3_switch_prg_rom)
588WRITE8_MEMBER(multigam_state::multigm3_switch_prg_rom)
581589{
582590   /* switch PRG rom */
583   UINT8* dst = space->machine().region("maincpu")->base();
584   UINT8* src = space->machine().region("user1")->base();
591   UINT8* dst = machine().region("maincpu")->base();
592   UINT8* src = machine().region("user1")->base();
585593
586594   if (data == 0xa8)
587595   {
588      multigam_init_mmc3(space->machine(), src + 0xa0000, 0x40000, 0x180);
596      multigam_init_mmc3(machine(), src + 0xa0000, 0x40000, 0x180);
589597      return;
590598   }
591599   else
592600   {
593      space->install_legacy_write_handler(0x8000, 0xffff, FUNC(multigm3_mapper2_w) );
594      memory_set_bankptr(space->machine(), "bank10", space->machine().region("maincpu")->base() + 0x6000);
601      space.install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigm3_mapper2_w),this) );
602      memory_set_bankptr(machine(), "bank10", machine().region("maincpu")->base() + 0x6000);
595603   }
596604
597605   if (data & 0x80)
r14896r14897
620628   AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
621629   AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
622630   AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE_LEGACY("nes", nes_psg_r, nes_psg_w)         /* PSG primary registers */
623   AM_RANGE(0x4014, 0x4014) AM_WRITE_LEGACY(sprite_dma_w)
631   AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
624632   AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE_LEGACY("nes", psg_4015_r, psg_4015_w)         /* PSG status / first control register */
625   AM_RANGE(0x4016, 0x4016) AM_READWRITE_LEGACY(multigam_IN0_r, multigam_IN0_w)   /* IN0 - input port 1 */
626   AM_RANGE(0x4017, 0x4017) AM_READ_LEGACY(multigam_IN1_r) AM_DEVWRITE_LEGACY("nes", psg_4017_w)      /* IN1 - input port 2 / PSG second control register */
627   AM_RANGE(0x5001, 0x5001) AM_WRITE_LEGACY(multigm3_switch_prg_rom)
633   AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w)   /* IN0 - input port 1 */
634   AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_DEVWRITE_LEGACY("nes", psg_4017_w)      /* IN1 - input port 2 / PSG second control register */
635   AM_RANGE(0x5001, 0x5001) AM_WRITE(multigm3_switch_prg_rom)
628636   AM_RANGE(0x5002, 0x5002) AM_WRITENOP
629   AM_RANGE(0x5003, 0x5003) AM_WRITE_LEGACY(multigm3_switch_gfx_rom)
637   AM_RANGE(0x5003, 0x5003) AM_WRITE(multigm3_switch_gfx_rom)
630638   AM_RANGE(0x5000, 0x5ffe) AM_ROM
631639   AM_RANGE(0x5fff, 0x5fff) AM_READ_PORT("IN0")
632640   AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("bank10")
633641   AM_RANGE(0x6fff, 0x6fff) AM_WRITENOP /* 0x00 in attract mode, 0xff during play */
634   AM_RANGE(0x8000, 0xffff) AM_ROM AM_WRITE_LEGACY(multigm3_mapper2_w)
642   AM_RANGE(0x8000, 0xffff) AM_ROM AM_WRITE(multigm3_mapper2_w)
635643ADDRESS_MAP_END
636644
637645/******************************************************
r14896r14897
641649*******************************************************/
642650
643651
644static WRITE8_HANDLER(multigam3_mapper02_rom_switch_w)
652WRITE8_MEMBER(multigam_state::multigam3_mapper02_rom_switch_w)
645653{
646   multigam_state *state = space->machine().driver_data<multigam_state>();
647   UINT8* mem = space->machine().region("maincpu")->base();
648   int bankmask = (state->m_mapper02_prg_size/0x4000) - 1;
649   memcpy(mem + 0x8000, state->m_mapper02_prg_base + 0x4000*(data & bankmask), 0x4000);
654   UINT8* mem = machine().region("maincpu")->base();
655   int bankmask = (m_mapper02_prg_size/0x4000) - 1;
656   memcpy(mem + 0x8000, m_mapper02_prg_base + 0x4000*(data & bankmask), 0x4000);
650657}
651658
652659static void multigam_init_mapper02(running_machine &machine, UINT8* prg_base, int prg_size)
r14896r14897
655662   ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
656663   UINT8* mem = machine.region("maincpu")->base();
657664   memcpy(mem + 0x8000, prg_base + prg_size - 0x8000, 0x8000);
658   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x8000, 0xffff, FUNC(multigam3_mapper02_rom_switch_w) );
665   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigam3_mapper02_rom_switch_w),state));
659666
660667   state->m_mapper02_prg_base = prg_base;
661668   state->m_mapper02_prg_size = prg_size;
r14896r14897
675682   state->m_mmc1_reg_write_enable = 1;
676683}
677684
678static WRITE8_HANDLER( mmc1_rom_switch_w )
685WRITE8_MEMBER(multigam_state::mmc1_rom_switch_w)
679686{
680   multigam_state *state = space->machine().driver_data<multigam_state>();
681687   /* basically, a MMC1 mapper from the nes */
682688
683   if ( state->m_mmc1_reg_write_enable == 0 )
689   if ( m_mmc1_reg_write_enable == 0 )
684690   {
685691      return;
686692   }
687693   else
688694   {
689      state->m_mmc1_reg_write_enable = 0;
690      space->machine().scheduler().synchronize(FUNC(mmc1_resync_callback));
695      m_mmc1_reg_write_enable = 0;
696      machine().scheduler().synchronize(FUNC(mmc1_resync_callback));
691697   }
692698
693699   int reg = (offset >> 13);
r14896r14897
695701   /* reset mapper */
696702   if (data & 0x80)
697703   {
698      state->m_mmc1_shiftreg = state->m_mmc1_shiftcount = 0;
704      m_mmc1_shiftreg = m_mmc1_shiftcount = 0;
699705
700      state->m_size16k = 1;
701      state->m_switchlow = 1;
702      state->m_vrom4k = 0;
706      m_size16k = 1;
707      m_switchlow = 1;
708      m_vrom4k = 0;
703709
704710      return;
705711   }
706712
707713   /* see if we need to clock in data */
708   if (state->m_mmc1_shiftcount < 5)
714   if (m_mmc1_shiftcount < 5)
709715   {
710      state->m_mmc1_shiftreg >>= 1;
711      state->m_mmc1_shiftreg |= (data & 1) << 4;
712      state->m_mmc1_shiftcount++;
716      m_mmc1_shiftreg >>= 1;
717      m_mmc1_shiftreg |= (data & 1) << 4;
718      m_mmc1_shiftcount++;
713719   }
714720
715721   /* are we done shifting? */
716   if (state->m_mmc1_shiftcount == 5)
722   if (m_mmc1_shiftcount == 5)
717723   {
718724      /* reset count */
719      state->m_mmc1_shiftcount = 0;
725      m_mmc1_shiftcount = 0;
720726
721727      /* apply data to registers */
722728      switch (reg)
r14896r14897
725731            {
726732               int _mirroring;
727733
728               state->m_vrom4k = state->m_mmc1_shiftreg & 0x10;
729               state->m_size16k = state->m_mmc1_shiftreg & 0x08;
730               state->m_switchlow = state->m_mmc1_shiftreg & 0x04;
734               m_vrom4k = m_mmc1_shiftreg & 0x10;
735               m_size16k = m_mmc1_shiftreg & 0x08;
736               m_switchlow = m_mmc1_shiftreg & 0x04;
731737
732               switch (state->m_mmc1_shiftreg & 3)
738               switch (m_mmc1_shiftreg & 3)
733739               {
734740                  case 0:
735741                     _mirroring = PPU_MIRROR_LOW;
r14896r14897
750756               }
751757
752758               /* apply mirroring */
753               set_mirroring(state, _mirroring);
759               set_mirroring(_mirroring);
754760            }
755761         break;
756762
757763         case 1:   /* video rom banking - bank 0 - 4k or 8k */
758            if (state->m_mmc1_chr_bank_base == 0)
759               set_videoram_bank(space->machine(), 0, (state->m_vrom4k) ? 4 : 8, (state->m_mmc1_shiftreg & 0x1f), 4);
764            if (m_mmc1_chr_bank_base == 0)
765               set_videoram_bank(machine(), 0, (m_vrom4k) ? 4 : 8, (m_mmc1_shiftreg & 0x1f), 4);
760766            else
761               set_videorom_bank(space->machine(), 0, (state->m_vrom4k) ? 4 : 8, state->m_mmc1_chr_bank_base + (state->m_mmc1_shiftreg & 0x1f), 4);
767               set_videorom_bank(machine(), 0, (m_vrom4k) ? 4 : 8, m_mmc1_chr_bank_base + (m_mmc1_shiftreg & 0x1f), 4);
762768         break;
763769
764770         case 2: /* video rom banking - bank 1 - 4k only */
765            if (state->m_vrom4k)
771            if (m_vrom4k)
766772            {
767               if (state->m_mmc1_chr_bank_base == 0)
768                  set_videoram_bank(space->machine(), 0, (state->m_vrom4k) ? 4 : 8, (state->m_mmc1_shiftreg & 0x1f), 4);
773               if (m_mmc1_chr_bank_base == 0)
774                  set_videoram_bank(machine(), 0, (m_vrom4k) ? 4 : 8, (m_mmc1_shiftreg & 0x1f), 4);
769775               else
770                  set_videorom_bank(space->machine(), 4, 4, state->m_mmc1_chr_bank_base + (state->m_mmc1_shiftreg & 0x1f), 4);
776                  set_videorom_bank(machine(), 4, 4, m_mmc1_chr_bank_base + (m_mmc1_shiftreg & 0x1f), 4);
771777            }
772778         break;
773779
774780         case 3:   /* program banking */
775781            {
776               int bank = (state->m_mmc1_shiftreg & state->m_mmc1_rom_mask) * 0x4000;
777               UINT8 *prg = space->machine().region("maincpu")->base();
782               int bank = (m_mmc1_shiftreg & m_mmc1_rom_mask) * 0x4000;
783               UINT8 *prg = machine().region("maincpu")->base();
778784
779               if (!state->m_size16k)
785               if (!m_size16k)
780786               {
781                  bank = ((state->m_mmc1_shiftreg >> 1) & state->m_mmc1_rom_mask) * 0x4000;
787                  bank = ((m_mmc1_shiftreg >> 1) & m_mmc1_rom_mask) * 0x4000;
782788                  /* switch 32k */
783                  memcpy(&prg[0x08000], state->m_mmc1_prg_base + bank, 0x8000);
789                  memcpy(&prg[0x08000], m_mmc1_prg_base + bank, 0x8000);
784790               }
785791               else
786792               {
787793                  /* switch 16k */
788                  if (state->m_switchlow)
794                  if (m_switchlow)
789795                  {
790796                     /* low */
791                     memcpy(&prg[0x08000], state->m_mmc1_prg_base + bank, 0x4000);
792                     memcpy(&prg[0x0c000], state->m_mmc1_prg_base + (0x0f & state->m_mmc1_rom_mask) * 0x4000, 0x4000);
797                     memcpy(&prg[0x08000], m_mmc1_prg_base + bank, 0x4000);
798                     memcpy(&prg[0x0c000], m_mmc1_prg_base + (0x0f & m_mmc1_rom_mask) * 0x4000, 0x4000);
793799                  }
794800                  else
795801                  {
796802                     /* high */
797                     memcpy(&prg[0x08000], state->m_mmc1_prg_base + (0x00 & state->m_mmc1_rom_mask) * 0x4000, 0x4000);
798                     memcpy(&prg[0x0c000], state->m_mmc1_prg_base + bank, 0x4000);
803                     memcpy(&prg[0x08000], m_mmc1_prg_base + (0x00 & m_mmc1_rom_mask) * 0x4000, 0x4000);
804                     memcpy(&prg[0x0c000], m_mmc1_prg_base + bank, 0x4000);
799805                  }
800806               }
801807            }
r14896r14897
812818
813819   memcpy(&dst[0x8000], prg_base + (prg_size - 0x8000), 0x8000);
814820
815   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x8000, 0xffff, FUNC(mmc1_rom_switch_w) );
821   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::mmc1_rom_switch_w),state));
816822
817823   state->m_mmc1_reg_write_enable = 1;
818824   state->m_mmc1_rom_mask = (prg_size / 0x4000) - 1;
r14896r14897
862868      memory_set_bankptr(machine, "bank1", state->m_vram);
863869
864870      if (state->m_supergm3_chr_bank == 0x40)
865         set_mirroring(state, PPU_MIRROR_VERT);
871         state->set_mirroring(PPU_MIRROR_VERT);
866872   }
867873   else
868874   {
r14896r14897
912918   }
913919}
914920
915static WRITE8_HANDLER(supergm3_prg_bank_w)
921WRITE8_MEMBER(multigam_state::supergm3_prg_bank_w)
916922{
917   multigam_state *state = space->machine().driver_data<multigam_state>();
918   state->m_supergm3_prg_bank = data;
923   m_supergm3_prg_bank = data;
919924}
920925
921static WRITE8_HANDLER(supergm3_chr_bank_w)
926WRITE8_MEMBER(multigam_state::supergm3_chr_bank_w)
922927{
923   multigam_state *state = space->machine().driver_data<multigam_state>();
924   state->m_supergm3_chr_bank = data;
925   supergm3_set_bank(space->machine());
928   m_supergm3_chr_bank = data;
929   supergm3_set_bank(machine());
926930}
927931
928932/******************************************************
r14896r14897
936940   AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
937941   AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
938942   AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE_LEGACY("nes", nes_psg_r, nes_psg_w)         /* PSG primary registers */
939   AM_RANGE(0x4014, 0x4014) AM_WRITE_LEGACY(sprite_dma_w)
943   AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
940944   AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE_LEGACY("nes", psg_4015_r, psg_4015_w)         /* PSG status / first control register */
941   AM_RANGE(0x4016, 0x4016) AM_READWRITE_LEGACY(multigam_IN0_r, multigam_IN0_w)   /* IN0 - input port 1 */
942   AM_RANGE(0x4017, 0x4017) AM_READ_LEGACY(multigam_IN1_r) AM_DEVWRITE_LEGACY("nes", psg_4017_w)      /* IN1 - input port 2 / PSG second control register */
945   AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w)   /* IN0 - input port 1 */
946   AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_DEVWRITE_LEGACY("nes", psg_4017_w)      /* IN1 - input port 2 / PSG second control register */
943947   AM_RANGE(0x4fff, 0x4fff) AM_READ_PORT("IN0")
944948   AM_RANGE(0x5000, 0x5fff) AM_ROM
945949   AM_RANGE(0x5000, 0x5000) AM_WRITENOP
946   AM_RANGE(0x5001, 0x5001) AM_WRITE_LEGACY(supergm3_prg_bank_w)
947   AM_RANGE(0x5002, 0x5002) AM_WRITE_LEGACY(supergm3_chr_bank_w)
950   AM_RANGE(0x5001, 0x5001) AM_WRITE(supergm3_prg_bank_w)
951   AM_RANGE(0x5002, 0x5002) AM_WRITE(supergm3_chr_bank_w)
948952   AM_RANGE(0x5fff, 0x5fff) AM_WRITENOP
949953   AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("bank10")
950954   AM_RANGE(0x8000, 0xffff) AM_ROM
r14896r14897
11201124{
11211125   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
11221126   /* reset the ppu */
1123   multigm3_switch_prg_rom(space, 0, 0x01 );
1127   multigam_state *state = machine.driver_data<multigam_state>();
1128   state->multigm3_switch_prg_rom(*space, 0, 0x01 );
11241129};
11251130
11261131static MACHINE_START( multigam )
r14896r14897
11321137   state->m_nt_page[2] = state->m_nt_ram + 0x800;
11331138   state->m_nt_page[3] = state->m_nt_ram + 0xc00;
11341139
1135   machine.device("ppu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2000, 0x3eff, FUNC(multigam_nt_r), FUNC(multigam_nt_w));
1140   machine.device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),state), write8_delegate(FUNC(multigam_state::multigam_nt_w),state));
11361141   machine.device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank1");
11371142   memory_set_bankptr(machine, "bank1", machine.region("gfx1")->base());
11381143}
r14896r14897
11461151   state->m_nt_page[2] = state->m_nt_ram + 0x800;
11471152   state->m_nt_page[3] = state->m_nt_ram + 0xc00;
11481153
1149   machine.device("ppu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2000, 0x3eff, FUNC(multigam_nt_r), FUNC(multigam_nt_w));
1154   machine.device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),state), write8_delegate(FUNC(multigam_state::multigam_nt_w),state));
11501155
11511156   machine.device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x03ff, "bank2");
11521157   machine.device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0400, 0x07ff, "bank3");
r14896r14897
11691174   state->m_nt_page[2] = state->m_nt_ram + 0x800;
11701175   state->m_nt_page[3] = state->m_nt_ram + 0xc00;
11711176
1172   machine.device("ppu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2000, 0x3eff, FUNC(multigam_nt_r), FUNC(multigam_nt_w));
1177   machine.device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),state), write8_delegate(FUNC(multigam_state::multigam_nt_w),state));
11731178
11741179   state->m_vram = auto_alloc_array(machine, UINT8, 0x2000);
11751180   state->m_multigmc_mmc3_6000_ram = auto_alloc_array(machine, UINT8, 0x2000);
r14896r14897
13471352
13481353static DRIVER_INIT( multigam )
13491354{
1355   multigam_state *state = machine.driver_data<multigam_state>();
13501356   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1351   multigam_switch_prg_rom(space, 0x0, 0x01);
1357   state->multigam_switch_prg_rom(*space, 0x0, 0x01);
13521358}
13531359
13541360static void multigm3_decrypt(UINT8* mem, int memsize, const UINT8* decode_nibble)
r14896r14897
13721378
13731379   state->m_multigmc_mmc3_6000_ram = auto_alloc_array(machine, UINT8, 0x2000);
13741380
1375   multigam_switch_prg_rom(space, 0x0, 0x01);
1381   state->multigam_switch_prg_rom(*space, 0x0, 0x01);
13761382}
13771383
13781384static DRIVER_INIT(multigmt)
r14896r14897
14131419   }
14141420
14151421   auto_free(machine, buf);
1416
1417   multigam_switch_prg_rom(space, 0x0, 0x01);
1422   multigam_state *state = machine.driver_data<multigam_state>();
1423   state->multigam_switch_prg_rom(*space, 0x0, 0x01);
14181424};
14191425
14201426GAME( 1992, multigam, 0,        multigam, multigam, multigam, ROT0, "<unknown>", "Multi Game (set 1)", 0 )
src/mame/drivers/fuukifg2.c
r14896r14897
7878{
7979   if (ACCESSING_BITS_0_7)
8080   {
81      soundlatch_w(space,0,data & 0xff);
81      soundlatch_byte_w(space,0,data & 0xff);
8282      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
8383//      device_spin_until_time(&space.device(), attotime::from_usec(50));   // Allow the other CPU to reply
8484      machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); // Fixes glitching in rasters
r14896r14897
9393   AM_RANGE(0x504000, 0x505fff) AM_RAM_WRITE(fuuki16_vram_2_w) AM_BASE(m_vram[2])               //
9494   AM_RANGE(0x506000, 0x507fff) AM_RAM_WRITE(fuuki16_vram_3_w) AM_BASE(m_vram[3])               //
9595   AM_RANGE(0x600000, 0x601fff) AM_MIRROR(0x008000) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites, mirrored?
96   AM_RANGE(0x700000, 0x703fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
96   AM_RANGE(0x700000, 0x703fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
9797   AM_RANGE(0x800000, 0x800001) AM_READ_PORT("SYSTEM")
9898   AM_RANGE(0x810000, 0x810001) AM_READ_PORT("P1_P2")
9999   AM_RANGE(0x880000, 0x880001) AM_READ_PORT("DSW")
r14896r14897
140140static ADDRESS_MAP_START( fuuki16_sound_io_map, AS_IO, 8, fuuki16_state )
141141   ADDRESS_MAP_GLOBAL_MASK(0xff)
142142   AM_RANGE(0x00, 0x00) AM_WRITE(fuuki16_sound_rombank_w)   // ROM Bank
143   AM_RANGE(0x11, 0x11) AM_READ(soundlatch_r) AM_WRITENOP   // From Main CPU / ? To Main CPU ?
143   AM_RANGE(0x11, 0x11) AM_READ(soundlatch_byte_r) AM_WRITENOP   // From Main CPU / ? To Main CPU ?
144144   AM_RANGE(0x20, 0x20) AM_DEVWRITE_LEGACY("oki", fuuki16_oki_banking_w)   // Oki Banking
145145   AM_RANGE(0x30, 0x30) AM_WRITENOP   // ? In the NMI routine
146146   AM_RANGE(0x40, 0x41) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
src/mame/drivers/vulgus.c
r14896r14897
5757   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2")
5858   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1")
5959   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
60   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
60   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_byte_w)
6161   AM_RANGE(0xc802, 0xc803) AM_RAM AM_BASE(m_scroll_low)
6262   AM_RANGE(0xc804, 0xc804) AM_WRITE(vulgus_c804_w)
6363   AM_RANGE(0xc805, 0xc805) AM_WRITE(vulgus_palette_bank_w)
r14896r14897
7272   AM_RANGE(0x0000, 0x1fff) AM_ROM
7373   AM_RANGE(0x4000, 0x47ff) AM_RAM
7474   AM_RANGE(0x4000, 0x47ff) AM_WRITEONLY
75   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
75   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
7676   AM_RANGE(0x8000, 0x8001) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
7777   AM_RANGE(0xc000, 0xc001) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
7878ADDRESS_MAP_END
src/mame/drivers/sderby.c
r14896r14897
282282   AM_RANGE(0x104000, 0x10400b) AM_WRITE(sderby_scroll_w)
283283   AM_RANGE(0x10400c, 0x10400d) AM_WRITENOP   /* ??? - check code at 0x000456 (executed once at startup) */
284284   AM_RANGE(0x10400e, 0x10400f) AM_WRITENOP   /* ??? - check code at 0x000524 (executed once at startup) */
285   AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
285   AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
286286   AM_RANGE(0x308000, 0x30800d) AM_READ(sderby_input_r)
287287   AM_RANGE(0x308008, 0x308009) AM_WRITE(sderby_out_w)   /* output port */
288288   AM_RANGE(0x30800e, 0x30800f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
289   AM_RANGE(0x380000, 0x380fff) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
289   AM_RANGE(0x380000, 0x380fff) AM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
290290   AM_RANGE(0x500000, 0x500001) AM_WRITENOP   /* unknown... write 0x01 in game, and 0x00 on reset */
291291   AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_SHARE("nvram")
292292   AM_RANGE(0xffc000, 0xffffff) AM_RAM
r14896r14897
301301   AM_RANGE(0x104000, 0x10400b) AM_WRITE(sderby_scroll_w)
302302   AM_RANGE(0x10400c, 0x10400d) AM_WRITENOP   /* ??? - check code at 0x000456 (executed once at startup) */
303303   AM_RANGE(0x10400e, 0x10400f) AM_WRITENOP   /* ??? - check code at 0x000524 (executed once at startup) */
304   AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
304   AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
305305   AM_RANGE(0x308000, 0x30800d) AM_READ(sderby_input_r)
306306   AM_RANGE(0x308008, 0x308009) AM_WRITE(sderby_out_w)   /* output port */
307307   AM_RANGE(0x30800e, 0x30800f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
308   AM_RANGE(0x380000, 0x380fff) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
308   AM_RANGE(0x380000, 0x380fff) AM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
309309   AM_RANGE(0x500000, 0x500001) AM_WRITENOP   /* unknown... write 0x01 in game, and 0x00 on reset */
310310   AM_RANGE(0xe00000, 0xe007ff) AM_RAM AM_SHARE("nvram")
311311   AM_RANGE(0xff0000, 0xffffff) AM_RAM
r14896r14897
324324   AM_RANGE(0x308000, 0x30800d) AM_READ(sderby_input_r)
325325   AM_RANGE(0x308008, 0x308009) AM_WRITE(scmatto_out_w)   /* output port */
326326   AM_RANGE(0x30800e, 0x30800f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
327   AM_RANGE(0x380000, 0x380fff) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
327   AM_RANGE(0x380000, 0x380fff) AM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
328328   AM_RANGE(0xd00000, 0xd001ff) AM_RAM
329   AM_RANGE(0x800000, 0x800fff) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
329   AM_RANGE(0x800000, 0x800fff) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
330330   AM_RANGE(0x801000, 0x80100d) AM_WRITENOP   /* unknown */
331331   AM_RANGE(0x8f0000, 0x8f07ff) AM_RAM AM_SHARE("nvram")   /* 16K Dallas DS1220Y-200 NVRAM */
332332   AM_RANGE(0x8fc000, 0x8fffff) AM_RAM
r14896r14897
334334
335335static ADDRESS_MAP_START( roulette_map, AS_PROGRAM, 16, sderby_state )
336336   AM_RANGE(0x000000, 0x03ffff) AM_ROM
337   AM_RANGE(0x440000, 0x440fff) AM_WRITEONLY AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
337   AM_RANGE(0x440000, 0x440fff) AM_WRITEONLY AM_BASE_SIZE(m_spriteram,m_spriteram_size)
338338   AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(sderby_videoram_w) AM_BASE(m_videoram)         /* bg */
339339   AM_RANGE(0x501000, 0x501fff) AM_RAM_WRITE(sderby_md_videoram_w) AM_BASE(m_md_videoram)   /* mid */
340340   AM_RANGE(0x502000, 0x503fff) AM_RAM_WRITE(sderby_fg_videoram_w) AM_BASE(m_fg_videoram)   /* fg */
r14896r14897
346346   AM_RANGE(0x70800a, 0x70800b) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
347347   AM_RANGE(0x70800c, 0x70800d) AM_WRITENOP   /* watchdog?? (0x0003) */
348348   AM_RANGE(0x70800e, 0x70800f) AM_READWRITE(rprot_r, rprot_w)   /* MCU communication */
349   AM_RANGE(0x780000, 0x780fff) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
349   AM_RANGE(0x780000, 0x780fff) AM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
350350
351351   AM_RANGE(0xff0000, 0xff07ff) AM_RAM AM_SHARE("nvram")
352352   AM_RANGE(0xffc000, 0xffffff) AM_RAM
src/mame/drivers/vcombat.c
r14896r14897
9494{
9595public:
9696   vcombat_state(const machine_config &mconfig, device_type type, const char *tag)
97      : driver_device(mconfig, type, tag) { }
97      : driver_device(mconfig, type, tag) ,
98      m_vid_0_shared_RAM(*this, "vid_0_shared_RAM"),
99      m_vid_1_shared_RAM(*this, "vid_1_shared_RAM"),
100      m_framebuffer_ctrl(*this, "framebuffer_ctrl"){ }
98101
99102   UINT16* m_m68k_framebuffer[2];
100103   UINT16* m_i860_framebuffer[2][2];
101   UINT16* m_framebuffer_ctrl;
102   UINT16* m_vid_0_shared_RAM;
103   UINT16* m_vid_1_shared_RAM;
104   required_shared_ptr<UINT16> m_vid_0_shared_RAM;
105   required_shared_ptr<UINT16> m_vid_1_shared_RAM;
106   required_shared_ptr<UINT16> m_framebuffer_ctrl;
104107   int m_crtc_select;
105108   DECLARE_WRITE16_MEMBER(main_video_write);
106109   DECLARE_READ16_MEMBER(control_1_r);
r14896r14897
329332   AM_RANGE(0x200000, 0x20ffff) AM_RAM
330333   AM_RANGE(0x300000, 0x30ffff) AM_WRITE(main_video_write)
331334
332   AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE(m_vid_0_shared_RAM) AM_SHARE("share2")   /* First i860 shared RAM */
335   AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_SHARE("vid_0_shared_RAM") AM_SHARE("share2")   /* First i860 shared RAM */
333336   AM_RANGE(0x440000, 0x440003) AM_RAM AM_SHARE("share6")      /* M0->P0 i860 #1 com 1 */
334337   AM_RANGE(0x480000, 0x480003) AM_RAM AM_SHARE("share7")      /* M0<-P0 i860 #1 com 2 */
335338   AM_RANGE(0x4c0000, 0x4c0003) AM_WRITE(wiggle_i860p0_pins_w)   /* i860 #1 stop/start/reset */
336339
337   AM_RANGE(0x500000, 0x53ffff) AM_RAM AM_BASE(m_vid_1_shared_RAM) AM_SHARE("share3")   /* Second i860 shared RAM */
340   AM_RANGE(0x500000, 0x53ffff) AM_RAM AM_SHARE("vid_1_shared_RAM") AM_SHARE("share3")   /* Second i860 shared RAM */
338341   AM_RANGE(0x540000, 0x540003) AM_RAM AM_SHARE("share8")      /* M0->P1 i860 #2 com 1 */
339342   AM_RANGE(0x580000, 0x580003) AM_RAM AM_SHARE("share9")      /* M0<-P1 i860 #2 com 2 */
340343   AM_RANGE(0x5c0000, 0x5c0003) AM_WRITE(wiggle_i860p1_pins_w)   /* i860 #2 stop/start/reset */
r14896r14897
345348   AM_RANGE(0x60001c, 0x60001d) AM_NOP
346349
347350   AM_RANGE(0x60000c, 0x60000d) AM_WRITE(crtc_w)
348   AM_RANGE(0x600010, 0x600011) AM_RAM AM_BASE(m_framebuffer_ctrl)
351   AM_RANGE(0x600010, 0x600011) AM_RAM AM_SHARE("framebuffer_ctrl")
349352   AM_RANGE(0x700000, 0x7007ff) AM_RAM AM_SHARE("nvram")
350353   AM_RANGE(0x701000, 0x701001) AM_READ(main_irqiack_r)
351354   AM_RANGE(0x702000, 0x702001) AM_READ(control_3_r)
r14896r14897
415418   vcombat_state *state = machine.driver_data<vcombat_state>();
416419   if (address >= 0xfffc0000 && address <= 0xffffffff)
417420   {
418      direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->m_vid_0_shared_RAM);
421      direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->m_vid_0_shared_RAM.target());
419422      return ~0;
420423   }
421424   return address;
r14896r14897
426429   vcombat_state *state = machine.driver_data<vcombat_state>();
427430   if (address >= 0xfffc0000 && address <= 0xffffffff)
428431   {
429      direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->m_vid_1_shared_RAM);
432      direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->m_vid_1_shared_RAM.target());
430433      return ~0;
431434   }
432435   return address;
src/mame/drivers/shangha3.c
r14896r14897
109109{
110110   if (ACCESSING_BITS_0_7)
111111   {
112      soundlatch_w(space, 0, data & 0xff);
112      soundlatch_byte_w(space, 0, data & 0xff);
113113      cputag_set_input_line_and_vector(machine(), "audiocpu", 0, HOLD_LINE, 0xff);   /* RST 38h */
114114   }
115115}
r14896r14897
118118
119119static ADDRESS_MAP_START( shangha3_map, AS_PROGRAM, 16, shangha3_state )
120120   AM_RANGE(0x000000, 0x07ffff) AM_ROM
121   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
121   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
122122   AM_RANGE(0x200000, 0x200001) AM_READ_PORT("INPUTS")
123123   AM_RANGE(0x200002, 0x200003) AM_READ_PORT("SYSTEM")
124124   AM_RANGE(0x200008, 0x200009) AM_WRITE(shangha3_blitter_go_w)
r14896r14897
136136
137137static ADDRESS_MAP_START( heberpop_map, AS_PROGRAM, 16, shangha3_state )
138138   AM_RANGE(0x000000, 0x0fffff) AM_ROM
139   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
139   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
140140   AM_RANGE(0x200000, 0x200001) AM_READ_PORT("INPUTS")
141141   AM_RANGE(0x200002, 0x200003) AM_READ_PORT("SYSTEM")
142142   AM_RANGE(0x200004, 0x200005) AM_READ_PORT("DSW")
r14896r14897
159159   AM_RANGE(0x10000a, 0x10000b) AM_WRITENOP   /* irq ack? */
160160   AM_RANGE(0x10000c, 0x10000d) AM_WRITE(blocken_coinctrl_w)
161161   AM_RANGE(0x10000e, 0x10000f) AM_WRITE(heberpop_sound_command_w)
162   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
162   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
163163   AM_RANGE(0x300000, 0x30ffff) AM_RAM AM_BASE_SIZE(m_ram, m_ram_size)   /* gfx & work ram */
164164   AM_RANGE(0x340000, 0x340001) AM_WRITE(shangha3_flipscreen_w)
165165   AM_RANGE(0x360000, 0x360001) AM_WRITE(shangha3_gfxlist_addr_w)
r14896r14897
176176   ADDRESS_MAP_GLOBAL_MASK(0xff)
177177   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym3438_r, ym3438_w)
178178   AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki", okim6295_device, read, write)
179   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
179   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
180180ADDRESS_MAP_END
181181
182182
src/mame/drivers/vastar.c
r14896r14897
9292
9393WRITE8_MEMBER(vastar_state::flip_screen_w)
9494{
95   flip_screen_set(machine(), data);
95   flip_screen_set(data);
9696}
9797
9898WRITE8_MEMBER(vastar_state::nmi_mask_w)
src/mame/drivers/pkscram.c
r14896r14897
2121{
2222public:
2323   pkscram_state(const machine_config &mconfig, device_type type, const char *tag)
24      : driver_device(mconfig, type, tag) { }
24      : driver_device(mconfig, type, tag) ,
25      m_pkscramble_fgtilemap_ram(*this, "pkscramble_fgtilemap_ram"),
26      m_pkscramble_mdtilemap_ram(*this, "pkscramble_mdtilemap_ram"),
27      m_pkscramble_bgtilemap_ram(*this, "pkscramble_bgtilemap_ram"){ }
2528
2629   UINT16 m_out;
2730   UINT8 m_interrupt_line_active;
28   UINT16* m_pkscramble_fgtilemap_ram;
29   UINT16* m_pkscramble_mdtilemap_ram;
30   UINT16* m_pkscramble_bgtilemap_ram;
31   required_shared_ptr<UINT16> m_pkscramble_fgtilemap_ram;
32   required_shared_ptr<UINT16> m_pkscramble_mdtilemap_ram;
33   required_shared_ptr<UINT16> m_pkscramble_bgtilemap_ram;
3134   tilemap_t *m_fg_tilemap;
3235   tilemap_t *m_md_tilemap;
3336   tilemap_t *m_bg_tilemap;
r14896r14897
4346
4447WRITE16_MEMBER(pkscram_state::pkscramble_fgtilemap_w)
4548{
46   COMBINE_DATA(&m_pkscramble_fgtilemap_ram[offset]);
49   COMBINE_DATA(&m_pkscramble_fgtilemap_ram.target()[offset]);
4750   m_fg_tilemap->mark_tile_dirty(offset >> 1);
4851}
4952
5053WRITE16_MEMBER(pkscram_state::pkscramble_mdtilemap_w)
5154{
52   COMBINE_DATA(&m_pkscramble_mdtilemap_ram[offset]);
55   COMBINE_DATA(&m_pkscramble_mdtilemap_ram.target()[offset]);
5356   m_md_tilemap->mark_tile_dirty(offset >> 1);
5457}
5558
5659WRITE16_MEMBER(pkscram_state::pkscramble_bgtilemap_w)
5760{
58   COMBINE_DATA(&m_pkscramble_bgtilemap_ram[offset]);
61   COMBINE_DATA(&m_pkscramble_bgtilemap_ram.target()[offset]);
5962   m_bg_tilemap->mark_tile_dirty(offset >> 1);
6063}
6164
r14896r14897
99102   AM_RANGE(0x000000, 0x01ffff) AM_ROM
100103   AM_RANGE(0x040000, 0x0400ff) AM_RAM AM_SHARE("nvram")
101104   AM_RANGE(0x041000, 0x043fff) AM_RAM // main ram
102   AM_RANGE(0x044000, 0x044fff) AM_RAM_WRITE(pkscramble_fgtilemap_w) AM_BASE(m_pkscramble_fgtilemap_ram) // fg tilemap
103   AM_RANGE(0x045000, 0x045fff) AM_RAM_WRITE(pkscramble_mdtilemap_w) AM_BASE(m_pkscramble_mdtilemap_ram) // md tilemap (just a copy of fg?)
104   AM_RANGE(0x046000, 0x046fff) AM_RAM_WRITE(pkscramble_bgtilemap_w) AM_BASE(m_pkscramble_bgtilemap_ram) // bg tilemap
105   AM_RANGE(0x044000, 0x044fff) AM_RAM_WRITE(pkscramble_fgtilemap_w) AM_SHARE("pkscramble_fgtilemap_ram") // fg tilemap
106   AM_RANGE(0x045000, 0x045fff) AM_RAM_WRITE(pkscramble_mdtilemap_w) AM_SHARE("pkscramble_mdtilemap_ram") // md tilemap (just a copy of fg?)
107   AM_RANGE(0x046000, 0x046fff) AM_RAM_WRITE(pkscramble_bgtilemap_w) AM_SHARE("pkscramble_bgtilemap_ram") // bg tilemap
105108   AM_RANGE(0x047000, 0x047fff) AM_RAM // unused
106   AM_RANGE(0x048000, 0x048fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
109   AM_RANGE(0x048000, 0x048fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
107110   AM_RANGE(0x049000, 0x049001) AM_READ_PORT("DSW")
108111   AM_RANGE(0x049004, 0x049005) AM_READ_PORT("INPUTS")
109112   AM_RANGE(0x049008, 0x049009) AM_WRITE(pkscramble_output_w)
r14896r14897
184187static TILE_GET_INFO( get_bg_tile_info )
185188{
186189   pkscram_state *state = machine.driver_data<pkscram_state>();
187   int tile  = state->m_pkscramble_bgtilemap_ram[tile_index*2];
188   int color = state->m_pkscramble_bgtilemap_ram[tile_index*2 + 1] & 0x7f;
190   int tile  = state->m_pkscramble_bgtilemap_ram.target()[tile_index*2];
191   int color = state->m_pkscramble_bgtilemap_ram.target()[tile_index*2 + 1] & 0x7f;
189192
190193   SET_TILE_INFO(0,tile,color,0);
191194}
r14896r14897
193196static TILE_GET_INFO( get_md_tile_info )
194197{
195198   pkscram_state *state = machine.driver_data<pkscram_state>();
196   int tile  = state->m_pkscramble_mdtilemap_ram[tile_index*2];
197   int color = state->m_pkscramble_mdtilemap_ram[tile_index*2 + 1] & 0x7f;
199   int tile  = state->m_pkscramble_mdtilemap_ram.target()[tile_index*2];
200   int color = state->m_pkscramble_mdtilemap_ram.target()[tile_index*2 + 1] & 0x7f;
198201
199202   SET_TILE_INFO(0,tile,color,0);
200203}
r14896r14897
202205static TILE_GET_INFO( get_fg_tile_info )
203206{
204207   pkscram_state *state = machine.driver_data<pkscram_state>();
205   int tile  = state->m_pkscramble_fgtilemap_ram[tile_index*2];
206   int color = state->m_pkscramble_fgtilemap_ram[tile_index*2 + 1] & 0x7f;
208   int tile  = state->m_pkscramble_fgtilemap_ram.target()[tile_index*2];
209   int color = state->m_pkscramble_fgtilemap_ram.target()[tile_index*2 + 1] & 0x7f;
207210
208211   SET_TILE_INFO(0,tile,color,0);
209212}
src/mame/drivers/39in1.c
r14896r14897
3131{
3232public:
3333   _39in1_state(const machine_config &mconfig, device_type type, const char *tag)
34      : driver_device(mconfig, type, tag) { }
34      : driver_device(mconfig, type, tag) ,
35      m_ram(*this, "ram"){ }
3536
3637   UINT32 m_seed;
3738   UINT32 m_magic;
3839   UINT32 m_state;
3940
40   UINT32* m_ram;
41   required_shared_ptr<UINT32> m_ram;
4142
4243   PXA255_DMA_Regs m_dma_regs;
4344   PXA255_I2S_Regs m_i2s_regs;
r14896r14897
14761477   AM_RANGE(0x40d00000, 0x40d00017) AM_READWRITE(pxa255_intc_r, pxa255_intc_w )
14771478   AM_RANGE(0x40e00000, 0x40e0006b) AM_READWRITE(pxa255_gpio_r, pxa255_gpio_w )
14781479   AM_RANGE(0x44000000, 0x4400021f) AM_READWRITE(pxa255_lcd_r,  pxa255_lcd_w )
1479   AM_RANGE(0xa0000000, 0xa07fffff) AM_RAM AM_BASE(m_ram)
1480   AM_RANGE(0xa0000000, 0xa07fffff) AM_RAM AM_SHARE("ram")
14801481ADDRESS_MAP_END
14811482
14821483static INPUT_PORTS_START( 39in1 )
src/mame/drivers/fortecar.c
r14896r14897
330330public:
331331   fortecar_state(const machine_config &mconfig, device_type type, const char *tag)
332332      : driver_device(mconfig, type, tag),
333      m_maincpu(*this,"maincpu")
334      { }
333      m_maincpu(*this,"maincpu"),
334      m_vram(*this, "vram"){ }
335335
336   UINT8 *m_vram;
337   size_t m_vram_size;
338
339336   required_device<cpu_device> m_maincpu;
337   required_shared_ptr<UINT8> m_vram;
340338};
341339
342340
r14896r14897
356354      {
357355         int tile,color,bpp;
358356
359         tile = (state->m_vram[(count*4)+1] | (state->m_vram[(count*4)+2]<<8)) & 0xfff;
360         color = state->m_vram[(count*4)+3] & 0x1f;
361         bpp = (state->m_vram[(count*4)+3] & 0x20) >> 5;
357         tile = (state->m_vram.target()[(count*4)+1] | (state->m_vram.target()[(count*4)+2]<<8)) & 0xfff;
358         color = state->m_vram.target()[(count*4)+3] & 0x1f;
359         bpp = (state->m_vram.target()[(count*4)+3] & 0x20) >> 5;
362360
363361         if(bpp)
364362            color&=0x3;
r14896r14897
562560   AM_RANGE(0x0000, 0xbfff) AM_ROM
563561   AM_RANGE(0xc000, 0xc7ff) AM_ROM
564562   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("nvram")
565   AM_RANGE(0xd800, 0xffff) AM_RAM AM_BASE_SIZE(m_vram,m_vram_size)
563   AM_RANGE(0xd800, 0xffff) AM_RAM AM_SHARE("vram")
566564ADDRESS_MAP_END
567565
568566static ADDRESS_MAP_START( fortecar_ports, AS_IO, 8, fortecar_state )
r14896r14897
674672   int i;
675673
676674   /* apparently there's a random fill in there (checked thru trojan TODO: extract proper algorythm) */
677   for(i=0;i<state->m_vram_size;i++)
678      state->m_vram[i] = machine.rand();
675   for(i=0;i<state->m_vram.bytes();i++)
676      state->m_vram.target()[i] = machine.rand();
679677}
680678
681679
src/mame/drivers/superwng.c
r14896r14897
3232{
3333public:
3434   superwng_state(const machine_config &mconfig, device_type type, const char *tag)
35      : driver_device(mconfig, type, tag) { }
35      : driver_device(mconfig, type, tag) ,
36      m_videoram_bg(*this, "videorabg"),
37      m_videoram_fg(*this, "videorafg"),
38      m_colorram_bg(*this, "colorrabg"),
39      m_colorram_fg(*this, "colorrafg"){ }
3640
37   UINT8 *    m_videoram_bg;
38   UINT8 *    m_colorram_bg;
39   UINT8 *    m_videoram_fg;
40   UINT8 *    m_colorram_fg;
41   required_shared_ptr<UINT8> m_videoram_bg;
42   required_shared_ptr<UINT8> m_videoram_fg;
43   required_shared_ptr<UINT8> m_colorram_bg;
44   required_shared_ptr<UINT8> m_colorram_fg;
4145
4246   int         m_tile_bank;
4347
r14896r14897
6872static TILE_GET_INFO( get_bg_tile_info )
6973{
7074   superwng_state *state = machine.driver_data<superwng_state>();
71   int code = state->m_videoram_bg[tile_index];
72   int attr = state->m_colorram_bg[tile_index];
75   int code = state->m_videoram_bg.target()[tile_index];
76   int attr = state->m_colorram_bg.target()[tile_index];
7377
7478   code= (code&0x7f) | ((attr&0x40)<<1) | ((code&0x80)<<1);
7579   code|=state->m_tile_bank?0x200:0;
r14896r14897
8387static TILE_GET_INFO( get_fg_tile_info )
8488{
8589   superwng_state *state = machine.driver_data<superwng_state>();
86   int code = state->m_videoram_fg[tile_index];
87   int attr = state->m_colorram_fg[tile_index];
90   int code = state->m_videoram_fg.target()[tile_index];
91   int attr = state->m_colorram_fg.target()[tile_index];
8892
8993   code= (code&0x7f) | ((attr&0x40)<<1) | ((code&0x80)<<1);
9094
r14896r14897
98102
99103WRITE8_MEMBER(superwng_state::superwng_flip_screen_x_w)
100104{
101   flip_screen_x_set(machine(), ~data & 1);
105   flip_screen_x_set(~data & 1);
102106}
103107
104108WRITE8_MEMBER(superwng_state::superwng_flip_screen_y_w)
105109{
106   flip_screen_y_set(machine(), ~data & 1);
110   flip_screen_y_set(~data & 1);
107111}
108112
109113static VIDEO_START( superwng )
r14896r14897
118122static SCREEN_UPDATE_IND16( superwng )
119123{
120124   superwng_state *state = screen.machine().driver_data<superwng_state>();
121   int flip=flip_screen_get(screen.machine());
125   int flip=state->flip_screen();
122126
123127   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
124128   rectangle tmp=cliprect;
r14896r14897
139143
140144      for(int i=0x3e; i>=0; i-=2)
141145      {
142         int code=(state->m_videoram_bg[i]>>2)+0x40;
143         int sx=256-state->m_videoram_bg[i+1]-8;
144         int sy = state->m_colorram_bg[i]+8;
145         int attr = state->m_colorram_bg[i+1];
146         int code=(state->m_videoram_bg.target()[i]>>2)+0x40;
147         int sx=256-state->m_videoram_bg.target()[i+1]-8;
148         int sy = state->m_colorram_bg.target()[i]+8;
149         int attr = state->m_colorram_bg.target()[i+1];
146150
147151         if (flip)
148152         {
r14896r14897
150154            sx-=8;
151155         }
152156
153         if(state->m_videoram_bg[i+1] | state->m_colorram_bg[i])
157         if(state->m_videoram_bg.target()[i+1] | state->m_colorram_bg.target()[i])
154158         {
155159
156160            drawgfx_transpen(bitmap, cliprect,screen.machine().gfx[1],
r14896r14897
242246
243247WRITE8_MEMBER(superwng_state::superwng_bg_vram_w)
244248{
245   m_videoram_bg[offset] = data;
249   m_videoram_bg.target()[offset] = data;
246250   m_bg_tilemap->mark_tile_dirty(offset);
247251}
248252
249253WRITE8_MEMBER(superwng_state::superwng_bg_cram_w)
250254{
251   m_colorram_bg[offset] = data;
255   m_colorram_bg.target()[offset] = data;
252256   m_bg_tilemap->mark_tile_dirty(offset);
253257}
254258
255259WRITE8_MEMBER(superwng_state::superwng_fg_vram_w)
256260{
257   m_videoram_fg[offset] = data;
261   m_videoram_fg.target()[offset] = data;
258262   m_fg_tilemap->mark_tile_dirty(offset);
259263}
260264
261265WRITE8_MEMBER(superwng_state::superwng_fg_cram_w)
262266{
263   m_colorram_fg[offset] = data;
267   m_colorram_fg.target()[offset] = data;
264268   m_fg_tilemap->mark_tile_dirty(offset);
265269}
266270
r14896r14897
273277
274278WRITE8_MEMBER(superwng_state::superwng_flip_screen_w)
275279{
276   flip_screen_set(machine(), ~data & 0x01);
280   flip_screen_set(~data & 0x01);
277281   m_bg_tilemap->mark_all_dirty();
278282   m_fg_tilemap->mark_all_dirty();
279283}
r14896r14897
291295static ADDRESS_MAP_START( superwng_map, AS_PROGRAM, 8, superwng_state )
292296   AM_RANGE(0x0000, 0x6fff) AM_ROM
293297   AM_RANGE(0x7000, 0x7fff) AM_RAM
294   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(superwng_bg_vram_w) AM_BASE(m_videoram_bg)
295   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(superwng_fg_vram_w) AM_BASE(m_videoram_fg)
296   AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(superwng_bg_cram_w) AM_BASE(m_colorram_bg)
297   AM_RANGE(0x8c00, 0x8fff) AM_RAM_WRITE(superwng_fg_cram_w) AM_BASE(m_colorram_fg)
298   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(superwng_bg_vram_w) AM_SHARE("videorabg")
299   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(superwng_fg_vram_w) AM_SHARE("videorafg")
300   AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(superwng_bg_cram_w) AM_SHARE("colorrabg")
301   AM_RANGE(0x8c00, 0x8fff) AM_RAM_WRITE(superwng_fg_cram_w) AM_SHARE("colorrafg")
298302   AM_RANGE(0x9800, 0x99ff) AM_RAM  //collision map
299303   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
300304   AM_RANGE(0xa000, 0xa000) AM_WRITENOP //unknown
src/mame/drivers/cyclemb.c
r14896r14897
7979{
8080public:
8181   cyclemb_state(const machine_config &mconfig, device_type type, const char *tag)
82      : driver_device(mconfig, type, tag) { }
82      : driver_device(mconfig, type, tag) ,
83      m_vram(*this, "vram"),
84      m_cram(*this, "cram"),
85      m_obj1_ram(*this, "obj1_ram"),
86      m_obj2_ram(*this, "obj2_ram"),
87      m_obj3_ram(*this, "obj3_ram"){ }
8388
84   UINT8 *m_vram;
85   UINT8 *m_cram;
86   UINT8 *m_obj1_ram;
87   UINT8 *m_obj2_ram;
88   UINT8 *m_obj3_ram;
89   required_shared_ptr<UINT8> m_vram;
90   required_shared_ptr<UINT8> m_cram;
91   required_shared_ptr<UINT8> m_obj1_ram;
92   required_shared_ptr<UINT8> m_obj2_ram;
93   required_shared_ptr<UINT8> m_obj3_ram;
8994   DECLARE_WRITE8_MEMBER(cyclemb_bankswitch_w);
9095   DECLARE_READ8_MEMBER(mcu_status_r);
9196   DECLARE_WRITE8_MEMBER(sound_cmd_w);
r14896r14897
130135   cyclemb_state *state = screen.machine().driver_data<cyclemb_state>();
131136   int x,y,count;
132137   const gfx_element *gfx = screen.machine().gfx[0];
133   UINT8 flip_screen = flip_screen_get(screen.machine());
138   UINT8 flip_screen = state->flip_screen();
134139
135140   count = 0;
136141
r14896r14897
138143   {
139144      for (x=0;x<64;x++)
140145      {
141         int attr = state->m_cram[count];
142         int tile = (state->m_vram[count]) | ((attr & 3)<<8);
146         int attr = state->m_cram.target()[count];
147         int tile = (state->m_vram.target()[count]) | ((attr & 3)<<8);
143148         int color = ((attr & 0xf8) >> 3) ^ 0x1f;
144149         int odd_line = y & 1 ? 0x40 : 0x00;
145150//          int sx_offs = flip_screen ? 512 : 0
146         int scrollx = ((state->m_vram[(y/2)+odd_line]) + (state->m_cram[(y/2)+odd_line]<<8) + 48) & 0x1ff;
151         int scrollx = ((state->m_vram.target()[(y/2)+odd_line]) + (state->m_cram.target()[(y/2)+odd_line]<<8) + 48) & 0x1ff;
147152
148153         if(flip_screen)
149154         {
r14896r14897
188193
189194      for(i=0;i<0x40;i+=2)
190195      {
191         y = 0xf1 - state->m_obj2_ram[i];
192         x = state->m_obj2_ram[i+1] - 56;
193         spr_offs = (state->m_obj1_ram[i+0]);
194         col = (state->m_obj1_ram[i+1] & 0x3f);
195         region = ((state->m_obj3_ram[i] & 0x10) >> 4) + 1;
196         y = 0xf1 - state->m_obj2_ram.target()[i];
197         x = state->m_obj2_ram.target()[i+1] - 56;
198         spr_offs = (state->m_obj1_ram.target()[i+0]);
199         col = (state->m_obj1_ram.target()[i+1] & 0x3f);
200         region = ((state->m_obj3_ram.target()[i] & 0x10) >> 4) + 1;
196201         if(region == 2)
197202         {
198203            spr_offs >>= 2;
199            spr_offs += ((state->m_obj3_ram[i+0] & 3) << 5);
204            spr_offs += ((state->m_obj3_ram.target()[i+0] & 3) << 5);
200205            y-=16;
201206         }
202207
203         if(state->m_obj3_ram[i+1] & 1)
208         if(state->m_obj3_ram.target()[i+1] & 1)
204209            x+=256;
205         //if(state->m_obj3_ram[i+1] & 2)
210         //if(state->m_obj3_ram.target()[i+1] & 2)
206211//              x-=256;
207         fx = (state->m_obj3_ram[i+0] & 4) >> 2;
208         fy = (state->m_obj3_ram[i+0] & 8) >> 3;
212         fx = (state->m_obj3_ram.target()[i+0] & 4) >> 2;
213         fy = (state->m_obj3_ram.target()[i+0] & 8) >> 3;
209214
210215         if(flip_screen)
211216         {
r14896r14897
227232#if 0
228233WRITE8_MEMBER(cyclemb_state::sound_cmd_w)
229234{
230   soundlatch_w(space, 0, data & 0xff);
235   soundlatch_byte_w(space, 0, data & 0xff);
231236   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
232237}
233238#endif
r14896r14897
241246
242247WRITE8_MEMBER(cyclemb_state::sound_cmd_w)//actually ciom
243248{
244   soundlatch_w(space, 0, data & 0xff);
249   soundlatch_byte_w(space, 0, data & 0xff);
245250   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
246251}
247252#endif
248253
249254WRITE8_MEMBER(cyclemb_state::cyclemb_flip_w)
250255{
251   flip_screen_set(machine(), data & 1);
256   flip_screen_set(data & 1);
252257
253258   // a bunch of other things are setted here
254259}
r14896r14897
256261static ADDRESS_MAP_START( cyclemb_map, AS_PROGRAM, 8, cyclemb_state )
257262   AM_RANGE(0x0000, 0x7fff) AM_ROM
258263   AM_RANGE(0x8000, 0x8fff) AM_ROMBANK("bank1")
259   AM_RANGE(0x9000, 0x97ff) AM_RAM AM_BASE(m_vram)
260   AM_RANGE(0x9800, 0x9fff) AM_RAM AM_BASE(m_cram)
261   AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE(m_obj1_ram) //ORAM1 (only a000-a3ff tested)
262   AM_RANGE(0xa800, 0xafff) AM_RAM AM_BASE(m_obj2_ram) //ORAM2 (only a800-abff tested)
263   AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_BASE(m_obj3_ram) //ORAM3 (only b000-b3ff tested)
264   AM_RANGE(0x9000, 0x97ff) AM_RAM AM_SHARE("vram")
265   AM_RANGE(0x9800, 0x9fff) AM_RAM AM_SHARE("cram")
266   AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("obj1_ram") //ORAM1 (only a000-a3ff tested)
267   AM_RANGE(0xa800, 0xafff) AM_RAM AM_SHARE("obj2_ram") //ORAM2 (only a800-abff tested)
268   AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_SHARE("obj3_ram") //ORAM3 (only b000-b3ff tested)
264269   AM_RANGE(0xb800, 0xbfff) AM_RAM //WRAM
265270ADDRESS_MAP_END
266271
r14896r14897
280285static ADDRESS_MAP_START( cyclemb_sound_io, AS_IO, 8, cyclemb_state )
281286   ADDRESS_MAP_GLOBAL_MASK(0xff)
282287   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("aysnd", ay8910_r, ay8910_address_data_w)
283   AM_RANGE(0x40, 0x40) AM_READ(soundlatch_r) AM_WRITE(soundlatch2_w)
288   AM_RANGE(0x40, 0x40) AM_READ(soundlatch_byte_r) AM_WRITE(soundlatch2_byte_w)
284289ADDRESS_MAP_END
285290
286291static MACHINE_RESET( cyclemb )
src/mame/drivers/bingor.c
r14896r14897
447447{
448448public:
449449   bingor_state(const machine_config &mconfig, device_type type, const char *tag)
450      : driver_device(mconfig, type, tag) { }
450      : driver_device(mconfig, type, tag) ,
451      m_blit_ram(*this, "blit_ram"){ }
451452
452   UINT16 *m_blit_ram;
453   required_shared_ptr<UINT16> m_blit_ram;
453454   DECLARE_READ16_MEMBER(test_r);
454455   DECLARE_READ8_MEMBER(test8_r);
455456};
r14896r14897
474475      {
475476         UINT32 color;
476477
477         color = (state->m_blit_ram[count] & 0xf000)>>12;
478         color = (state->m_blit_ram.target()[count] & 0xf000)>>12;
478479
479480         if(cliprect.contains(x+3, y))
480481            bitmap.pix32(y, x+3) = screen.machine().pens[color];
481482
482         color = (state->m_blit_ram[count] & 0x0f00)>>8;
483         color = (state->m_blit_ram.target()[count] & 0x0f00)>>8;
483484
484485         if(cliprect.contains(x+2, y))
485486            bitmap.pix32(y, x+2) = screen.machine().pens[color];
486487
487         color = (state->m_blit_ram[count] & 0x00f0)>>4;
488         color = (state->m_blit_ram.target()[count] & 0x00f0)>>4;
488489
489490         if(cliprect.contains(x+1, y))
490491            bitmap.pix32(y, x+1) = screen.machine().pens[color];
491492
492         color = (state->m_blit_ram[count] & 0x000f)>>0;
493         color = (state->m_blit_ram.target()[count] & 0x000f)>>0;
493494
494495         if(cliprect.contains(x+0, y))
495496            bitmap.pix32(y, x+0) = screen.machine().pens[color];
r14896r14897
511512static ADDRESS_MAP_START( bingor_map, AS_PROGRAM, 16, bingor_state )
512513   AM_RANGE(0x00000, 0x0ffff) AM_RAM
513514   AM_RANGE(0x90000, 0x9ffff) AM_ROM AM_REGION("gfx", 0)
514   AM_RANGE(0xa0300, 0xa031f) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBIIII_word_w) AM_SHARE("paletteram") //wrong
515   AM_RANGE(0xa0000, 0xaffff) AM_RAM AM_BASE(m_blit_ram)
515   AM_RANGE(0xa0300, 0xa031f) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBIIII_word_w) AM_SHARE("paletteram") //wrong
516   AM_RANGE(0xa0000, 0xaffff) AM_RAM AM_SHARE("blit_ram")
516517   AM_RANGE(0xe0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0)
517518ADDRESS_MAP_END
518519
src/mame/drivers/beaminv.c
r14896r14897
6060{
6161public:
6262   beaminv_state(const machine_config &mconfig, device_type type, const char *tag)
63      : driver_device(mconfig, type, tag) { }
63      : driver_device(mconfig, type, tag) ,
64      m_videoram(*this, "videoram"){ }
6465
6566   /* memory pointers */
66   UINT8 *    m_videoram;
67   size_t     m_videoram_size;
67   required_shared_ptr<UINT8> m_videoram;
6868
6969   /* misc */
7070   emu_timer  *m_interrupt_timer;
r14896r14897
173173   beaminv_state *state = screen.machine().driver_data<beaminv_state>();
174174   offs_t offs;
175175
176   for (offs = 0; offs < state->m_videoram_size; offs++)
176   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
177177   {
178178      int i;
179179
180180      UINT8 y = offs;
181181      UINT8 x = offs >> 8 << 3;
182      UINT8 data = state->m_videoram[offs];
182      UINT8 data = state->m_videoram.target()[offs];
183183
184184      for (i = 0; i < 8; i++)
185185      {
r14896r14897
239239   AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x03ff) AM_READ_PORT("INPUTS")
240240   AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_READ(controller_r)
241241   AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x03ff) AM_READ(v128_r)
242   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
242   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videoram")
243243ADDRESS_MAP_END
244244
245245
src/mame/drivers/mcr.c
r14896r14897
308308 *
309309 *************************************/
310310
311static READ8_HANDLER( solarfox_ip0_r )
311READ8_MEMBER(mcr_state::solarfox_ip0_r)
312312{
313313   /* This is a kludge; according to the wiring diagram, the player 2 */
314314   /* controls are hooked up as documented below. If you go into test */
r14896r14897
316316   /* game in cocktail mode, they don't work at all. So we fake-mux   */
317317   /* the controls through player 1's ports */
318318   if (mcr_cocktail_flip)
319      return input_port_read(space->machine(), "SSIO.IP0") | 0x08;
319      return input_port_read(machine(), "SSIO.IP0") | 0x08;
320320   else
321      return ((input_port_read(space->machine(), "SSIO.IP0") & ~0x14) | 0x08) | ((input_port_read(space->machine(), "SSIO.IP0") & 0x08) >> 1) | ((input_port_read(space->machine(), "SSIO.IP2") & 0x01) << 4);
321      return ((input_port_read(machine(), "SSIO.IP0") & ~0x14) | 0x08) | ((input_port_read(machine(), "SSIO.IP0") & 0x08) >> 1) | ((input_port_read(machine(), "SSIO.IP2") & 0x01) << 4);
322322}
323323
324324
325static READ8_HANDLER( solarfox_ip1_r )
325READ8_MEMBER(mcr_state::solarfox_ip1_r)
326326{
327327   /*  same deal as above */
328328   if (mcr_cocktail_flip)
329      return input_port_read(space->machine(), "SSIO.IP1") | 0xf0;
329      return input_port_read(machine(), "SSIO.IP1") | 0xf0;
330330   else
331      return (input_port_read(space->machine(), "SSIO.IP1") >> 4) | 0xf0;
331      return (input_port_read(machine(), "SSIO.IP1") >> 4) | 0xf0;
332332}
333333
334334
r14896r14897
339339 *
340340 *************************************/
341341
342static READ8_HANDLER( kick_ip1_r )
342READ8_MEMBER(mcr_state::kick_ip1_r)
343343{
344   return (input_port_read(space->machine(), "DIAL2") << 4) & 0xf0;
344   return (input_port_read(machine(), "DIAL2") << 4) & 0xf0;
345345}
346346
347347
r14896r14897
352352 *
353353 *************************************/
354354
355static WRITE8_HANDLER( wacko_op4_w )
355WRITE8_MEMBER(mcr_state::wacko_op4_w)
356356{
357357   input_mux = data & 1;
358358}
359359
360360
361static READ8_HANDLER( wacko_ip1_r )
361READ8_MEMBER(mcr_state::wacko_ip1_r)
362362{
363363   if (!input_mux)
364      return input_port_read(space->machine(), "SSIO.IP1");
364      return input_port_read(machine(), "SSIO.IP1");
365365   else
366      return input_port_read(space->machine(), "SSIO.IP1.ALT");
366      return input_port_read(machine(), "SSIO.IP1.ALT");
367367}
368368
369369
370static READ8_HANDLER( wacko_ip2_r )
370READ8_MEMBER(mcr_state::wacko_ip2_r)
371371{
372372   if (!input_mux)
373      return input_port_read(space->machine(), "SSIO.IP2");
373      return input_port_read(machine(), "SSIO.IP2");
374374   else
375      return input_port_read(space->machine(), "SSIO.IP2.ALT");
375      return input_port_read(machine(), "SSIO.IP2.ALT");
376376}
377377
378378
r14896r14897
383383 *
384384 *************************************/
385385
386static READ8_HANDLER( kroozr_ip1_r )
386READ8_MEMBER(mcr_state::kroozr_ip1_r)
387387{
388   int dial = input_port_read(space->machine(), "DIAL");
388   int dial = input_port_read(machine(), "DIAL");
389389   return ((dial & 0x80) >> 1) | ((dial & 0x70) >> 4);
390390}
391391
392392
393static WRITE8_HANDLER( kroozr_op4_w )
393WRITE8_MEMBER(mcr_state::kroozr_op4_w)
394394{
395395   /*
396396        bit 2 = ship control
r14896r14897
407407 *
408408 *************************************/
409409
410static WRITE8_HANDLER( journey_op4_w )
410WRITE8_MEMBER(mcr_state::journey_op4_w)
411411{
412   samples_device *samples = space->machine().device<samples_device>("samples");
412   samples_device *samples = machine().device<samples_device>("samples");
413413
414414   /* if we're not playing the sample yet, start it */
415415   if (!samples->playing(0))
r14896r14897
427427 *
428428 *************************************/
429429
430static WRITE8_HANDLER( twotiger_op4_w )
430WRITE8_MEMBER(mcr_state::twotiger_op4_w)
431431{
432   samples_device *samples = space->machine().device<samples_device>("samples");
432   samples_device *samples = machine().device<samples_device>("samples");
433433
434434   for (int i = 0; i < 2; i++)
435435   {
r14896r14897
453453 *
454454 *************************************/
455455
456static WRITE8_HANDLER( dotron_op4_w )
456WRITE8_MEMBER(mcr_state::dotron_op4_w)
457457{
458458   /*
459459        Flasher Control:
r14896r14897
534534}
535535
536536
537static READ8_HANDLER( nflfoot_ip2_r )
537READ8_MEMBER(mcr_state::nflfoot_ip2_r)
538538{
539539   /* bit 7 = J3-2 on IPU board = TXDA on SIO */
540540   UINT8 val = 0x80;
r14896r14897
548548         nflfoot_serial_in_active = FALSE;
549549   }
550550
551   if (cpu_get_pc(&space->device()) != 0x107)
552      logerror("%04X:ip2_r = %02X\n", cpu_get_pc(&space->device()), val);
551   if (cpu_get_pc(&space.device()) != 0x107)
552      logerror("%04X:ip2_r = %02X\n", cpu_get_pc(&space.device()), val);
553553   return val;
554554}
555555
556556
557static WRITE8_HANDLER( nflfoot_op4_w )
557WRITE8_MEMBER(mcr_state::nflfoot_op4_w)
558558{
559   device_t *sio = space->machine().device("ipu_sio");
559   device_t *sio = machine().device("ipu_sio");
560560
561561   /* bit 7 = J3-7 on IPU board = /RXDA on SIO */
562   logerror("%04X:op4_w(%d%d%d)\n", cpu_get_pc(&space->device()), (data >> 7) & 1, (data >> 6) & 1, (data >> 5) & 1);
562   logerror("%04X:op4_w(%d%d%d)\n", cpu_get_pc(&space.device()), (data >> 7) & 1, (data >> 6) & 1, (data >> 5) & 1);
563563
564564   /* look for a non-zero start bit to go active */
565565   if (!nflfoot_serial_out_active && (data & 0x80))
r14896r14897
606606 *
607607 *************************************/
608608
609static READ8_HANDLER( demoderb_ip1_r )
609READ8_MEMBER(mcr_state::demoderb_ip1_r)
610610{
611   return input_port_read(space->machine(), "SSIO.IP1") |
612      (input_port_read(space->machine(), input_mux ? "SSIO.IP1.ALT2" : "SSIO.IP1.ALT1") << 2);
611   return input_port_read(machine(), "SSIO.IP1") |
612      (input_port_read(machine(), input_mux ? "SSIO.IP1.ALT2" : "SSIO.IP1.ALT1") << 2);
613613}
614614
615615
616static READ8_HANDLER( demoderb_ip2_r )
616READ8_MEMBER(mcr_state::demoderb_ip2_r)
617617{
618   return input_port_read(space->machine(), "SSIO.IP2") |
619      (input_port_read(space->machine(), input_mux ? "SSIO.IP2.ALT2" : "SSIO.IP2.ALT1") << 2);
618   return input_port_read(machine(), "SSIO.IP2") |
619      (input_port_read(machine(), input_mux ? "SSIO.IP2.ALT2" : "SSIO.IP2.ALT1") << 2);
620620}
621621
622622
623static WRITE8_HANDLER( demoderb_op4_w )
623WRITE8_MEMBER(mcr_state::demoderb_op4_w)
624624{
625625   if (data & 0x40) input_mux = 1;
626626   if (data & 0x80) input_mux = 0;
r14896r14897
641641   AM_RANGE(0x0000, 0x6fff) AM_ROM
642642   AM_RANGE(0x7000, 0x77ff) AM_MIRROR(0x0800) AM_RAM AM_SHARE("nvram")
643643   AM_RANGE(0xf000, 0xf1ff) AM_MIRROR(0x0200) AM_RAM AM_SHARE("spriteram")
644   AM_RANGE(0xf400, 0xf41f) AM_MIRROR(0x03e0) AM_WRITE(paletteram_xxxxRRRRBBBBGGGG_split1_w) AM_SHARE("paletteram")
645   AM_RANGE(0xf800, 0xf81f) AM_MIRROR(0x03e0) AM_WRITE(paletteram_xxxxRRRRBBBBGGGG_split2_w) AM_SHARE("paletteram2")
644   AM_RANGE(0xf400, 0xf41f) AM_MIRROR(0x03e0) AM_WRITE(paletteram_xxxxRRRRBBBBGGGG_byte_split_lo_w) AM_SHARE("paletteram")
645   AM_RANGE(0xf800, 0xf81f) AM_MIRROR(0x03e0) AM_WRITE(paletteram_xxxxRRRRBBBBGGGG_byte_split_hi_w) AM_SHARE("paletteram2")
646646   AM_RANGE(0xfc00, 0xffff) AM_RAM_WRITE(mcr_90009_videoram_w) AM_BASE(m_videoram)
647647ADDRESS_MAP_END
648648
r14896r14897
25842584   mcr_init(machine, 90009, 91399, 90908);
25852585   mcr_sound_init(machine, MCR_SSIO);
25862586
2587   ssio_set_custom_input(0, 0x1c, solarfox_ip0_r);
2588   ssio_set_custom_input(1, 0xff, solarfox_ip1_r);
2587   mcr_state *state = machine.driver_data<mcr_state>();
2588   ssio_set_custom_input(0, 0x1c, read8_delegate(FUNC(mcr_state::solarfox_ip0_r),state));
2589   ssio_set_custom_input(1, 0xff, read8_delegate(FUNC(mcr_state::solarfox_ip1_r),state));
25892590
25902591   mcr12_sprite_xoffs = 16;
25912592}
r14896r14897
25962597   mcr_init(machine, 90009, 91399, 90908);
25972598   mcr_sound_init(machine, MCR_SSIO);
25982599
2599   ssio_set_custom_input(1, 0xf0, kick_ip1_r);
2600   mcr_state *state = machine.driver_data<mcr_state>();
2601   ssio_set_custom_input(1, 0xf0, read8_delegate(FUNC(mcr_state::kick_ip1_r),state));
26002602
26012603   mcr12_sprite_xoffs_flip = 16;
26022604}
r14896r14897
26142616   mcr_init(machine, 90010, 91399, 90913);
26152617   mcr_sound_init(machine, MCR_SSIO);
26162618
2617   ssio_set_custom_input(1, 0xff, wacko_ip1_r);
2618   ssio_set_custom_input(2, 0xff, wacko_ip2_r);
2619   ssio_set_custom_output(4, 0x01, wacko_op4_w);
2619   mcr_state *state = machine.driver_data<mcr_state>();
2620   ssio_set_custom_input(1, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip1_r),state));
2621   ssio_set_custom_input(2, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip2_r),state));
2622   ssio_set_custom_output(4, 0x01, write8_delegate(FUNC(mcr_state::wacko_op4_w),state));
26202623}
26212624
26222625
r14896r14897
26252628   mcr_init(machine, 90010, 91399, 90913);
26262629   mcr_sound_init(machine, MCR_SSIO);
26272630
2628   ssio_set_custom_output(4, 0xff, twotiger_op4_w);
26292631   mcr_state *state = machine.driver_data<mcr_state>();
2632   ssio_set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::twotiger_op4_w),state));
26302633   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xe800, 0xefff, 0, 0x1000, read8_delegate(FUNC(mcr_state::twotiger_videoram_r),state), write8_delegate(FUNC(mcr_state::twotiger_videoram_w),state));
26312634}
26322635
r14896r14897
26362639   mcr_init(machine, 90010, 91399, 91483);
26372640   mcr_sound_init(machine, MCR_SSIO);
26382641
2639   ssio_set_custom_input(1, 0x47, kroozr_ip1_r);
2640   ssio_set_custom_output(4, 0x34, kroozr_op4_w);
2642   mcr_state *state = machine.driver_data<mcr_state>();
2643   ssio_set_custom_input(1, 0x47, read8_delegate(FUNC(mcr_state::kroozr_ip1_r),state));
2644   ssio_set_custom_output(4, 0x34, write8_delegate(FUNC(mcr_state::kroozr_op4_w),state));
26412645}
26422646
26432647
r14896r14897
26462650   mcr_init(machine, 91475, 91464, 90913);
26472651   mcr_sound_init(machine, MCR_SSIO);
26482652
2649   ssio_set_custom_output(4, 0x01, journey_op4_w);
2653   mcr_state *state = machine.driver_data<mcr_state>();
2654   ssio_set_custom_output(4, 0x01, write8_delegate(FUNC(mcr_state::journey_op4_w),state));
26502655}
26512656
26522657
r14896r14897
26622667   mcr_init(machine, 91490, 91464, 91657);
26632668   mcr_sound_init(machine, MCR_SSIO | MCR_SQUAWK_N_TALK);
26642669
2665   ssio_set_custom_output(4, 0xff, dotron_op4_w);
2670   mcr_state *state = machine.driver_data<mcr_state>();
2671   ssio_set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::dotron_op4_w),state));
26662672}
26672673
26682674
r14896r14897
26712677   mcr_init(machine, 91490, 91464, 91657);
26722678   mcr_sound_init(machine, MCR_SSIO | MCR_SQUAWK_N_TALK);
26732679
2674   ssio_set_custom_input(2, 0x80, nflfoot_ip2_r);
2675   ssio_set_custom_output(4, 0xff, nflfoot_op4_w);
2680   mcr_state *state = machine.driver_data<mcr_state>();
2681   ssio_set_custom_input(2, 0x80, read8_delegate(FUNC(mcr_state::nflfoot_ip2_r),state));
2682   ssio_set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::nflfoot_op4_w),state));
26762683
26772684   nflfoot_serial_out_active = FALSE;
26782685   nflfoot_serial_in_active = FALSE;
r14896r14897
26912698   mcr_init(machine, 91490, 91464, 90913);
26922699   mcr_sound_init(machine, MCR_SSIO | MCR_TURBO_CHIP_SQUEAK);
26932700
2694   ssio_set_custom_input(1, 0xfc, demoderb_ip1_r);
2695   ssio_set_custom_input(2, 0xfc, demoderb_ip2_r);
2696   ssio_set_custom_output(4, 0xff, demoderb_op4_w);
2701   mcr_state *state = machine.driver_data<mcr_state>();
2702   ssio_set_custom_input(1, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip1_r),state));
2703   ssio_set_custom_input(2, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip2_r),state));
2704   ssio_set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::demoderb_op4_w),state));
26972705
26982706   /* the SSIO Z80 doesn't have any program to execute */
26992707   machine.device<cpu_device>("tcscpu")->suspend(SUSPEND_REASON_DISABLE, 1);
src/mame/drivers/matmania.c
r14896r14897
4646
4747WRITE8_MEMBER(matmania_state::matmania_sh_command_w)
4848{
49   soundlatch_w(space, offset, data);
49   soundlatch_byte_w(space, offset, data);
5050   device_set_input_line(m_audiocpu, M6502_IRQ_LINE, HOLD_LINE);
5151}
5252
5353WRITE8_MEMBER(matmania_state::maniach_sh_command_w)
5454{
55   soundlatch_w(space, offset, data);
55   soundlatch_byte_w(space, offset, data);
5656   device_set_input_line(m_audiocpu, M6809_IRQ_LINE, HOLD_LINE);
5757}
5858
r14896r14897
105105   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ay1", ay8910_data_address_w)
106106   AM_RANGE(0x2002, 0x2003) AM_DEVWRITE_LEGACY("ay2", ay8910_data_address_w)
107107   AM_RANGE(0x2004, 0x2004) AM_DEVWRITE_LEGACY("dac", dac_signed_w)
108   AM_RANGE(0x2007, 0x2007) AM_READ(soundlatch_r)
108   AM_RANGE(0x2007, 0x2007) AM_READ(soundlatch_byte_r)
109109   AM_RANGE(0x8000, 0xffff) AM_ROM
110110ADDRESS_MAP_END
111111
r14896r14897
113113   AM_RANGE(0x0000, 0x0fff) AM_RAM
114114   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ymsnd", ym3526_w)
115115   AM_RANGE(0x2002, 0x2002) AM_DEVWRITE_LEGACY("dac", dac_signed_w)
116   AM_RANGE(0x2004, 0x2004) AM_READ(soundlatch_r)
116   AM_RANGE(0x2004, 0x2004) AM_READ(soundlatch_byte_r)
117117   AM_RANGE(0x4000, 0xffff) AM_ROM
118118ADDRESS_MAP_END
119119
src/mame/drivers/clshroad.c
r14896r14897
2424
2525static MACHINE_RESET( clshroad )
2626{
27   flip_screen_set(machine, 0);
27   clshroad_state *state = machine.driver_data<clshroad_state>();
28   state->flip_screen_set(0);
2829}
2930
3031
src/mame/drivers/dcheese.c
r14896r14897
130130   if (ACCESSING_BITS_0_7)
131131   {
132132      input_port_write(machine(), "EEPROMOUT", data, 0xff);
133      ticket_dispenser_w(machine().device("ticket"), 0, (data & 1) << 7);
133      machine().device<ticket_dispenser_device>("ticket")->write(space, 0, (data & 1) << 7);
134134   }
135135}
136136
r14896r14897
143143      /* write the latch and set the IRQ */
144144      m_soundlatch_full = 1;
145145      device_set_input_line(m_audiocpu, 0, ASSERT_LINE);
146      soundlatch_w(space, 0, data & 0xff);
146      soundlatch_byte_w(space, 0, data & 0xff);
147147   }
148148}
149149
r14896r14897
161161   /* read the latch and clear the IRQ */
162162   m_soundlatch_full = 0;
163163   device_set_input_line(m_audiocpu, 0, CLEAR_LINE);
164   return soundlatch_r(space, 0);
164   return soundlatch_byte_r(space, 0);
165165}
166166
167167
r14896r14897
270270
271271   PORT_START("240000")
272272   PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* low 5 bits read as a unit */
273   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
273   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
274274   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* sound->main buffer status (0=empty) */
275275   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dcheese_state,sound_latch_state_r, NULL)
276276   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
r14896r14897
319319
320320   PORT_START("240000")
321321   PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* low 5 bits read as a unit */
322   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
322   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
323323   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* sound->main buffer status (0=empty) */
324324   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dcheese_state,sound_latch_state_r, NULL)
325325   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
r14896r14897
366366
367367   PORT_START("240000")
368368   PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* low 5 bits read as a unit */
369   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
369   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
370370   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* sound->main buffer status (0=empty) */
371371   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dcheese_state,sound_latch_state_r, NULL)
372372   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
r14896r14897
419419   MCFG_MACHINE_START(dcheese)
420420
421421   MCFG_EEPROM_93C46_ADD("eeprom")
422   MCFG_TICKET_DISPENSER_ADD("ticket", 200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
422   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
423423
424424   /* video hardware */
425425   MCFG_SCREEN_ADD("screen", RASTER)
src/mame/drivers/chqflag.c
r14896r14897
5050   if (data & 0x20)
5151   {
5252      space.install_read_bank(0x1800, 0x1fff, "bank5");
53      space.install_write_handler(0x1800, 0x1fff, write8_delegate(FUNC(driver_device::paletteram_xBBBBBGGGGGRRRRR_be_w),this));
53      space.install_write_handler(0x1800, 0x1fff, write8_delegate(FUNC(driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_be_w),this));
5454      memory_set_bankptr(machine(), "bank5", m_generic_paletteram_8);
5555
5656      if (m_k051316_readroms)
r14896r14897
131131
132132WRITE8_MEMBER(chqflag_state::chqflag_sh_irqtrigger_w)
133133{
134   soundlatch2_w(space, 0, data);
134   soundlatch2_byte_w(space, 0, data);
135135   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
136136}
137137
r14896r14897
145145   AM_RANGE(0x2000, 0x2007) AM_DEVREADWRITE_LEGACY("k051960", k051937_r, k051937_w)               /* Sprite control registers */
146146   AM_RANGE(0x2400, 0x27ff) AM_DEVREADWRITE_LEGACY("k051960", k051960_r, k051960_w)               /* Sprite RAM */
147147   AM_RANGE(0x2800, 0x2fff) AM_READ_BANK("bank3") AM_DEVWRITE_LEGACY("k051316_2", k051316_w)      /* 051316 zoom/rotation (chip 2) */
148   AM_RANGE(0x3000, 0x3000) AM_WRITE(soundlatch_w)                        /* sound code # */
148   AM_RANGE(0x3000, 0x3000) AM_WRITE(soundlatch_byte_w)                        /* sound code # */
149149   AM_RANGE(0x3001, 0x3001) AM_WRITE(chqflag_sh_irqtrigger_w)               /* cause interrupt on audio CPU */
150150   AM_RANGE(0x3002, 0x3002) AM_WRITE(chqflag_bankswitch_w)                  /* bankswitch control */
151151   AM_RANGE(0x3003, 0x3003) AM_WRITE(chqflag_vreg_w)                     /* enable K051316 ROM reading */
r14896r14897
187187   AM_RANGE(0xa01c, 0xa01c) AM_DEVWRITE_LEGACY("k007232_2", k007232_extvolume_w)   /* extra volume, goes to the 007232 w/ A11 */
188188   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232_2", k007232_r, k007232_w)   /* 007232 (chip 2) */
189189   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)   /* YM2151 */
190   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)         /* soundlatch_r */
191   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch2_r)         /* engine sound volume */
190   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r)         /* soundlatch_byte_r */
191   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch2_byte_r)         /* engine sound volume */
192192   AM_RANGE(0xf000, 0xf000) AM_WRITENOP               /* ??? */
193193ADDRESS_MAP_END
194194
src/mame/drivers/lsasquad.c
r14896r14897
160160   /* bit 3 is zeroed on startup, maybe reset sound CPU */
161161
162162   /* bit 4 flips screen */
163   flip_screen_set(machine(), data & 0x10);
163   flip_screen_set(data & 0x10);
164164
165165   /* other bits unknown */
166166}
src/mame/drivers/sengokmj.c
r14896r14897
121121   AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE_LEGACY(seibucrtc_sc1vram_w) AM_BASE_LEGACY(&seibucrtc_sc1vram)
122122   AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE_LEGACY(seibucrtc_sc2vram_w) AM_BASE_LEGACY(&seibucrtc_sc2vram)
123123   AM_RANGE(0x0d800, 0x0e7ff) AM_RAM_WRITE_LEGACY(seibucrtc_sc3vram_w) AM_BASE_LEGACY(&seibucrtc_sc3vram)
124   AM_RANGE(0x0e800, 0x0f7ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
124   AM_RANGE(0x0e800, 0x0f7ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
125125   AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_SHARE("spriteram")
126126   AM_RANGE(0xc0000, 0xfffff) AM_ROM
127127ADDRESS_MAP_END
src/mame/drivers/dooyong.c
r14896r14897
9898
9999WRITE8_MEMBER(dooyong_state::flip_screen_w)
100100{
101   flip_screen_set(machine(), data);
101   flip_screen_set(data);
102102}
103103
104104static MACHINE_RESET( sound_ym2203 )
r14896r14897
125125   AM_RANGE(0xc011, 0xc011) AM_READ_PORT("P1")
126126   AM_RANGE(0xc011, 0xc011) AM_WRITE(lastday_bankswitch_w)
127127   AM_RANGE(0xc012, 0xc012) AM_READ_PORT("P2")
128   AM_RANGE(0xc012, 0xc012) AM_WRITE(soundlatch_w)
128   AM_RANGE(0xc012, 0xc012) AM_WRITE(soundlatch_byte_w)
129129   AM_RANGE(0xc013, 0xc013) AM_READ_PORT("DSWA")
130130   AM_RANGE(0xc014, 0xc014) AM_READ_PORT("DSWB")
131   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_SHARE("paletteram")
131   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
132132   AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_BASE(m_txvideoram)
133133   AM_RANGE(0xe000, 0xefff) AM_RAM
134134   AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("spriteram")
r14896r14897
146146   AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P2")
147147   AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM")
148148   AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w)   /* coin counter, flip screen */
149   AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_w)
149   AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w)
150150   AM_RANGE(0xf018, 0xf01f) AM_WRITE(dooyong_bgscroll8_w)
151151   AM_RANGE(0xf020, 0xf027) AM_WRITE(dooyong_fgscroll8_w)
152   AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
152   AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
153153ADDRESS_MAP_END
154154
155155static ADDRESS_MAP_START( gulfstrm_map, AS_PROGRAM, 8, dooyong_state )
r14896r14897
165165   AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P1")
166166   AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM")
167167   AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w)   /* coin counter, flip screen */
168   AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_w)
168   AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w)
169169   AM_RANGE(0xf018, 0xf01f) AM_WRITE(dooyong_bgscroll8_w)
170170   AM_RANGE(0xf020, 0xf027) AM_WRITE(dooyong_fgscroll8_w)
171   AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
171   AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
172172ADDRESS_MAP_END
173173
174174static ADDRESS_MAP_START( bluehawk_map, AS_PROGRAM, 8, dooyong_state )
r14896r14897
181181   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("P2")
182182   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("SYSTEM")
183183   AM_RANGE(0xc008, 0xc008) AM_WRITE(lastday_bankswitch_w)
184   AM_RANGE(0xc010, 0xc010) AM_WRITE(soundlatch_w)
184   AM_RANGE(0xc010, 0xc010) AM_WRITE(soundlatch_byte_w)
185185   AM_RANGE(0xc018, 0xc01f) AM_WRITE(dooyong_fg2scroll8_w)
186186   AM_RANGE(0xc040, 0xc047) AM_WRITE(dooyong_bgscroll8_w)
187187   AM_RANGE(0xc048, 0xc04f) AM_WRITE(dooyong_fgscroll8_w)
188   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
188   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
189189   AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_BASE(m_txvideoram)
190190   AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("spriteram")
191191   AM_RANGE(0xf000, 0xffff) AM_RAM
r14896r14897
203203   AM_RANGE(0xe006, 0xe006) AM_READ_PORT("DSWA")
204204   AM_RANGE(0xe008, 0xe008) AM_READ_PORT("DSWB")
205205   AM_RANGE(0xe010, 0xe010) AM_WRITE(flytiger_ctrl_w)   /* coin counter, flip screen */
206   AM_RANGE(0xe020, 0xe020) AM_WRITE(soundlatch_w)
206   AM_RANGE(0xe020, 0xe020) AM_WRITE(soundlatch_byte_w)
207207   AM_RANGE(0xe030, 0xe037) AM_WRITE(dooyong_bgscroll8_w)
208208   AM_RANGE(0xe040, 0xe047) AM_WRITE(dooyong_fgscroll8_w)
209209   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_flytiger_w) AM_BASE(m_paletteram_flytiger)
r14896r14897
216216   AM_RANGE(0xc000, 0xcfff) AM_RAM
217217   AM_RANGE(0xd000, 0xd3ff) AM_RAM /* what is this? looks like a palette? scratchpad RAM maybe? */
218218   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_BASE(m_txvideoram)
219   AM_RANGE(0xf000, 0xf7ff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
219   AM_RANGE(0xf000, 0xf7ff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
220220   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("DSWA")
221221   AM_RANGE(0xf800, 0xf800) AM_WRITE(primella_ctrl_w)   /* bank switch, flip screen etc */
222222   AM_RANGE(0xf810, 0xf810) AM_READ_PORT("DSWB")
223   AM_RANGE(0xf810, 0xf810) AM_WRITE(soundlatch_w)
223   AM_RANGE(0xf810, 0xf810) AM_WRITE(soundlatch_byte_w)
224224   AM_RANGE(0xf820, 0xf820) AM_READ_PORT("P1")
225225   AM_RANGE(0xf830, 0xf830) AM_READ_PORT("P2")
226226   AM_RANGE(0xf840, 0xf840) AM_READ_PORT("SYSTEM")
r14896r14897
239239   AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM")
240240   AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE(dooyong_bgscroll16_w)
241241   AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(dooyong_bg2scroll16_w)
242   AM_RANGE(0x0c8000, 0x0c8fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
242   AM_RANGE(0x0c8000, 0x0c8fff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
243243   AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w)
244244   AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(rshark_ctrl_w)   /* flip screen + unknown stuff */
245245   AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE(dooyong_fgscroll16_w)
r14896r14897
257257   AM_RANGE(0x080006, 0x080007) AM_READ_PORT("SYSTEM")
258258   AM_RANGE(0x084000, 0x08400f) AM_WRITE(dooyong_bgscroll16_w)
259259   AM_RANGE(0x084010, 0x08401f) AM_WRITE(dooyong_bg2scroll16_w)
260   AM_RANGE(0x088000, 0x088fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
260   AM_RANGE(0x088000, 0x088fff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
261261   AM_RANGE(0x080012, 0x080013) AM_WRITE(soundlatch_word_w)
262262   AM_RANGE(0x080014, 0x080015) AM_WRITE(rshark_ctrl_w)   /* flip screen + unknown stuff */
263263   AM_RANGE(0x08c000, 0x08c00f) AM_WRITE(dooyong_fgscroll16_w)
r14896r14897
278278   AM_RANGE(0x0c0018, 0x0c001b) AM_WRITENOP // ?
279279   AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE(dooyong_bgscroll16_w)
280280   AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(dooyong_bg2scroll16_w) // not used atm
281   AM_RANGE(0x0c8000, 0x0c8fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
281   AM_RANGE(0x0c8000, 0x0c8fff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
282282   AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE(dooyong_fgscroll16_w) // not used atm
283283   AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE(dooyong_fg2scroll16_w) // not used atm
284284   AM_RANGE(0x0dc000, 0x0dc01f) AM_RAM // registers of some kind?
r14896r14897
287287static ADDRESS_MAP_START( lastday_sound_map, AS_PROGRAM, 8, dooyong_state )
288288   AM_RANGE(0x0000, 0x7fff) AM_ROM
289289   AM_RANGE(0xc000, 0xc7ff) AM_RAM
290   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
290   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r)
291291   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
292292   AM_RANGE(0xf002, 0xf003) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r, ym2203_w)
293293ADDRESS_MAP_END
r14896r14897
295295static ADDRESS_MAP_START( pollux_sound_map, AS_PROGRAM, 8, dooyong_state )
296296   AM_RANGE(0x0000, 0xefff) AM_ROM
297297   AM_RANGE(0xf000, 0xf7ff) AM_RAM
298   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
298   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
299299   AM_RANGE(0xf802, 0xf803) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
300300   AM_RANGE(0xf804, 0xf805) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r, ym2203_w)
301301ADDRESS_MAP_END
r14896r14897
303303static ADDRESS_MAP_START( bluehawk_sound_map, AS_PROGRAM, 8, dooyong_state )
304304   AM_RANGE(0x0000, 0xefff) AM_ROM
305305   AM_RANGE(0xf000, 0xf7ff) AM_RAM
306   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
306   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
307307   AM_RANGE(0xf808, 0xf809) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
308308   AM_RANGE(0xf80a, 0xf80a) AM_DEVREADWRITE("oki", okim6295_device, read, write)
309309ADDRESS_MAP_END
src/mame/drivers/brkthru.c
r14896r14897
9292
9393WRITE8_MEMBER(brkthru_state::brkthru_soundlatch_w)
9494{
95   soundlatch_w(space, offset, data);
95   soundlatch_byte_w(space, offset, data);
9696   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
9797}
9898
r14896r14897
151151static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, brkthru_state )
152152   AM_RANGE(0x0000, 0x1fff) AM_RAM
153153   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
154   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r)
154   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r)
155155   AM_RANGE(0x6000, 0x6001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
156156   AM_RANGE(0x8000, 0xffff) AM_ROM
157157ADDRESS_MAP_END
src/mame/drivers/rbmk.c
r14896r14897
6161{
6262public:
6363   rbmk_state(const machine_config &mconfig, device_type type, const char *tag)
64      : driver_device(mconfig, type, tag) { }
64      : driver_device(mconfig, type, tag) ,
65      m_gms_vidram2(*this, "gms_vidram2"),
66      m_gms_vidram(*this, "gms_vidram"){ }
6567
66   UINT16 *m_gms_vidram;
67   UINT16 *m_gms_vidram2;
68   required_shared_ptr<UINT16> m_gms_vidram2;
69   required_shared_ptr<UINT16> m_gms_vidram;
6870   UINT16 m_tilebank;
6971   UINT8 m_mux_data;
7072   DECLARE_READ16_MEMBER(gms_read);
r14896r14897
114116   AM_RANGE(0x000000, 0x07ffff) AM_ROM
115117   AM_RANGE(0x100000, 0x10ffff) AM_RAM
116118   AM_RANGE(0x500000, 0x50ffff) AM_RAM
117   AM_RANGE(0x940000, 0x940fff) AM_RAM AM_BASE(m_gms_vidram2)
119   AM_RANGE(0x940000, 0x940fff) AM_RAM AM_SHARE("gms_vidram2")
118120   AM_RANGE(0x980300, 0x983fff) AM_RAM // 0x2048  words ???, byte access
119   AM_RANGE(0x900000, 0x900fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
120   AM_RANGE(0x9c0000, 0x9c0fff) AM_RAM AM_BASE(m_gms_vidram)
121   AM_RANGE(0x900000, 0x900fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
122   AM_RANGE(0x9c0000, 0x9c0fff) AM_RAM AM_SHARE("gms_vidram")
121123   AM_RANGE(0xb00000, 0xb00001) AM_DEVWRITE_LEGACY("eeprom", eeprom_w)
122124   AM_RANGE(0xC00000, 0xC00001) AM_READ_PORT("IN0") AM_WRITE(gms_write1)
123125   AM_RANGE(0xC08000, 0xC08001) AM_READ_PORT("IN1") AM_WRITE(gms_write2)
r14896r14897
502504   {
503505      for (x=0;x<64;x++)
504506      {
505         int tile = state->m_gms_vidram2[count+0x600];
507         int tile = state->m_gms_vidram2.target()[count+0x600];
506508         drawgfx_opaque(bitmap,cliprect,screen.machine().gfx[0],(tile&0xfff)+((state->m_tilebank&0x10)>>4)*0x1000,tile>>12,0,0,x*8,y*32);
507509         count++;
508510      }
r14896r14897
514516   {
515517      for (x=0;x<64;x++)
516518      {
517         int tile = state->m_gms_vidram[count];
519         int tile = state->m_gms_vidram.target()[count];
518520         drawgfx_transpen(bitmap,cliprect,screen.machine().gfx[1],(tile&0xfff)+((state->m_tilebank>>1)&3)*0x1000,tile>>12,0,0,x*8,y*8,0);
519521         count++;
520522      }
src/mame/drivers/thepit.c
r14896r14897
158158   AM_RANGE(0x8800, 0x8bff) AM_MIRROR(0x0400) AM_RAM_WRITE(thepit_colorram_w) AM_BASE(m_colorram)
159159   AM_RANGE(0x9000, 0x93ff) AM_MIRROR(0x0400) AM_RAM_WRITE(thepit_videoram_w) AM_BASE(m_videoram)
160160   AM_RANGE(0x9800, 0x983f) AM_MIRROR(0x0700) AM_RAM AM_BASE(m_attributesram)
161   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
161   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
162162   AM_RANGE(0x9860, 0x98ff) AM_RAM
163163   AM_RANGE(0xa000, 0xa000) AM_READ(thepit_input_port_0_r) AM_WRITENOP // Not hooked up according to the schematics
164164   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN1")
r14896r14897
169169   AM_RANGE(0xb004, 0xb005) AM_WRITENOP // Unused, but initialized
170170   AM_RANGE(0xb006, 0xb006) AM_WRITE(thepit_flip_screen_x_w)
171171   AM_RANGE(0xb007, 0xb007) AM_WRITE(thepit_flip_screen_y_w)
172   AM_RANGE(0xb800, 0xb800) AM_READWRITE(watchdog_reset_r, soundlatch_w)
172   AM_RANGE(0xb800, 0xb800) AM_READWRITE(watchdog_reset_r, soundlatch_byte_w)
173173ADDRESS_MAP_END
174174
175175static ADDRESS_MAP_START( intrepid_main_map, AS_PROGRAM, 8, thepit_state )
r14896r14897
179179   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(thepit_videoram_w) AM_BASE(m_videoram)
180180   AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(thepit_colorram_w) AM_BASE(m_colorram)
181181   AM_RANGE(0x9800, 0x983f) AM_MIRROR(0x0700) AM_RAM AM_BASE(m_attributesram)
182   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
182   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
183183   AM_RANGE(0x9860, 0x98ff) AM_RAM
184184   AM_RANGE(0xa000, 0xa000) AM_READ(thepit_input_port_0_r)
185185   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN1")
r14896r14897
191191   AM_RANGE(0xb005, 0xb005) AM_WRITE(intrepid_graphics_bank_w)
192192   AM_RANGE(0xb006, 0xb006) AM_WRITE(thepit_flip_screen_x_w)
193193   AM_RANGE(0xb007, 0xb007) AM_WRITE(thepit_flip_screen_y_w)
194   AM_RANGE(0xb800, 0xb800) AM_READWRITE(watchdog_reset_r, soundlatch_w)
194   AM_RANGE(0xb800, 0xb800) AM_READWRITE(watchdog_reset_r, soundlatch_byte_w)
195195ADDRESS_MAP_END
196196
197197
r14896r14897
203203
204204static ADDRESS_MAP_START( audio_io_map, AS_IO, 8, thepit_state )
205205   ADDRESS_MAP_GLOBAL_MASK(0xff)
206   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_w)
206   AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_byte_w)
207207   AM_RANGE(0x8c, 0x8d) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
208208   AM_RANGE(0x8d, 0x8d) AM_DEVREAD_LEGACY("ay2", ay8910_r)
209209   AM_RANGE(0x8e, 0x8f) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
r14896r14897
629629{
630630   AY8910_LEGACY_OUTPUT,
631631   AY8910_DEFAULT_LOADS,
632   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
632   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
633633   DEVCB_NULL,
634634   DEVCB_NULL,
635635   DEVCB_NULL
src/mame/drivers/trvmadns.c
r14896r14897
6969{
7070public:
7171   trvmadns_state(const machine_config &mconfig, device_type type, const char *tag)
72      : driver_device(mconfig, type, tag) { }
72      : driver_device(mconfig, type, tag) ,
73      m_gfxram(*this, "gfxram"),
74      m_tileram(*this, "tileram"){ }
7375
7476   tilemap_t *m_bg_tilemap;
75   UINT8 *m_gfxram;
76   UINT8 *m_tileram;
77   required_shared_ptr<UINT8> m_gfxram;
78   required_shared_ptr<UINT8> m_tileram;
7779   int m_old_data;
7880   DECLARE_WRITE8_MEMBER(trvmadns_banking_w);
7981   DECLARE_WRITE8_MEMBER(trvmadns_gfxram_w);
r14896r14897
158160
159161WRITE8_MEMBER(trvmadns_state::trvmadns_gfxram_w)
160162{
161   m_gfxram[offset] = data;
163   m_gfxram.target()[offset] = data;
162164   gfx_element_mark_dirty(machine().gfx[0], offset/16);
163165}
164166
r14896r14897
206208
207209   }
208210
209   m_tileram[offset] = data;
211   m_tileram.target()[offset] = data;
210212   m_bg_tilemap->mark_tile_dirty(offset >> 1);
211213}
212214
r14896r14897
215217   AM_RANGE(0x0000, 0x5fff) AM_ROM
216218   AM_RANGE(0x6000, 0x6fff) AM_ROMBANK("bank1")
217219   AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("bank2")
218   AM_RANGE(0x6000, 0x7fff) AM_WRITE(trvmadns_gfxram_w) AM_BASE(m_gfxram)
220   AM_RANGE(0x6000, 0x7fff) AM_WRITE(trvmadns_gfxram_w) AM_SHARE("gfxram")
219221   AM_RANGE(0x8000, 0x87ff) AM_RAM
220   AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(trvmadns_tileram_w) AM_BASE(m_tileram)
222   AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(trvmadns_tileram_w) AM_SHARE("tileram")
221223   AM_RANGE(0xc000, 0xc01f) AM_RAM_WRITE(trvmadns_palette_w) AM_SHARE("paletteram")
222224   AM_RANGE(0xe000, 0xe000) AM_WRITE(w2)//NOP
223225   AM_RANGE(0xe004, 0xe004) AM_WRITE(w3)//NOP
r14896r14897
262264   trvmadns_state *state = machine.driver_data<trvmadns_state>();
263265   int tile,attr,color,flag;
264266
265   attr = state->m_tileram[tile_index*2 + 0];
266   tile = state->m_tileram[tile_index*2 + 1] + ((attr & 0x01) << 8);
267   attr = state->m_tileram.target()[tile_index*2 + 0];
268   tile = state->m_tileram.target()[tile_index*2 + 1] + ((attr & 0x01) << 8);
267269   color = (attr & 0x18) >> 3;
268270   flag = TILE_FLIPXY((attr & 0x06) >> 1);
269271
r14896r14897
285287
286288//  fg_tilemap->set_transparent_pen(1);
287289
288   gfx_element_set_source(machine.gfx[0], state->m_gfxram);
290   gfx_element_set_source(machine.gfx[0], state->m_gfxram.target());
289291}
290292
291293static SCREEN_UPDATE_IND16( trvmadns )
r14896r14897
302304   {
303305      for (x=0;x<32;x++)
304306      {
305         int attr = state->m_tileram[count*2+0];
306         int tile = state->m_tileram[count*2+1] | ((attr & 0x01) << 8);
307         int attr = state->m_tileram.target()[count*2+0];
308         int tile = state->m_tileram.target()[count*2+1] | ((attr & 0x01) << 8);
307309         int color = (attr & 0x18) >> 3;
308310         int flipx = attr & 4;
309311         int flipy = attr & 2;
r14896r14897
320322   {
321323      for (x=0;x<32;x++)
322324      {
323         int attr = state->m_tileram[count*2+0];
324         int tile = state->m_tileram[count*2+1] | ((attr & 0x01) << 8);
325         int attr = state->m_tileram.target()[count*2+0];
326         int tile = state->m_tileram.target()[count*2+1] | ((attr & 0x01) << 8);
325327         int color = (attr & 0x18) >> 3;
326328         int flipx = attr & 4;
327329         int flipy = attr & 2;
src/mame/drivers/rpunch.c
r14896r14897
224224static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, rpunch_state )
225225   ADDRESS_MAP_GLOBAL_MASK(0xfffff)
226226   AM_RANGE(0x000000, 0x03ffff) AM_ROM
227   AM_RANGE(0x040000, 0x04ffff) AM_RAM AM_BASE(m_bitmapram) AM_SIZE(m_bitmapram_size)
227   AM_RANGE(0x040000, 0x04ffff) AM_RAM AM_BASE_SIZE(m_bitmapram,m_bitmapram_size)
228228   AM_RANGE(0x060000, 0x060fff) AM_RAM AM_BASE(m_spriteram)
229229   AM_RANGE(0x080000, 0x083fff) AM_RAM_WRITE(rpunch_videoram_w) AM_BASE(m_videoram)
230   AM_RANGE(0x0a0000, 0x0a07ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
230   AM_RANGE(0x0a0000, 0x0a07ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
231231   AM_RANGE(0x0c0000, 0x0c0007) AM_WRITE(rpunch_scrollreg_w)
232232   AM_RANGE(0x0c0008, 0x0c0009) AM_WRITE(rpunch_crtc_data_w)
233233   AM_RANGE(0x0c000c, 0x0c000d) AM_WRITE(rpunch_videoreg_w)
src/mame/drivers/albazg.c
r14896r14897
4545{
4646public:
4747   albazg_state(const machine_config &mconfig, device_type type, const char *tag)
48      : driver_device(mconfig, type, tag) { }
48      : driver_device(mconfig, type, tag) ,
49      m_cus_ram(*this, "cus_ram"),
50      m_videoram(*this, "videoram"),
51      m_colorram(*this, "colorram"){ }
4952
5053   /* memory pointers */
51   UINT8 *  m_cus_ram;
52   UINT8 *  m_videoram;
53   UINT8 *  m_colorram;
54   required_shared_ptr<UINT8> m_cus_ram;
55   required_shared_ptr<UINT8> m_videoram;
56   required_shared_ptr<UINT8> m_colorram;
5457//  UINT8 *  m_paletteram;    // currently this uses generic palette handling
5558//  UINT8 *  m_paletteram_2;  // currently this uses generic palette handling
5659
r14896r14897
7174static TILE_GET_INFO( y_get_bg_tile_info )
7275{
7376   albazg_state *state = machine.driver_data<albazg_state>();
74   int code = state->m_videoram[tile_index];
75   int color = state->m_colorram[tile_index];
77   int code = state->m_videoram.target()[tile_index];
78   int color = state->m_colorram.target()[tile_index];
7679
7780   SET_TILE_INFO(
7881         0,
r14896r14897
115118
116119WRITE8_MEMBER(albazg_state::yumefuda_vram_w)
117120{
118   m_videoram[offset] = data;
121   m_videoram.target()[offset] = data;
119122   m_bg_tilemap->mark_tile_dirty(offset);
120123}
121124
122125WRITE8_MEMBER(albazg_state::yumefuda_cram_w)
123126{
124   m_colorram[offset] = data;
127   m_colorram.target()[offset] = data;
125128   m_bg_tilemap->mark_tile_dirty(offset);
126129}
127130
r14896r14897
129132READ8_MEMBER(albazg_state::custom_ram_r)
130133{
131134//  logerror("Custom RAM read at %02x PC = %x\n", offset + 0xaf80, cpu_get_pc(&space.device()));
132   return m_cus_ram[offset];// ^ 0x55;
135   return m_cus_ram.target()[offset];// ^ 0x55;
133136}
134137
135138WRITE8_MEMBER(albazg_state::custom_ram_w)
136139{
137140//  logerror("Custom RAM write at %02x : %02x PC = %x\n", offset + 0xaf80, data, cpu_get_pc(&space.device()));
138141   if(m_prot_lock)
139      m_cus_ram[offset] = data;
142      m_cus_ram.target()[offset] = data;
140143}
141144
142145/*this might be used as NVRAM commands btw*/
r14896r14897
183186
184187static WRITE8_DEVICE_HANDLER( yumefuda_output_w )
185188{
189   albazg_state *state = device->machine().driver_data<albazg_state>();
186190   coin_counter_w(device->machine(), 0, ~data & 4);
187191   coin_counter_w(device->machine(), 1, ~data & 2);
188192   coin_lockout_global_w(device->machine(), data & 1);
189193   //data & 0x10 hopper-c (active LOW)
190194   //data & 0x08 divider (active HIGH)
191   flip_screen_set(device->machine(), ~data & 0x20);
195   state->flip_screen_set(~data & 0x20);
192196}
193197
194198static const ay8910_interface ay8910_config =
r14896r14897
232236   AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1")
233237   AM_RANGE(0xa7fc, 0xa7fc) AM_WRITE(prot_lock_w)
234238   AM_RANGE(0xa7ff, 0xa7ff) AM_WRITE_PORT("EEPROMOUT")
235   AM_RANGE(0xaf80, 0xafff) AM_READWRITE(custom_ram_r, custom_ram_w) AM_BASE(m_cus_ram)
236   AM_RANGE(0xb000, 0xb07f) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_split1_w) AM_SHARE("paletteram")
237   AM_RANGE(0xb080, 0xb0ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_split2_w) AM_SHARE("paletteram2")
238   AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(yumefuda_vram_w) AM_BASE(m_videoram)
239   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(yumefuda_cram_w) AM_BASE(m_colorram)
239   AM_RANGE(0xaf80, 0xafff) AM_READWRITE(custom_ram_r, custom_ram_w) AM_SHARE("cus_ram")
240   AM_RANGE(0xb000, 0xb07f) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_split_lo_w) AM_SHARE("paletteram")
241   AM_RANGE(0xb080, 0xb0ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_split_hi_w) AM_SHARE("paletteram2")
242   AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(yumefuda_vram_w) AM_SHARE("videoram")
243   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(yumefuda_cram_w) AM_SHARE("colorram")
240244   AM_RANGE(0xe000, 0xffff) AM_RAM
241245ADDRESS_MAP_END
242246
src/mame/drivers/bingoc.c
r14896r14897
8989#else
9090WRITE16_MEMBER(bingoc_state::main_sound_latch_w)
9191{
92   soundlatch_w(space,0,data&0xff);
92   soundlatch_byte_w(space,0,data&0xff);
9393   cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
9494}
9595#endif
r14896r14897
127127   AM_RANGE(0x40, 0x40) AM_DEVWRITE_LEGACY("upd", bingoc_play_w)
128128   AM_RANGE(0x80, 0x80) AM_DEVWRITE_LEGACY("upd", upd7759_port_w)
129129#if !SOUND_TEST
130   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r) //soundlatch
130   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r) //soundlatch
131131#else
132132   AM_RANGE(0xc0, 0xc0) AM_READ(sound_test_r)
133133#endif
src/mame/drivers/sstrangr.c
r14896r14897
1717{
1818public:
1919   sstrangr_state(const machine_config &mconfig, device_type type, const char *tag)
20      : driver_device(mconfig, type, tag) { }
20      : driver_device(mconfig, type, tag) ,
21      m_ram(*this, "ram"){ }
2122
22   UINT8 *m_ram;
23   required_shared_ptr<UINT8> m_ram;
2324   UINT8 m_flip_screen;
2425   UINT8 *m_proms;
2526   DECLARE_WRITE8_MEMBER(port_w);
r14896r14897
4445
4546      UINT8 x = offs << 3;
4647      int y = offs >> 5;
47      UINT8 data = state->m_ram[offs];
48      UINT8 data = state->m_ram.target()[offs];
4849
4950      for (i = 0; i < 8; i++)
5051      {
r14896r14897
102103
103104      offs_t color_address = (offs >> 9 << 5) | (offs & 0x1f);
104105
105      UINT8 data = state->m_ram[offs];
106      UINT8 data = state->m_ram.target()[offs];
106107      UINT8 fore_color = color_map_base[color_address] & 0x07;
107108
108109      for (i = 0; i < 8; i++)
r14896r14897
141142static ADDRESS_MAP_START( sstrangr_map, AS_PROGRAM, 8, sstrangr_state )
142143   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
143144   AM_RANGE(0x0000, 0x1fff) AM_ROM
144   AM_RANGE(0x2000, 0x3fff) AM_RAM AM_BASE(m_ram)
145   AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("ram")
145146   AM_RANGE(0x6000, 0x63ff) AM_ROM
146147ADDRESS_MAP_END
147148
src/mame/drivers/backfire.c
r14896r14897
2525{
2626public:
2727   backfire_state(const machine_config &mconfig, device_type type, const char *tag)
28      : driver_device(mconfig, type, tag) { }
28      : driver_device(mconfig, type, tag) ,
29      m_mainram(*this, "mainram"),
30      m_left_priority(*this, "left_priority"),
31      m_right_priority(*this, "right_priority"){ }
2932
3033   /* memory pointers */
3134   UINT16 *  m_spriteram_1;
3235   UINT16 *  m_spriteram_2;
33   UINT32 *  m_mainram;
34   UINT32 *  m_left_priority;
35   UINT32 *  m_right_priority;
36   required_shared_ptr<UINT32> m_mainram;
37   required_shared_ptr<UINT32> m_left_priority;
38   required_shared_ptr<UINT32> m_right_priority;
3639
3740   /* video related */
3841   bitmap_ind16  *m_left;
r14896r14897
106109   backfire_state *state = screen.machine().driver_data<backfire_state>();
107110
108111   //FIXME: flip_screen_x should not be written!
109   flip_screen_set_no_update(screen.machine(), 1);
112   state->flip_screen_set_no_update(1);
110113
111114   /* screen 1 uses pf1 as the forground and pf3 as the background */
112115   /* screen 2 uses pf2 as the foreground and pf4 as the background */
r14896r14897
116119   screen.machine().priority_bitmap.fill(0);
117120   bitmap.fill(0x100, cliprect);
118121
119   if (state->m_left_priority[0] == 0)
122   if (state->m_left_priority.target()[0] == 0)
120123   {
121124      deco16ic_tilemap_1_draw(state->m_deco_tilegen2, bitmap, cliprect, 0, 1);
122125      deco16ic_tilemap_1_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 2);
123126      screen.machine().device<decospr_device>("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram_1, 0x800);
124127   }
125   else if (state->m_left_priority[0] == 2)
128   else if (state->m_left_priority.target()[0] == 2)
126129   {
127130      deco16ic_tilemap_1_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 2);
128131      deco16ic_tilemap_1_draw(state->m_deco_tilegen2, bitmap, cliprect, 0, 4);
129132      screen.machine().device<decospr_device>("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram_1, 0x800);
130133   }
131134   else
132      popmessage( "unknown left priority %08x", state->m_left_priority[0]);
135      popmessage( "unknown left priority %08x", state->m_left_priority.target()[0]);
133136
134137   return 0;
135138}
r14896r14897
139142   backfire_state *state = screen.machine().driver_data<backfire_state>();
140143
141144   //FIXME: flip_screen_x should not be written!
142   flip_screen_set_no_update(screen.machine(), 1);
145   state->flip_screen_set_no_update(1);
143146
144147   /* screen 1 uses pf1 as the forground and pf3 as the background */
145148   /* screen 2 uses pf2 as the foreground and pf4 as the background */
r14896r14897
149152   screen.machine().priority_bitmap.fill(0);
150153   bitmap.fill(0x500, cliprect);
151154
152   if (state->m_right_priority[0] == 0)
155   if (state->m_right_priority.target()[0] == 0)
153156   {
154157      deco16ic_tilemap_2_draw(state->m_deco_tilegen2, bitmap, cliprect, 0, 1);
155158      deco16ic_tilemap_2_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 2);
156159      screen.machine().device<decospr_device>("spritegen2")->draw_sprites(bitmap, cliprect, state->m_spriteram_2, 0x800);
157160   }
158   else if (state->m_right_priority[0] == 2)
161   else if (state->m_right_priority.target()[0] == 2)
159162   {
160163      deco16ic_tilemap_2_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 2);
161164      deco16ic_tilemap_2_draw(state->m_deco_tilegen2, bitmap, cliprect, 0, 4);
162165      screen.machine().device<decospr_device>("spritegen2")->draw_sprites(bitmap, cliprect, state->m_spriteram_2, 0x800);
163166   }
164167   else
165      popmessage( "unknown right priority %08x", state->m_right_priority[0]);
168      popmessage( "unknown right priority %08x", state->m_right_priority.target()[0]);
166169
167170   return 0;
168171}
r14896r14897
286289   AM_RANGE(0x150000, 0x150fff) AM_READWRITE(backfire_pf3_rowscroll_r, backfire_pf3_rowscroll_w)
287290   AM_RANGE(0x154000, 0x154fff) AM_READWRITE(backfire_pf4_rowscroll_r, backfire_pf4_rowscroll_w)
288291   AM_RANGE(0x160000, 0x161fff) AM_WRITE(backfire_nonbuffered_palette_w) AM_SHARE("paletteram")
289   AM_RANGE(0x170000, 0x177fff) AM_RAM AM_BASE(m_mainram)// main ram
292   AM_RANGE(0x170000, 0x177fff) AM_RAM AM_SHARE("mainram")// main ram
290293
291294//  AM_RANGE(0x180010, 0x180013) AM_RAM AM_BASE_LEGACY(&backfire_180010) // always 180010 ?
292295//  AM_RANGE(0x188010, 0x188013) AM_RAM AM_BASE_LEGACY(&backfire_188010) // always 188010 ?
r14896r14897
297300   AM_RANGE(0x194000, 0x194003) AM_READ(backfire_control2_r)
298301   AM_RANGE(0x1a4000, 0x1a4003) AM_DEVWRITE_LEGACY("eeprom", backfire_eeprom_w)
299302
300   AM_RANGE(0x1a8000, 0x1a8003) AM_RAM AM_BASE(m_left_priority)
301   AM_RANGE(0x1ac000, 0x1ac003) AM_RAM AM_BASE(m_right_priority)
303   AM_RANGE(0x1a8000, 0x1a8003) AM_RAM AM_SHARE("left_priority")
304   AM_RANGE(0x1ac000, 0x1ac003) AM_RAM AM_SHARE("right_priority")
302305//  AM_RANGE(0x1b0000, 0x1b0003) AM_WRITENOP // always 1b0000
303306
304307   /* when set to pentometer in test mode */
r14896r14897
696699   if (cpu_get_pc(&space.device() )== 0xce44)  device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfire
697700   if (cpu_get_pc(&space.device()) == 0xcee4)  device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfirea
698701
699   return m_mainram[0x18/4];
702   return m_mainram.target()[0x18/4];
700703}
701704
702705
src/mame/drivers/sidepckt.c
r14896r14897
133133
134134WRITE8_MEMBER(sidepckt_state::sound_cpu_command_w)
135135{
136   soundlatch_w(space, offset, data);
136   soundlatch_byte_w(space, offset, data);
137137   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
138138}
139139
r14896r14897
226226
227227static ADDRESS_MAP_START( sidepckt_map, AS_PROGRAM, 8, sidepckt_state )
228228   AM_RANGE(0x0000, 0x0fff) AM_RAM
229   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(sidepckt_videoram_w) AM_BASE(m_videoram) AM_SIZE(m_videoram_size)
229   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(sidepckt_videoram_w) AM_BASE_SIZE(m_videoram,m_videoram_size)
230230   AM_RANGE(0x1400, 0x17ff) AM_RAM // ???
231231   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(sidepckt_colorram_w) AM_BASE(m_colorram)
232232   AM_RANGE(0x1c00, 0x1fff) AM_RAM // ???
233   AM_RANGE(0x2000, 0x20ff) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
233   AM_RANGE(0x2000, 0x20ff) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
234234   AM_RANGE(0x2100, 0x24ff) AM_RAM // ???
235235   AM_RANGE(0x3000, 0x3000) AM_READ_PORT("P1")
236236   AM_RANGE(0x3001, 0x3001) AM_READ_PORT("P2")
r14896r14897
247247   AM_RANGE(0x0000, 0x0fff) AM_RAM
248248   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
249249   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
250   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
250   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
251251   AM_RANGE(0x8000, 0xffff) AM_ROM
252252ADDRESS_MAP_END
253253
src/mame/drivers/starwars.c
r14896r14897
160160   AM_RANGE(0x4340, 0x435f) AM_READ_PORT("DSW0")
161161   AM_RANGE(0x4360, 0x437f) AM_READ_PORT("DSW1")
162162   AM_RANGE(0x4380, 0x439f) AM_READ(starwars_adc_r)         /* a-d control result */
163   AM_RANGE(0x4400, 0x4400) AM_READWRITE_LEGACY(starwars_main_read_r, starwars_main_wr_w)
164   AM_RANGE(0x4401, 0x4401) AM_READ_LEGACY(starwars_main_ready_flag_r)
163   AM_RANGE(0x4400, 0x4400) AM_READWRITE(starwars_main_read_r, starwars_main_wr_w)
164   AM_RANGE(0x4401, 0x4401) AM_READ(starwars_main_ready_flag_r)
165165   AM_RANGE(0x4500, 0x45ff) AM_DEVREADWRITE("x2212", x2212_device, read, write)
166166   AM_RANGE(0x4600, 0x461f) AM_WRITE_LEGACY(avgdvg_go_w)
167167   AM_RANGE(0x4620, 0x463f) AM_WRITE_LEGACY(avgdvg_reset_w)
r14896r14897
170170   AM_RANGE(0x4680, 0x469f) AM_READNOP AM_WRITE(starwars_out_w)
171171   AM_RANGE(0x46a0, 0x46bf) AM_WRITE(starwars_nstore_w)
172172   AM_RANGE(0x46c0, 0x46c2) AM_WRITE(starwars_adc_select_w)
173   AM_RANGE(0x46e0, 0x46e0) AM_WRITE_LEGACY(starwars_soundrst_w)
173   AM_RANGE(0x46e0, 0x46e0) AM_WRITE(starwars_soundrst_w)
174174   AM_RANGE(0x4700, 0x4707) AM_WRITE(starwars_math_w)
175175   AM_RANGE(0x4700, 0x4700) AM_READ(starwars_div_reh_r)
176176   AM_RANGE(0x4701, 0x4701) AM_READ(starwars_div_rel_r)
r14896r14897
190190 *************************************/
191191
192192static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, starwars_state )
193   AM_RANGE(0x0000, 0x07ff) AM_WRITE_LEGACY(starwars_sout_w)
194   AM_RANGE(0x0800, 0x0fff) AM_READ_LEGACY(starwars_sin_r)      /* SIN Read */
193   AM_RANGE(0x0000, 0x07ff) AM_WRITE(starwars_sout_w)
194   AM_RANGE(0x0800, 0x0fff) AM_READ(starwars_sin_r)      /* SIN Read */
195195   AM_RANGE(0x1000, 0x107f) AM_RAM                     /* 6532 ram */
196196   AM_RANGE(0x1080, 0x109f) AM_DEVREADWRITE_LEGACY("riot", riot6532_r, riot6532_w)
197197   AM_RANGE(0x1800, 0x183f) AM_WRITE_LEGACY(quad_pokey_w)
src/mame/drivers/exerion.c
r14896r14897
200200   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("DSW0")
201201   AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW1")
202202   AM_RANGE(0xc000, 0xc000) AM_WRITE(exerion_videoreg_w)
203   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
203   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_byte_w)
204204   AM_RANGE(0xd000, 0xd001) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
205205   AM_RANGE(0xd800, 0xd801) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
206206   AM_RANGE(0xd802, 0xd802) AM_DEVREAD_LEGACY("ay2", ay8910_r)
r14896r14897
217217static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, exerion_state )
218218   AM_RANGE(0x0000, 0x1fff) AM_ROM
219219   AM_RANGE(0x4000, 0x47ff) AM_RAM
220   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
220   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
221221   AM_RANGE(0x8000, 0x800c) AM_WRITE(exerion_video_latch_w)
222222   AM_RANGE(0xa000, 0xa000) AM_READ(exerion_video_timing_r)
223223ADDRESS_MAP_END
src/mame/drivers/mosaic.c
r14896r14897
9292   AM_RANGE(0x20000, 0x21fff) AM_RAM
9393   AM_RANGE(0x22000, 0x22fff) AM_RAM_WRITE(mosaic_bgvideoram_w) AM_BASE(m_bgvideoram)
9494   AM_RANGE(0x23000, 0x23fff) AM_RAM_WRITE(mosaic_fgvideoram_w) AM_BASE(m_fgvideoram)
95   AM_RANGE(0x24000, 0x241ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
95   AM_RANGE(0x24000, 0x241ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
9696ADDRESS_MAP_END
9797
9898static ADDRESS_MAP_START( gfire2_map, AS_PROGRAM, 8, mosaic_state )
r14896r14897
100100   AM_RANGE(0x10000, 0x17fff) AM_RAM
101101   AM_RANGE(0x22000, 0x22fff) AM_RAM_WRITE(mosaic_bgvideoram_w) AM_BASE(m_bgvideoram)
102102   AM_RANGE(0x23000, 0x23fff) AM_RAM_WRITE(mosaic_fgvideoram_w) AM_BASE(m_fgvideoram)
103   AM_RANGE(0x24000, 0x241ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
103   AM_RANGE(0x24000, 0x241ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
104104ADDRESS_MAP_END
105105
106106static ADDRESS_MAP_START( mosaic_io_map, AS_IO, 8, mosaic_state )
src/mame/drivers/savquest.c
r14896r14897
7777
7878   // driver_device overrides
7979//  virtual void video_start();
80public:
81   DECLARE_READ8_MEMBER(at_page8_r);
82   DECLARE_WRITE8_MEMBER(at_page8_w);
83   DECLARE_READ8_MEMBER(pc_dma_read_byte);
84   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
8085};
8186
8287// Intel 82439TX System Controller (MXTC)
r14896r14897
258263   ide_controller32_w(device, 0x3f0/4 + offset, data, mem_mask);
259264}
260265
261static READ8_HANDLER(at_page8_r)
266READ8_MEMBER(savquest_state::at_page8_r)
262267{
263   savquest_state *state = space->machine().driver_data<savquest_state>();
264   UINT8 data = state->m_at_pages[offset % 0x10];
268   UINT8 data = m_at_pages[offset % 0x10];
265269
266270   switch(offset % 8) {
267271   case 1:
268      data = state->m_dma_offset[(offset / 8) & 1][2];
272      data = m_dma_offset[(offset / 8) & 1][2];
269273      break;
270274   case 2:
271      data = state->m_dma_offset[(offset / 8) & 1][3];
275      data = m_dma_offset[(offset / 8) & 1][3];
272276      break;
273277   case 3:
274      data = state->m_dma_offset[(offset / 8) & 1][1];
278      data = m_dma_offset[(offset / 8) & 1][1];
275279      break;
276280   case 7:
277      data = state->m_dma_offset[(offset / 8) & 1][0];
281      data = m_dma_offset[(offset / 8) & 1][0];
278282      break;
279283   }
280284   return data;
281285}
282286
283287
284static WRITE8_HANDLER(at_page8_w)
288WRITE8_MEMBER(savquest_state::at_page8_w)
285289{
286   savquest_state *state = space->machine().driver_data<savquest_state>();
287   state->m_at_pages[offset % 0x10] = data;
290   m_at_pages[offset % 0x10] = data;
288291
289292   switch(offset % 8) {
290293   case 1:
291      state->m_dma_offset[(offset / 8) & 1][2] = data;
294      m_dma_offset[(offset / 8) & 1][2] = data;
292295      break;
293296   case 2:
294      state->m_dma_offset[(offset / 8) & 1][3] = data;
297      m_dma_offset[(offset / 8) & 1][3] = data;
295298      break;
296299   case 3:
297      state->m_dma_offset[(offset / 8) & 1][1] = data;
300      m_dma_offset[(offset / 8) & 1][1] = data;
298301      break;
299302   case 7:
300      state->m_dma_offset[(offset / 8) & 1][0] = data;
303      m_dma_offset[(offset / 8) & 1][0] = data;
301304      break;
302305   }
303306}
304307
305static READ32_HANDLER(at_page32_r)
306{
307   return read32le_with_read8_handler(at_page8_r, space, offset, mem_mask);
308}
309308
310
311static WRITE32_HANDLER(at_page32_w)
312{
313   write32le_with_write8_handler(at_page8_w, space, offset, data, mem_mask);
314}
315
316309static READ8_DEVICE_HANDLER(at_dma8237_2_r)
317310{
318311   return i8237_r(device, offset / 2);
r14896r14897
345338}
346339
347340
348static READ8_HANDLER( pc_dma_read_byte )
341READ8_MEMBER(savquest_state::pc_dma_read_byte)
349342{
350   savquest_state *state = space->machine().driver_data<savquest_state>();
351   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
343   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
352344      & 0xFF0000;
353345
354   return space->read_byte(page_offset + offset);
346   return space.read_byte(page_offset + offset);
355347}
356348
357349
358static WRITE8_HANDLER( pc_dma_write_byte )
350WRITE8_MEMBER(savquest_state::pc_dma_write_byte)
359351{
360   savquest_state *state = space->machine().driver_data<savquest_state>();
361   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
352   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
362353      & 0xFF0000;
363354
364   space->write_byte(page_offset + offset, data);
355   space.write_byte(page_offset + offset, data);
365356}
366357
367358static void set_dma_channel(device_t *device, int channel, int state)
r14896r14897
379370{
380371   DEVCB_LINE(pc_dma_hrq_changed),
381372   DEVCB_NULL,
382   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
383   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
373   DEVCB_DRIVER_MEMBER(savquest_state, pc_dma_read_byte),
374   DEVCB_DRIVER_MEMBER(savquest_state, pc_dma_write_byte),
384375   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
385376   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
386377   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
415406   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
416407   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
417408   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
418   AM_RANGE(0x0080, 0x009f) AM_READWRITE_LEGACY(at_page32_r,            at_page32_w)
409   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
419410   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
420411   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
421412   AM_RANGE(0x00e8, 0x00ef) AM_NOP
src/mame/drivers/segas18.c
r14896r14897
142142   segas1x_state *state = machine.driver_data<segas1x_state>();
143143   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
144144
145   state->soundlatch_w(*space, 0, data & 0xff);
145   state->soundlatch_byte_w(*space, 0, data & 0xff);
146146   device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, PULSE_LINE);
147147}
148148
r14896r14897
634634   AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym1", ym3438_r, ym3438_w)
635635   AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym2", ym3438_r, ym3438_w)
636636   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1f) AM_WRITE_LEGACY(soundbank_w)
637   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_READ(soundlatch_r) AM_WRITE_LEGACY(mcu_data_w)
637   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_READ(soundlatch_byte_r) AM_WRITE_LEGACY(mcu_data_w)
638638ADDRESS_MAP_END
639639
640640
src/mame/drivers/astrocorp.c
r14896r14897
4040{
4141public:
4242   astrocorp_state(const machine_config &mconfig, device_type type, const char *tag)
43      : driver_device(mconfig, type, tag) { }
43      : driver_device(mconfig, type, tag) ,
44      m_spriteram(*this, "spriteram"),
45      m_paletteram(*this, "paletteram"){ }
4446
4547   /* memory pointers */
46   UINT16 *   m_spriteram;
47   UINT16 *   m_paletteram;
48   size_t     m_spriteram_size;
48   required_shared_ptr<UINT16> m_spriteram;
49   required_shared_ptr<UINT16> m_paletteram;
4950
5051   /* video-related */
5152   bitmap_ind16 m_bitmap;
r14896r14897
100101static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
101102{
102103   astrocorp_state *state = machine.driver_data<astrocorp_state>();
103   UINT16 *source = state->m_spriteram;
104   UINT16 *finish = state->m_spriteram + state->m_spriteram_size / 2;
104   UINT16 *source = state->m_spriteram.target();
105   UINT16 *finish = state->m_spriteram.target() + state->m_spriteram.bytes() / 2;
105106
106107   for ( ; source < finish; source += 8 / 2 )
107108   {
r14896r14897
243244      coin_counter_w(machine(), 0,   (data & 0x0001));   // key in  |
244245      coin_counter_w(machine(), 0,   (data & 0x0002));   // coin in |- manual shows 1 in- and 1 out- counter
245246      coin_counter_w(machine(), 1,   (data & 0x0004));   // key out |
246      ticket_dispenser_w(machine().device("hopper"), 0, (data & 0x0008)<<4);   // hopper motor?
247      machine().device<ticket_dispenser_device>("hopper")->write(space, 0, (data & 0x0008)<<4);   // hopper motor?
247248      //                                  (data & 0x0010)     // hopper?
248249      set_led_status(machine(), 0,   (data & 0x0020));   // error lamp (coin/hopper jam: "call attendant")
249      ticket_dispenser_w(machine().device("ticket"), 0, data & 0x0080);   // ticket motor?
250      machine().device<ticket_dispenser_device>("ticket")->write(space, 0, data & 0x0080);   // ticket motor?
250251   }
251252   if (ACCESSING_BITS_8_15)
252253   {
r14896r14897
278279// 5-6-5 Palette: BBBBB-GGGGGG-RRRRR
279280WRITE16_MEMBER(astrocorp_state::astrocorp_palette_w)
280281{
281   COMBINE_DATA(&m_paletteram[offset]);
282   COMBINE_DATA(&m_paletteram.target()[offset]);
282283   palette_set_color_rgb(machine(), offset,
283      pal5bit((m_paletteram[offset] >>  0) & 0x1f),
284      pal6bit((m_paletteram[offset] >>  5) & 0x3f),
285      pal5bit((m_paletteram[offset] >> 11) & 0x1f)
284      pal5bit((m_paletteram.target()[offset] >>  0) & 0x1f),
285      pal6bit((m_paletteram.target()[offset] >>  5) & 0x3f),
286      pal5bit((m_paletteram.target()[offset] >> 11) & 0x1f)
286287   );
287288}
288289
289290static ADDRESS_MAP_START( showhand_map, AS_PROGRAM, 16, astrocorp_state )
290291   AM_RANGE( 0x000000, 0x01ffff ) AM_ROM
291   AM_RANGE( 0x050000, 0x050fff ) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
292   AM_RANGE( 0x050000, 0x050fff ) AM_RAM AM_SHARE("spriteram")
292293   AM_RANGE( 0x052000, 0x052001 ) AM_WRITE(astrocorp_draw_sprites_w)
293294   AM_RANGE( 0x054000, 0x054001 ) AM_READ_PORT("INPUTS")
294295   AM_RANGE( 0x058000, 0x058001 ) AM_WRITE(astrocorp_eeprom_w)
295296   AM_RANGE( 0x05a000, 0x05a001 ) AM_WRITE(showhand_outputs_w)
296297   AM_RANGE( 0x05e000, 0x05e001 ) AM_READ_PORT("EEPROMIN")
297   AM_RANGE( 0x060000, 0x0601ff ) AM_RAM_WRITE(astrocorp_palette_w) AM_BASE(m_paletteram)
298   AM_RANGE( 0x060000, 0x0601ff ) AM_RAM_WRITE(astrocorp_palette_w) AM_SHARE("paletteram")
298299   AM_RANGE( 0x070000, 0x073fff ) AM_RAM AM_SHARE("nvram")   // battery
299300   AM_RANGE( 0x080000, 0x080001 ) AM_DEVWRITE_LEGACY("oki", astrocorp_sound_bank_w)
300301   AM_RANGE( 0x0a0000, 0x0a0001 ) AM_WRITE(astrocorp_screen_enable_w)
r14896r14897
303304
304305static ADDRESS_MAP_START( showhanc_map, AS_PROGRAM, 16, astrocorp_state )
305306   AM_RANGE( 0x000000, 0x01ffff ) AM_ROM
306   AM_RANGE( 0x060000, 0x0601ff ) AM_RAM_WRITE(astrocorp_palette_w) AM_BASE(m_paletteram)
307   AM_RANGE( 0x060000, 0x0601ff ) AM_RAM_WRITE(astrocorp_palette_w) AM_SHARE("paletteram")
307308   AM_RANGE( 0x070000, 0x070001 ) AM_DEVWRITE_LEGACY("oki", astrocorp_sound_bank_w)
308   AM_RANGE( 0x080000, 0x080fff ) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
309   AM_RANGE( 0x080000, 0x080fff ) AM_RAM AM_SHARE("spriteram")
309310   AM_RANGE( 0x082000, 0x082001 ) AM_WRITE(astrocorp_draw_sprites_w)
310311   AM_RANGE( 0x084000, 0x084001 ) AM_READ_PORT("INPUTS")
311312   AM_RANGE( 0x088000, 0x088001 ) AM_WRITE(astrocorp_eeprom_w)
r14896r14897
318319
319320static ADDRESS_MAP_START( skilldrp_map, AS_PROGRAM, 16, astrocorp_state )
320321   AM_RANGE( 0x000000, 0x03ffff ) AM_ROM
321   AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
322   AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_SHARE("spriteram")
322323   AM_RANGE( 0x202000, 0x202001 ) AM_WRITE(astrocorp_draw_sprites_w)
323324   AM_RANGE( 0x204000, 0x204001 ) AM_READ_PORT("INPUTS")
324325   AM_RANGE( 0x208000, 0x208001 ) AM_WRITE(astrocorp_eeprom_w)
325326   AM_RANGE( 0x20a000, 0x20a001 ) AM_WRITE(skilldrp_outputs_w)
326327   AM_RANGE( 0x20e000, 0x20e001 ) AM_READ_PORT("EEPROMIN")
327   AM_RANGE( 0x380000, 0x3801ff ) AM_RAM_WRITE(astrocorp_palette_w) AM_BASE(m_paletteram)
328   AM_RANGE( 0x380000, 0x3801ff ) AM_RAM_WRITE(astrocorp_palette_w) AM_SHARE("paletteram")
328329   AM_RANGE( 0x400000, 0x400001 ) AM_WRITE(astrocorp_screen_enable_w)
329330   AM_RANGE( 0x500000, 0x507fff ) AM_RAM AM_SHARE("nvram")   // battery
330331   AM_RANGE( 0x580000, 0x580001 ) AM_DEVWRITE_LEGACY("oki", skilldrp_sound_bank_w)
r14896r14897
334335static ADDRESS_MAP_START( speeddrp_map, AS_PROGRAM, 16, astrocorp_state )
335336   AM_RANGE( 0x000000, 0x01ffff ) AM_ROM
336337   AM_RANGE( 0x280000, 0x283fff ) AM_RAM AM_SHARE("nvram")   // battery
337   AM_RANGE( 0x380000, 0x380fff ) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
338   AM_RANGE( 0x380000, 0x380fff ) AM_RAM AM_SHARE("spriteram")
338339   AM_RANGE( 0x382000, 0x382001 ) AM_WRITE(astrocorp_draw_sprites_w)
339340   AM_RANGE( 0x384000, 0x384001 ) AM_READ_PORT("INPUTS")
340341   AM_RANGE( 0x388000, 0x388001 ) AM_WRITE(astrocorp_eeprom_w)
341342   AM_RANGE( 0x38a000, 0x38a001 ) AM_WRITE(skilldrp_outputs_w)
342343   AM_RANGE( 0x38e000, 0x38e001 ) AM_READ_PORT("EEPROMIN")
343   AM_RANGE( 0x480000, 0x4801ff ) AM_RAM_WRITE(astrocorp_palette_w) AM_BASE(m_paletteram)
344   AM_RANGE( 0x480000, 0x4801ff ) AM_RAM_WRITE(astrocorp_palette_w) AM_SHARE("paletteram")
344345   AM_RANGE( 0x500000, 0x500001 ) AM_WRITE(astrocorp_screen_enable_w)
345346   AM_RANGE( 0x580000, 0x580001 ) AM_DEVWRITE_LEGACY("oki", skilldrp_sound_bank_w)
346347   AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
r14896r14897
422423   PORT_BIT( 0x0200, IP_ACTIVE_LOW,  IPT_UNKNOWN       )
423424   PORT_BIT( 0x0400, IP_ACTIVE_LOW,  IPT_UNKNOWN       )
424425   PORT_BIT( 0x0800, IP_ACTIVE_LOW,  IPT_START2        )   PORT_NAME("Bet")
425   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)   // ticket sw
426   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)   // ticket sw
426427   PORT_BIT( 0x2000, IP_ACTIVE_LOW,  IPT_GAMBLE_BOOK   )
427   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("hopper", ticket_dispenser_line_r)   // hopper sw
428   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r)   // hopper sw
428429   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_GAMBLE_KEYIN  )
429430
430431   PORT_START( "EEPROMIN" )
r14896r14897
522523   MCFG_NVRAM_ADD_0FILL("nvram")
523524   MCFG_EEPROM_93C46_ADD("eeprom")
524525
525   MCFG_TICKET_DISPENSER_ADD("ticket", 200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
526   MCFG_TICKET_DISPENSER_ADD("hopper", 200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
526   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
527   MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW )
527528
528529   /* video hardware */
529530   MCFG_SCREEN_ADD("screen", RASTER)
src/mame/drivers/ltcasino.c
r14896r14897
2222{
2323public:
2424   ltcasino_state(const machine_config &mconfig, device_type type, const char *tag)
25      : driver_device(mconfig, type, tag) { }
25      : driver_device(mconfig, type, tag) ,
26      m_tile_num_ram(*this, "tile_nuram"),
27      m_tile_atr_ram(*this, "tile_atr_ram"){ }
2628
27   UINT8 *m_tile_num_ram;
28   UINT8 *m_tile_atr_ram;
29   required_shared_ptr<UINT8> m_tile_num_ram;
30   required_shared_ptr<UINT8> m_tile_atr_ram;
2931   tilemap_t *m_tilemap;
3032   DECLARE_WRITE8_MEMBER(ltcasino_tile_num_w);
3133   DECLARE_WRITE8_MEMBER(ltcasino_tile_atr_w);
r14896r14897
3941   ltcasino_state *state = machine.driver_data<ltcasino_state>();
4042   int tileno, colour;
4143
42   tileno = state->m_tile_num_ram[tile_index];
43   colour = state->m_tile_atr_ram[tile_index];
44   tileno = state->m_tile_num_ram.target()[tile_index];
45   colour = state->m_tile_atr_ram.target()[tile_index];
4446
4547   tileno += (colour & 0x80) << 1;
4648
r14896r14897
5658
5759WRITE8_MEMBER(ltcasino_state::ltcasino_tile_num_w)
5860{
59   m_tile_num_ram[offset] = data;
61   m_tile_num_ram.target()[offset] = data;
6062   m_tilemap->mark_tile_dirty(offset);
6163}
6264
6365WRITE8_MEMBER(ltcasino_state::ltcasino_tile_atr_w)
6466{
65   m_tile_atr_ram[offset] = data;
67   m_tile_atr_ram.target()[offset] = data;
6668   m_tilemap->mark_tile_dirty(offset);
6769}
6870
r14896r14897
7072static ADDRESS_MAP_START( ltcasino_map, AS_PROGRAM, 8, ltcasino_state )
7173   AM_RANGE(0x0000, 0x7fff) AM_RAM
7274   AM_RANGE(0x8000, 0xcfff) AM_ROM
73   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(ltcasino_tile_num_w) AM_BASE(m_tile_num_ram)
75   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(ltcasino_tile_num_w) AM_SHARE("tile_nuram")
7476   AM_RANGE(0xd800, 0xdfff) AM_RAM
75   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(ltcasino_tile_atr_w) AM_BASE(m_tile_atr_ram)
77   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(ltcasino_tile_atr_w) AM_SHARE("tile_atr_ram")
7678   AM_RANGE(0xe800, 0xebff) AM_RAM
7779
7880   AM_RANGE(0xec00, 0xec00) AM_READ_PORT("IN0")
src/mame/drivers/meijinsn.c
r14896r14897
6969public:
7070   meijinsn_state(const machine_config &mconfig, device_type type, const char *tag)
7171      : driver_device(mconfig, type, tag),
72      m_maincpu(*this,"maincpu")
73      { }
72      m_maincpu(*this,"maincpu"),
73      m_videoram(*this, "videoram"),
74      m_shared_ram(*this, "shared_ram"){ }
7475
76   required_device<cpu_device> m_maincpu;
7577   /* memory pointers */
76   UINT16 *   m_shared_ram;
77   UINT16 *   m_videoram;
78   required_shared_ptr<UINT16> m_videoram;
79   required_shared_ptr<UINT16> m_shared_ram;
7880
7981   /* video-related */
8082   tilemap_t  *m_bg_tilemap;
r14896r14897
8890   UINT8 m_coinvalue;
8991   int m_mcu_latch;
9092
91   required_device<cpu_device> m_maincpu;
9293   DECLARE_WRITE16_MEMBER(sound_w);
9394   DECLARE_READ16_MEMBER(alpha_mcu_r);
9495};
r14896r14897
9899WRITE16_MEMBER(meijinsn_state::sound_w)
99100{
100101   if (ACCESSING_BITS_0_7)
101      soundlatch_w(space, 0, data & 0xff);
102      soundlatch_byte_w(space, 0, data & 0xff);
102103}
103104
104105READ16_MEMBER(meijinsn_state::alpha_mcu_r)
r14896r14897
106107   static const UINT8 coinage1[2][2] = {{1,1}, {1,2}};
107108   static const UINT8 coinage2[2][2] = {{1,5}, {2,1}};
108109
109   int source = m_shared_ram[offset];
110   int source = m_shared_ram.target()[offset];
110111
111112   switch (offset)
112113   {
113114      case 0: /* Dipswitch 2 */
114         m_shared_ram[0] = (source & 0xff00) | input_port_read(machine(), "DSW");
115         m_shared_ram.target()[0] = (source & 0xff00) | input_port_read(machine(), "DSW");
115116         return 0;
116117
117118      case 0x22: /* Coin value */
118         m_shared_ram[0x22] = (source & 0xff00) | (m_credits & 0x00ff);
119         m_shared_ram.target()[0x22] = (source & 0xff00) | (m_credits & 0x00ff);
119120         return 0;
120121
121122      case 0x29: /* Query microcontroller for coin insert */
r14896r14897
127128
128129         if ((input_port_read(machine(), "COINS") & 0x1) == 0 && !m_mcu_latch)
129130         {
130            m_shared_ram[0x29] = (source & 0xff00) | 0x22;   // coinA
131            m_shared_ram[0x22] = (source & 0xff00) | 0x00;
131            m_shared_ram.target()[0x29] = (source & 0xff00) | 0x22;   // coinA
132            m_shared_ram.target()[0x22] = (source & 0xff00) | 0x00;
132133            m_mcu_latch = 1;
133134
134135            m_coinvalue = (~input_port_read(machine(), "DSW")>>3) & 1;
r14896r14897
144145         }
145146         else if ((input_port_read(machine(), "COINS") & 0x2) == 0 && !m_mcu_latch)
146147         {
147            m_shared_ram[0x29] = (source & 0xff00) | 0x22;   // coinA
148            m_shared_ram[0x22] = (source & 0xff00) | 0x00;
148            m_shared_ram.target()[0x29] = (source & 0xff00) | 0x22;   // coinA
149            m_shared_ram.target()[0x22] = (source & 0xff00) | 0x00;
149150            m_mcu_latch = 1;
150151
151152            m_coinvalue = (~input_port_read(machine(), "DSW") >> 3) & 1;
r14896r14897
161162         }
162163         else
163164         {
164            m_shared_ram[0x29] = (source & 0xff00) | 0x22;
165            m_shared_ram.target()[0x29] = (source & 0xff00) | 0x22;
165166         }
166167         return 0;
167168   }
r14896r14897
173174static ADDRESS_MAP_START( meijinsn_map, AS_PROGRAM, 16, meijinsn_state )
174175   AM_RANGE(0x000000, 0x03ffff) AM_ROM
175176   AM_RANGE(0x080e00, 0x080fff) AM_READ(alpha_mcu_r) AM_WRITENOP
176   AM_RANGE(0x100000, 0x107fff) AM_RAM AM_BASE(m_videoram)
177   AM_RANGE(0x100000, 0x107fff) AM_RAM AM_SHARE("videoram")
177178   AM_RANGE(0x180000, 0x180dff) AM_RAM
178   AM_RANGE(0x180e00, 0x180fff) AM_RAM AM_BASE(m_shared_ram)
179   AM_RANGE(0x180e00, 0x180fff) AM_RAM AM_SHARE("shared_ram")
179180   AM_RANGE(0x181000, 0x181fff) AM_RAM
180181   AM_RANGE(0x1c0000, 0x1c0001) AM_READ_PORT("P2")
181182   AM_RANGE(0x1a0000, 0x1a0001) AM_READ_PORT("P1") AM_WRITE(sound_w)
r14896r14897
190191   ADDRESS_MAP_GLOBAL_MASK(0xff)
191192   AM_RANGE(0x00, 0x01) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
192193   AM_RANGE(0x01, 0x01) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
193   AM_RANGE(0x02, 0x02) AM_WRITE(soundlatch_clear_w)
194   AM_RANGE(0x02, 0x02) AM_WRITE(soundlatch_clear_byte_w)
194195   AM_RANGE(0x06, 0x06) AM_WRITENOP
195196ADDRESS_MAP_END
196197
r14896r14897
296297      sx = offs >> 8;
297298      sy = offs & 0xff;
298299
299      data1 = state->m_videoram[offs] >> 8;
300      data2 = state->m_videoram[offs] & 0xff;
300      data1 = state->m_videoram.target()[offs] >> 8;
301      data2 = state->m_videoram.target()[offs] & 0xff;
301302
302303      for (x = 0; x < 4; x++)
303304      {
r14896r14897
326327{
327328   AY8910_LEGACY_OUTPUT,
328329   AY8910_DEFAULT_LOADS,
329   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r)
330   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r)
330331};
331332
332333static MACHINE_START( meijinsn )
src/mame/drivers/coolridr.c
r14896r14897
268268      m_hPosition(0x0000),
269269      m_maincpu(*this, "maincpu"),
270270      m_subcpu(*this,"sub"),
271      m_soundcpu(*this,"soundcpu")
272      { }
271      m_soundcpu(*this,"soundcpu"),
272      m_h1_vram(*this, "h1_vram"),
273      m_h1_charram(*this, "h1_charram"),
274      m_framebuffer_vram(*this, "framebuffer_vram"),
275      m_txt_vram(*this, "txt_vram"),
276      m_sysh1_txt_blit(*this, "sysh1_txt_blit"),
277      m_sysh1_workram_h(*this, "sysh1_workrah"),
278      m_h1_unk(*this, "h1_unk"){ }
273279
274   UINT32* m_sysh1_workram_h;
275   UINT32* m_framebuffer_vram;
276   UINT32* m_h1_unk;
277   UINT32* m_h1_charram;
278   UINT32* m_h1_vram;
279   UINT32* m_sysh1_txt_blit;
280   UINT32* m_txt_vram;
281   bitmap_rgb32 m_temp_bitmap_sprites;
282   UINT32 m_test_offs;
283   int m_color;
284   UINT8 m_vblank;
285
286280   // Blitter state
287281   UINT16 m_textBytesToWrite;
288282   INT16  m_blitterSerialCount;
r14896r14897
293287   UINT16 m_hCellCount;
294288   UINT16 m_vPosition;
295289   UINT16 m_hPosition;
296
290   
297291   required_device<cpu_device> m_maincpu;
298292   required_device<cpu_device> m_subcpu;
299293   required_device<cpu_device> m_soundcpu;
294
295   required_shared_ptr<UINT32> m_h1_vram;
296   required_shared_ptr<UINT32> m_h1_charram;
297   required_shared_ptr<UINT32> m_framebuffer_vram;
298   required_shared_ptr<UINT32> m_txt_vram;
299   required_shared_ptr<UINT32> m_sysh1_txt_blit;
300   required_shared_ptr<UINT32> m_sysh1_workram_h;
301   required_shared_ptr<UINT32> m_h1_unk;
302   bitmap_rgb32 m_temp_bitmap_sprites;
303   UINT32 m_test_offs;
304   int m_color;
305   UINT8 m_vblank;
306
307
308
300309   DECLARE_READ32_MEMBER(sysh1_unk_r);
301310   DECLARE_WRITE32_MEMBER(sysh1_unk_w);
302311   DECLARE_READ32_MEMBER(sysh1_ioga_r);
r14896r14897
366375      {
367376         int tile;
368377
369         tile = (state->m_h1_vram[count] & 0x0fff0000) >> 16;
378         tile = (state->m_h1_vram.target()[count] & 0x0fff0000) >> 16;
370379         drawgfx_opaque(bitmap,cliprect,gfx,tile,state->m_color,0,0,(x+0)*16,y*16);
371380
372         tile = (state->m_h1_vram[count] & 0x00000fff) >> 0;
381         tile = (state->m_h1_vram.target()[count] & 0x00000fff) >> 0;
373382         drawgfx_opaque(bitmap,cliprect,gfx,tile,state->m_color,0,0,(x+1)*16,y*16);
374383
375384         count++;
r14896r14897
395404
396405         m_vblank^=1;
397406
398         return (m_h1_unk[offset] & 0xfdffffff) | (m_vblank<<25);
407         return (m_h1_unk.target()[offset] & 0xfdffffff) | (m_vblank<<25);
399408      }
400409      case 0x14/4:
401         return m_h1_unk[offset];
410         return m_h1_unk.target()[offset];
402411      //case 0x20/4:
403412   }
404413
405   return 0xffffffff;//m_h1_unk[offset];
414   return 0xffffffff;//m_h1_unk.target()[offset];
406415}
407416
408417WRITE32_MEMBER(coolridr_state::sysh1_unk_w)
409418{
410   COMBINE_DATA(&m_h1_unk[offset]);
419   COMBINE_DATA(&m_h1_unk.target()[offset]);
411420}
412421
413422/* According to Guru, this is actually the same I/O chip of Sega Model 2 HW */
r14896r14897
429438WRITE32_MEMBER(coolridr_state::sysh1_txt_blit_w)
430439{
431440
432   COMBINE_DATA(&m_sysh1_txt_blit[offset]);
441   COMBINE_DATA(&m_sysh1_txt_blit.target()[offset]);
433442
434443   switch(offset)
435444   {
r14896r14897
591600   end_dma_mark = 0;
592601
593602   do{
594      src = (state->m_framebuffer_vram[(0+dma_index)/4] & 0x0fffffff);
595      dst = (state->m_framebuffer_vram[(4+dma_index)/4]);
596      size = state->m_framebuffer_vram[(8+dma_index)/4];
597      type = (state->m_framebuffer_vram[(0+dma_index)/4] & 0xf0000000) >> 28;
603      src = (state->m_framebuffer_vram.target()[(0+dma_index)/4] & 0x0fffffff);
604      dst = (state->m_framebuffer_vram.target()[(4+dma_index)/4]);
605      size = state->m_framebuffer_vram.target()[(8+dma_index)/4];
606      type = (state->m_framebuffer_vram.target()[(0+dma_index)/4] & 0xf0000000) >> 28;
598607
599608      #if 0
600609      if(type == 0xc || type == 0xd || type == 0xe)
r14896r14897
660669
661670WRITE32_MEMBER(coolridr_state::sysh1_dma_w)
662671{
663   COMBINE_DATA(&m_framebuffer_vram[offset]);
672   COMBINE_DATA(&m_framebuffer_vram.target()[offset]);
664673
665674   if(offset*4 == 0x000)
666675   {
667      if((m_framebuffer_vram[offset] & 0xff00000) == 0xfe00000)
668         sysh1_dma_transfer(&space, m_framebuffer_vram[offset] & 0xffff);
676      if((m_framebuffer_vram.target()[offset] & 0xff00000) == 0xfe00000)
677         sysh1_dma_transfer(&space, m_framebuffer_vram.target()[offset] & 0xffff);
669678   }
670679}
671680
672681WRITE32_MEMBER(coolridr_state::sysh1_char_w)
673682{
674   COMBINE_DATA(&m_h1_charram[offset]);
683   COMBINE_DATA(&m_h1_charram.target()[offset]);
675684
676685   {
677686      UINT8 *gfx = machine().region("ram_gfx")->base();
678687
679      gfx[offset*4+0] = (m_h1_charram[offset] & 0xff000000) >> 24;
680      gfx[offset*4+1] = (m_h1_charram[offset] & 0x00ff0000) >> 16;
681      gfx[offset*4+2] = (m_h1_charram[offset] & 0x0000ff00) >> 8;
682      gfx[offset*4+3] = (m_h1_charram[offset] & 0x000000ff) >> 0;
688      gfx[offset*4+0] = (m_h1_charram.target()[offset] & 0xff000000) >> 24;
689      gfx[offset*4+1] = (m_h1_charram.target()[offset] & 0x00ff0000) >> 16;
690      gfx[offset*4+2] = (m_h1_charram.target()[offset] & 0x0000ff00) >> 8;
691      gfx[offset*4+3] = (m_h1_charram.target()[offset] & 0x000000ff) >> 0;
683692
684693      gfx_element_mark_dirty(machine().gfx[2], offset/64); //*4/256
685694   }
r14896r14897
689698   AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_SHARE("share1") AM_WRITENOP
690699   AM_RANGE(0x01000000, 0x01ffffff) AM_ROM AM_REGION("gfx_data",0x0000000)
691700
692   AM_RANGE(0x03000000, 0x030fffff) AM_RAM AM_BASE(m_h1_vram)//bg vram
701   AM_RANGE(0x03000000, 0x030fffff) AM_RAM AM_SHARE("h1_vram")//bg vram
693702   AM_RANGE(0x03c00000, 0x03c0ffff) AM_RAM_WRITE(sysh1_pal_w) AM_SHARE("paletteram")
694   AM_RANGE(0x03d00000, 0x03dfffff) AM_RAM_WRITE(sysh1_char_w) AM_BASE(m_h1_charram) //FIXME: half size
695   AM_RANGE(0x03e00000, 0x03efffff) AM_RAM_WRITE(sysh1_dma_w) AM_BASE(m_framebuffer_vram) //FIXME: not all of it
703   AM_RANGE(0x03d00000, 0x03dfffff) AM_RAM_WRITE(sysh1_char_w) AM_SHARE("h1_charram") //FIXME: half size
704   AM_RANGE(0x03e00000, 0x03efffff) AM_RAM_WRITE(sysh1_dma_w) AM_SHARE("framebuffer_vram") //FIXME: not all of it
696705
697706   AM_RANGE(0x03f00000, 0x03f0ffff) AM_RAM AM_SHARE("share3") /*Communication area RAM*/
698   AM_RANGE(0x03f40000, 0x03f4ffff) AM_RAM AM_BASE(m_txt_vram)//text tilemap + "lineram"
699   AM_RANGE(0x04000000, 0x0400003f) AM_RAM_WRITE(sysh1_txt_blit_w) AM_BASE(m_sysh1_txt_blit)
700   AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_BASE(m_sysh1_workram_h)
707   AM_RANGE(0x03f40000, 0x03f4ffff) AM_RAM AM_SHARE("txt_vram")//text tilemap + "lineram"
708   AM_RANGE(0x04000000, 0x0400003f) AM_RAM_WRITE(sysh1_txt_blit_w) AM_SHARE("sysh1_txt_blit")
709   AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_SHARE("sysh1_workrah")
701710   AM_RANGE(0x20000000, 0x201fffff) AM_ROM AM_SHARE("share1")
702711
703712   AM_RANGE(0x60000000, 0x600003ff) AM_WRITENOP
r14896r14897
715724   AM_RANGE(0x03208900, 0x03208903) AM_RAM /*???*/
716725   AM_RANGE(0x03300400, 0x03300403) AM_RAM /*irq enable?*/
717726
718   AM_RANGE(0x04000000, 0x0400003f) AM_READWRITE(sysh1_unk_r,sysh1_unk_w) AM_BASE(m_h1_unk)
727   AM_RANGE(0x04000000, 0x0400003f) AM_READWRITE(sysh1_unk_r,sysh1_unk_w) AM_SHARE("h1_unk")
719728   AM_RANGE(0x04200000, 0x0420003f) AM_RAM /*???*/
720729
721730   AM_RANGE(0x05000000, 0x05000fff) AM_RAM
r14896r14897
12261235   if(pc == 0x6012374 || pc == 0x6012392)
12271236      return 0;
12281237
1229   return m_sysh1_workram_h[0xd88a4/4];
1238   return m_sysh1_workram_h.target()[0xd88a4/4];
12301239}
12311240#endif
12321241
r14896r14897
12371246   if(pc == 0x6002cba || pc == 0x6002d42)
12381247      return 0;
12391248
1240   return m_sysh1_workram_h[0xd8894/4];
1249   return m_sysh1_workram_h.target()[0xd8894/4];
12411250}
12421251
12431252static DRIVER_INIT( coolridr )
src/mame/drivers/blitz.c
r14896r14897
296296{
297297public:
298298   blitz_state(const machine_config &mconfig, device_type type, const char *tag)
299      : driver_device(mconfig, type, tag) { }
299      : driver_device(mconfig, type, tag) ,
300      m_videoram(*this, "videoram"),
301      m_colorram(*this, "colorram"){ }
300302
301   UINT8 *m_videoram;
302   UINT8 *m_colorram;
303   required_shared_ptr<UINT8> m_videoram;
304   required_shared_ptr<UINT8> m_colorram;
303305   tilemap_t *m_bg_tilemap;
304306   int m_mux_data;
305307   DECLARE_WRITE8_MEMBER(megadpkr_videoram_w);
r14896r14897
315317
316318WRITE8_MEMBER(blitz_state::megadpkr_videoram_w)
317319{
318   m_videoram[offset] = data;
320   m_videoram.target()[offset] = data;
319321   m_bg_tilemap->mark_tile_dirty(offset);
320322}
321323
322324WRITE8_MEMBER(blitz_state::megadpkr_colorram_w)
323325{
324   m_colorram[offset] = data;
326   m_colorram.target()[offset] = data;
325327   m_bg_tilemap->mark_tile_dirty(offset);
326328}
327329
r14896r14897
337339    xx-- ----   unused.
338340*/
339341
340   int attr = state->m_colorram[tile_index];
341   int code = ((attr & 1) << 8) | state->m_videoram[tile_index];
342   int attr = state->m_colorram.target()[tile_index];
343   int code = ((attr & 1) << 8) | state->m_videoram.target()[tile_index];
342344   int bank = (attr & 0x02) >> 1;   /* bit 1 switch the gfx banks */
343345   int color = (attr & 0x3c) >> 2;   /* bits 2-3-4-5 for color */
344346
r14896r14897
485487    AM_RANGE(0x10f8, 0x10fb) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
486488*/
487489
488   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(megadpkr_videoram_w) AM_BASE(m_videoram)
489   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(megadpkr_colorram_w) AM_BASE(m_colorram)
490   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(megadpkr_videoram_w) AM_SHARE("videoram")
491   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(megadpkr_colorram_w) AM_SHARE("colorram")
490492
491493   AM_RANGE(0xc000, 0xffff) AM_ROM
492494ADDRESS_MAP_END
src/mame/drivers/gamtor.c
r14896r14897
3232{
3333public:
3434   gaminator_state(const machine_config &mconfig, device_type type, const char *tag)
35      : driver_device(mconfig, type, tag) { }
35      : driver_device(mconfig, type, tag){ }
36   DECLARE_WRITE32_MEMBER(gamtor_unk_w);
3637};
3738
38static WRITE32_HANDLER( gamtor_unk_w )
39WRITE32_MEMBER(gaminator_state::gamtor_unk_w)
3940{
4041
4142}
r14896r14897
4546static ADDRESS_MAP_START( gaminator_map, AS_PROGRAM, 32, gaminator_state )
4647   AM_RANGE(0x00000000, 0x07ffffff) AM_ROM
4748   AM_RANGE(0x08000000, 0x0bffffff) AM_RAM
48   AM_RANGE(0x1e040008, 0x1e04000b) AM_WRITE_LEGACY(gamtor_unk_w )
49   AM_RANGE(0x1e040008, 0x1e04000b) AM_WRITE(gamtor_unk_w )
4950
5051   AM_RANGE(0x20000000, 0x2003ffff) AM_RAM
5152
5253   /* standard VGA */
5354//  AM_RANGE(0x40000000, 0x40000fff) AM_RAM // regs
5455   AM_RANGE(0x44000000, 0x4401ffff) AM_RAM // VRAM
55//  AM_RANGE(0x44000000, 0x44007fff) AM_RAM AM_BASE(m_tmapram1) // puts strings here, looks almost like a tilemap, but where are the tiles?
56//  AM_RANGE(0x440a0000, 0x440a1fff) AM_RAM AM_BASE(m_tmapram2) // beetlem (like above, mirror?)
56//  AM_RANGE(0x44000000, 0x44007fff) AM_RAM AM_SHARE("tmapram1") // puts strings here, looks almost like a tilemap, but where are the tiles?
57//  AM_RANGE(0x440a0000, 0x440a1fff) AM_RAM AM_SHARE("tmapram2") // beetlem (like above, mirror?)
5758
5859   AM_RANGE(0xe0000000, 0xe00001ff) AM_RAM // nvram?
5960
src/mame/drivers/tutankhm.c
r14896r14897
135135   AM_RANGE(0x8207, 0x8207) AM_MIRROR(0x00f8) AM_WRITE(tutankhm_flip_screen_y_w)
136136   AM_RANGE(0x8300, 0x8300) AM_MIRROR(0x00ff) AM_WRITE(tutankhm_bankselect_w)
137137   AM_RANGE(0x8600, 0x8600) AM_MIRROR(0x00ff) AM_WRITE_LEGACY(timeplt_sh_irqtrigger_w)
138   AM_RANGE(0x8700, 0x8700) AM_MIRROR(0x00ff) AM_WRITE(soundlatch_w)
138   AM_RANGE(0x8700, 0x8700) AM_MIRROR(0x00ff) AM_WRITE(soundlatch_byte_w)
139139   AM_RANGE(0x8800, 0x8fff) AM_RAM
140140   AM_RANGE(0x9000, 0x9fff) AM_ROMBANK("bank1")
141141   AM_RANGE(0xa000, 0xffff) AM_ROM
src/mame/drivers/targeth.c
r14896r14897
7373   AM_RANGE(0x108006, 0x108007) AM_READ_PORT("GUNY2")
7474   AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE(m_vregs)   /* Video Registers */
7575   AM_RANGE(0x10800c, 0x10800d) AM_WRITENOP               /* CLR Video INT */
76   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
76   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
7777   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(m_spriteram)   /* Sprite RAM */
7878   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2")
7979   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
src/mame/drivers/intrscti.c
r14896r14897
1919{
2020public:
2121   intrscti_state(const machine_config &mconfig, device_type type, const char *tag)
22      : driver_device(mconfig, type, tag) { }
22      : driver_device(mconfig, type, tag) ,
23      m_ram(*this, "ram"){ }
2324
24   UINT8 *m_ram;
25   required_shared_ptr<UINT8> m_ram;
2526   DECLARE_READ8_MEMBER(unk_r);
2627};
2728
r14896r14897
3435static ADDRESS_MAP_START( intrscti_map, AS_PROGRAM, 8, intrscti_state )
3536   AM_RANGE(0x0000, 0x1fff) AM_ROM
3637   AM_RANGE(0x6000, 0x67ff) AM_RAM
37   AM_RANGE(0x7000, 0x77ff) AM_RAM AM_BASE(m_ram) // video ram
38   AM_RANGE(0x7000, 0x77ff) AM_RAM AM_SHARE("ram") // video ram
3839   AM_RANGE(0x8000, 0x8fff) AM_ROM
3940ADDRESS_MAP_END
4041
r14896r14897
8182      for (x=0;x<32;x++)
8283      {
8384         int dat;
84         dat = state->m_ram[count];
85         dat = state->m_ram.target()[count];
8586         drawgfx_transpen(bitmap,cliprect,screen.machine().gfx[0],dat/*+0x100*/,0,0,0,x*8,y*8,0);
8687         count++;
8788      }
src/mame/drivers/rainbow.c
r14896r14897
347347static ADDRESS_MAP_START( rbisland_map, AS_PROGRAM, 16, rbisland_state )
348348   AM_RANGE(0x000000, 0x07ffff) AM_ROM
349349   AM_RANGE(0x10c000, 0x10ffff) AM_RAM            /* main RAM */
350   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
350   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
351351   AM_RANGE(0x201000, 0x203fff) AM_RAM            /* r/w in initial checks */
352352   AM_RANGE(0x390000, 0x390003) AM_READ_PORT("DSWA")
353353   AM_RANGE(0x3a0000, 0x3a0001) AM_WRITE(rbisland_spritectrl_w)
r14896r14897
368368static ADDRESS_MAP_START( jumping_map, AS_PROGRAM, 16, rbisland_state )
369369   AM_RANGE(0x000000, 0x09ffff) AM_ROM
370370   AM_RANGE(0x10c000, 0x10ffff) AM_RAM            /* main RAM */
371   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
371   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
372372   AM_RANGE(0x201000, 0x203fff) AM_RAM            /* r/w in initial checks */
373373   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("DSWA")
374374   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("DSWB")
src/mame/drivers/galspnbl.c
r14896r14897
3131
3232   if (ACCESSING_BITS_0_7)
3333   {
34      soundlatch_w(space,offset,data & 0xff);
34      soundlatch_byte_w(space,offset,data & 0xff);
3535      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
3636   }
3737}
r14896r14897
5151   AM_RANGE(0x905000, 0x907fff) AM_WRITENOP   /* ??? */
5252   AM_RANGE(0x980000, 0x9bffff) AM_RAM AM_BASE(m_bgvideoram)
5353   AM_RANGE(0xa00000, 0xa00fff) AM_WRITENOP   /* more palette ? */
54   AM_RANGE(0xa01000, 0xa017ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
54   AM_RANGE(0xa01000, 0xa017ff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
5555   AM_RANGE(0xa01800, 0xa027ff) AM_WRITENOP   /* more palette ? */
5656   AM_RANGE(0xa80000, 0xa80001) AM_READ_PORT("IN0")
5757   AM_RANGE(0xa80010, 0xa80011) AM_READ_PORT("IN1") AM_WRITE(soundcommand_w)
r14896r14897
6767   AM_RANGE(0xf800, 0xf800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
6868   AM_RANGE(0xf810, 0xf811) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w)
6969   AM_RANGE(0xfc00, 0xfc00) AM_NOP   /* irq ack ?? */
70   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
70   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_byte_r)
7171ADDRESS_MAP_END
7272
7373
src/mame/drivers/tryout.c
r14896r14897
3232
3333WRITE8_MEMBER(tryout_state::tryout_sound_w)
3434{
35   soundlatch_w(space, 0, data);
35   soundlatch_byte_w(space, 0, data);
3636   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
3737}
3838
r14896r14897
7676static ADDRESS_MAP_START( sound_cpu, AS_PROGRAM, 8, tryout_state )
7777   AM_RANGE(0x0000, 0x07ff) AM_RAM
7878   AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
79   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
79   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
8080   AM_RANGE(0xd000, 0xd000) AM_WRITE(tryout_sound_irq_ack_w)
8181   AM_RANGE(0xc000, 0xffff) AM_ROM
8282ADDRESS_MAP_END
src/mame/drivers/photoply.c
r14896r14897
4040   device_t   *m_pic8259_2;
4141   device_t   *m_dma8237_1;
4242   device_t   *m_dma8237_2;
43   DECLARE_READ8_MEMBER(pc_dma_read_byte);
44   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
45   DECLARE_READ8_MEMBER(dma_page_select_r);
46   DECLARE_WRITE8_MEMBER(dma_page_select_w);
4347};
4448
4549
r14896r14897
5862}
5963
6064
61static READ8_HANDLER( pc_dma_read_byte )
65READ8_MEMBER(photoply_state::pc_dma_read_byte)
6266{
63   photoply_state *state = space->machine().driver_data<photoply_state>();
64   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
67   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
6568      & 0xFF0000;
6669
67   return space->read_byte(page_offset + offset);
70   return space.read_byte(page_offset + offset);
6871}
6972
7073
71static WRITE8_HANDLER( pc_dma_write_byte )
74WRITE8_MEMBER(photoply_state::pc_dma_write_byte)
7275{
73   photoply_state *state = space->machine().driver_data<photoply_state>();
74   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
76   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
7577      & 0xFF0000;
7678
77   space->write_byte(page_offset + offset, data);
79   space.write_byte(page_offset + offset, data);
7880}
7981
80static READ8_HANDLER(dma_page_select_r)
82READ8_MEMBER(photoply_state::dma_page_select_r)
8183{
82   photoply_state *state = space->machine().driver_data<photoply_state>();
83   UINT8 data = state->m_at_pages[offset % 0x10];
84   UINT8 data = m_at_pages[offset % 0x10];
8485
8586   switch(offset % 8)
8687   {
8788   case 1:
88      data = state->m_dma_offset[(offset / 8) & 1][2];
89      data = m_dma_offset[(offset / 8) & 1][2];
8990      break;
9091   case 2:
91      data = state->m_dma_offset[(offset / 8) & 1][3];
92      data = m_dma_offset[(offset / 8) & 1][3];
9293      break;
9394   case 3:
94      data = state->m_dma_offset[(offset / 8) & 1][1];
95      data = m_dma_offset[(offset / 8) & 1][1];
9596      break;
9697   case 7:
97      data = state->m_dma_offset[(offset / 8) & 1][0];
98      data = m_dma_offset[(offset / 8) & 1][0];
9899      break;
99100   }
100101   return data;
101102}
102103
103104
104static WRITE8_HANDLER(dma_page_select_w)
105WRITE8_MEMBER(photoply_state::dma_page_select_w)
105106{
106   photoply_state *state = space->machine().driver_data<photoply_state>();
107   state->m_at_pages[offset % 0x10] = data;
107   m_at_pages[offset % 0x10] = data;
108108
109109   switch(offset % 8)
110110   {
111111   case 1:
112      state->m_dma_offset[(offset / 8) & 1][2] = data;
112      m_dma_offset[(offset / 8) & 1][2] = data;
113113      break;
114114   case 2:
115      state->m_dma_offset[(offset / 8) & 1][3] = data;
115      m_dma_offset[(offset / 8) & 1][3] = data;
116116      break;
117117   case 3:
118      state->m_dma_offset[(offset / 8) & 1][1] = data;
118      m_dma_offset[(offset / 8) & 1][1] = data;
119119      break;
120120   case 7:
121      state->m_dma_offset[(offset / 8) & 1][0] = data;
121      m_dma_offset[(offset / 8) & 1][0] = data;
122122      break;
123123   }
124124}
r14896r14897
138138{
139139   DEVCB_LINE(pc_dma_hrq_changed),
140140   DEVCB_NULL,
141   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
142   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
141   DEVCB_DRIVER_MEMBER(photoply_state, pc_dma_read_byte),
142   DEVCB_DRIVER_MEMBER(photoply_state, pc_dma_write_byte),
143143   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
144144   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
145145   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
248248   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
249249   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
250250   AM_RANGE(0x0070, 0x007f) AM_RAM//DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
251   AM_RANGE(0x0080, 0x009f) AM_READWRITE8_LEGACY(dma_page_select_r,dma_page_select_w, 0xffffffff)//TODO
251   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(dma_page_select_r,dma_page_select_w, 0xffffffff)//TODO
252252   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
253253   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", i8237_r, i8237_w, 0xffff)
254254   AM_RANGE(0x00e8, 0x00eb) AM_NOP
src/mame/drivers/rungun.c
r14896r14897
146146WRITE16_MEMBER(rungun_state::sound_cmd1_w)
147147{
148148   if (ACCESSING_BITS_8_15)
149      soundlatch_w(space, 0, data >> 8);
149      soundlatch_byte_w(space, 0, data >> 8);
150150}
151151
152152WRITE16_MEMBER(rungun_state::sound_cmd2_w)
153153{
154154   if (ACCESSING_BITS_8_15)
155      soundlatch2_w(space, 0, data >> 8);
155      soundlatch2_byte_w(space, 0, data >> 8);
156156}
157157
158158WRITE16_MEMBER(rungun_state::sound_irq_w)
r14896r14897
181181
182182static ADDRESS_MAP_START( rungun_map, AS_PROGRAM, 16, rungun_state )
183183   AM_RANGE(0x000000, 0x2fffff) AM_ROM                                 // main program + data
184   AM_RANGE(0x300000, 0x3007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
184   AM_RANGE(0x300000, 0x3007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
185185   AM_RANGE(0x380000, 0x39ffff) AM_RAM                                 // work RAM
186186   AM_RANGE(0x400000, 0x43ffff) AM_READNOP   // AM_READ_LEGACY(K053936_0_rom_r )       // '936 ROM readback window
187187   AM_RANGE(0x480000, 0x48001f) AM_READWRITE(rng_sysregs_r, rng_sysregs_w) AM_BASE(m_sysreg)
r14896r14897
247247   AM_RANGE(0xe400, 0xe62f) AM_DEVREADWRITE("k054539_1", k054539_device, read, write)
248248   AM_RANGE(0xe630, 0xe7ff) AM_RAM
249249   AM_RANGE(0xf000, 0xf000) AM_WRITE(sound_status_w)
250   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
251   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
250   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_byte_r)
251   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_byte_r)
252252   AM_RANGE(0xf800, 0xf800) AM_WRITE(z80ctrl_w)
253253   AM_RANGE(0xfff0, 0xfff3) AM_WRITENOP
254254ADDRESS_MAP_END
src/mame/drivers/sfbonus.c
r14896r14897
279279{
280280public:
281281   sfbonus_state(const machine_config &mconfig, device_type type, const char *tag)
282      : driver_device(mconfig, type, tag) { }
282      : driver_device(mconfig, type, tag) ,
283      m_nvram(*this, "nvram"),
284      m_1800_regs(*this, "1800_regs"),
285      m_vregs(*this, "vregs"),
286      m_2801_regs(*this, "2801_regs"),
287      m_2c01_regs(*this, "2c01_regs"),
288      m_3000_regs(*this, "3000_regs"),
289      m_3800_regs(*this, "3800_regs"){ }
283290
284291   bitmap_ind16 *m_temp_reel_bitmap;
285292   tilemap_t *m_tilemap;
r14896r14897
293300   UINT8 *m_reel3_ram;
294301   UINT8 *m_reel4_ram;
295302   UINT8* m_videoram;
296   UINT8 *m_vregs;
297   UINT8 *m_nvram;
298   size_t m_nvram_size;
299   UINT8* m_1800_regs;
300   UINT8* m_3800_regs;
301   UINT8* m_3000_regs;
302   UINT8* m_2801_regs;
303   UINT8* m_2c01_regs;
303   required_shared_ptr<UINT8> m_nvram;
304   required_shared_ptr<UINT8> m_1800_regs;
305   required_shared_ptr<UINT8> m_vregs;
306   required_shared_ptr<UINT8> m_2801_regs;
307   required_shared_ptr<UINT8> m_2c01_regs;
308   required_shared_ptr<UINT8> m_3000_regs;
309   required_shared_ptr<UINT8> m_3800_regs;
304310   DECLARE_WRITE8_MEMBER(sfbonus_videoram_w);
305311   DECLARE_WRITE8_MEMBER(sfbonus_bank_w);
306312   DECLARE_READ8_MEMBER(sfbonus_2800_r);
r14896r14897
802808   UINT8* selectbase = &state->m_videoram[0x600];
803809   UINT8* bg_scroll = &state->m_videoram[0x000];
804810   UINT8* reels_rowscroll = &state->m_videoram[0x400];
805   int globalyscrollreels = (state->m_vregs[6] | state->m_vregs[7]<<8);
806   int globalxscrollreels = (state->m_vregs[4] | state->m_vregs[5]<<8);
811   int globalyscrollreels = (state->m_vregs.target()[6] | state->m_vregs.target()[7]<<8);
812   int globalxscrollreels = (state->m_vregs.target()[4] | state->m_vregs.target()[5]<<8);
807813   globalyscrollreels += 8;
808814   globalxscrollreels += 8;
809815
r14896r14897
932938{
933939   sfbonus_state *state = screen.machine().driver_data<sfbonus_state>();
934940
935   int globalyscroll = (state->m_vregs[2] | state->m_vregs[3]<<8);
936   int globalxscroll = (state->m_vregs[0] | state->m_vregs[1]<<8);
941   int globalyscroll = (state->m_vregs.target()[2] | state->m_vregs.target()[3]<<8);
942   int globalxscroll = (state->m_vregs.target()[0] | state->m_vregs.target()[1]<<8);
937943   UINT8* front_rowscroll = &state->m_videoram[0x200];
938944   ioport_constructor ipt;
939945   int i;
r14896r14897
991997   }
992998#if 0
993999    popmessage("%02x %02x %02x %02x %02x %02x %02x %02x -- %02x -- %02x %02x -- %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
994    state->m_3800_regs[0],
995    state->m_3800_regs[1],
996    state->m_3800_regs[2],
997    state->m_3800_regs[3],
998    state->m_3800_regs[4],
999    state->m_3800_regs[5],
1000    state->m_3800_regs[6],
1001    state->m_3800_regs[7],
1002    state->m_3000_regs[0],
1003    state->m_2801_regs[0],
1004    state->m_2c01_regs[0],
1005    state->m_vregs[8],
1006    state->m_vregs[0],
1007    state->m_vregs[10],
1008    state->m_vregs[11],
1009    state->m_vregs[12],
1010    state->m_vregs[13],
1011    state->m_vregs[14],
1012    state->m_vregs[15],
1013    state->m_vregs[16],
1014    state->m_vregs[17],
1015    state->m_vregs[18],
1016    state->m_vregs[19],
1017    state->m_vregs[20],
1018    state->m_vregs[21],
1019    state->m_vregs[22],
1020    state->m_vregs[23],
1021    state->m_vregs[24],
1022    state->m_vregs[25],
1023    state->m_vregs[26],
1024    state->m_vregs[27],
1025    state->m_vregs[28],
1026    state->m_vregs[29],
1027    state->m_vregs[30],
1028    state->m_vregs[31]
1000    state->m_3800_regs.target()[0],
1001    state->m_3800_regs.target()[1],
1002    state->m_3800_regs.target()[2],
1003    state->m_3800_regs.target()[3],
1004    state->m_3800_regs.target()[4],
1005    state->m_3800_regs.target()[5],
1006    state->m_3800_regs.target()[6],
1007    state->m_3800_regs.target()[7],
1008    state->m_3000_regs.target()[0],
1009    state->m_2801_regs.target()[0],
1010    state->m_2c01_regs.target()[0],
1011    state->m_vregs.target()[8],
1012    state->m_vregs.target()[0],
1013    state->m_vregs.target()[10],
1014    state->m_vregs.target()[11],
1015    state->m_vregs.target()[12],
1016    state->m_vregs.target()[13],
1017    state->m_vregs.target()[14],
1018    state->m_vregs.target()[15],
1019    state->m_vregs.target()[16],
1020    state->m_vregs.target()[17],
1021    state->m_vregs.target()[18],
1022    state->m_vregs.target()[19],
1023    state->m_vregs.target()[20],
1024    state->m_vregs.target()[21],
1025    state->m_vregs.target()[22],
1026    state->m_vregs.target()[23],
1027    state->m_vregs.target()[24],
1028    state->m_vregs.target()[25],
1029    state->m_vregs.target()[26],
1030    state->m_vregs.target()[27],
1031    state->m_vregs.target()[28],
1032    state->m_vregs.target()[29],
1033    state->m_vregs.target()[30],
1034    state->m_vregs.target()[31]
10291035    );
10301036
10311037    popmessage("-- %02x %02x %02x %02x %02x %02x %02x %02x",
1032    state->m_1800_regs[0],
1033    state->m_1800_regs[1],
1034    state->m_1800_regs[2],
1035    state->m_1800_regs[3],
1036    state->m_1800_regs[4],
1037    state->m_1800_regs[5],
1038    state->m_1800_regs[6],
1039    state->m_1800_regs[7]);
1038    state->m_1800_regs.target()[0],
1039    state->m_1800_regs.target()[1],
1040    state->m_1800_regs.target()[2],
1041    state->m_1800_regs.target()[3],
1042    state->m_1800_regs.target()[4],
1043    state->m_1800_regs.target()[5],
1044    state->m_1800_regs.target()[6],
1045    state->m_1800_regs.target()[7]);
10401046#endif
10411047
10421048   ipt = screen.machine().system().ipt;
r14896r14897
10441050      || (ipt == INPUT_PORTS_NAME(amcoe2_poker)))
10451051   {
10461052      // based on pirpok2
1047      output_set_lamp_value(0, (state->m_1800_regs[6] & 0x1) >> 0);
1048      output_set_lamp_value(1, (state->m_1800_regs[6] & 0x4) >> 2);
1049      output_set_lamp_value(2, (state->m_1800_regs[5] & 0x4) >> 2);
1050      output_set_lamp_value(3, (state->m_1800_regs[5] & 0x1) >> 0);
1051      output_set_lamp_value(4, (state->m_1800_regs[4] & 0x4) >> 2);
1052      output_set_lamp_value(5, (state->m_1800_regs[4] & 0x1) >> 0);
1053      output_set_lamp_value(0, (state->m_1800_regs.target()[6] & 0x1) >> 0);
1054      output_set_lamp_value(1, (state->m_1800_regs.target()[6] & 0x4) >> 2);
1055      output_set_lamp_value(2, (state->m_1800_regs.target()[5] & 0x4) >> 2);
1056      output_set_lamp_value(3, (state->m_1800_regs.target()[5] & 0x1) >> 0);
1057      output_set_lamp_value(4, (state->m_1800_regs.target()[4] & 0x4) >> 2);
1058      output_set_lamp_value(5, (state->m_1800_regs.target()[4] & 0x1) >> 0);
10531059   }
10541060   else if ((ipt == INPUT_PORTS_NAME(amcoe1_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe1_reels4))
10551061      || (ipt == INPUT_PORTS_NAME(amcoe1_poker)))
10561062   {
1057      output_set_lamp_value(0, (state->m_1800_regs[0] & 0x2) >> 1);
1058      output_set_lamp_value(1, (state->m_1800_regs[4] & 0x2) >> 1);
1059      output_set_lamp_value(2, (state->m_1800_regs[3] & 0x2) >> 1);
1060      output_set_lamp_value(3, (state->m_1800_regs[6] & 0x4) >> 2);
1061      output_set_lamp_value(4, (state->m_1800_regs[4] & 0x4) >> 2);
1062      output_set_lamp_value(5, (state->m_1800_regs[3] & 0x4) >> 2);
1063      output_set_lamp_value(0, (state->m_1800_regs.target()[0] & 0x2) >> 1);
1064      output_set_lamp_value(1, (state->m_1800_regs.target()[4] & 0x2) >> 1);
1065      output_set_lamp_value(2, (state->m_1800_regs.target()[3] & 0x2) >> 1);
1066      output_set_lamp_value(3, (state->m_1800_regs.target()[6] & 0x4) >> 2);
1067      output_set_lamp_value(4, (state->m_1800_regs.target()[4] & 0x4) >> 2);
1068      output_set_lamp_value(5, (state->m_1800_regs.target()[3] & 0x4) >> 2);
10631069   }
10641070
10651071   return 0;
r14896r14897
10691075
10701076static ADDRESS_MAP_START( sfbonus_map, AS_PROGRAM, 8, sfbonus_state )
10711077   AM_RANGE(0x0000, 0xefff) AM_ROMBANK("bank1") AM_WRITE(sfbonus_videoram_w)
1072   AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE(m_nvram) AM_SIZE(m_nvram_size)
1078   AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("nvram")
10731079ADDRESS_MAP_END
10741080
10751081WRITE8_MEMBER(sfbonus_state::sfbonus_bank_w)
r14896r14897
11131119// lamps and coin counters
11141120WRITE8_MEMBER(sfbonus_state::sfbonus_1800_w)
11151121{
1116   m_1800_regs[offset] = data;
1122   m_1800_regs.target()[offset] = data;
11171123}
11181124
11191125WRITE8_MEMBER(sfbonus_state::sfbonus_3800_w)
11201126{
1121   m_3800_regs[offset] = data;
1127   m_3800_regs.target()[offset] = data;
11221128}
11231129
11241130WRITE8_MEMBER(sfbonus_state::sfbonus_3000_w)
11251131{
1126   m_3000_regs[offset] = data;
1132   m_3000_regs.target()[offset] = data;
11271133}
11281134
11291135WRITE8_MEMBER(sfbonus_state::sfbonus_2801_w)
11301136{
1131   m_2801_regs[offset] = data;
1137   m_2801_regs.target()[offset] = data;
11321138}
11331139
11341140WRITE8_MEMBER(sfbonus_state::sfbonus_2c01_w)
11351141{
1136   m_2c01_regs[offset] = data;
1142   m_2c01_regs.target()[offset] = data;
11371143}
11381144
11391145
r14896r14897
11541160   AM_RANGE(0x0c01, 0x0c01) AM_DEVWRITE("ramdac", ramdac_device, pal_w)
11551161   AM_RANGE(0x0c02, 0x0c02) AM_DEVWRITE("ramdac", ramdac_device, mask_w)
11561162
1157   AM_RANGE(0x1800, 0x1807) AM_WRITE(sfbonus_1800_w) AM_BASE(m_1800_regs) // lamps and coin counters
1163   AM_RANGE(0x1800, 0x1807) AM_WRITE(sfbonus_1800_w) AM_SHARE("1800_regs") // lamps and coin counters
11581164
1159   AM_RANGE(0x2400, 0x241f) AM_RAM AM_BASE(m_vregs)
1165   AM_RANGE(0x2400, 0x241f) AM_RAM AM_SHARE("vregs")
11601166
11611167   AM_RANGE(0x2800, 0x2800) AM_READ(sfbonus_2800_r)
1162   AM_RANGE(0x2801, 0x2801) AM_READ(sfbonus_2801_r) AM_WRITE(sfbonus_2801_w) AM_BASE(m_2801_regs)
1168   AM_RANGE(0x2801, 0x2801) AM_READ(sfbonus_2801_r) AM_WRITE(sfbonus_2801_w) AM_SHARE("2801_regs")
11631169
11641170   AM_RANGE(0x2c00, 0x2c00) AM_READ(sfbonus_2c00_r)
1165   AM_RANGE(0x2c01, 0x2c01) AM_READ(sfbonus_2c01_r) AM_WRITE(sfbonus_2c01_w) AM_BASE(m_2c01_regs)
1171   AM_RANGE(0x2c01, 0x2c01) AM_READ(sfbonus_2c01_r) AM_WRITE(sfbonus_2c01_w) AM_SHARE("2c01_regs")
11661172
1167   AM_RANGE(0x3000, 0x3000) AM_WRITE(sfbonus_3000_w) AM_BASE(m_3000_regs)
1173   AM_RANGE(0x3000, 0x3000) AM_WRITE(sfbonus_3000_w) AM_SHARE("3000_regs")
11681174   AM_RANGE(0x3400, 0x3400) AM_WRITE(sfbonus_bank_w)
11691175   AM_RANGE(0x3800, 0x3800) AM_READ(sfbonus_3800_r)
11701176
1171   AM_RANGE(0x3800, 0x3807) AM_WRITE(sfbonus_3800_w) AM_BASE(m_3800_regs)
1177   AM_RANGE(0x3800, 0x3807) AM_WRITE(sfbonus_3800_w) AM_SHARE("3800_regs")
11721178ADDRESS_MAP_END
11731179
11741180
r14896r14897
12171223{
12181224   sfbonus_state *state = machine.driver_data<sfbonus_state>();
12191225   if (read_or_write)
1220      file->write(state->m_nvram,state->m_nvram_size);
1226      file->write(state->m_nvram,state->m_nvram.bytes());
12211227   else
12221228   {
12231229      if (file)
12241230      {
1225         memset(state->m_nvram,0x00,state->m_nvram_size);
1226         file->read(state->m_nvram,state->m_nvram_size);
1231         memset(state->m_nvram,0x00,state->m_nvram.bytes());
1232         file->read(state->m_nvram,state->m_nvram.bytes());
12271233      }
12281234      else
12291235      {
12301236         UINT8* defaultram = machine.region("defaults")->base();
1231         memset(state->m_nvram,0x00,state->m_nvram_size);
1237         memset(state->m_nvram,0x00,state->m_nvram.bytes());
12321238
12331239         if (defaultram)
12341240            if ((defaultram[0x02]==0x00) && (defaultram[0x03]==0x00)) // hack! rom region optional regions get cleared with garbage if no rom is present, this is not good!
src/mame/drivers/crystal.c
r14896r14897
129129{
130130public:
131131   crystal_state(const machine_config &mconfig, device_type type, const char *tag)
132      : driver_device(mconfig, type, tag) { }
132      : driver_device(mconfig, type, tag) ,
133      m_sysregs(*this, "sysregs"),
134      m_workram(*this, "workram"),
135      m_vidregs(*this, "vidregs"),
136      m_textureram(*this, "textureram"),
137      m_frameram(*this, "frameram"),
138      m_ResetPatch(*this, "ResetPatch"){ }
133139
134140   /* memory pointers */
135   UINT32 *  m_workram;
136   UINT32 *  m_textureram;
137   UINT32 *  m_frameram;
138   UINT32 *  m_sysregs;
139   UINT32 *  m_vidregs;
141   required_shared_ptr<UINT32> m_sysregs;
142   required_shared_ptr<UINT32> m_workram;
143   required_shared_ptr<UINT32> m_vidregs;
144   required_shared_ptr<UINT32> m_textureram;
145   required_shared_ptr<UINT32> m_frameram;
146   required_shared_ptr<UINT32> m_ResetPatch;
140147//  UINT32 *  m_nvram;    // currently this uses generic nvram handling
141148
142149#ifdef IDLE_LOOP_SPEEDUP
r14896r14897
152159   UINT32    m_PIO;
153160   UINT32    m_DMActrl[2];
154161   UINT8     m_OldPort4;
155   UINT32    *m_ResetPatch;
156162
157163   device_t *m_maincpu;
158164   device_t *m_ds1302;
r14896r14897
489495   AM_RANGE(0x01800810, 0x01800813) AM_READWRITE(DMA1_r, DMA1_w)
490496
491497   AM_RANGE(0x01800c04, 0x01800c07) AM_WRITE(IntAck_w)
492   AM_RANGE(0x01800000, 0x0180ffff) AM_RAM AM_BASE(m_sysregs)
493   AM_RANGE(0x02000000, 0x027fffff) AM_RAM AM_BASE(m_workram)
498   AM_RANGE(0x01800000, 0x0180ffff) AM_RAM AM_SHARE("sysregs")
499   AM_RANGE(0x02000000, 0x027fffff) AM_RAM AM_SHARE("workram")
494500
495501   AM_RANGE(0x030000a4, 0x030000a7) AM_READWRITE(FlipCount_r, FlipCount_w)
496502
497   AM_RANGE(0x03000000, 0x0300ffff) AM_RAM AM_BASE(m_vidregs)
498   AM_RANGE(0x03800000, 0x03ffffff) AM_RAM AM_BASE(m_textureram)
499   AM_RANGE(0x04000000, 0x047fffff) AM_RAM AM_BASE(m_frameram)
503   AM_RANGE(0x03000000, 0x0300ffff) AM_RAM AM_SHARE("vidregs")
504   AM_RANGE(0x03800000, 0x03ffffff) AM_RAM AM_SHARE("textureram")
505   AM_RANGE(0x04000000, 0x047fffff) AM_RAM AM_SHARE("frameram")
500506   AM_RANGE(0x04800000, 0x04800fff) AM_DEVREADWRITE_LEGACY("vrender", vr0_snd_read, vr0_snd_write)
501507
502508   AM_RANGE(0x05000000, 0x05000003) AM_READWRITE(FlashCmd_r, FlashCmd_w)
503509   AM_RANGE(0x05000000, 0x05ffffff) AM_ROMBANK("bank1")
504510
505   AM_RANGE(0x44414F4C, 0x44414F7F) AM_RAM AM_BASE(m_ResetPatch)
511   AM_RANGE(0x44414F4C, 0x44414F7F) AM_RAM AM_SHARE("ResetPatch")
506512
507513ADDRESS_MAP_END
508514
r14896r14897
620626      state->m_Timer[i]->adjust(attotime::never);
621627   }
622628
623   vr0_snd_set_areas(machine.device("vrender"), state->m_textureram, state->m_frameram);
629   vr0_snd_set_areas(machine.device("vrender"), state->m_textureram, state->m_frameram.target());
624630#ifdef IDLE_LOOP_SPEEDUP
625631   state->m_FlipCntRead = 0;
626632#endif
r14896r14897
666672   }
667673
668674   Visible  = (UINT16*) Front;
669   DrawDest = (UINT16 *) state->m_frameram;
675   DrawDest = (UINT16 *) state->m_frameram.target();
670676
671677
672678   if (GetVidReg(space, 0x8c) & 0x80)
r14896r14897
683689   tail = GetVidReg(space, 0x80);
684690   while ((head & 0x7ff) != (tail & 0x7ff))
685691   {
686      DoFlip = vrender0_ProcessPacket(state->m_vr0video, 0x03800000 + head * 64, DrawDest, (UINT8*)state->m_textureram);
692      DoFlip = vrender0_ProcessPacket(state->m_vr0video, 0x03800000 + head * 64, DrawDest, (UINT8*)state->m_textureram.target());
687693      head++;
688694      head &= 0x7ff;
689695      if (DoFlip)
src/mame/drivers/eprom.c
r14896r14897
7474 *
7575 *************************************/
7676
77static READ16_HANDLER( special_port1_r )
77READ16_MEMBER(eprom_state::special_port1_r)
7878{
79   eprom_state *state = space->machine().driver_data<eprom_state>();
80   int result = input_port_read(space->machine(), "260010");
79   int result = input_port_read(machine(), "260010");
8180
82   if (state->m_sound_to_cpu_ready) result ^= 0x0004;
83   if (state->m_cpu_to_sound_ready) result ^= 0x0008;
81   if (m_sound_to_cpu_ready) result ^= 0x0004;
82   if (m_cpu_to_sound_ready) result ^= 0x0008;
8483   result ^= 0x0010;
8584
8685   return result;
8786}
8887
8988
90static READ16_HANDLER( adc_r )
89READ16_MEMBER(eprom_state::adc_r)
9190{
92   eprom_state *state = space->machine().driver_data<eprom_state>();
9391   static const char *const adcnames[] = { "ADC0", "ADC1", "ADC2", "ADC3" };
94   int result = input_port_read(space->machine(), adcnames[state->m_last_offset & 3]);
92   int result = input_port_read(machine(), adcnames[m_last_offset & 3]);
9593
96   state->m_last_offset = offset;
94   m_last_offset = offset;
9795   return result;
9896}
9997
r14896r14897
105103 *
106104 *************************************/
107105
108static WRITE16_HANDLER( eprom_latch_w )
106WRITE16_MEMBER(eprom_state::eprom_latch_w)
109107{
110   eprom_state *state = space->machine().driver_data<eprom_state>();
111108
112   if (ACCESSING_BITS_0_7 && (space->machine().device("extra") != NULL))
109   if (ACCESSING_BITS_0_7 && (machine().device("extra") != NULL))
113110   {
114111      /* bit 0: reset extra CPU */
115112      if (data & 1)
116         cputag_set_input_line(space->machine(), "extra", INPUT_LINE_RESET, CLEAR_LINE);
113         cputag_set_input_line(machine(), "extra", INPUT_LINE_RESET, CLEAR_LINE);
117114      else
118         cputag_set_input_line(space->machine(), "extra", INPUT_LINE_RESET, ASSERT_LINE);
115         cputag_set_input_line(machine(), "extra", INPUT_LINE_RESET, ASSERT_LINE);
119116
120117      /* bits 1-4: screen intensity */
121      state->m_screen_intensity = (data & 0x1e) >> 1;
118      m_screen_intensity = (data & 0x1e) >> 1;
122119
123120      /* bit 5: video disable */
124      state->m_video_disable = (data & 0x20);
121      m_video_disable = (data & 0x20);
125122   }
126123}
127124
r14896r14897
133130 *
134131 *************************************/
135132
136static READ16_HANDLER( sync_r )
133READ16_MEMBER(eprom_state::sync_r)
137134{
138   eprom_state *state = space->machine().driver_data<eprom_state>();
139   return state->m_sync_data[offset];
135   return m_sync_data[offset];
140136}
141137
142138
143static WRITE16_HANDLER( sync_w )
139WRITE16_MEMBER(eprom_state::sync_w)
144140{
145   eprom_state *state = space->machine().driver_data<eprom_state>();
146   int oldword = state->m_sync_data[offset];
141   int oldword = m_sync_data[offset];
147142   int newword = oldword;
148143   COMBINE_DATA(&newword);
149144
150   state->m_sync_data[offset] = newword;
145   m_sync_data[offset] = newword;
151146   if ((oldword & 0xff00) != (newword & 0xff00))
152      device_yield(&space->device());
147      device_yield(&space.device());
153148}
154149
155150
r14896r14897
167162   AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1")
168163   AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
169164   AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000")
170   AM_RANGE(0x260010, 0x26001f) AM_READ_LEGACY(special_port1_r)
171   AM_RANGE(0x260020, 0x26002f) AM_READ_LEGACY(adc_r)
165   AM_RANGE(0x260010, 0x26001f) AM_READ(special_port1_r)
166   AM_RANGE(0x260020, 0x26002f) AM_READ(adc_r)
172167   AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
173168   AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w)
174169   AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
175   AM_RANGE(0x360010, 0x360011) AM_WRITE_LEGACY(eprom_latch_w)
170   AM_RANGE(0x360010, 0x360011) AM_WRITE(eprom_latch_w)
176171   AM_RANGE(0x360020, 0x360021) AM_WRITE_LEGACY(atarigen_sound_reset_w)
177172   AM_RANGE(0x360030, 0x360031) AM_WRITE_LEGACY(atarigen_sound_w)
178173   AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_SHARE("paletteram")
r14896r14897
192187   AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1")
193188   AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
194189   AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000")
195   AM_RANGE(0x260010, 0x26001f) AM_READ_LEGACY(special_port1_r)
196   AM_RANGE(0x260020, 0x26002f) AM_READ_LEGACY(adc_r)
190   AM_RANGE(0x260010, 0x26001f) AM_READ(special_port1_r)
191   AM_RANGE(0x260020, 0x26002f) AM_READ(adc_r)
197192   AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
198193   AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w)
199194   AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
200//  AM_RANGE(0x360010, 0x360011) AM_WRITE_LEGACY(eprom_latch_w)
195//  AM_RANGE(0x360010, 0x360011) AM_WRITE(eprom_latch_w)
201196   AM_RANGE(0x360020, 0x360021) AM_WRITE_LEGACY(atarigen_sound_reset_w)
202197   AM_RANGE(0x360030, 0x360031) AM_WRITE_LEGACY(atarigen_sound_w)
203198   AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_SHARE("paletteram")
r14896r14897
220215
221216static ADDRESS_MAP_START( extra_map, AS_PROGRAM, 16, eprom_state )
222217   AM_RANGE(0x000000, 0x07ffff) AM_ROM
223   AM_RANGE(0x16cc00, 0x16cc01) AM_READWRITE_LEGACY(sync_r, sync_w) AM_SHARE("share2") AM_BASE(m_sync_data)
218   AM_RANGE(0x16cc00, 0x16cc01) AM_READWRITE(sync_r, sync_w) AM_SHARE("share2") AM_BASE(m_sync_data)
224219   AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1")
225220   AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000")
226   AM_RANGE(0x260010, 0x26001f) AM_READ_LEGACY(special_port1_r)
227   AM_RANGE(0x260020, 0x26002f) AM_READ_LEGACY(adc_r)
221   AM_RANGE(0x260010, 0x26001f) AM_READ(special_port1_r)
222   AM_RANGE(0x260020, 0x26002f) AM_READ(adc_r)
228223   AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
229224   AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
230   AM_RANGE(0x360010, 0x360011) AM_WRITE_LEGACY(eprom_latch_w)
225   AM_RANGE(0x360010, 0x360011) AM_WRITE(eprom_latch_w)
231226   AM_RANGE(0x360020, 0x360021) AM_WRITE_LEGACY(atarigen_sound_reset_w)
232227   AM_RANGE(0x360030, 0x360031) AM_WRITE_LEGACY(atarigen_sound_w)
233228ADDRESS_MAP_END
r14896r14897
728723   atarijsa_init(machine, "260010", 0x0002);
729724
730725   /* install CPU synchronization handlers */
731   state->m_sync_data = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x16cc00, 0x16cc01, FUNC(sync_r), FUNC(sync_w));
732   state->m_sync_data = machine.device("extra")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x16cc00, 0x16cc01, FUNC(sync_r), FUNC(sync_w));
726   state->m_sync_data = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),state), write16_delegate(FUNC(eprom_state::sync_w),state));
727   state->m_sync_data = machine.device("extra")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),state), write16_delegate(FUNC(eprom_state::sync_w),state));
733728}
734729
735730
src/mame/drivers/madmotor.c
r14896r14897
2929
3030   if (ACCESSING_BITS_0_7)
3131   {
32      soundlatch_w(space, 0, data & 0xff);
32      soundlatch_byte_w(space, 0, data & 0xff);
3333      device_set_input_line(m_audiocpu, 0, HOLD_LINE);
3434   }
3535}
r14896r14897
5656   AM_RANGE(0x1a4000, 0x1a4fff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_data_r, deco_bac06_pf_data_w)
5757   AM_RANGE(0x3e0000, 0x3e3fff) AM_RAM
5858   AM_RANGE(0x3e8000, 0x3e87ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
59   AM_RANGE(0x3f0000, 0x3f07ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
59   AM_RANGE(0x3f0000, 0x3f07ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
6060   AM_RANGE(0x3f8002, 0x3f8003) AM_READ_PORT("P1_P2")
6161   AM_RANGE(0x3f8004, 0x3f8005) AM_READ_PORT("DSW")
6262   AM_RANGE(0x3f8006, 0x3f8007) AM_READ_PORT("SYSTEM")
r14896r14897
7272   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ym2", ym2151_r,ym2151_w)
7373   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
7474   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
75   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
75   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
7676   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
7777   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
7878   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/chinsan.c
r14896r14897
5151{
5252public:
5353   chinsan_state(const machine_config &mconfig, device_type type, const char *tag)
54      : driver_device(mconfig, type, tag) { }
54      : driver_device(mconfig, type, tag) ,
55      m_video(*this, "video"){ }
5556
5657   /* memory pointers */
57   UINT8 * m_video;
58   required_shared_ptr<UINT8> m_video;
5859
5960   /* misc */
6061   UINT8    m_port_select;
r14896r14897
9899      for (x = 0; x < 64; x++)
99100      {
100101         int tileno, colour;
101         tileno = state->m_video[count] | (state->m_video[count + 0x800] << 8);
102         colour = state->m_video[count + 0x1000] >> 3;
102         tileno = state->m_video.target()[count] | (state->m_video.target()[count + 0x800] << 8);
103         colour = state->m_video.target()[count + 0x1000] >> 3;
103104         drawgfx_opaque(bitmap,cliprect,screen.machine().gfx[0],tileno,colour,0,0,x*8,y*8);
104105         count++;
105106      }
r14896r14897
242243   AM_RANGE(0x0000, 0x7fff) AM_ROM
243244   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
244245   AM_RANGE(0xc000, 0xdfff) AM_RAM
245   AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_BASE(m_video)
246   AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_SHARE("video")
246247ADDRESS_MAP_END
247248
248249static ADDRESS_MAP_START( chinsan_io, AS_IO, 8, chinsan_state )
src/mame/drivers/cshooter.c
r14896r14897
9292{
9393public:
9494   cshooter_state(const machine_config &mconfig, device_type type, const char *tag)
95      : driver_device(mconfig, type, tag) { }
95      : driver_device(mconfig, type, tag) ,
96      m_txram(*this, "txram"),
97      m_mainram(*this, "mainram"),
98      m_spriteram(*this, "spriteram"){ }
9699
97   UINT8* m_txram;
100   required_shared_ptr<UINT8> m_txram;
98101   tilemap_t *m_txtilemap;
99   UINT8 *m_mainram;
102   required_shared_ptr<UINT8> m_mainram;
100103   int m_coin_stat;
101104   int m_counter;
102   UINT8 *m_spriteram;
103   size_t m_spriteram_size;
105   required_shared_ptr<UINT8> m_spriteram;
104106   DECLARE_WRITE8_MEMBER(cshooter_txram_w);
105107   DECLARE_READ8_MEMBER(cshooter_coin_r);
106108   DECLARE_WRITE8_MEMBER(cshooter_c500_w);
r14896r14897
117119static TILE_GET_INFO( get_cstx_tile_info )
118120{
119121   cshooter_state *state = machine.driver_data<cshooter_state>();
120   int code = (state->m_txram[tile_index*2]);
121   int attr = (state->m_txram[tile_index*2+1]);
122   int code = (state->m_txram.target()[tile_index*2]);
123   int attr = (state->m_txram.target()[tile_index*2+1]);
122124   int rg;
123125   rg=0;
124126   if (attr & 0x20) rg = 1;
r14896r14897
133135
134136WRITE8_MEMBER(cshooter_state::cshooter_txram_w)
135137{
136   m_txram[offset] = data;
138   m_txram.target()[offset] = data;
137139   m_txtilemap->mark_tile_dirty(offset/2);
138140}
139141
r14896r14897
152154
153155   //sprites
154156   {
155      UINT8 *spriteram = state->m_spriteram;
157      UINT8 *spriteram = state->m_spriteram.target();
156158      int i;
157      for(i=0;i<state->m_spriteram_size;i+=4)
159      for(i=0;i<state->m_spriteram.bytes();i+=4)
158160      {
159161         if(spriteram[i+3]!=0)
160162         {
r14896r14897
275277   AM_RANGE(0xc600, 0xc600) AM_WRITENOP         // see notes
276278   AM_RANGE(0xc700, 0xc700) AM_WRITE(cshooter_c700_w)
277279   AM_RANGE(0xc801, 0xc801) AM_WRITENOP         // see notes
278   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(cshooter_txram_w) AM_BASE(m_txram)
280   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(cshooter_txram_w) AM_SHARE("txram")
279281   AM_RANGE(0xd800, 0xdfff) AM_RAM
280282   AM_RANGE(0xe000, 0xffff) AM_RAM
281283ADDRESS_MAP_END
r14896r14897
304306   AM_RANGE(0xc600, 0xc600) AM_WRITENOP         // see notes
305307   AM_RANGE(0xc700, 0xc700) AM_WRITE(cshooter_c700_w)
306308   AM_RANGE(0xc801, 0xc801) AM_WRITENOP         // see notes
307   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(cshooter_txram_w) AM_BASE(m_txram)
309   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(cshooter_txram_w) AM_SHARE("txram")
308310   AM_RANGE(0xd800, 0xdbff) AM_WRITE(pal2_w) AM_READ(pal_r) AM_SHARE("paletteram")
309311   AM_RANGE(0xdc11, 0xdc11) AM_WRITE(bank_w)
310312   AM_RANGE(0xdc00, 0xdc1f) AM_RAM //video registers
311313   AM_RANGE(0xde00, 0xde0f) AM_READWRITE(seibu_sound_comms_r,seibu_sound_comms_w)
312   AM_RANGE(0xe000, 0xfdff) AM_RAM AM_BASE(m_mainram)
313   AM_RANGE(0xfe00, 0xffff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
314   AM_RANGE(0xe000, 0xfdff) AM_RAM AM_SHARE("mainram")
315   AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("spriteram")
314316ADDRESS_MAP_END
315317
316318
src/mame/drivers/aerofgt.c
r14896r14897
7171   if (ACCESSING_BITS_0_7)
7272   {
7373      m_pending_command = 1;
74      soundlatch_w(space, offset, data & 0xff);
74      soundlatch_byte_w(space, offset, data & 0xff);
7575      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
7676   }
7777}
r14896r14897
8181   if (ACCESSING_BITS_8_15)
8282   {
8383      m_pending_command = 1;
84      soundlatch_w(space, offset, (data >> 8) & 0xff);
84      soundlatch_byte_w(space, offset, (data >> 8) & 0xff);
8585      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
8686   }
8787}
r14896r14897
9090{
9191   if(ACCESSING_BITS_8_15)
9292   {
93      soundlatch_w(space, 0, (data >> 8) & 0xff);
93      soundlatch_byte_w(space, 0, (data >> 8) & 0xff);
9494      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
9595   }
9696}
r14896r14897
142142   AM_RANGE(0xff8000, 0xff8fff) AM_RAM_WRITE(aerofgt_bg1videoram_w) AM_BASE(m_bg1videoram)
143143   AM_RANGE(0xffc000, 0xffc3ff) AM_WRITEONLY AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
144144   AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_BASE(m_rasterram)   /* bg1 scroll registers */
145   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
145   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
146146   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0") AM_WRITE(pspikes_palette_bank_w)
147147   AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(pspikes_gfxbank_w)
148148   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg1scrolly_w)
r14896r14897
158158   AM_RANGE(0xffc000, 0xffcbff) AM_RAM AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
159159   AM_RANGE(0xffd200, 0xffd201) AM_WRITE(pspikesb_gfxbank_w)
160160   AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_BASE(m_rasterram)   /* bg1 scroll registers */
161   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
161   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
162162   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0")
163163   AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1")
164164   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg1scrolly_w)
r14896r14897
178178   AM_RANGE(0xffc000, 0xffcfff) AM_RAM AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
179179   //AM_RANGE(0xffd200, 0xffd201) AM_WRITE(pspikesb_gfxbank_w)
180180   AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_BASE(m_rasterram)   /* bg1 scroll registers */
181   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
181   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
182182   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0")
183183   AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(pspikes_gfxbank_w)
184184   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg1scrolly_w)
r14896r14897
193193   AM_RANGE(0xff8000, 0xff8fff) AM_RAM_WRITE(aerofgt_bg1videoram_w) AM_BASE(m_bg1videoram)
194194   AM_RANGE(0xffc000, 0xffcbff) AM_RAM AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
195195   AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_BASE(m_rasterram)   /* bg1 scroll registers */
196   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
196   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
197197   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0") AM_WRITE(pspikes_palette_bank_w)
198198   AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(pspikes_gfxbank_w)
199199   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW")
r14896r14897
211211   AM_RANGE(0x0c0000, 0x0cffff) AM_RAM   /* work RAM */
212212   AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM   /* work RAM */
213213   AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
214   AM_RANGE(0x0fe000, 0x0fe7ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
214   AM_RANGE(0x0fe000, 0x0fe7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
215215   AM_RANGE(0x0ff000, 0x0ff001) AM_READ_PORT("IN0")
216216   AM_RANGE(0x0ff002, 0x0ff003) AM_READ_PORT("IN1") AM_WRITE(karatblz_gfxbank_w)
217217   AM_RANGE(0x0ff004, 0x0ff005) AM_READ_PORT("IN2")
r14896r14897
229229   AM_RANGE(0xff8000, 0xffbfff) AM_RAM   /* work RAM */
230230   AM_RANGE(0xffc000, 0xffc7ff) AM_RAM AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
231231   AM_RANGE(0xffd000, 0xffd1ff) AM_RAM AM_BASE(m_rasterram)   /* bg1 scroll registers */
232   AM_RANGE(0xffe000, 0xffe7ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
232   AM_RANGE(0xffe000, 0xffe7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
233233   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0") AM_WRITE(spinlbrk_gfxbank_w)
234234   AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(aerofgt_bg2scrollx_w)
235235   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW")
r14896r14897
247247   AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM   /* work RAM */
248248   AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
249249   AM_RANGE(0x0fd000, 0x0fdfff) AM_RAM AM_BASE(m_rasterram)   /* bg1 scroll registers */
250   AM_RANGE(0x0fe000, 0x0fe7ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
250   AM_RANGE(0x0fe000, 0x0fe7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
251251   AM_RANGE(0x0ff000, 0x0ff001) AM_READ_PORT("IN0")
252252   AM_RANGE(0x0ff002, 0x0ff003) AM_READ_PORT("IN1") AM_WRITE(aerofgt_bg1scrolly_w)
253253   AM_RANGE(0x0ff004, 0x0ff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg2scrollx_w)
r14896r14897
267267   AM_RANGE(0x0e4000, 0x0e7fff) AM_RAM AM_BASE_SIZE(m_spriteram2, m_spriteram2_size)
268268   AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM   /* work RAM */
269269   AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
270   AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
270   AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
271271   AM_RANGE(0x0fe000, 0x0fe001) AM_READ_PORT("IN0")
272272   AM_RANGE(0x0fe002, 0x0fe003) AM_READ_PORT("IN1") AM_WRITE(aerofgt_bg1scrolly_w)
273273   AM_RANGE(0x0fe004, 0x0fe005) AM_READ_PORT("DSW1") AM_WRITE(aerofgt_bg2scrollx_w)
r14896r14897
280280
281281static ADDRESS_MAP_START( aerofgt_map, AS_PROGRAM, 16, aerofgt_state )
282282   AM_RANGE(0x000000, 0x07ffff) AM_ROM
283   AM_RANGE(0x1a0000, 0x1a07ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
283   AM_RANGE(0x1a0000, 0x1a07ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
284284   AM_RANGE(0x1b0000, 0x1b07ff) AM_RAM AM_BASE(m_rasterram)   /* used only for the scroll registers */
285285   AM_RANGE(0x1b0800, 0x1b0801) AM_NOP   /* ??? */
286286   AM_RANGE(0x1b0ff0, 0x1b0fff) AM_RAM   /* stack area during boot */
r14896r14897
312312   AM_RANGE(0x0e4000, 0x0e7fff) AM_RAM AM_BASE_SIZE(m_spriteram2, m_spriteram2_size)
313313   AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM   /* work RAM */
314314   AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM //AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
315   AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
315   AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
316316   AM_RANGE(0x0fe000, 0x0fe001) AM_READ_PORT("IN0")
317317   AM_RANGE(0x0fe002, 0x0fe003) AM_READ_PORT("IN1")
318318   AM_RANGE(0x0fe004, 0x0fe005) AM_READ_PORT("DSW1")
r14896r14897
341341   AM_RANGE(0x0e4000, 0x0e7fff) AM_RAM AM_BASE_SIZE(m_spriteram2, m_spriteram2_size)
342342   AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM   /* work RAM */
343343   AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
344   AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
344   AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
345345   AM_RANGE(0x0fe000, 0x0fe001) AM_READ_PORT("IN0")
346346   AM_RANGE(0x0fe002, 0x0fe003) AM_READ_PORT("IN1")
347347   AM_RANGE(0x0fe004, 0x0fe005) AM_READ_PORT("DSW1")
r14896r14897
368368   AM_RANGE(0xff8000, 0xff8fff) AM_RAM_WRITE(aerofgt_bg1videoram_w) AM_BASE(m_bg1videoram)
369369   AM_RANGE(0xffc000, 0xffc3ff) AM_WRITEONLY AM_BASE_SIZE(m_spriteram3, m_spriteram3_size)
370370   AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_BASE(m_rasterram)   /* bg1 scroll registers */
371   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
371   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
372372   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0") AM_WRITE(pspikes_palette_bank_w)
373373   AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(pspikes_gfxbank_w)
374374   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg1scrolly_w)
r14896r14897
385385static ADDRESS_MAP_START( turbofrc_sound_portmap, AS_IO, 8, aerofgt_state )
386386   ADDRESS_MAP_GLOBAL_MASK(0xff)
387387   AM_RANGE(0x00, 0x00) AM_WRITE(aerofgt_sh_bankswitch_w)
388   AM_RANGE(0x14, 0x14) AM_READ(soundlatch_r) AM_WRITE(pending_command_clear_w)
388   AM_RANGE(0x14, 0x14) AM_READ(soundlatch_byte_r) AM_WRITE(pending_command_clear_w)
389389   AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
390390ADDRESS_MAP_END
391391
r14896r14897
394394   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
395395   AM_RANGE(0x04, 0x04) AM_WRITE(aerofgt_sh_bankswitch_w)
396396   AM_RANGE(0x08, 0x08) AM_WRITE(pending_command_clear_w)
397   AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_r)
397   AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_byte_r)
398398ADDRESS_MAP_END
399399
400400static ADDRESS_MAP_START( aerfboot_sound_map, AS_PROGRAM, 8, aerofgt_state )
r14896r14897
402402   AM_RANGE(0x8000, 0x87ff) AM_RAM
403403   AM_RANGE(0x9000, 0x9000) AM_WRITE(aerfboot_okim6295_banking_w)
404404   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
405   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
405   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
406406ADDRESS_MAP_END
407407
408408static ADDRESS_MAP_START( wbbc97_sound_map, AS_PROGRAM, 8, aerofgt_state )
r14896r14897
411411   AM_RANGE(0xf800, 0xf800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
412412   AM_RANGE(0xf810, 0xf811) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w)
413413   AM_RANGE(0xfc00, 0xfc00) AM_NOP
414   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
414   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_byte_r)
415415ADDRESS_MAP_END
416416
417417static INPUT_PORTS_START( pspikes )
src/mame/drivers/rocnrope.c
r14896r14897
6262   AM_RANGE(0x8083, 0x8083) AM_WRITENOP   /* Coin counter 1 */
6363   AM_RANGE(0x8084, 0x8084) AM_WRITENOP   /* Coin counter 2 */
6464   AM_RANGE(0x8087, 0x8087) AM_WRITE(irq_mask_w)
65   AM_RANGE(0x8100, 0x8100) AM_WRITE(soundlatch_w)
65   AM_RANGE(0x8100, 0x8100) AM_WRITE(soundlatch_byte_w)
6666   AM_RANGE(0x8182, 0x818d) AM_WRITE(rocnrope_interrupt_vector_w)
6767   AM_RANGE(0x6000, 0xffff) AM_ROM
6868ADDRESS_MAP_END
src/mame/drivers/ultrsprt.c
r14896r14897
2121{
2222public:
2323   ultrsprt_state(const machine_config &mconfig, device_type type, const char *tag)
24      : driver_device(mconfig, type, tag) { }
24      : driver_device(mconfig, type, tag) ,
25      m_vram(*this, "vram"),
26      m_workram(*this, "workram"){ }
2527
26   UINT32 *m_vram;
27   UINT32 *m_workram;
28   required_shared_ptr<UINT32> m_vram;
29   required_shared_ptr<UINT32> m_workram;
2830   DECLARE_WRITE32_MEMBER(palette_w);
2931   DECLARE_READ32_MEMBER(eeprom_r);
3032   DECLARE_WRITE32_MEMBER(eeprom_w);
r14896r14897
4244   ultrsprt_state *state = screen.machine().driver_data<ultrsprt_state>();
4345   int i, j;
4446
45   UINT8 *ram = (UINT8 *)state->m_vram;
47   UINT8 *ram = (UINT8 *)state->m_vram.target();
4648
4749   for (j=0; j < 400; j++)
4850   {
r14896r14897
105107   ppcdrc_set_options(machine.device("maincpu"), PPCDRC_COMPATIBLE_OPTIONS);
106108
107109   /* configure fast RAM regions for DRC */
108   ppcdrc_add_fastram(machine.device("maincpu"), 0x80000000, 0x8007ffff, FALSE, state->m_vram);
109   ppcdrc_add_fastram(machine.device("maincpu"), 0xff000000, 0xff01ffff, FALSE, state->m_workram);
110   ppcdrc_add_fastram(machine.device("maincpu"), 0x80000000, 0x8007ffff, FALSE, state->m_vram.target());
111   ppcdrc_add_fastram(machine.device("maincpu"), 0xff000000, 0xff01ffff, FALSE, state->m_workram.target());
110112}
111113
112114
113115
114116static ADDRESS_MAP_START( ultrsprt_map, AS_PROGRAM, 32, ultrsprt_state )
115   AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_BASE(m_vram)
117   AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_SHARE("vram")
116118   AM_RANGE(0x70000000, 0x70000003) AM_READWRITE(eeprom_r, eeprom_w)
117119   AM_RANGE(0x70000020, 0x70000023) AM_READ_PORT("P1")
118120   AM_RANGE(0x70000040, 0x70000043) AM_READ_PORT("P2")
119121   AM_RANGE(0x70000080, 0x70000087) AM_DEVWRITE_LEGACY("k056800", k056800_host_w)
120122   AM_RANGE(0x70000088, 0x7000008f) AM_DEVREAD_LEGACY("k056800", k056800_host_r)
121123   AM_RANGE(0x700000e0, 0x700000e3) AM_WRITE(int_ack_w)
122   AM_RANGE(0x7f000000, 0x7f01ffff) AM_RAM AM_BASE(m_workram)
124   AM_RANGE(0x7f000000, 0x7f01ffff) AM_RAM AM_SHARE("workram")
123125   AM_RANGE(0x7f700000, 0x7f703fff) AM_RAM_WRITE(palette_w) AM_SHARE("paletteram")
124126   AM_RANGE(0x7f800000, 0x7f9fffff) AM_MIRROR(0x00600000) AM_ROM AM_REGION("user1", 0)
125127ADDRESS_MAP_END
src/mame/drivers/midyunit.c
r14896r14897
185185   AM_RANGE(0x01c00060, 0x01c0007f) AM_READWRITE(midyunit_protection_r, midyunit_cmos_enable_w)
186186   AM_RANGE(0x01e00000, 0x01e0001f) AM_WRITE(midyunit_sound_w)
187187   AM_RANGE(0x01f00000, 0x01f0001f) AM_WRITE(midyunit_control_w)
188   AM_RANGE(0x02000000, 0x05ffffff) AM_READ(midyunit_gfxrom_r) AM_BASE(m_gfx_rom) AM_SIZE(m_gfx_rom_size)
188   AM_RANGE(0x02000000, 0x05ffffff) AM_READ(midyunit_gfxrom_r) AM_BASE_SIZE(m_gfx_rom,m_gfx_rom_size)
189189   AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE_LEGACY(tms34010_io_register_r, tms34010_io_register_w)
190190   AM_RANGE(0xff800000, 0xffffffff) AM_ROM AM_REGION("user1", 0)
191191ADDRESS_MAP_END
r14896r14897
196196   AM_RANGE(0x8000, 0x87ff) AM_RAM
197197   AM_RANGE(0x9000, 0x97ff) AM_DEVWRITE_LEGACY("oki", yawdim_oki_bank_w)
198198   AM_RANGE(0x9800, 0x9fff) AM_DEVREADWRITE("oki", okim6295_device, read, write)
199   AM_RANGE(0xa000, 0xa7ff) AM_READ(soundlatch_r)
199   AM_RANGE(0xa000, 0xa7ff) AM_READ(soundlatch_byte_r)
200200ADDRESS_MAP_END
201201
202202
src/mame/drivers/senjyo.c
r14896r14897
9999
100100WRITE8_MEMBER(senjyo_state::flip_screen_w)
101101{
102   flip_screen_set(machine(), data);
102   flip_screen_set(data);
103103}
104104
105105static WRITE8_DEVICE_HANDLER( sound_cmd_w )
r14896r14897
165165   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE_LEGACY("sn1", sn76496_w)
166166   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("sn2", sn76496_w)
167167   AM_RANGE(0xa000, 0xa000) AM_DEVWRITE_LEGACY("sn3", sn76496_w)
168   AM_RANGE(0xd000, 0xd000) AM_WRITE_LEGACY(senjyo_volume_w)
168   AM_RANGE(0xd000, 0xd000) AM_WRITE(senjyo_volume_w)
169169#if 0
170170   AM_RANGE(0xe000, 0xe000) AM_WRITE_LEGACY(unknown)
171171   AM_RANGE(0xf000, 0xf000) AM_WRITE_LEGACY(unknown)
r14896r14897
233233   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE_LEGACY("sn1", sn76496_w)
234234   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("sn2", sn76496_w)
235235   AM_RANGE(0xa000, 0xa000) AM_DEVWRITE_LEGACY("sn3", sn76496_w)
236   AM_RANGE(0xd000, 0xd000) AM_WRITE_LEGACY(senjyo_volume_w)
236   AM_RANGE(0xd000, 0xd000) AM_WRITE(senjyo_volume_w)
237237#if 0
238238   AM_RANGE(0xe000, 0xe000) AM_WRITE_LEGACY(unknown)
239239   AM_RANGE(0xf000, 0xf000) AM_WRITE_LEGACY(unknown)
src/mame/drivers/spool99.c
r14896r14897
9898{
9999public:
100100   spool99_state(const machine_config &mconfig, device_type type, const char *tag)
101      : driver_device(mconfig, type, tag) { }
101      : driver_device(mconfig, type, tag) ,
102      m_main(*this, "main"),
103      m_vram(*this, "vram"),
104      m_cram(*this, "cram"){ }
102105
103   UINT8 *m_main;
106   required_shared_ptr<UINT8> m_main;
107   required_shared_ptr<UINT8> m_vram;
108   required_shared_ptr<UINT8> m_cram;
104109   tilemap_t *m_sc0_tilemap;
105   UINT8 *m_cram;
106   UINT8 *m_vram;
107110   DECLARE_WRITE8_MEMBER(spool99_vram_w);
108111   DECLARE_WRITE8_MEMBER(spool99_cram_w);
109112   DECLARE_READ8_MEMBER(spool99_io_r);
r14896r14897
113116static TILE_GET_INFO( get_spool99_tile_info )
114117{
115118   spool99_state *state = machine.driver_data<spool99_state>();
116   int code = ((state->m_vram[tile_index*2+1]<<8) | (state->m_vram[tile_index*2+0]));
117   int color = state->m_cram[tile_index*2+0];
119   int code = ((state->m_vram.target()[tile_index*2+1]<<8) | (state->m_vram.target()[tile_index*2+0]));
120   int color = state->m_cram.target()[tile_index*2+0];
118121
119122   SET_TILE_INFO(
120123         0,
r14896r14897
141144WRITE8_MEMBER(spool99_state::spool99_vram_w)
142145{
143146
144   m_vram[offset] = data;
147   m_vram.target()[offset] = data;
145148   m_sc0_tilemap->mark_tile_dirty(offset/2);
146149}
147150
148151WRITE8_MEMBER(spool99_state::spool99_cram_w)
149152{
150153
151   m_cram[offset] = data;
154   m_cram.target()[offset] = data;
152155   m_sc0_tilemap->mark_tile_dirty(offset/2);
153156}
154157
r14896r14897
209212}
210213
211214static ADDRESS_MAP_START( spool99_map, AS_PROGRAM, 8, spool99_state )
212   AM_RANGE(0x0000, 0x00ff) AM_RAM AM_BASE(m_main)
215   AM_RANGE(0x0000, 0x00ff) AM_RAM AM_SHARE("main")
213216   AM_RANGE(0x0100, 0xaeff) AM_ROM AM_REGION("maincpu", 0x100) AM_WRITENOP
214217   AM_RANGE(0xaf00, 0xafff) AM_READ(spool99_io_r)
215218   AM_RANGE(0xafed, 0xafed) AM_DEVWRITE_LEGACY("eeprom", eeprom_resetline_w )
r14896r14897
217220   AM_RANGE(0xafef, 0xafef) AM_DEVWRITE_LEGACY("eeprom", eeprom_dataline_w )
218221   AM_RANGE(0xaff8, 0xaff8) AM_DEVWRITE("oki", okim6295_device, write)
219222
220   AM_RANGE(0xb000, 0xb3ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_SHARE("paletteram")
223   AM_RANGE(0xb000, 0xb3ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
221224
222225   AM_RANGE(0xb800, 0xdfff) AM_RAM
223   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(spool99_vram_w) AM_BASE(m_vram)
224   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(spool99_cram_w) AM_BASE(m_cram)
226   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(spool99_vram_w) AM_SHARE("vram")
227   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(spool99_cram_w) AM_SHARE("cram")
225228ADDRESS_MAP_END
226229
227230READ8_MEMBER(spool99_state::vcarn_io_r)
r14896r14897
255258}
256259
257260static ADDRESS_MAP_START( vcarn_map, AS_PROGRAM, 8, spool99_state )
258   AM_RANGE(0x0000, 0x00ff) AM_RAM AM_BASE(m_main)
261   AM_RANGE(0x0000, 0x00ff) AM_RAM AM_SHARE("main")
259262   AM_RANGE(0x0100, 0xa6ff) AM_ROM AM_REGION("maincpu", 0x100) AM_WRITENOP
260263   AM_RANGE(0xa700, 0xa7ff) AM_READ(vcarn_io_r)
261264   AM_RANGE(0xa745, 0xa745) AM_DEVWRITE_LEGACY("eeprom", eeprom_resetline_w )
r14896r14897
263266   AM_RANGE(0xa747, 0xa747) AM_DEVWRITE_LEGACY("eeprom", eeprom_dataline_w )
264267   AM_RANGE(0xa780, 0xa780) AM_DEVWRITE("oki", okim6295_device, write)
265268
266   AM_RANGE(0xa800, 0xabff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_SHARE("paletteram")
269   AM_RANGE(0xa800, 0xabff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
267270
268271   AM_RANGE(0xb000, 0xdfff) AM_RAM
269272//  AM_RANGE(0xdf00, 0xdfff) AM_READWRITE(vcarn_io_r,vcarn_io_w) AM_BASE_LEGACY(&vcarn_io)
270   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(spool99_vram_w) AM_BASE(m_vram)
271   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(spool99_cram_w) AM_BASE(m_cram)
273   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(spool99_vram_w) AM_SHARE("vram")
274   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(spool99_cram_w) AM_SHARE("cram")
272275ADDRESS_MAP_END
273276
274277
src/mame/drivers/lgp.c
r14896r14897
7474public:
7575   lgp_state(const machine_config &mconfig, device_type type, const char *tag)
7676      : driver_device(mconfig, type, tag),
77        m_laserdisc(*this, "laserdisc") { }
77        m_laserdisc(*this, "laserdisc") ,
78      m_tile_ram(*this, "tile_ram"),
79      m_tile_control_ram(*this, "tile_control_ram"){ }
7880
7981   required_device<pioneer_ldv1000_device> m_laserdisc;
80   UINT8 *m_tile_ram;
81   UINT8 *m_tile_control_ram;
82   required_shared_ptr<UINT8> m_tile_ram;
83   required_shared_ptr<UINT8> m_tile_control_ram;
8284   emu_timer *m_irq_timer;
8385   DECLARE_READ8_MEMBER(ldp_read);
8486   DECLARE_WRITE8_MEMBER(ldp_write);
r14896r14897
112114         /* Somewhere there's a flag that offsets the tilemap by 0x100*x */
113115         /* Palette is likely set somewhere as well (tile_control_ram?) */
114116         drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[0],
115               state->m_tile_ram[current_screen_character],
117               state->m_tile_ram.target()[current_screen_character],
116118               0,
117119               0, 0, charx*8, chary*8, 0);
118120      }
r14896r14897
141143/* PROGRAM MAPS */
142144static ADDRESS_MAP_START( main_program_map, AS_PROGRAM, 8, lgp_state )
143145   AM_RANGE(0x0000,0x7fff) AM_ROM
144   AM_RANGE(0xe000,0xe3ff) AM_RAM AM_BASE(m_tile_ram)
145   AM_RANGE(0xe400,0xe7ff) AM_RAM AM_BASE(m_tile_control_ram)
146   AM_RANGE(0xe000,0xe3ff) AM_RAM AM_SHARE("tile_ram")
147   AM_RANGE(0xe400,0xe7ff) AM_RAM AM_SHARE("tile_control_ram")
146148
147149//  AM_RANGE(0xef00,0xef00) AM_READ_PORT("IN_TEST")
148150   AM_RANGE(0xef80,0xef80) AM_READWRITE(ldp_read,ldp_write)
src/mame/drivers/deadang.c
r14896r14897
6767   AM_RANGE(0x08800, 0x0bfff) AM_WRITEONLY
6868   AM_RANGE(0x0a000, 0x0a001) AM_READ_PORT("P1_P2")
6969   AM_RANGE(0x0a002, 0x0a003) AM_READ_PORT("DSW")
70   AM_RANGE(0x0c000, 0x0cfff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
70   AM_RANGE(0x0c000, 0x0cfff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
7171   AM_RANGE(0x0d000, 0x0dfff) AM_WRITEONLY
7272   AM_RANGE(0x0e000, 0x0e0ff) AM_WRITEONLY AM_BASE(m_scroll_ram)
7373   AM_RANGE(0x0e100, 0x0ffff) AM_WRITEONLY
src/mame/drivers/twincobr.c
r14896r14897
278278   AM_RANGE(0x000000, 0x02ffff) AM_ROM
279279   AM_RANGE(0x030000, 0x033fff) AM_RAM      /* 68K and DSP shared RAM */
280280   AM_RANGE(0x040000, 0x040fff) AM_RAM AM_SHARE("spriteram")
281   AM_RANGE(0x050000, 0x050dff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
281   AM_RANGE(0x050000, 0x050dff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
282282   AM_RANGE(0x060000, 0x060001) AM_DEVWRITE8("crtc", mc6845_device, address_w, 0x00ff)
283283   AM_RANGE(0x060002, 0x060003) AM_DEVWRITE8("crtc", mc6845_device, register_w, 0x00ff)
284284   AM_RANGE(0x070000, 0x070003) AM_WRITE(twincobr_txscroll_w)   /* text layer scroll */
src/mame/drivers/hexion.c
r14896r14897
9696   coin_counter_w(machine(), 1,data & 0x02);
9797
9898   /* bit 5 = flip screen */
99   flip_screen_set(machine(), data & 0x20);
99   flip_screen_set(data & 0x20);
100100
101101   /* other bit unknown */
102102if ((data & 0xdc) != 0x10) popmessage("coincntr %02x",data);
src/mame/drivers/battlnts.c
r14896r14897
6060   AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE_LEGACY("k007342", k007342_r, k007342_w)   /* Color RAM + Video RAM */
6161   AM_RANGE(0x2000, 0x21ff) AM_DEVREADWRITE_LEGACY("k007420", k007420_r, k007420_w)   /* Sprite RAM */
6262   AM_RANGE(0x2200, 0x23ff) AM_DEVREADWRITE_LEGACY("k007342", k007342_scroll_r, k007342_scroll_w)      /* Scroll RAM */
63   AM_RANGE(0x2400, 0x24ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_be_w) AM_SHARE("paletteram")/* palette */
63   AM_RANGE(0x2400, 0x24ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram")/* palette */
6464   AM_RANGE(0x2600, 0x2607) AM_DEVWRITE_LEGACY("k007342", k007342_vreg_w)         /* Video Registers */
6565   AM_RANGE(0x2e00, 0x2e00) AM_READ_PORT("DSW1")
6666   AM_RANGE(0x2e01, 0x2e01) AM_READ_PORT("P2")
r14896r14897
7070   AM_RANGE(0x2e08, 0x2e08) AM_WRITE(battlnts_bankswitch_w)   /* bankswitch control */
7171   AM_RANGE(0x2e0c, 0x2e0c) AM_WRITE(battlnts_spritebank_w)   /* sprite bank select */
7272   AM_RANGE(0x2e10, 0x2e10) AM_WRITE(watchdog_reset_w)         /* watchdog reset */
73   AM_RANGE(0x2e14, 0x2e14) AM_WRITE(soundlatch_w)            /* sound code # */
73   AM_RANGE(0x2e14, 0x2e14) AM_WRITE(soundlatch_byte_w)            /* sound code # */
7474   AM_RANGE(0x2e18, 0x2e18) AM_WRITE(battlnts_sh_irqtrigger_w)   /* cause interrupt on audio CPU */
7575   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")                  /* banked ROM */
7676   AM_RANGE(0x8000, 0xffff) AM_ROM                        /* ROM 777e02.bin */
r14896r14897
8181   AM_RANGE(0x8000, 0x87ff) AM_RAM                     /* RAM */
8282   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ym1", ym3812_r, ym3812_w)      /* YM3812 (chip 1) */
8383   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ym2", ym3812_r, ym3812_w)      /* YM3812 (chip 2) */
84   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)         /* soundlatch_r */
84   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)         /* soundlatch_byte_r */
8585ADDRESS_MAP_END
8686
8787/*************************************
src/mame/drivers/galpani2.c
r14896r14897
112112   }
113113}
114114
115static WRITE8_HANDLER( galpani2_mcu_init_w )
115WRITE8_MEMBER(galpani2_state::galpani2_mcu_init_w)
116116{
117   running_machine &machine = space->machine();
118   address_space *srcspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
119   address_space *dstspace = machine.device("sub")->memory().space(AS_PROGRAM);
117   address_space *srcspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
118   address_space *dstspace = machine().device("sub")->memory().space(AS_PROGRAM);
120119   UINT32 mcu_address, mcu_data;
121120
122121   for ( mcu_address = 0x100010; mcu_address < (0x100010 + 6); mcu_address += 1 )
r14896r14897
124123      mcu_data   =   srcspace->read_byte(mcu_address );
125124      dstspace->write_byte(mcu_address-0x10, mcu_data);
126125   }
127   cputag_set_input_line(machine, "sub", INPUT_LINE_IRQ7, HOLD_LINE); //MCU Initialised
126   cputag_set_input_line(machine(), "sub", INPUT_LINE_IRQ7, HOLD_LINE); //MCU Initialised
128127}
129128
130129static void galpani2_mcu_nmi1(running_machine &machine)
r14896r14897
236235      //logerror("%s : MCU executes CHECKs synchro\n", machine.describe_context());
237236}
238237
239static WRITE8_HANDLER( galpani2_mcu_nmi1_w ) //driven by CPU1's int5 ISR
238WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi1_w)//driven by CPU1's int5 ISR
240239{
241   galpani2_state *state = space->machine().driver_data<galpani2_state>();
242240//for galpan2t:
243241//Triggered from 'maincpu' (00007D60),once, with no command, using alternate line, during init
244242//Triggered from 'maincpu' (000080BE),once, for unknown command, during init
245243//Triggered from 'maincpu' (0000741E),from here on...driven by int5, even if there's no command
246   if ( (data & 1) && !(state->m_old_mcu_nmi1 & 1) )   galpani2_mcu_nmi1(space->machine());
247   //if ( (data & 0x10) && !(state->m_old_mcu_nmi1 & 0x10) )    galpani2_mcu_nmi1(space->machine());
244   if ( (data & 1) && !(m_old_mcu_nmi1 & 1) )   galpani2_mcu_nmi1(machine());
245   //if ( (data & 0x10) && !(m_old_mcu_nmi1 & 0x10) )    galpani2_mcu_nmi1(machine());
248246   //alternate line, same function?
249   state->m_old_mcu_nmi1 = data;
247   m_old_mcu_nmi1 = data;
250248}
251249
252static WRITE8_HANDLER( galpani2_mcu_nmi2_w ) //driven by CPU2's int5 ISR
250WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi2_w)//driven by CPU2's int5 ISR
253251{
254   galpani2_state *state = space->machine().driver_data<galpani2_state>();
255   if ( (data & 1) && !(state->m_old_mcu_nmi2 & 1) )   galpani2_mcu_nmi2(space->machine());
256   state->m_old_mcu_nmi2 = data;
252   if ( (data & 1) && !(m_old_mcu_nmi2 & 1) )   galpani2_mcu_nmi2(machine());
253   m_old_mcu_nmi2 = data;
257254}
258255
259256
r14896r14897
265262
266263***************************************************************************/
267264
268static WRITE8_HANDLER( galpani2_coin_lockout_w )
265WRITE8_MEMBER(galpani2_state::galpani2_coin_lockout_w)
269266{
270      coin_counter_w(space->machine(), 0, data & 0x01);
271      coin_counter_w(space->machine(), 1, data & 0x02);
272      coin_lockout_w(space->machine(), 0,~data & 0x04);
273      coin_lockout_w(space->machine(), 1,~data & 0x08);
267      coin_counter_w(machine(), 0, data & 0x01);
268      coin_counter_w(machine(), 1, data & 0x02);
269      coin_lockout_w(machine(), 0,~data & 0x04);
270      coin_lockout_w(machine(), 1,~data & 0x08);
274271      // & 0x10     CARD in lockout?
275272      // & 0x20     CARD in lockout?
276273      // & 0x40     CARD out
r14896r14897
304301   AM_RANGE(0x314000, 0x314001) AM_WRITENOP                              // ? flip backgrounds ?
305302   AM_RANGE(0x318000, 0x318001) AM_DEVREADWRITE_LEGACY("eeprom", galpani2_eeprom_r, galpani2_eeprom_w)   // EEPROM
306303   AM_RANGE(0x380000, 0x387fff) AM_RAM                                    // Palette?
307   AM_RANGE(0x388000, 0x38ffff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram"   )   // Palette
304   AM_RANGE(0x388000, 0x38ffff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram"   )   // Palette
308305   AM_RANGE(0x390000, 0x3901ff) AM_WRITENOP                              // ? at startup of service mode
309306
310307   AM_RANGE(0x400000, 0x43ffff) AM_RAM_WRITE_LEGACY(galpani2_bg8_0_w) AM_BASE(m_bg8[0])   // Background 0
r14896r14897
327324   AM_RANGE(0x580000, 0x580001) AM_RAM AM_BASE(m_bg8_scrolly[1])         // Background 1 Scroll Y
328325   AM_RANGE(0x5c0000, 0x5c0001) AM_WRITENOP                              // ? 0 at startup only
329326   AM_RANGE(0x600000, 0x600001) AM_WRITENOP                              // Watchdog
330   AM_RANGE(0x640000, 0x640001) AM_WRITE8_LEGACY(galpani2_mcu_init_w, 0x00ff         )   // ? 0 before resetting and at startup, Reset mcu ?
331   AM_RANGE(0x680000, 0x680001) AM_WRITE8_LEGACY(galpani2_mcu_nmi1_w, 0x00ff)            // ? 0 -> 1 -> 0 (lev 5) / 0 -> $10 -> 0
332   AM_RANGE(0x6c0000, 0x6c0001) AM_WRITE8_LEGACY(galpani2_coin_lockout_w, 0xff00      )   // Coin + Card Lockout
327   AM_RANGE(0x640000, 0x640001) AM_WRITE8(galpani2_mcu_init_w, 0x00ff         )   // ? 0 before resetting and at startup, Reset mcu ?
328   AM_RANGE(0x680000, 0x680001) AM_WRITE8(galpani2_mcu_nmi1_w, 0x00ff)            // ? 0 -> 1 -> 0 (lev 5) / 0 -> $10 -> 0
329   AM_RANGE(0x6c0000, 0x6c0001) AM_WRITE8(galpani2_coin_lockout_w, 0xff00      )   // Coin + Card Lockout
333330   AM_RANGE(0x780000, 0x780001) AM_READ_PORT("DSW1_P1")
334331   AM_RANGE(0x780002, 0x780003) AM_READ_PORT("DSW2_P2")
335332   AM_RANGE(0x780004, 0x780005) AM_READ_PORT("SPECIAL")
r14896r14897
350347***************************************************************************/
351348
352349
353static READ16_HANDLER( galpani2_bankedrom_r )
350READ16_MEMBER(galpani2_state::galpani2_bankedrom_r)
354351{
355   galpani2_state *state = space->machine().driver_data<galpani2_state>();
356   UINT16 *ROM = (UINT16 *) space->machine().region( "user1" )->base();
357   size_t    len = space->machine().region( "user1" )->bytes() / 2;
352   UINT16 *ROM = (UINT16 *) machine().region( "user1" )->base();
353   size_t    len = machine().region( "user1" )->bytes() / 2;
358354
359   offset += (0x800000/2) * (*state->m_rombank & 0x0003);
355   offset += (0x800000/2) * (*m_rombank & 0x0003);
360356
361357   if ( offset < len )   return ROM[offset];
362358   else            return 0xffff; //floating bus for absent ROMs
r14896r14897
373369   AM_RANGE(0x6c0000, 0x6c0001) AM_WRITENOP                        // ? 0 at startup only
374370   AM_RANGE(0x700000, 0x700001) AM_WRITENOP                        // Watchdog
375371//  AM_RANGE(0x740000, 0x740001) AM_WRITENOP                                // ? Reset mcu
376   AM_RANGE(0x780000, 0x780001) AM_WRITE8_LEGACY(galpani2_mcu_nmi2_w, 0x00ff)            // ? 0 -> 1 -> 0 (lev 5)
372   AM_RANGE(0x780000, 0x780001) AM_WRITE8(galpani2_mcu_nmi2_w, 0x00ff)            // ? 0 -> 1 -> 0 (lev 5)
377373   AM_RANGE(0x7c0000, 0x7c0001) AM_WRITEONLY AM_BASE(m_rombank)   // Rom Bank
378   AM_RANGE(0x800000, 0xffffff) AM_READ_LEGACY(galpani2_bankedrom_r      )      // Banked ROM
374   AM_RANGE(0x800000, 0xffffff) AM_READ(galpani2_bankedrom_r      )      // Banked ROM
379375ADDRESS_MAP_END
380376
381377/***************************************************************************
src/mame/drivers/midqslvr.c
r14896r14897
8282   DECLARE_WRITE32_MEMBER( bios_ext4_ram_w );
8383
8484   DECLARE_WRITE32_MEMBER( bios_ram_w );
85   DECLARE_READ8_MEMBER(at_page8_r);
86   DECLARE_WRITE8_MEMBER(at_page8_w);
87   DECLARE_READ8_MEMBER(pc_dma_read_byte);
88   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
8589};
8690
8791
r14896r14897
398402   ide_controller32_w(device, 0x3f0/4 + offset, data, mem_mask);
399403}
400404
401static READ8_HANDLER(at_page8_r)
405READ8_MEMBER(midqslvr_state::at_page8_r)
402406{
403   midqslvr_state *state = space->machine().driver_data<midqslvr_state>();
404   UINT8 data = state->m_at_pages[offset % 0x10];
407   UINT8 data = m_at_pages[offset % 0x10];
405408
406409   switch(offset % 8) {
407410   case 1:
408      data = state->m_dma_offset[(offset / 8) & 1][2];
411      data = m_dma_offset[(offset / 8) & 1][2];
409412      break;
410413   case 2:
411      data = state->m_dma_offset[(offset / 8) & 1][3];
414      data = m_dma_offset[(offset / 8) & 1][3];
412415      break;
413416   case 3:
414      data = state->m_dma_offset[(offset / 8) & 1][1];
417      data = m_dma_offset[(offset / 8) & 1][1];
415418      break;
416419   case 7:
417      data = state->m_dma_offset[(offset / 8) & 1][0];
420      data = m_dma_offset[(offset / 8) & 1][0];
418421      break;
419422   }
420423   return data;
421424}
422425
423426
424static WRITE8_HANDLER(at_page8_w)
427WRITE8_MEMBER(midqslvr_state::at_page8_w)
425428{
426   midqslvr_state *state = space->machine().driver_data<midqslvr_state>();
427   state->m_at_pages[offset % 0x10] = data;
429   m_at_pages[offset % 0x10] = data;
428430
429431   switch(offset % 8) {
430432   case 1:
431      state->m_dma_offset[(offset / 8) & 1][2] = data;
433      m_dma_offset[(offset / 8) & 1][2] = data;
432434      break;
433435   case 2:
434      state->m_dma_offset[(offset / 8) & 1][3] = data;
436      m_dma_offset[(offset / 8) & 1][3] = data;
435437      break;
436438   case 3:
437      state->m_dma_offset[(offset / 8) & 1][1] = data;
439      m_dma_offset[(offset / 8) & 1][1] = data;
438440      break;
439441   case 7:
440      state->m_dma_offset[(offset / 8) & 1][0] = data;
442      m_dma_offset[(offset / 8) & 1][0] = data;
441443      break;
442444   }
443445}
444446
445static READ32_HANDLER(at_page32_r)
446{
447   return read32le_with_read8_handler(at_page8_r, space, offset, mem_mask);
448}
449
450
451static WRITE32_HANDLER(at_page32_w)
452{
453   write32le_with_write8_handler(at_page8_w, space, offset, data, mem_mask);
454}
455
456447static READ8_DEVICE_HANDLER(at_dma8237_2_r)
457448{
458449   return i8237_r(device, offset / 2);
r14896r14897
485476}
486477
487478
488static READ8_HANDLER( pc_dma_read_byte )
479READ8_MEMBER(midqslvr_state::pc_dma_read_byte)
489480{
490   midqslvr_state *state = space->machine().driver_data<midqslvr_state>();
491   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
481   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
492482      & 0xFF0000;
493483
494   return space->read_byte(page_offset + offset);
484   return space.read_byte(page_offset + offset);
495485}
496486
497487
498static WRITE8_HANDLER( pc_dma_write_byte )
488WRITE8_MEMBER(midqslvr_state::pc_dma_write_byte)
499489{
500   midqslvr_state *state = space->machine().driver_data<midqslvr_state>();
501   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
490   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
502491      & 0xFF0000;
503492
504   space->write_byte(page_offset + offset, data);
493   space.write_byte(page_offset + offset, data);
505494}
506495
507496static void set_dma_channel(device_t *device, int channel, int state)
r14896r14897
519508{
520509   DEVCB_LINE(pc_dma_hrq_changed),
521510   DEVCB_NULL,
522   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
523   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
511   DEVCB_DRIVER_MEMBER(midqslvr_state, pc_dma_read_byte),
512   DEVCB_DRIVER_MEMBER(midqslvr_state, pc_dma_write_byte),
524513   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
525514   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
526515   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
558547   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
559548   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
560549   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
561   AM_RANGE(0x0080, 0x009f) AM_READWRITE_LEGACY(at_page32_r,            at_page32_w)
550   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,at_page8_w,0xffffffff)
562551   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
563552   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
564553   AM_RANGE(0x00e8, 0x00ef) AM_NOP
src/mame/drivers/exterm.c
r14896r14897
286286   AM_RANGE(0x01500000, 0x0153ffff) AM_MIRROR(0xfc000000) AM_WRITE(exterm_output_port_0_w)
287287   AM_RANGE(0x01580000, 0x015bffff) AM_MIRROR(0xfc000000) AM_WRITE(sound_latch_w)
288288   AM_RANGE(0x015c0000, 0x015fffff) AM_MIRROR(0xfc000000) AM_WRITE(watchdog_reset16_w)
289   AM_RANGE(0x01800000, 0x01807fff) AM_MIRROR(0xfc7f8000) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
289   AM_RANGE(0x01800000, 0x01807fff) AM_MIRROR(0xfc7f8000) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
290290   AM_RANGE(0x02800000, 0x02807fff) AM_MIRROR(0xfc7f8000) AM_RAM AM_SHARE("nvram")
291291   AM_RANGE(0x03000000, 0x03ffffff) AM_MIRROR(0xfc000000) AM_ROM AM_REGION("user1", 0)
292292ADDRESS_MAP_END
src/mame/drivers/seibuspi.c
r14896r14897
817817   state->m_fifoin_read_request = 1;
818818}
819819
820static READ32_HANDLER( sb_coin_r )
820READ32_MEMBER(seibuspi_state::sb_coin_r)
821821{
822   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
823   UINT8 r = state->m_sb_coin_latch;
822   UINT8 r = m_sb_coin_latch;
824823
825   state->m_sb_coin_latch = 0;
824   m_sb_coin_latch = 0;
826825   return r;
827826}
828827
829static WRITE8_HANDLER( sb_coin_w )
828WRITE8_MEMBER(seibuspi_state::sb_coin_w)
830829{
831   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
832830   if (data)
833      state->m_sb_coin_latch = 0xa0 | data;
831      m_sb_coin_latch = 0xa0 | data;
834832   else
835      state->m_sb_coin_latch = 0;
833      m_sb_coin_latch = 0;
836834}
837835
838static READ32_HANDLER( sound_fifo_r )
836READ32_MEMBER(seibuspi_state::sound_fifo_r)
839837{
840   UINT8 r = z80_fifoout_pop(space);
838   UINT8 r = z80_fifoout_pop(&space);
841839
842840   return r;
843841}
844842
845static WRITE32_HANDLER( sound_fifo_w )
843WRITE32_MEMBER(seibuspi_state::sound_fifo_w)
846844{
847845   if( ACCESSING_BITS_0_7 ) {
848      z80_fifoin_push(space, data & 0xff);
846      z80_fifoin_push(&space, data & 0xff);
849847   }
850848}
851849
852static READ32_HANDLER( sound_fifo_status_r )
850READ32_MEMBER(seibuspi_state::sound_fifo_status_r)
853851{
854   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
855852   UINT32 r = 0;
856   if (state->m_fifoout_read_request)
853   if (m_fifoout_read_request)
857854   {
858855      r |= 2;
859856   }
860857   return r | 1;
861858}
862859
863static READ32_HANDLER( spi_int_r )
860READ32_MEMBER(seibuspi_state::spi_int_r)
864861{
865   cputag_set_input_line(space->machine(), "maincpu", 0,CLEAR_LINE );
862   cputag_set_input_line(machine(), "maincpu", 0,CLEAR_LINE );
866863   return 0xffffffff;
867864}
868865
869static READ32_HANDLER( spi_unknown_r )
866READ32_MEMBER(seibuspi_state::spi_unknown_r)
870867{
871868   return 0xffffffff;
872869}
r14896r14897
890887      oki2->set_bank_base((data & 0x4000000) ? 0x40000 : 0);
891888}
892889
893static WRITE32_HANDLER( z80_prg_fifo_w )
890WRITE32_MEMBER(seibuspi_state::z80_prg_fifo_w)
894891{
895   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
896892   if( ACCESSING_BITS_0_7 ) {
897      if (state->m_z80_prg_fifo_pos<0x40000) state->m_z80_rom[state->m_z80_prg_fifo_pos] = data & 0xff;
898      state->m_z80_prg_fifo_pos++;
893      if (m_z80_prg_fifo_pos<0x40000) m_z80_rom[m_z80_prg_fifo_pos] = data & 0xff;
894      m_z80_prg_fifo_pos++;
899895   }
900896}
901897
902static WRITE32_HANDLER( z80_enable_w )
898WRITE32_MEMBER(seibuspi_state::z80_enable_w)
903899{
904   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
905900   // tile banks
906901   if( ACCESSING_BITS_16_23 ) {
907      rf2_set_layer_banks(space->machine(), data >> 16);
902      rf2_set_layer_banks(machine(), data >> 16);
908903   }
909904
910905logerror("z80 data = %08x mask = %08x\n",data,mem_mask);
911906   if( ACCESSING_BITS_0_7 ) {
912907      if( data & 0x1 ) {
913         state->m_z80_prg_fifo_pos = 0;
914         cputag_set_input_line(space->machine(), "soundcpu", INPUT_LINE_RESET, CLEAR_LINE );
908         m_z80_prg_fifo_pos = 0;
909         cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_RESET, CLEAR_LINE );
915910      } else {
916         cputag_set_input_line(space->machine(), "soundcpu", INPUT_LINE_RESET, ASSERT_LINE );
911         cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_RESET, ASSERT_LINE );
917912      }
918913   }
919914}
920915
921static READ32_HANDLER( spi_controls1_r )
916READ32_MEMBER(seibuspi_state::spi_controls1_r)
922917{
923918   if( ACCESSING_BITS_0_7 )
924919   {
925      return input_port_read(space->machine(), "INPUTS");
920      return input_port_read(machine(), "INPUTS");
926921   }
927922   return 0xffffffff;
928923}
929924
930static READ32_HANDLER( spi_controls2_r )
925READ32_MEMBER(seibuspi_state::spi_controls2_r)
931926{
932927   if( ACCESSING_BITS_0_7 )
933928   {
934      return input_port_read(space->machine(), "SYSTEM");
929      return input_port_read(machine(), "SYSTEM");
935930   }
936931   return 0xffffffff;
937932}
r14896r14897
957952}
958953/********************************************************************/
959954
960static READ8_HANDLER( z80_soundfifo_r )
955READ8_MEMBER(seibuspi_state::z80_soundfifo_r)
961956{
962   UINT8 r = z80_fifoin_pop(space);
957   UINT8 r = z80_fifoin_pop(&space);
963958
964959   return r;
965960}
966961
967static WRITE8_HANDLER( z80_soundfifo_w )
962WRITE8_MEMBER(seibuspi_state::z80_soundfifo_w)
968963{
969   z80_fifoout_push(space, data);
964   z80_fifoout_push(&space, data);
970965}
971966
972static READ8_HANDLER( z80_soundfifo_status_r )
967READ8_MEMBER(seibuspi_state::z80_soundfifo_status_r)
973968{
974   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
975969   UINT8 r = 0;
976   if (state->m_fifoin_read_request)
970   if (m_fifoin_read_request)
977971   {
978972      r |= 2;
979973   }
980974   return r | 1;
981975}
982976
983static WRITE8_HANDLER( z80_bank_w )
977WRITE8_MEMBER(seibuspi_state::z80_bank_w)
984978{
985   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
986   if ((data & 7) != state->m_z80_lastbank)
979   if ((data & 7) != m_z80_lastbank)
987980   {
988      state->m_z80_lastbank = (data & 7);
989      memory_set_bankptr(space->machine(), "bank4", state->m_z80_rom + (0x8000 * state->m_z80_lastbank));
981      m_z80_lastbank = (data & 7);
982      memory_set_bankptr(machine(), "bank4", m_z80_rom + (0x8000 * m_z80_lastbank));
990983   }
991984}
992985
993static READ8_HANDLER( z80_jp1_r )
986READ8_MEMBER(seibuspi_state::z80_jp1_r)
994987{
995   return input_port_read(space->machine(), "JP1");
988   return input_port_read(machine(), "JP1");
996989}
997990
998static READ8_HANDLER( z80_coin_r )
991READ8_MEMBER(seibuspi_state::z80_coin_r)
999992{
1000   return input_port_read(space->machine(), "COIN");
993   return input_port_read(machine(), "COIN");
1001994}
1002995
1003static READ32_HANDLER( soundrom_r )
996READ32_MEMBER(seibuspi_state::soundrom_r)
1004997{
1005   UINT8 *sound = (UINT8*)space->machine().region("user2")->base();
1006   UINT16 *sound16 = (UINT16*)space->machine().region("user2")->base();
998   UINT8 *sound = (UINT8*)machine().region("user2")->base();
999   UINT16 *sound16 = (UINT16*)machine().region("user2")->base();
10071000
10081001   if (mem_mask == 0x000000ff)
10091002   {
r14896r14897
10421035   AM_RANGE(0x00000490, 0x00000493) AM_WRITE(video_dma_length_w)
10431036   AM_RANGE(0x00000494, 0x00000497) AM_WRITE(video_dma_address_w)
10441037   AM_RANGE(0x0000050c, 0x0000050f) AM_WRITE(sprite_dma_start_w)
1045   AM_RANGE(0x00000600, 0x00000603) AM_READ_LEGACY(spi_int_r)            /* Clear Interrupt */
1038   AM_RANGE(0x00000600, 0x00000603) AM_READ(spi_int_r)            /* Clear Interrupt */
10461039   AM_RANGE(0x00000600, 0x00000603) AM_WRITENOP            /* Unknown */
1047   AM_RANGE(0x00000604, 0x00000607) AM_READ_LEGACY(spi_controls1_r)   /* Player controls */
1048   AM_RANGE(0x00000608, 0x0000060b) AM_READ_LEGACY(spi_unknown_r)      /* Unknown */
1049   AM_RANGE(0x0000060c, 0x0000060f) AM_READ_LEGACY(spi_controls2_r)   /* Player controls (start) */
1050   AM_RANGE(0x00000680, 0x00000683) AM_WRITE_LEGACY(sound_fifo_w)
1051   AM_RANGE(0x00000684, 0x00000687) AM_READ_LEGACY(sound_fifo_status_r)
1040   AM_RANGE(0x00000604, 0x00000607) AM_READ(spi_controls1_r)   /* Player controls */
1041   AM_RANGE(0x00000608, 0x0000060b) AM_READ(spi_unknown_r)      /* Unknown */
1042   AM_RANGE(0x0000060c, 0x0000060f) AM_READ(spi_controls2_r)   /* Player controls (start) */
1043   AM_RANGE(0x00000680, 0x00000683) AM_WRITE(sound_fifo_w)
1044   AM_RANGE(0x00000684, 0x00000687) AM_READ(sound_fifo_status_r)
10521045   AM_RANGE(0x00000684, 0x00000687) AM_WRITENOP            /* Unknown */
10531046   AM_RANGE(0x000006d0, 0x000006d3) AM_DEVWRITE8_LEGACY("ds2404", ds2404_1w_reset_w, 0x000000ff)
10541047   AM_RANGE(0x000006d4, 0x000006d7) AM_DEVWRITE8_LEGACY("ds2404", ds2404_data_w, 0x000000ff)
r14896r14897
10561049   AM_RANGE(0x000006dc, 0x000006df) AM_DEVREAD8_LEGACY("ds2404", ds2404_data_r, 0x000000ff)
10571050   AM_RANGE(0x00000800, 0x0003ffff) AM_RAM AM_BASE(m_spimainram)
10581051   AM_RANGE(0x00200000, 0x003fffff) AM_ROM AM_SHARE("share2")
1059   AM_RANGE(0x00a00000, 0x013fffff) AM_READ_LEGACY(soundrom_r)
1052   AM_RANGE(0x00a00000, 0x013fffff) AM_READ(soundrom_r)
10601053   AM_RANGE(0xffe00000, 0xffffffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("share2")      /* ROM location in real-mode */
10611054ADDRESS_MAP_END
10621055
r14896r14897
10641057   AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank5")
10651058   AM_RANGE(0x4002, 0x4002) AM_WRITENOP         /* ack RST 10 */
10661059   AM_RANGE(0x4003, 0x4003) AM_WRITENOP         /* Unknown */
1067   AM_RANGE(0x4004, 0x4004) AM_WRITE_LEGACY(sb_coin_w)   /* single board systems */
1068   AM_RANGE(0x4008, 0x4008) AM_READWRITE_LEGACY(z80_soundfifo_r, z80_soundfifo_w)
1069   AM_RANGE(0x4009, 0x4009) AM_READ_LEGACY(z80_soundfifo_status_r)
1070   AM_RANGE(0x400a, 0x400a) AM_READ_LEGACY(z80_jp1_r)
1060   AM_RANGE(0x4004, 0x4004) AM_WRITE(sb_coin_w)   /* single board systems */
1061   AM_RANGE(0x4008, 0x4008) AM_READWRITE(z80_soundfifo_r, z80_soundfifo_w)
1062   AM_RANGE(0x4009, 0x4009) AM_READ(z80_soundfifo_status_r)
1063   AM_RANGE(0x400a, 0x400a) AM_READ(z80_jp1_r)
10711064   AM_RANGE(0x400b, 0x400b) AM_WRITENOP         /* Unknown */
1072   AM_RANGE(0x4013, 0x4013) AM_READ_LEGACY(z80_coin_r)
1073   AM_RANGE(0x401b, 0x401b) AM_WRITE_LEGACY(z80_bank_w)      /* control register: bits 0-2 = bank @ 8000, bit 3 = watchdog? */
1065   AM_RANGE(0x4013, 0x4013) AM_READ(z80_coin_r)
1066   AM_RANGE(0x401b, 0x401b) AM_WRITE(z80_bank_w)      /* control register: bits 0-2 = bank @ 8000, bit 3 = watchdog? */
10741067   AM_RANGE(0x6000, 0x600f) AM_DEVREADWRITE_LEGACY("ymf", ymf271_r, ymf271_w)
10751068   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank4")
10761069ADDRESS_MAP_END
r14896r14897
11401133   AM_RANGE(0x00000490, 0x00000493) AM_WRITE(video_dma_length_w)
11411134   AM_RANGE(0x00000494, 0x00000497) AM_WRITE(video_dma_address_w)
11421135   AM_RANGE(0x0000050c, 0x0000050f) AM_WRITE(sprite_dma_start_w)
1143   AM_RANGE(0x00000600, 0x00000603) AM_READ_LEGACY(spi_int_r)            /* Unknown */
1144   AM_RANGE(0x00000604, 0x00000607) AM_READ_LEGACY(spi_controls1_r)   /* Player controls */
1145   AM_RANGE(0x00000608, 0x0000060b) AM_READ_LEGACY(spi_unknown_r)
1146   AM_RANGE(0x0000060c, 0x0000060f) AM_READ_LEGACY(spi_controls2_r)   /* Player controls (start) */
1136   AM_RANGE(0x00000600, 0x00000603) AM_READ(spi_int_r)            /* Unknown */
1137   AM_RANGE(0x00000604, 0x00000607) AM_READ(spi_controls1_r)   /* Player controls */
1138   AM_RANGE(0x00000608, 0x0000060b) AM_READ(spi_unknown_r)
1139   AM_RANGE(0x0000060c, 0x0000060f) AM_READ(spi_controls2_r)   /* Player controls (start) */
11471140   AM_RANGE(0x0000068c, 0x0000068f) AM_DEVWRITE_LEGACY("eeprom", eeprom_w)
11481141   AM_RANGE(0x00000800, 0x0003ffff) AM_RAM AM_BASE(m_spimainram)
11491142   AM_RANGE(0x00200000, 0x003fffff) AM_ROM AM_SHARE("share2")
r14896r14897
11521145   AM_RANGE(0xffe00000, 0xffffffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("share2")      /* ROM location in real-mode */
11531146ADDRESS_MAP_END
11541147
1155static WRITE32_HANDLER(input_select_w)
1148WRITE32_MEMBER(seibuspi_state::input_select_w)
11561149{
1157   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
1158   state->m_ejsakura_input_port = data;
1150   m_ejsakura_input_port = data;
11591151}
11601152
11611153static ADDRESS_MAP_START( sys386f2_map, AS_PROGRAM, 32, seibuspi_state )
11621154   AM_RANGE(0x00000000, 0x0000000f) AM_RAM
1163   AM_RANGE(0x00000010, 0x00000013) AM_READ_LEGACY(spi_int_r)            /* Unknown */
1155   AM_RANGE(0x00000010, 0x00000013) AM_READ(spi_int_r)            /* Unknown */
11641156   AM_RANGE(0x00000090, 0x00000097) AM_RAM /* Unknown */
1165   AM_RANGE(0x00000400, 0x00000403) AM_READNOP AM_WRITE_LEGACY(input_select_w)
1157   AM_RANGE(0x00000400, 0x00000403) AM_READNOP AM_WRITE(input_select_w)
11661158   AM_RANGE(0x00000404, 0x00000407) AM_DEVWRITE_LEGACY("eeprom", sys386f2_eeprom_w)
11671159   AM_RANGE(0x00000408, 0x0000040f) AM_DEVWRITE8_LEGACY("ymz", ymz280b_w, 0x000000ff)
11681160   AM_RANGE(0x00000484, 0x00000487) AM_WRITE(palette_dma_start_w)
r14896r14897
11711163   AM_RANGE(0x00000500, 0x0000054f) AM_RAM /* Unknown */
11721164   AM_RANGE(0x00000560, 0x00000563) AM_WRITE(sprite_dma_start_w)
11731165   AM_RANGE(0x00000600, 0x00000607) AM_DEVREAD8_LEGACY("ymz", ymz280b_r, 0x000000ff)
1174   AM_RANGE(0x00000608, 0x0000060b) AM_READ_LEGACY(spi_unknown_r)
1175   AM_RANGE(0x0000060c, 0x0000060f) AM_READ_LEGACY(spi_controls1_r)   /* Player controls */
1166   AM_RANGE(0x00000608, 0x0000060b) AM_READ(spi_unknown_r)
1167   AM_RANGE(0x0000060c, 0x0000060f) AM_READ(spi_controls1_r)   /* Player controls */
11761168   AM_RANGE(0x00000800, 0x0003ffff) AM_RAM AM_BASE(m_spimainram)
11771169   AM_RANGE(0x00200000, 0x003fffff) AM_ROM AM_SHARE("share2")
11781170   AM_RANGE(0xffe00000, 0xffffffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("share2")      /* ROM location in real-mode */
r14896r14897
18281820   cputag_set_input_line(machine, "soundcpu", INPUT_LINE_RESET, ASSERT_LINE );
18291821   device_set_irq_callback(machine.device("maincpu"), spi_irq_callback);
18301822
1831   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x00000680, 0x00000683, FUNC(sound_fifo_r));
1832   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x00000688, 0x0000068b, FUNC(z80_prg_fifo_w));
1833   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0000068c, 0x0000068f, FUNC(z80_enable_w));
1823   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000680, 0x00000683, read32_delegate(FUNC(seibuspi_state::sound_fifo_r),state));
1824   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00000688, 0x0000068b, write32_delegate(FUNC(seibuspi_state::z80_prg_fifo_w),state));
1825   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0000068c, 0x0000068f, write32_delegate(FUNC(seibuspi_state::z80_enable_w),state));
18341826
18351827   memory_set_bankptr(machine, "bank4", state->m_z80_rom);
18361828   memory_set_bankptr(machine, "bank5", state->m_z80_rom);
r14896r14897
19131905   memcpy(state->m_z80_rom, rom, 0x40000);
19141906
19151907   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(*machine.device("eeprom"), 0x0000068c, 0x0000068f, FUNC(eeprom_w));
1916   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x00000680, 0x00000683, FUNC(sb_coin_r));
1908   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000680, 0x00000683, read32_delegate(FUNC(seibuspi_state::sb_coin_r),state));
19171909
19181910   device_set_irq_callback(machine.device("maincpu"), spi_irq_callback);
19191911
r14896r14897
19521944
19531945MACHINE_CONFIG_END
19541946
1955static READ32_HANDLER ( senkyu_speedup_r )
1947READ32_MEMBER(seibuspi_state::senkyu_speedup_r)
19561948{
1957   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
1958   if (cpu_get_pc(&space->device())==0x00305bb2) device_spin_until_interrupt(&space->device()); // idle
1959   return state->m_spimainram[(0x0018cb4-0x800)/4];
1949   if (cpu_get_pc(&space.device())==0x00305bb2) device_spin_until_interrupt(&space.device()); // idle
1950   return m_spimainram[(0x0018cb4-0x800)/4];
19601951}
19611952
1962static READ32_HANDLER( senkyua_speedup_r )
1953READ32_MEMBER(seibuspi_state::senkyua_speedup_r)
19631954{
1964   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
1965   if (cpu_get_pc(&space->device())== 0x30582e) device_spin_until_interrupt(&space->device()); // idle
1966   return state->m_spimainram[(0x0018c9c-0x800)/4];
1955   if (cpu_get_pc(&space.device())== 0x30582e) device_spin_until_interrupt(&space.device()); // idle
1956   return m_spimainram[(0x0018c9c-0x800)/4];
19671957}
19681958
1969static READ32_HANDLER ( batlball_speedup_r )
1959READ32_MEMBER(seibuspi_state::batlball_speedup_r)
19701960{
1971   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
1972//  printf("cpu_get_pc(&space->device()) %06x\n", cpu_get_pc(&space->device()));
1961//  printf("cpu_get_pc(&space.device()) %06x\n", cpu_get_pc(&space.device()));
19731962
19741963   /* batlbalu */
1975   if (cpu_get_pc(&space->device())==0x00305996) device_spin_until_interrupt(&space->device()); // idle
1964   if (cpu_get_pc(&space.device())==0x00305996) device_spin_until_interrupt(&space.device()); // idle
19761965
19771966   /* batlball */
1978   if (cpu_get_pc(&space->device())==0x003058aa) device_spin_until_interrupt(&space->device()); // idle
1967   if (cpu_get_pc(&space.device())==0x003058aa) device_spin_until_interrupt(&space.device()); // idle
19791968
1980   return state->m_spimainram[(0x0018db4-0x800)/4];
1969   return m_spimainram[(0x0018db4-0x800)/4];
19811970}
19821971
1983static READ32_HANDLER ( rdft_speedup_r )
1972READ32_MEMBER(seibuspi_state::rdft_speedup_r)
19841973{
1985   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
19861974   /* rdft */
1987   if (cpu_get_pc(&space->device())==0x0203f0a) device_spin_until_interrupt(&space->device()); // idle
1975   if (cpu_get_pc(&space.device())==0x0203f0a) device_spin_until_interrupt(&space.device()); // idle
19881976
19891977   /* rdftau */
1990   if (cpu_get_pc(&space->device())==0x0203f16) device_spin_until_interrupt(&space->device()); // idle
1978   if (cpu_get_pc(&space.device())==0x0203f16) device_spin_until_interrupt(&space.device()); // idle
19911979
19921980   /* rdftj */
1993   if (cpu_get_pc(&space->device())==0x0203f22) device_spin_until_interrupt(&space->device()); // idle
1981   if (cpu_get_pc(&space.device())==0x0203f22) device_spin_until_interrupt(&space.device()); // idle
19941982
19951983   /* rdftdi */
1996   if (cpu_get_pc(&space->device())==0x0203f46) device_spin_until_interrupt(&space->device()); // idle
1984   if (cpu_get_pc(&space.device())==0x0203f46) device_spin_until_interrupt(&space.device()); // idle
19971985
19981986   /* rdftu */
1999   if (cpu_get_pc(&space->device())==0x0203f3a) device_spin_until_interrupt(&space->device()); // idle
1987   if (cpu_get_pc(&space.device())==0x0203f3a) device_spin_until_interrupt(&space.device()); // idle
20001988
2001//  mame_printf_debug("%08x\n",cpu_get_pc(&space->device()));
1989//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
20021990
2003   return state->m_spimainram[(0x00298d0-0x800)/4];
1991   return m_spimainram[(0x00298d0-0x800)/4];
20041992}
20051993
2006static READ32_HANDLER ( viprp1_speedup_r )
1994READ32_MEMBER(seibuspi_state::viprp1_speedup_r)
20071995{
2008   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
20091996   /* viprp1 */
2010   if (cpu_get_pc(&space->device())==0x0202769) device_spin_until_interrupt(&space->device()); // idle
1997   if (cpu_get_pc(&space.device())==0x0202769) device_spin_until_interrupt(&space.device()); // idle
20111998
20121999   /* viprp1s */
2013   if (cpu_get_pc(&space->device())==0x02027e9) device_spin_until_interrupt(&space->device()); // idle
2000   if (cpu_get_pc(&space.device())==0x02027e9) device_spin_until_interrupt(&space.device()); // idle
20142001
20152002   /* viprp1ot */
2016   if (cpu_get_pc(&space->device())==0x02026bd) device_spin_until_interrupt(&space->device()); // idle
2003   if (cpu_get_pc(&space.device())==0x02026bd) device_spin_until_interrupt(&space.device()); // idle
20172004
2018//  mame_printf_debug("%08x\n",cpu_get_pc(&space->device()));
2005//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
20192006
2020   return state->m_spimainram[(0x001e2e0-0x800)/4];
2007   return m_spimainram[(0x001e2e0-0x800)/4];
20212008}
20222009
2023static READ32_HANDLER ( viprp1o_speedup_r )
2010READ32_MEMBER(seibuspi_state::viprp1o_speedup_r)
20242011{
2025   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
20262012   /* viperp1o */
2027   if (cpu_get_pc(&space->device())==0x0201f99) device_spin_until_interrupt(&space->device()); // idle
2028//  mame_printf_debug("%08x\n",cpu_get_pc(&space->device()));
2029   return state->m_spimainram[(0x001d49c-0x800)/4];
2013   if (cpu_get_pc(&space.device())==0x0201f99) device_spin_until_interrupt(&space.device()); // idle
2014//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
2015   return m_spimainram[(0x001d49c-0x800)/4];
20302016}
20312017
20322018#ifdef UNUSED_FUNCTION
r14896r14897
20392025}
20402026#endif
20412027
2042static READ32_HANDLER ( rf2_speedup_r )
2028READ32_MEMBER(seibuspi_state::rf2_speedup_r)
20432029{
2044   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
20452030
20462031   /* rdft22kc */
2047   if (cpu_get_pc(&space->device())==0x0203926) device_spin_until_interrupt(&space->device()); // idle
2032   if (cpu_get_pc(&space.device())==0x0203926) device_spin_until_interrupt(&space.device()); // idle
20482033
20492034   /* rdft2, rdft2j */
2050   if (cpu_get_pc(&space->device())==0x0204372) device_spin_until_interrupt(&space->device()); // idle
2035   if (cpu_get_pc(&space.device())==0x0204372) device_spin_until_interrupt(&space.device()); // idle
20512036
20522037   /* rdft2us */
2053   if (cpu_get_pc(&space->device())==0x020420e) device_spin_until_interrupt(&space->device()); // idle
2038   if (cpu_get_pc(&space.device())==0x020420e) device_spin_until_interrupt(&space.device()); // idle
20542039
20552040   /* rdft2a */
2056   if (cpu_get_pc(&space->device())==0x0204366) device_spin_until_interrupt(&space->device()); // idle
2041   if (cpu_get_pc(&space.device())==0x0204366) device_spin_until_interrupt(&space.device()); // idle
20572042
2058//  mame_printf_debug("%08x\n",cpu_get_pc(&space->device()));
2043//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
20592044
2060   return state->m_spimainram[(0x0282AC-0x800)/4];
2045   return m_spimainram[(0x0282AC-0x800)/4];
20612046}
20622047
2063static READ32_HANDLER ( rfjet_speedup_r )
2048READ32_MEMBER(seibuspi_state::rfjet_speedup_r)
20642049{
2065   seibuspi_state *state = space->machine().driver_data<seibuspi_state>();
20662050   /* rfjet, rfjetu, rfjeta */
2067   if (cpu_get_pc(&space->device())==0x0206082) device_spin_until_interrupt(&space->device()); // idle
2051   if (cpu_get_pc(&space.device())==0x0206082) device_spin_until_interrupt(&space.device()); // idle
20682052
20692053   /* rfjetus */
2070   if (cpu_get_pc(&space->device())==0x0205b39)
2054   if (cpu_get_pc(&space.device())==0x0205b39)
20712055   {
20722056      UINT32 r;
2073      device_spin_until_interrupt(&space->device()); // idle
2057      device_spin_until_interrupt(&space.device()); // idle
20742058      // Hack to enter test mode
2075      r = state->m_spimainram[(0x002894c-0x800)/4] & (~0x400);
2076      return r | (((input_port_read(space->machine(), "SYSTEM") ^ 0xff)<<8) & 0x400);
2059      r = m_spimainram[(0x002894c-0x800)/4] & (~0x400);
2060      return r | (((input_port_read(machine(), "SYSTEM") ^ 0xff)<<8) & 0x400);
20772061   }
20782062
20792063   /* rfjetj */
2080   if (cpu_get_pc(&space->device())==0x0205f2e) device_spin_until_interrupt(&space->device()); // idle
2064   if (cpu_get_pc(&space.device())==0x0205f2e) device_spin_until_interrupt(&space.device()); // idle
20812065
2082//  mame_printf_debug("%08x\n",cpu_get_pc(&space->device()));
2066//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
20832067
20842068
2085   return state->m_spimainram[(0x002894c-0x800)/4];
2069   return m_spimainram[(0x002894c-0x800)/4];
20862070}
20872071
20882072static void init_spi(running_machine &machine)
r14896r14897
20982082
20992083static DRIVER_INIT( rdft )
21002084{
2101   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x00298d0, 0x00298d3, FUNC(rdft_speedup_r) );
2085   seibuspi_state *state = machine.driver_data<seibuspi_state>();
2086   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00298d0, 0x00298d3, read32_delegate(FUNC(seibuspi_state::rdft_speedup_r),state));
21022087
21032088   init_spi(machine);
21042089}
21052090
21062091static DRIVER_INIT( senkyu )
21072092{
2108   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0018cb4, 0x0018cb7, FUNC(senkyu_speedup_r) );
2093   seibuspi_state *state = machine.driver_data<seibuspi_state>();
2094   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0018cb4, 0x0018cb7, read32_delegate(FUNC(seibuspi_state::senkyu_speedup_r),state));
21092095
21102096   init_spi(machine);
21112097}
21122098
21132099static DRIVER_INIT( senkyua )
21142100{
2115   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0018c9c, 0x0018c9f, FUNC(senkyua_speedup_r) );
2101   seibuspi_state *state = machine.driver_data<seibuspi_state>();
2102   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0018c9c, 0x0018c9f, read32_delegate(FUNC(seibuspi_state::senkyua_speedup_r),state));
21162103
21172104   init_spi(machine);
21182105}
21192106
21202107static DRIVER_INIT( batlball )
21212108{
2122   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0018db4, 0x0018db7, FUNC(batlball_speedup_r) );
2109   seibuspi_state *state = machine.driver_data<seibuspi_state>();
2110   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0018db4, 0x0018db7, read32_delegate(FUNC(seibuspi_state::batlball_speedup_r),state));
21232111
21242112   init_spi(machine);
21252113}
r14896r14897
21272115static DRIVER_INIT( ejanhs )
21282116{
21292117//  idle skip doesn't work properly?
2130//  machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x002d224, 0x002d227, FUNC(ejanhs_speedup_r) );
2118//  seibuspi_state *state = machine.driver_data<seibuspi_state>();
2119//  machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x002d224, 0x002d227, read32_delegate(FUNC(seibuspi_state::ejanhs_speedup_r),state));
21312120
21322121   init_spi(machine);
21332122}
21342123
21352124static DRIVER_INIT( viprp1 )
21362125{
2137   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x001e2e0, 0x001e2e3, FUNC(viprp1_speedup_r) );
2126   seibuspi_state *state = machine.driver_data<seibuspi_state>();
2127   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x001e2e0, 0x001e2e3, read32_delegate(FUNC(seibuspi_state::viprp1_speedup_r),state));
21382128
21392129   init_spi(machine);
21402130}
21412131
21422132static DRIVER_INIT( viprp1o )
21432133{
2144   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x001d49c, 0x001d49f, FUNC(viprp1o_speedup_r) );
2134   seibuspi_state *state = machine.driver_data<seibuspi_state>();
2135   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x001d49c, 0x001d49f, read32_delegate(FUNC(seibuspi_state::viprp1o_speedup_r),state));
21452136
21462137   init_spi(machine);
21472138}
r14896r14897
21542145   state->m_flash[0] = machine.device<intel_e28f008sa_device>("flash0");
21552146   state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1");
21562147
2157   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0282AC, 0x0282AF, FUNC(rf2_speedup_r) );
2148   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0282AC, 0x0282AF, read32_delegate(FUNC(seibuspi_state::rf2_speedup_r),state));
21582149   seibuspi_rise10_text_decrypt(machine.region("gfx1")->base());
21592150   seibuspi_rise10_bg_decrypt(machine.region("gfx2")->base(), machine.region("gfx2")->bytes());
21602151   seibuspi_rise10_sprite_decrypt(machine.region("gfx3")->base(), 0x600000);
r14896r14897
21792170   state->m_flash[0] = machine.device<intel_e28f008sa_device>("flash0");
21802171   state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1");
21812172
2182   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x002894c, 0x002894f, FUNC(rfjet_speedup_r) );
2173   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x002894c, 0x002894f, read32_delegate(FUNC(seibuspi_state::rfjet_speedup_r),state));
21832174   seibuspi_rise11_text_decrypt(machine.region("gfx1")->base());
21842175   seibuspi_rise11_bg_decrypt(machine.region("gfx2")->base(), machine.region("gfx2")->bytes());
21852176   seibuspi_rise11_sprite_decrypt_rfjet(machine.region("gfx3")->base(), 0x800000);
src/mame/drivers/sauro.c
r14896r14897
131131WRITE8_MEMBER(sauro_state::sauro_sound_command_w)
132132{
133133   data |= 0x80;
134   soundlatch_w(space, offset, data);
134   soundlatch_byte_w(space, offset, data);
135135}
136136
137137READ8_MEMBER(sauro_state::sauro_sound_command_r)
138138{
139   int ret   = soundlatch_r(space, offset);
140   soundlatch_clear_w(space, offset, 0);
139   int ret   = soundlatch_byte_r(space, offset);
140   soundlatch_clear_byte_w(space, offset, 0);
141141   return ret;
142142}
143143
r14896r14897
155155
156156WRITE8_MEMBER(sauro_state::flip_screen_w)
157157{
158   flip_screen_set(machine(), data);
158   flip_screen_set(data);
159159}
160160
161161static WRITE8_DEVICE_HANDLER( adpcm_w )
src/mame/drivers/timetrv.c
r14896r14897
3131{
3232public:
3333   timetrv_state(const machine_config &mconfig, device_type type, const char *tag)
34      : driver_device(mconfig, type, tag) { }
34      : driver_device(mconfig, type, tag) ,
35      m_led_vram_lo(*this, "led_vralo"),
36      m_led_vram_hi(*this, "led_vrahi"){ }
3537
36   UINT8 *m_led_vram_lo;
37   UINT8 *m_led_vram_hi;
38   required_shared_ptr<UINT8> m_led_vram_lo;
39   required_shared_ptr<UINT8> m_led_vram_hi;
3840   DECLARE_READ8_MEMBER(test1_r);
3941   DECLARE_READ8_MEMBER(test2_r);
4042   DECLARE_READ8_MEMBER(in_r);
r14896r14897
5153static SCREEN_UPDATE_IND16( timetrv )
5254{
5355   timetrv_state *state = screen.machine().driver_data<timetrv_state>();
54   popmessage("%s%s",state->m_led_vram_lo,state->m_led_vram_hi);
56   popmessage("%s%s",state->m_led_vram_lo.target(),state->m_led_vram_hi.target());
5557   return 0;
5658}
5759
r14896r14897
9193   AM_RANGE(0x1080, 0x1082) AM_READ(in_r) //dsw
9294   AM_RANGE(0x1100, 0x1105) AM_WRITENOP //laserdisc write area
9395   AM_RANGE(0x1100, 0x1105) AM_READ(ld_r) //5 -> laserdisc read status
94   AM_RANGE(0x1180, 0x1187) AM_RAM AM_BASE(m_led_vram_lo)//led string,part 1
95   AM_RANGE(0x1200, 0x1207) AM_RAM AM_BASE(m_led_vram_hi)//led string,part 2
96   AM_RANGE(0x1180, 0x1187) AM_RAM AM_SHARE("led_vralo")//led string,part 1
97   AM_RANGE(0x1200, 0x1207) AM_RAM AM_SHARE("led_vrahi")//led string,part 2
9698   AM_RANGE(0xff80, 0xffff) AM_RAM //am80188-em-like cpu internal regs?
9799ADDRESS_MAP_END
98100
src/mame/drivers/drmicro.c
r14896r14897
3636
3737   m_nmi_enable = data & 1;
3838   m_flipscreen = (data & 2) ? 1 : 0;
39   flip_screen_set(machine(), data & 2);
39   flip_screen_set(data & 2);
4040
4141   // bit2,3 unknown
4242}
src/mame/drivers/astrafr.c
r14896r14897
11/* Astra Fruit Machines
2 -- Unknown HW platform (related to pluto5.c?)
3 -- 68k based
2 -- Unknown 68340 based HW platform (seems related to pluto5.c?)
43 -- dumps are of an unknown quality
54 -- These might all be the same system with different rom configurations, or different systems (unknown)
65 -- Some sets contain what look to be additional sound roms, others have them in the main program roms?
r14896r14897
1514#include "cpu/m68000/m68000.h"
1615
1716
17
1818class astrafr_state : public driver_device
1919{
2020public:
2121   astrafr_state(const machine_config &mconfig, device_type type, const char *tag)
22      : driver_device(mconfig, type, tag) { }
22      : driver_device(mconfig, type, tag)
23   {
24      fgpa_first_read_addr = 0xffff;
25      fgpa_rom_write_addr = 0xffff;
26      fgpa_after_rom_write_addr = 0xffff;
27   }
28
29   // ports move above from game to game..
30   UINT16 fgpa_rom_write_addr;
31   UINT16 fgpa_first_read_addr;
32   UINT16 fgpa_after_rom_write_addr;
33
34   DECLARE_READ8_MEMBER( astra_fgpa_r )
35   {
36      int pc = cpu_get_pc(&space.device());
37     
38      if (offset==fgpa_first_read_addr)
39      {
40         return 0xff;
41      }
42      else
43      {
44         logerror("%08x astra_fgpa_r offset %02x\n", pc, offset);
45         return 0xff;
46      }
47   }
48   
49   DECLARE_WRITE8_MEMBER( astra_fgpa_w )
50   {
51      int pc = cpu_get_pc(&space.device());
52     
53      if (offset==fgpa_rom_write_addr)
54      {
55         // the games write most of the ROM data to a port
56         // I think it kicks the FPGA into life?
57      }
58      else
59      {
60         logerror("%08x astra_fgpa_w offset %02x %02x\n", pc, offset, data);
61      }
62   }
63
64   /* 2nd copy for the 2nd board (assume same addresses for now */
65   DECLARE_READ8_MEMBER( astra_fgpa_slave_r )
66   {
67      int pc = cpu_get_pc(&space.device());
68     
69      if (offset==fgpa_first_read_addr)
70      {
71         return 0xff;
72      }
73      else
74      {
75         logerror("%08x astra_fgpa_slave_r offset %02x\n", pc, offset);
76         return 0xff;
77      }
78   }
79   
80   DECLARE_WRITE8_MEMBER( astra_fgpa_slave_w )
81   {
82      int pc = cpu_get_pc(&space.device());
83     
84      if (offset==fgpa_rom_write_addr)
85      {
86         // the games write most of the ROM data to a port
87         // I think it kicks the FPGA into life?
88      }
89      else
90      {
91         logerror("%08x astra_fgpa_slave_w offset %02x %02x\n", pc, offset, data);
92      }
93   }
94
2395};
2496
2597
2698static ADDRESS_MAP_START( astrafr_master_map, AS_PROGRAM, 32, astrafr_state )
2799   AM_RANGE(0x000000, 0x1fffff) AM_ROM
100   AM_RANGE(0x800000, 0x8000ff) AM_READWRITE8(astra_fgpa_r, astra_fgpa_w, 0xffffffff)
28101   AM_RANGE(0x400000, 0x40ffff) AM_RAM // as_partyd set
29102ADDRESS_MAP_END
30103
31// probably identical, afaik they're linekd units..
104// probably identical, afaik they're linked units..
32105static ADDRESS_MAP_START( astrafr_slave_map, AS_PROGRAM, 32, astrafr_state )
33106   AM_RANGE(0x000000, 0x1fffff) AM_ROM
107   AM_RANGE(0x800000, 0x8000ff) AM_READWRITE8(astra_fgpa_slave_r, astra_fgpa_slave_w, 0xffffffff)
34108   AM_RANGE(0x400000, 0x40ffff) AM_RAM // as_partyd set
35109ADDRESS_MAP_END
36110
37111
112static ADDRESS_MAP_START( astrafr_master_alt_map, AS_PROGRAM, 32, astrafr_state )
113   AM_RANGE(0x0000000, 0x01fffff) AM_ROM
114   AM_RANGE(0x1000000, 0x1009fff) AM_RAM // ?
115   AM_RANGE(0x2000000, 0x20000ff) AM_READWRITE8(astra_fgpa_r, astra_fgpa_w, 0xffffffff)
116ADDRESS_MAP_END
117
118
119
120
38121static ADDRESS_MAP_START( astra_map, AS_PROGRAM, 32, astrafr_state )
39122   AM_RANGE(0x000000, 0x1fffff) AM_ROM
123   AM_RANGE(0x800000, 0x8000ff) AM_READWRITE8(astra_fgpa_r, astra_fgpa_w, 0xffffffff)
40124   AM_RANGE(0x400000, 0x40ffff) AM_RAM // as_partyd set
41125ADDRESS_MAP_END
42126
127static ADDRESS_MAP_START( astra_alt_map, AS_PROGRAM, 32, astrafr_state )
128   AM_RANGE(0x0000000, 0x01fffff) AM_ROM
129   AM_RANGE(0x1000000, 0x1009fff) AM_RAM // ?
130   AM_RANGE(0x2000000, 0x20000ff) AM_READWRITE8(astra_fgpa_r, astra_fgpa_w, 0xffffffff)
131ADDRESS_MAP_END
43132
44133static INPUT_PORTS_START( astrafr )
45134INPUT_PORTS_END
46135
136/* the FPGA area read/write addresses move around ... */
137static MACHINE_START( astra_37 )
138{
139   astrafr_state *state = machine.driver_data<astrafr_state>();
140   state->fgpa_after_rom_write_addr = 0x30;
141   state->fgpa_first_read_addr = 0x33;
142   state->fgpa_rom_write_addr = 0x37;
143}
47144
145static MACHINE_START( astra_2e )
146{
147   astrafr_state *state = machine.driver_data<astrafr_state>();
148   state->fgpa_after_rom_write_addr = 0x20;
149   state->fgpa_first_read_addr = 0x23;
150   state->fgpa_rom_write_addr = 0x2e;
151}
152
153
48154static MACHINE_CONFIG_START( astrafr_dual, astrafr_state )
49
50   MCFG_CPU_ADD("maincpu", M68020, 16000000) // probably 68340 like other systems of this era? definitely not plain 68k
155   MCFG_CPU_ADD("maincpu", M68340, 16000000)
51156   MCFG_CPU_PROGRAM_MAP(astrafr_master_map)
52157
53   MCFG_CPU_ADD("slavecpu", M68020, 16000000) // probably 68340 like other systems of this era? definitely not plain 68k
158   MCFG_CPU_ADD("slavecpu", M68340, 16000000)
54159   MCFG_CPU_PROGRAM_MAP(astrafr_slave_map)
55160MACHINE_CONFIG_END
56161
162static MACHINE_CONFIG_DERIVED( astrafr_dual_2e, astrafr_dual )
163   MCFG_MACHINE_START( astra_2e )
164MACHINE_CONFIG_END
57165
166static MACHINE_CONFIG_DERIVED( astrafr_dual_37, astrafr_dual )
167   MCFG_MACHINE_START( astra_37 )
168MACHINE_CONFIG_END
169
170static MACHINE_CONFIG_START( astrafr_dual_alt, astrafr_state )
171   MCFG_CPU_ADD("maincpu", M68340, 16000000)
172   MCFG_CPU_PROGRAM_MAP(astrafr_master_alt_map)
173
174   MCFG_CPU_ADD("slavecpu", M68340, 16000000)
175   MCFG_CPU_PROGRAM_MAP(astrafr_slave_map)
176MACHINE_CONFIG_END
177
178static MACHINE_CONFIG_DERIVED( astrafr_dual_alt_37, astrafr_dual_alt )
179   MCFG_MACHINE_START( astra_37 )
180MACHINE_CONFIG_END
181
182
183
58184static MACHINE_CONFIG_START( astra_single, astrafr_state )
59
60   MCFG_CPU_ADD("maincpu", M68020, 16000000)
185   MCFG_CPU_ADD("maincpu", M68340, 16000000)
61186   MCFG_CPU_PROGRAM_MAP(astra_map)
62187MACHINE_CONFIG_END
63188
189static MACHINE_CONFIG_DERIVED( astra_single_37, astra_single )
190   MCFG_MACHINE_START( astra_37 )
191MACHINE_CONFIG_END
64192
193static MACHINE_CONFIG_DERIVED( astra_single_2e, astra_single )
194   MCFG_MACHINE_START( astra_2e )
195MACHINE_CONFIG_END
65196
197static MACHINE_START( astra_57 )
198{
199   astrafr_state *state = machine.driver_data<astrafr_state>();
200//   state->fgpa_after_rom_write_addr = 0x20;
201//   state->fgpa_first_read_addr = 0x23;
202   state->fgpa_rom_write_addr = 0x57;
203}
66204
67/* are the ptM roms Master nad ptS roms Slave?
205
206static MACHINE_CONFIG_START( astra_single_alt, astrafr_state )
207   MCFG_CPU_ADD("maincpu", M68340, 16000000)
208   MCFG_CPU_PROGRAM_MAP(astra_alt_map)
209MACHINE_CONFIG_END
210
211static MACHINE_CONFIG_DERIVED( astra_single_alt_57, astra_single_alt )
212   MCFG_MACHINE_START( astra_57 )
213MACHINE_CONFIG_END
214
215static MACHINE_CONFIG_DERIVED( astra_single_alt_37, astra_single_alt )
216   MCFG_MACHINE_START( astra_37 )
217MACHINE_CONFIG_END
218
219/* are the ptM roms Master and ptS roms Slave?
68220  or is as_partyd set actually the master, with the larger roms?
69221*/
70222
r14896r14897
75227   ROM_REGION( 0x200000, "slavecpu", 0 )
76228   ROM_LOAD( "pts105.u1", 0x0000, 0x080000, CRC(0699143f) SHA1(486dff92c27ede8cd0d9395f6e4418ba0d056e90) )
77229
78   ROM_REGION( 0x200000, "altrevs", 0 )
230   ROM_REGION( 0x200000, "altrevs", 0 ) /* these were in 'party time' sets, but I don't think they're all party time! */
79231   ROM_LOAD( "pts105d.u1", 0x0000, 0x080000, CRC(0f628b8c) SHA1(c970db9274df6b9c0383ae6e0bcf9b24288a40cd) )
232   ROM_LOAD( "ptmv0-02.bin", 0x0000, 0x080000, CRC(e9dd8674) SHA1(ace543bc7fea8d09661e76c1ade4e1f27db5a116) )
233   ROM_LOAD( "ptmv1-04.bin", 0x0000, 0x080000, CRC(32af5358) SHA1(bd61c396824bb2b6845126162c4ff797564ebdf2) )
234   ROM_LOAD( "ptmv1-13.bin", 0x0000, 0x080000, CRC(4f321735) SHA1(3f9b0b64c42011d948291cd774a922393793a4b1) )
235   ROM_LOAD( "joker03.u1", 0x0000, 0x080000, CRC(a3dd15e8) SHA1(95d04de6c991b3c1ff43b0f477f03213e83f63f2) )
236   ROM_LOAD( "joker03.u2", 0x0000, 0x080000, CRC(57b3305a) SHA1(c38bc7db6c9a3f8f5371bb4c555333404fed6a9f) )
237   ROM_LOAD( "jokr03d.u1", 0x0000, 0x080000, CRC(aa268a5b) SHA1(cce89dbaaaf2d44daf127de1ad6d621c46d892fc) )
238   ROM_LOAD( "jokr03g.u1", 0x0000, 0x080000, CRC(cb12f8fa) SHA1(7a9c9fe72b70fe1b4a3be2edfde9d7a54d7a8219) )
239   ROM_LOAD( "jst0-05.u1", 0x0000, 0x080000, CRC(38f2d7b0) SHA1(11ccb5b5a35e43f505a7d3ebc36a0694111fed11) )
240   ROM_LOAD( "jst0-05.u2", 0x0000, 0x080000, CRC(97c14933) SHA1(8515601fbacf76a78a95e4a46a47809fcec021bc) )
241   ROM_LOAD( "jst0-05d.u1", 0x0000, 0x080000, CRC(31094803) SHA1(b7b5fd97681c38de5e877ca7b09909c82316d4d8) )
242   ROM_LOAD( "jst0-05g.u1", 0x0000, 0x080000, CRC(503d3aa2) SHA1(818e79126ca8ae6bbd1eaac2ae13977b3402f497) )
243   ROM_LOAD( "jst0-06.u1", 0x0000, 0x080000, CRC(b6106ca4) SHA1(dedeeff6e8c13da1f62e882cbeb36567a631e563) )
244   ROM_LOAD( "jst0-06.u2", 0x0000, 0x080000, CRC(49a78695) SHA1(af99df8c97a8c3bcb5a81a38b985e1fc92176927) )
245   ROM_LOAD( "jst0-06d.u1", 0x0000, 0x080000, CRC(bfebf317) SHA1(7f1a2a8e3f3de6a03452f535d2c314810bc652da) )
246   ROM_LOAD( "jst0-06g.u1", 0x0000, 0x080000, CRC(dedf81b6) SHA1(0579501c939eacb93d1455eaf74b629c2170b05b) )
247   ROM_LOAD( "l7v1-03.bin", 0x0000, 0x080000, CRC(878d1a3d) SHA1(fd7cb08f698bb6bbfed1c57486e53dce062d22e4) )
248   ROM_LOAD( "l7v1-03d.bin", 0x0000, 0x080000, CRC(91a81e50) SHA1(6086861bd5a53fa17df8b155acd47e9aa45a032d) )
249   ROM_LOAD( "pbmv0-06.u1", 0x0000, 0x080000, CRC(d0283320) SHA1(472f0e0dd45da61081ca12e466ac02dc82eb4431) )
250   ROM_LOAD( "pbmv0-06.u2", 0x0000, 0x080000, CRC(38fb2ff6) SHA1(628dcdcbf4767db62b4bdee7b7feff32715e6a2d) )
251   ROM_LOAD( "pbs0-06d.u1", 0x0000, 0x080000, CRC(f24e84d2) SHA1(d54e787c91c79a26383971249f935529e2a492f4) )
252   ROM_LOAD( "pbs0-06g.u1", 0x0000, 0x080000, CRC(937af673) SHA1(88f33fd3921440a99b662fec7291c8b9845210a5) )
253   ROM_LOAD( "pbsv0-06.u1", 0x0000, 0x080000, CRC(fbb51b61) SHA1(c1459f8f2d9f182e5be55bbcaf143315f7efc3b0) )
254   ROM_LOAD( "pbsv0-06.u2", 0x0000, 0x080000, CRC(2f0934de) SHA1(915a16898087f396457d712e3847f4f7c0bd5c06) )
255   ROM_LOAD( "pgm0-04.u1", 0x0000, 0x040000, CRC(2885367c) SHA1(c33cb554889b1f7390baa416a77953f45a80044f) )
256   ROM_LOAD( "pgm0-04.u2", 0x0000, 0x040000, CRC(c5eed515) SHA1(9b832a6ef301a25bccf2d97cca0c9a012ca0090a) )
257   ROM_LOAD( "pgm1-00.u1", 0x0000, 0x040000, CRC(1fa4e10f) SHA1(787ec967a9aba5934db79fe67efb32370d2c0258) )
258   ROM_LOAD( "pgm1-00.u2", 0x0000, 0x040000, CRC(8b5a6178) SHA1(e1f9898ef37877ce50630a468b3c187a4fe253fa) )
259   ROM_LOAD( "pgs0-04d.u1", 0x0000, 0x040000, CRC(1f5ede2c) SHA1(ac67536a021b531efe18027806f1f86504d72493) )
260   ROM_LOAD( "pgsv0-04.u1", 0x0000, 0x040000, CRC(cb3387be) SHA1(2add224a8839e83cc04901274acc7ca4a781b7d9) )
261   ROM_LOAD( "pgsv0-04.u2", 0x0000, 0x040000, CRC(63054bd6) SHA1(59cf8dd7efdaf2491a2aca8fbcda2d3b8b70fbf7) )
262   ROM_LOAD( "pgsv1-00.u1", 0x0000, 0x040000, CRC(725dd2af) SHA1(f8ecd1282809c0906497c62a68429152c10e2da0) )
263   ROM_LOAD( "pgsv1-00.u2", 0x0000, 0x040000, CRC(067dd0c2) SHA1(ac36aeb63b33969dc0a49150e41bfdd8624072de) )
264   ROM_LOAD( "pgsv100d.u1", 0x0000, 0x040000, CRC(a6308b3d) SHA1(125ed244bcb7a515dfc9c34c12bc74f8cd50e8dd) )
265   ROM_LOAD( "ptp003d.u1", 0x0000, 0x100000, CRC(2b2c05b6) SHA1(541a53c84c07bd7e1f09d4d033cf652ab838b4ef) )
266   ROM_LOAD( "ptp003g.u1", 0x0000, 0x100000, CRC(d9d0e151) SHA1(35fb4412602b9fd3b66e7170cc1984693b9c9ebd) )
267   ROM_LOAD( "ptpv003.u1", 0x0000, 0x100000, CRC(07c189da) SHA1(c4574cdedba87058312db84c6ee7f4a7142eea65) )
268   ROM_LOAD( "ptpv003.u2", 0x0000, 0x100000, CRC(e1f78cf4) SHA1(5f72b2604fd7ee300f6bd5b5a12d98c77b03b9ba) )
269   ROM_LOAD( "pts1-04d.bin", 0x0000, 0x080000, CRC(95564b9f) SHA1(98091d4badd346578882db75a8d72ddaa810b3f5) )
270   ROM_LOAD( "pts1-13d.bin", 0x0000, 0x080000, CRC(876232cf) SHA1(5d2355f85bde636dcb6f3dbd87874294db8e1ded) )
271   ROM_LOAD( "ptsv0-02.bin", 0x0000, 0x080000, CRC(3cc9c022) SHA1(1eb3c237971cf407057d077fd08e4436c765ae43) )
272   ROM_LOAD( "ptsv1-04.bin", 0x0000, 0x080000, CRC(9cadd42c) SHA1(e6ead7112195a17797672112c7bbd4910ae6eb50) )
273   ROM_LOAD( "ptsv1-13.bin", 0x0000, 0x080000, CRC(8e99ad7c) SHA1(d4cfce825b4a718a12d80e79ed943797c6510ad6) )
274   ROM_LOAD( "sov0-03.u1", 0x0000, 0x080000, CRC(4e2e7a79) SHA1(77f32b43d2e01cb0223feccb9e29c3fde0a6e9b7) )
275   ROM_LOAD( "sov0-03.u2", 0x0000, 0x080000, CRC(1ef8712a) SHA1(1a2ef378679384e720e5b20f1420454102f18258) )
276   ROM_LOAD( "sov0-03d.u1", 0x0000, 0x080000, CRC(47d5e5ca) SHA1(d3624a8b8545f67d14bee90bc3967c13b8497e5b) )
277   ROM_LOAD( "hog0-03.u1", 0x0000, 0x080000, CRC(eaa26ab0) SHA1(ee7d76b92c3274ba8c5ba59184bb3334fbbc64c4) )
278   ROM_LOAD( "jjrv1-02.u1", 0x0000, 0x080000, CRC(0f05e392) SHA1(64c885c92fb26c0ed64b8283793cdf86d2bc0e35) )
279   ROM_LOAD( "jjrv1-02.u2", 0x0000, 0x080000, CRC(1d86f26c) SHA1(e7db51b217e9fb8a0440b7c7591c5ea4142540bc) )
80280ROM_END
81281
82282ROM_START( as_partya )
r14896r14897
13871587
13881588ROM_START( as_stp )
13891589   ROM_REGION( 0x200000, "maincpu", 0 )
1390   ROM_LOAD16_BYTE( "1st1_03.bin", 0x0000, 0x080000, CRC(6f34a144) SHA1(69f7e58bf7d868f75ef3f4242a0b6624452a3558) )
1391   ROM_LOAD16_BYTE( "2st1_03.bin", 0x0000, 0x080000, CRC(cc04e763) SHA1(532c914d4925d19b2c416d29711e7eb506eb75e5) )
1590   ROM_LOAD16_BYTE( "1st1_03.bin", 0x00000, 0x080000, CRC(6f34a144) SHA1(69f7e58bf7d868f75ef3f4242a0b6624452a3558) )
1591   ROM_LOAD16_BYTE( "2st1_03.bin", 0x00001, 0x080000, CRC(cc04e763) SHA1(532c914d4925d19b2c416d29711e7eb506eb75e5) )
13921592
13931593   ROM_REGION( 0x200000, "altrevs", 0 )
13941594   ROM_LOAD16_BYTE( "1st1_03g.bin", 0x0000, 0x080000, CRC(f08d5a74) SHA1(ee2c0fb15354178880f9ecf82f6d5f3ca3f0879d) )
r14896r14897
13981598
13991599ROM_START( as_stpa )
14001600   ROM_REGION( 0x200000, "maincpu", 0 )
1401   ROM_LOAD16_BYTE( "stp102.u1", 0x0000, 0x080000, CRC(8df15c17) SHA1(45f6bdd3e213cea5de5feca8e2c4658b17507014) )
1402   ROM_LOAD16_BYTE( "stp102.u2", 0x0000, 0x080000, CRC(a06d6e4a) SHA1(d0ca62e98863ae9d07a8f81f8e9c0d655c0eab2b) )
1601   ROM_LOAD16_BYTE( "stp102.u1", 0x00000, 0x080000, CRC(8df15c17) SHA1(45f6bdd3e213cea5de5feca8e2c4658b17507014) )
1602   ROM_LOAD16_BYTE( "stp102.u2", 0x00001, 0x080000, CRC(a06d6e4a) SHA1(d0ca62e98863ae9d07a8f81f8e9c0d655c0eab2b) )
14031603
14041604   ROM_REGION( 0x200000, "altrevs", 0 )
14051605   ROM_LOAD16_BYTE( "stp102d.u1", 0x0000, 0x080000, CRC(840ac3a4) SHA1(d843c0884bfe470ea3bcf778e1786869fb032619) )
r14896r14897
14071607
14081608ROM_START( as_stpb )
14091609   ROM_REGION( 0x200000, "maincpu", 0 )
1410   ROM_LOAD16_BYTE( "stp105.u1", 0x0000, 0x080000, CRC(c3c600b4) SHA1(e570ed887e8aad6b816872c8468e15ab5b904ad5) )
1411   ROM_LOAD16_BYTE( "stp105.u2", 0x0000, 0x080000, CRC(7f23fe83) SHA1(e8b0a141ca3c578a1c0d49b237b309326a01300d) )
1610   ROM_LOAD16_BYTE( "stp105.u1", 0x00000, 0x080000, CRC(c3c600b4) SHA1(e570ed887e8aad6b816872c8468e15ab5b904ad5) )
1611   ROM_LOAD16_BYTE( "stp105.u2", 0x00001, 0x080000, CRC(7f23fe83) SHA1(e8b0a141ca3c578a1c0d49b237b309326a01300d) )
14121612
14131613   ROM_REGION( 0x200000, "altrevs", 0 )
14141614   ROM_LOAD16_BYTE( "stp105d.u1", 0x0000, 0x080000, CRC(ca3d9f07) SHA1(2f20259aa1adf5a7144bd8e35746b10a2f9e5f54) )
r14896r14897
17951995
17961996
17971997// Linked games (single rom per CPU with master/slave?)
1798GAME( 200?, as_party,    0         , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V105)", GAME_IS_SKELETON_MECHANICAL)
1799GAME( 200?, as_partya,   as_party   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V110)", GAME_IS_SKELETON_MECHANICAL)
1800GAME( 200?, as_partyb,   as_party   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V112)", GAME_IS_SKELETON_MECHANICAL)
1801GAME( 200?, as_partyc,   as_party   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V206)" ,GAME_IS_SKELETON_MECHANICAL)
1802GAME( 200?, as_partyd,   as_party   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V401)", GAME_IS_SKELETON_MECHANICAL) // significantly different set
1803GAME( 200?, as_partye,   as_party   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V907)", GAME_IS_SKELETON_MECHANICAL)
1804GAME( 200?, as_partyf,   as_party   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V906)", GAME_IS_SKELETON_MECHANICAL)
1998GAME( 200?, as_party,    0         , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V105)", GAME_IS_SKELETON_MECHANICAL)
1999GAME( 200?, as_partya,   as_party   , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V110)", GAME_IS_SKELETON_MECHANICAL)
2000GAME( 200?, as_partyb,   as_party   , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V112)", GAME_IS_SKELETON_MECHANICAL)
2001GAME( 200?, as_partyc,   as_party   , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V206)" ,GAME_IS_SKELETON_MECHANICAL)
2002GAME( 200?, as_partyd,   as_party   , astrafr_dual_37,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V401)", GAME_IS_SKELETON_MECHANICAL) // significantly different set
2003GAME( 200?, as_partye,   as_party   , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V907)", GAME_IS_SKELETON_MECHANICAL)
2004GAME( 200?, as_partyf,   as_party   , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Party Time (Astra, V906)", GAME_IS_SKELETON_MECHANICAL)
18052005
1806GAME( 200?, as_letsp,    0         , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Let's Party (Astra, V904)", GAME_IS_SKELETON_MECHANICAL)
2006GAME( 200?, as_letsp,    0         , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Let's Party (Astra, V904)", GAME_IS_SKELETON_MECHANICAL)
18072007
1808GAME( 200?, as_topsl,   0         , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V103)", GAME_IS_SKELETON_MECHANICAL)
1809GAME( 200?, as_topsla,  as_topsl   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V104)", GAME_IS_SKELETON_MECHANICAL)
1810GAME( 200?, as_topslb,  as_topsl   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V201)", GAME_IS_SKELETON_MECHANICAL)
1811GAME( 200?, as_topslc,  as_topsl   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V203)", GAME_IS_SKELETON_MECHANICAL)
1812GAME( 200?, as_topsld,  as_topsl   , astrafr_dual,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V205)", GAME_IS_SKELETON_MECHANICAL)
2008GAME( 200?, as_topsl,   0         , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V103)", GAME_IS_SKELETON_MECHANICAL)
2009GAME( 200?, as_topsla,  as_topsl   , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V104)", GAME_IS_SKELETON_MECHANICAL)
2010GAME( 200?, as_topslb,  as_topsl   , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V201)", GAME_IS_SKELETON_MECHANICAL)
2011GAME( 200?, as_topslc,  as_topsl   , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V203)", GAME_IS_SKELETON_MECHANICAL)
2012GAME( 200?, as_topsld,  as_topsl   , astrafr_dual_2e,    astrafr,    0, ROT0,  "Astra", "Top Slot (Astra, V205)", GAME_IS_SKELETON_MECHANICAL)
18132013
18142014
18152015// Other HW? (has u1/u2 pairing)
r14896r14897
18222022
18232023// u1/u2 pairing and Linked?
18242024
1825GAME( 200?, as_hc,     0         , astrafr_dual ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V107)", GAME_IS_SKELETON_MECHANICAL)
1826GAME( 200?, as_hca,    as_hc      , astrafr_dual ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V109)", GAME_IS_SKELETON_MECHANICAL)
1827GAME( 200?, as_hcb,    as_hc      , astrafr_dual ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V110)", GAME_IS_SKELETON_MECHANICAL)
1828GAME( 200?, as_hcc,    as_hc      , astrafr_dual ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V111)", GAME_IS_SKELETON_MECHANICAL)
1829GAME( 200?, as_hcd,    as_hc      , astrafr_dual ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V909)", GAME_IS_SKELETON_MECHANICAL)
2025GAME( 200?, as_hc,     0         , astrafr_dual_37 ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V107)", GAME_IS_SKELETON_MECHANICAL)
2026GAME( 200?, as_hca,    as_hc      , astrafr_dual_37 ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V109)", GAME_IS_SKELETON_MECHANICAL)
2027GAME( 200?, as_hcb,    as_hc      , astrafr_dual_37 ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V110)", GAME_IS_SKELETON_MECHANICAL)
2028GAME( 200?, as_hcc,    as_hc      , astrafr_dual_37 ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V111)", GAME_IS_SKELETON_MECHANICAL)
2029GAME( 200?, as_hcd,    as_hc      , astrafr_dual_37 ,    astrafr,    astradec_dual, ROT0,  "Astra", "Hokey Cokey (Astra, V909)", GAME_IS_SKELETON_MECHANICAL)
18302030
18312031// Non-Astra, same hw?
18322032
1833GAME( 200?, as_cshah,  0           , astra_single ,    astrafr,    astradec, ROT0,  "Lowen", "Cash Ahoi (Lowen, V105)", GAME_IS_SKELETON_MECHANICAL)
2033GAME( 200?, as_cshah,  0           , astra_single_alt_57 ,    astrafr,    astradec, ROT0,  "Lowen", "Cash Ahoi (Lowen, V105)", GAME_IS_SKELETON_MECHANICAL)
18342034
18352035
18362036GAME( 200?, as_big10,    0         , astra_single,    astrafr,    0, ROT0,  "Astra", "Big 10 (Astra, V500)", GAME_IS_SKELETON_MECHANICAL) // BB96
r14896r14897
18422042GAME( 200?, as_bigcs,    0         , astra_single,    astrafr,    0, ROT0,  "Astra", "Big Cash (Astra, V101)", GAME_IS_SKELETON_MECHANICAL) // CF97/CF98
18432043GAME( 200?, as_bigcsa,   as_bigcs   , astra_single,    astrafr,    0, ROT0,  "Astra", "Big Cash (Astra, V103)", GAME_IS_SKELETON_MECHANICAL) // CF97/CF98
18442044
1845GAME( 200?, as_bbr,      0         , astra_single,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V101)"      , GAME_IS_SKELETON_MECHANICAL) // FA00/CU98
1846GAME( 200?, as_bbra,     as_bbr      , astra_single,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V102,alt)"   , GAME_IS_SKELETON_MECHANICAL) // FA00/CU98
1847GAME( 200?, as_bbrb,     as_bbr      , astra_single,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V201)"      , GAME_IS_SKELETON_MECHANICAL) // FA00/CU98
1848GAME( 200?, as_bbrc,     as_bbr      , astra_single,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V003)"      , GAME_IS_SKELETON_MECHANICAL) // CU98
1849GAME( 200?, as_bbrd,     as_bbr      , astra_single,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL) // CU98
1850GAME( 200?, as_bbre,     as_bbr      , astra_single,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V105)"      , GAME_IS_SKELETON_MECHANICAL) // FG01
1851GAME( 200?, as_bbrf,     as_bbr      , astra_single,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V004)"      , GAME_IS_SKELETON_MECHANICAL) // FN01
2045GAME( 200?, as_bbr,      0         , astra_single_2e,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V101)"      , GAME_IS_SKELETON_MECHANICAL) // FA00/CU98
2046GAME( 200?, as_bbra,     as_bbr      , astra_single_2e,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V102,alt)"   , GAME_IS_SKELETON_MECHANICAL) // FA00/CU98
2047GAME( 200?, as_bbrb,     as_bbr      , astra_single_2e,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V201)"      , GAME_IS_SKELETON_MECHANICAL) // FA00/CU98
2048GAME( 200?, as_bbrc,     as_bbr      , astra_single_2e,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V003)"      , GAME_IS_SKELETON_MECHANICAL) // CU98
2049GAME( 200?, as_bbrd,     as_bbr      , astra_single_2e,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL) // CU98
2050GAME( 200?, as_bbre,     as_bbr      , astra_single_37,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V105)"      , GAME_IS_SKELETON_MECHANICAL) // FG01
2051GAME( 200?, as_bbrf,     as_bbr      , astra_single_37,    astrafr,    0, ROT0,  "Astra", "Bullion Bars (Astra, V004)"      , GAME_IS_SKELETON_MECHANICAL) // FN01
18522052
18532053GAME( 200?, as_dblcs,    0          , astra_single,    astrafr,    0, ROT0,  "Astra", "Double Cash (Astra, V110)"      , GAME_IS_SKELETON_MECHANICAL) // BR97
18542054GAME( 200?, as_dblcsa,   as_dblcs   , astra_single,    astrafr,    0, ROT0,  "Astra", "Double Cash (Astra, V112)"      , GAME_IS_SKELETON_MECHANICAL) // BR97
r14896r14897
18982098GAME( 200?, as_lbt,   0       , astra_single,    astrafr,    0,   ROT0,  "Astra", "Little Big 10 (Astra, V103)"      , GAME_IS_SKELETON_MECHANICAL)
18992099GAME( 200?, as_lbta,  as_lbt , astra_single,    astrafr,    0,   ROT0,  "Astra", "Little Big 10 (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL)
19002100
1901GAME( 200?, as_ldl,     0         , astra_single,    astrafr,    astradec_sml,   ROT0,  "Astra", "Little Devils (Astra, V700)"      , GAME_IS_SKELETON_MECHANICAL)
2101GAME( 200?, as_ldl,     0         , astra_single_2e,    astrafr,    astradec_sml,   ROT0,  "Astra", "Little Devils (Astra, V700)"      , GAME_IS_SKELETON_MECHANICAL)
19022102GAME( 200?, as_ldla,    as_ldl      , astra_single,    astrafr,    astradec_sml,   ROT0,  "Astra", "Little Devils (Astra, V600)"      , GAME_IS_SKELETON_MECHANICAL)
19032103GAME( 200?, as_ldlb,    as_ldl      , astra_single,    astrafr,    astradec_sml,   ROT0,  "Astra", "Little Devils (Astra, V312)"      , GAME_IS_SKELETON_MECHANICAL)
19042104GAME( 200?, as_ldlc,    as_ldl      , astra_single,    astrafr,    astradec_sml,   ROT0,  "Astra", "Little Devils (Astra, V003)"      , GAME_IS_SKELETON_MECHANICAL)
19052105GAME( 200?, as_ldld,    as_ldl      , astra_single,    astrafr,    0,            ROT0,  "Astra", "Little Devils (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL)
19062106GAME( 200?, as_ldle,    as_ldl      , astra_single,    astrafr,    0,            ROT0,  "Astra", "Little Devils (Astra, V103)"      , GAME_IS_SKELETON_MECHANICAL)
1907GAME( 200?, as_mp,     0         , astra_single,    astrafr,    astradec,   ROT0,  "Lowen", "Mission Possible (Lowen, V118)"      , GAME_IS_SKELETON_MECHANICAL)
2107GAME( 200?, as_mp,     0         , astra_single_2e,    astrafr,    astradec,   ROT0,  "Lowen", "Mission Possible (Lowen, V118)"      , GAME_IS_SKELETON_MECHANICAL)
19082108GAME( 200?, as_mp2,     0         , astra_single,    astrafr,    0,   ROT0,  "Lowen", "Mission Possible 2 (Lowen, V114)"      , GAME_IS_SKELETON_MECHANICAL)
1909GAME( 200?, as_otr,     0         , astra_single,    astrafr,    astradec_sml,   ROT0,  "Astra", "Over The Rainbow (Astra, V104)"      , GAME_IS_SKELETON_MECHANICAL)
2109GAME( 200?, as_otr,     0         , astra_single_2e,    astrafr,    astradec_sml,   ROT0,  "Astra", "Over The Rainbow (Astra, V104)"      , GAME_IS_SKELETON_MECHANICAL)
19102110GAME( 200?, as_otra,    as_otr      , astra_single,    astrafr,    astradec_sml,   ROT0,  "Astra", "Over The Rainbow (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL) // incomplete set
1911GAME( 200?, as_ptf,    0      , astrafr_dual,    astrafr,    astradec_sml_dual,   ROT0,  "Astra", "Party Fruits (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL) // strange extra sound(?) roms in here
1912GAME( 200?, as_ptfa,   as_ptf   , astrafr_dual,    astrafr,    astradec_sml_dual,   ROT0,  "Astra", "Party Fruits (Astra, V803)"      , GAME_IS_SKELETON_MECHANICAL)
1913GAME( 200?, as_ptfb,   as_ptf   , astrafr_dual,    astrafr,    astradec_sml_dual,   ROT0,  "Astra", "Party Fruits (Astra, V905)"      , GAME_IS_SKELETON_MECHANICAL)
1914GAME( 200?, as_ptfc,   as_ptf   , astrafr_dual,    astrafr,    astradec_sml_dual,   ROT0,  "Astra", "Party Fruits (Astra)"      , GAME_IS_SKELETON_MECHANICAL)
2111GAME( 200?, as_ptf,    0      , astrafr_dual_37,    astrafr,    astradec_sml_dual,   ROT0,  "Astra", "Party Fruits (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL) // strange extra sound(?) roms in here
2112GAME( 200?, as_ptfa,   as_ptf   , astrafr_dual_37,    astrafr,    astradec_sml_dual,   ROT0,  "Astra", "Party Fruits (Astra, V803)"      , GAME_IS_SKELETON_MECHANICAL)
2113GAME( 200?, as_ptfb,   as_ptf   , astrafr_dual_37,    astrafr,    astradec_sml_dual,   ROT0,  "Astra", "Party Fruits (Astra, V905)"      , GAME_IS_SKELETON_MECHANICAL)
2114GAME( 200?, as_ptfc,   as_ptf   , astrafr_dual_37,    astrafr,    astradec_sml_dual,   ROT0,  "Astra", "Party Fruits (Astra)"      , GAME_IS_SKELETON_MECHANICAL)
19152115GAME( 200?, as_pia,     0         , astra_single,    astrafr,    0,   ROT0,  "Astra", "Pay It Again (Astra, V202)"      , GAME_IS_SKELETON_MECHANICAL)
19162116GAME( 200?, as_piaa,    as_pia      , astra_single,    astrafr,    0,   ROT0,  "Astra", "Pay It Again (Astra, V206)"      , GAME_IS_SKELETON_MECHANICAL)
19172117GAME( 200?, as_piab,    as_pia      , astra_single,    astrafr,    0,   ROT0,  "Astra", "Pay It Again (Astra, V904)"      , GAME_IS_SKELETON_MECHANICAL)
1918GAME( 200?, as_pharg,    0        , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Pharaoh's Gold (Astra, V005)"      , GAME_IS_SKELETON_MECHANICAL)
2118GAME( 200?, as_pharg,    0        , astra_single_37,    astrafr,    astradec,   ROT0,  "Astra", "Pharaoh's Gold (Astra, V005)"      , GAME_IS_SKELETON_MECHANICAL)
19192119GAME( 200?, as_pharga,   as_pharg , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Pharaoh's Gold (Astra, V101)"      , GAME_IS_SKELETON_MECHANICAL)
19202120GAME( 200?, as_phargb,   as_pharg , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Pharaoh's Gold (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL)
19212121GAME( 200?, as_phargc,   as_pharg , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Pharaoh's Gold (Astra, V104)"      , GAME_IS_SKELETON_MECHANICAL)
19222122GAME( 200?, as_phargd,   as_pharg , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Pharaoh's Gold (Astra, V106)"      , GAME_IS_SKELETON_MECHANICAL)
19232123GAME( 200?, as_pharge,   as_pharg , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Pharaoh's Gold (Astra, V107)"      , GAME_IS_SKELETON_MECHANICAL)
1924GAME( 200?, as_pb,   0 , astra_single,    astrafr,    0,   ROT0,  "Astra", "Piggy Banking (Astra, V105)"      , GAME_IS_SKELETON_MECHANICAL)
2124GAME( 200?, as_pb,   0 , astra_single_2e,    astrafr,    0,   ROT0,  "Astra", "Piggy Banking (Astra, V105)"      , GAME_IS_SKELETON_MECHANICAL)
19252125// this might be another mix of master / slave sets, and multiple games....
1926GAME( 200?, as_rtr,    0        , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V101)"      , GAME_IS_SKELETON_MECHANICAL)
1927GAME( 200?, as_rtra,   as_rtr     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V101, alt 1)"      , GAME_IS_SKELETON_MECHANICAL)
1928GAME( 200?, as_rtrb,   as_rtr     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V101, alt 2)"      , GAME_IS_SKELETON_MECHANICAL)
1929GAME( 200?, as_rtrc,   as_rtr     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V101, alt 3)"      , GAME_IS_SKELETON_MECHANICAL)
1930GAME( 200?, as_rtrd,   as_rtr     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V100, )"      , GAME_IS_SKELETON_MECHANICAL)
1931GAME( 200?, as_rtre,   as_rtr     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V100, alt)"      , GAME_IS_SKELETON_MECHANICAL)
1932GAME( 200?, as_rtrf,   as_rtr     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V200)"      , GAME_IS_SKELETON_MECHANICAL)
2126GAME( 200?, as_rtr,    0        , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V101)"      , GAME_IS_SKELETON_MECHANICAL)
2127GAME( 200?, as_rtra,   as_rtr     , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V101, alt 1)"      , GAME_IS_SKELETON_MECHANICAL)
2128GAME( 200?, as_rtrb,   as_rtr     , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V101, alt 2)"      , GAME_IS_SKELETON_MECHANICAL)
2129GAME( 200?, as_rtrc,   as_rtr     , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V101, alt 3)"      , GAME_IS_SKELETON_MECHANICAL)
2130GAME( 200?, as_rtrd,   as_rtr     , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V100, )"      , GAME_IS_SKELETON_MECHANICAL)
2131GAME( 200?, as_rtre,   as_rtr     , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V100, alt)"      , GAME_IS_SKELETON_MECHANICAL)
2132GAME( 200?, as_rtrf,   as_rtr     , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V200)"      , GAME_IS_SKELETON_MECHANICAL)
19332133GAME( 200?, as_rtrg,   as_rtr     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V200, alt)"      , GAME_IS_SKELETON_MECHANICAL)
1934GAME( 200?, as_rtrh,   as_rtr     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V202)"      , GAME_IS_SKELETON_MECHANICAL)
2134GAME( 200?, as_rtrh,   as_rtr     , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Ready To Roll (Astra, V202)"      , GAME_IS_SKELETON_MECHANICAL)
19352135
1936GAME( 200?, as_rab,    0        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Ring A Bell (Astra, V105)"      , GAME_IS_SKELETON_MECHANICAL)
2136GAME( 200?, as_rab,    0        , astra_single_2e,    astrafr,    0,    ROT0,  "Astra", "Ring A Bell (Astra, V105)"      , GAME_IS_SKELETON_MECHANICAL)
19372137GAME( 200?, as_raba,   as_rab     , astra_single,    astrafr,    0,    ROT0,  "Astra", "Ring A Bell (Astra, V106)"      , GAME_IS_SKELETON_MECHANICAL)
19382138GAME( 200?, as_rabb,   as_rab     , astra_single,    astrafr,    0,    ROT0,  "Astra", "Ring A Bell (Astra, V107)"      , GAME_IS_SKELETON_MECHANICAL)
19392139GAME( 200?, as_rabc,   as_rab     , astra_single,    astrafr,    0,    ROT0,  "Astra", "Ring A Bell (Astra, V104)"      , GAME_IS_SKELETON_MECHANICAL)
1940GAME( 200?, as_rbg,    0        , astra_single,    astrafr,    0,    ROT0,  "Astra", "River Boat Gambler (Astra, V304)"      , GAME_IS_SKELETON_MECHANICAL)
2140GAME( 200?, as_rbg,    0        , astra_single_2e,    astrafr,    0,    ROT0,  "Astra", "River Boat Gambler (Astra, V304)"      , GAME_IS_SKELETON_MECHANICAL)
19412141GAME( 200?, as_rbga,   as_rab     , astra_single,    astrafr,    0,    ROT0,  "Astra", "River Boat Gambler (Astra, V303)"      , GAME_IS_SKELETON_MECHANICAL)
19422142GAME( 200?, as_rbgb,   as_rab     , astra_single,    astrafr,    0,    ROT0,  "Astra", "River Boat Gambler (Astra, V104)"      , GAME_IS_SKELETON_MECHANICAL)
19432143GAME( 200?, as_rbgc,   as_rab     , astra_single,    astrafr,    0,    ROT0,  "Astra", "River Boat Gambler (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL)
19442144GAME( 200?, as_rbgd,   as_rab     , astra_single,    astrafr,    0,    ROT0,  "Astra", "River Boat Gambler (Astra, V101)"      , GAME_IS_SKELETON_MECHANICAL)
19452145GAME( 200?, as_rbge,   as_rab     , astra_single,    astrafr,    0,    ROT0,  "Astra", "River Boat Gambler (Astra, V008)"      , GAME_IS_SKELETON_MECHANICAL)
1946GAME( 200?, as_rbglo,    0        , astrafr_dual,    astrafr,    astradec_sml_dual,    ROT0,  "Lowen", "River Boat Gambler (Lowen, V106)"      , GAME_IS_SKELETON_MECHANICAL)
2146GAME( 200?, as_rbglo,    0        , astrafr_dual_37,    astrafr,    astradec_sml_dual,    ROT0,  "Lowen", "River Boat Gambler (Lowen, V106)"      , GAME_IS_SKELETON_MECHANICAL)
19472147GAME( 200?, as_rox,    0        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Roll X (Astra, V006)"      , GAME_IS_SKELETON_MECHANICAL)
1948GAME( 200?, as_csv,    0        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Slot Slant (?) (Astra, V202)"      , GAME_IS_SKELETON_MECHANICAL)
2148GAME( 200?, as_csv,    0        , astra_single_37,    astrafr,    0,    ROT0,  "Astra", "Slot Slant (?) (Astra, V202)"      , GAME_IS_SKELETON_MECHANICAL)
19492149GAME( 200?, as_sltcl,    0        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Slots Classic (?) (Astra)"      , GAME_IS_SKELETON_MECHANICAL)
1950GAME( 200?, as_stp,    0        , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Stampede (Astra, V103)"      , GAME_IS_SKELETON_MECHANICAL)
2150GAME( 200?, as_stp,    0        , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Stampede (Astra, V103)"      , GAME_IS_SKELETON_MECHANICAL)
19512151GAME( 200?, as_stpa,   as_stp     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Stampede (Astra, V102)"      , GAME_IS_SKELETON_MECHANICAL)
19522152GAME( 200?, as_stpb,   as_stp     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Stampede (Astra, V105)"      , GAME_IS_SKELETON_MECHANICAL)
1953GAME( 200?, as_siu,    0        , astra_single,    astrafr,    astradec_sml,   ROT0,  "Astra", "Step It Up (Astra, V202)"      , GAME_IS_SKELETON_MECHANICAL) // extra sound roms(?) in this set
2153GAME( 200?, as_siu,    0        , astra_single_37,    astrafr,    astradec_sml,   ROT0,  "Astra", "Step It Up (Astra, V202)"      , GAME_IS_SKELETON_MECHANICAL) // extra sound roms(?) in this set
19542154GAME( 200?, as_siua,   as_siu     , astra_single,    astrafr,    astradec_sml,   ROT0,  "Astra", "Step It Up (Astra, V203)"      , GAME_IS_SKELETON_MECHANICAL)
19552155GAME( 200?, as_sld,    0        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Super Little Devil (Astra, V700)"      , GAME_IS_SKELETON_MECHANICAL)
19562156GAME( 200?, as_slda,   as_sld     , astra_single,    astrafr,    0,    ROT0,  "Astra", "Super Little Devil (Astra, V600)"      , GAME_IS_SKELETON_MECHANICAL)
r14896r14897
19582158GAME( 200?, as_sldc,   as_sld     , astra_single,    astrafr,    0,    ROT0,  "Astra", "Super Little Devil (Astra, V400)"      , GAME_IS_SKELETON_MECHANICAL)
19592159GAME( 200?, as_sldd,   as_sld     , astra_single,    astrafr,    0,    ROT0,  "Astra", "Super Little Devil (Astra, V200)"      , GAME_IS_SKELETON_MECHANICAL)
19602160GAME( 200?, as_slde,   as_sld     , astra_single,    astrafr,    0,    ROT0,  "Astra", "Super Little Devil (Astra, V101)"      , GAME_IS_SKELETON_MECHANICAL)
1961GAME( 200?, as_tem,   0          , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Temptation (Astra, V101)"      , GAME_IS_SKELETON_MECHANICAL)
1962GAME( 200?, as_tema,  as_tem     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Temptation (Astra, V006)"      , GAME_IS_SKELETON_MECHANICAL)
1963GAME( 200?, as_tbl,   0              , astra_single,    astrafr,    0,    ROT0,  "Astra", "Triple Bells (Astra, V104)"      , GAME_IS_SKELETON_MECHANICAL)
2161GAME( 200?, as_tem,   0          , astra_single_alt_37,    astrafr,    astradec,   ROT0,  "Astra", "Temptation (Astra, V101)"      , GAME_IS_SKELETON_MECHANICAL)
2162GAME( 200?, as_tema,  as_tem     , astra_single_alt_37,    astrafr,    astradec,   ROT0,  "Astra", "Temptation (Astra, V006)"      , GAME_IS_SKELETON_MECHANICAL)
2163GAME( 200?, as_tbl,   0              , astra_single_2e,    astrafr,    0,    ROT0,  "Astra", "Triple Bells (Astra, V104)"      , GAME_IS_SKELETON_MECHANICAL)
19642164GAME( 200?, as_tbla,  as_tbl        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Triple Bells (Astra, V105)"      , GAME_IS_SKELETON_MECHANICAL)
19652165GAME( 200?, as_tblb,  as_tbl        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Triple Bells (Astra, V106)"      , GAME_IS_SKELETON_MECHANICAL)
19662166GAME( 200?, as_tblc,  as_tbl        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Triple Bells (Astra, V103)"      , GAME_IS_SKELETON_MECHANICAL)
19672167GAME( 200?, as_tbld,  as_tbl        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Triple Bells (Astra, V304)"      , GAME_IS_SKELETON_MECHANICAL)
19682168GAME( 200?, as_tble,  as_tbl        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Triple Bells (Astra, V303)"      , GAME_IS_SKELETON_MECHANICAL)
19692169GAME( 200?, as_tblf,  as_tbl        , astra_single,    astrafr,    0,    ROT0,  "Astra", "Triple Bells (Astra, V301)"      , GAME_IS_SKELETON_MECHANICAL)
1970GAME( 200?, as_td,   0       , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Twin Dragons (Astra, V103)"      , GAME_IS_SKELETON_MECHANICAL)
2170GAME( 200?, as_td,   0       , astra_single_2e,    astrafr,    astradec,   ROT0,  "Astra", "Twin Dragons (Astra, V103)"      , GAME_IS_SKELETON_MECHANICAL)
19712171
19722172GAME( 200?, as_twp,   0          , astra_single,    astrafr,    0,    ROT0,  "Astra", "Twin Pots (Astra, V106)"      , GAME_IS_SKELETON_MECHANICAL)
19732173GAME( 200?, as_twpa,  as_twp      , astra_single,    astrafr,    0,    ROT0,  "Astra", "Twin Pots (Astra, V104)"      , GAME_IS_SKELETON_MECHANICAL)
1974GAME( 200?, as_vn,    0        , astrafr_dual,    astrafr,    astradec_dual,    ROT0,  "Astra", "Vegas Nights (Astra, V205)"      , GAME_IS_SKELETON_MECHANICAL)
2174GAME( 200?, as_vn,    0        , astrafr_dual_alt_37,    astrafr,    astradec_dual,    ROT0,  "Astra", "Vegas Nights (Astra, V205)"      , GAME_IS_SKELETON_MECHANICAL)
19752175GAME( 200?, as_vcv,    0        , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Viva Cash Vegas (Astra, V005)"      , GAME_IS_SKELETON_MECHANICAL)
19762176GAME( 200?, as_vcva,   as_vcv     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Viva Cash Vegas (Astra, V107)"      , GAME_IS_SKELETON_MECHANICAL)
19772177GAME( 200?, as_vcvb,   as_vcv     , astra_single,    astrafr,    astradec,   ROT0,  "Astra", "Viva Cash Vegas (Astra, V106)"      , GAME_IS_SKELETON_MECHANICAL)
src/mame/drivers/system1.c
r14896r14897
499499      UINT8 initial_value = ppi8255_get_port_c(ppi);
500500      ppi8255_set_port_c(ppi, initial_value & ~0x40);
501501      ppi8255_set_port_c(ppi, initial_value |  0x40);
502      return soundlatch_r(space, offset);
502      return soundlatch_byte_r(space, offset);
503503   }
504504
505505   /* if we have a Z80 PIO, get the data from the port and toggle the strobe */
r14896r14897
518518WRITE8_MEMBER(system1_state::soundport_w)
519519{
520520   /* boost interleave when communicating with the sound CPU */
521   soundlatch_w(space, 0, data);
521   soundlatch_byte_w(space, 0, data);
522522   machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
523523}
524524
src/mame/drivers/niyanpai.c
r14896r14897
6262
6363READ8_MEMBER(niyanpai_state::niyanpai_sound_r)
6464{
65   return soundlatch_r(space, 0);
65   return soundlatch_byte_r(space, 0);
6666}
6767
6868WRITE16_MEMBER(niyanpai_state::niyanpai_sound_w)
6969{
70   soundlatch_w(space, 0, ((data >> 8) & 0xff));
70   soundlatch_byte_w(space, 0, ((data >> 8) & 0xff));
7171}
7272
7373WRITE8_MEMBER(niyanpai_state::niyanpai_soundclr_w)
7474{
75   soundlatch_clear_w(space, 0, 0);
75   soundlatch_clear_byte_w(space, 0, 0);
7676}
7777
7878
src/mame/drivers/witch.c
r14896r14897
200200{
201201public:
202202   witch_state(const machine_config &mconfig, device_type type, const char *tag)
203      : driver_device(mconfig, type, tag) { }
203      : driver_device(mconfig, type, tag) ,
204      m_gfx0_vram(*this, "gfx0_vram"),
205      m_gfx0_cram(*this, "gfx0_cram"),
206      m_gfx1_vram(*this, "gfx1_vram"),
207      m_gfx1_cram(*this, "gfx1_cram"),
208      m_sprite_ram(*this, "sprite_ram"){ }
204209
205210   tilemap_t *m_gfx0a_tilemap;
206211   tilemap_t *m_gfx0b_tilemap;
207212   tilemap_t *m_gfx1_tilemap;
208   UINT8 *m_gfx0_cram;
209   UINT8 *m_gfx0_vram;
210   UINT8 *m_gfx1_cram;
211   UINT8 *m_gfx1_vram;
212   UINT8 *m_sprite_ram;
213   required_shared_ptr<UINT8> m_gfx0_vram;
214   required_shared_ptr<UINT8> m_gfx0_cram;
215   required_shared_ptr<UINT8> m_gfx1_vram;
216   required_shared_ptr<UINT8> m_gfx1_cram;
217   required_shared_ptr<UINT8> m_sprite_ram;
213218   int m_scrollx;
214219   int m_scrolly;
215220   UINT8 m_reg_a002;
r14896r14897
234239static TILE_GET_INFO( get_gfx0b_tile_info )
235240{
236241   witch_state *state = machine.driver_data<witch_state>();
237   int code  = state->m_gfx0_vram[tile_index];
238   int color = state->m_gfx0_cram[tile_index];
242   int code  = state->m_gfx0_vram.target()[tile_index];
243   int color = state->m_gfx0_cram.target()[tile_index];
239244
240245   code=code | ((color & 0xe0) << 3);
241246
r14896r14897
254259static TILE_GET_INFO( get_gfx0a_tile_info )
255260{
256261   witch_state *state = machine.driver_data<witch_state>();
257   int code  = state->m_gfx0_vram[tile_index];
258   int color = state->m_gfx0_cram[tile_index];
262   int code  = state->m_gfx0_vram.target()[tile_index];
263   int color = state->m_gfx0_cram.target()[tile_index];
259264
260265   code=code | ((color & 0xe0) << 3);
261266
r14896r14897
274279static TILE_GET_INFO( get_gfx1_tile_info )
275280{
276281   witch_state *state = machine.driver_data<witch_state>();
277   int code  = state->m_gfx1_vram[tile_index];
278   int color = state->m_gfx1_cram[tile_index];
282   int code  = state->m_gfx1_vram.target()[tile_index];
283   int color = state->m_gfx1_cram.target()[tile_index];
279284
280285   SET_TILE_INFO(
281286         0,
r14896r14897
286291
287292WRITE8_MEMBER(witch_state::gfx0_vram_w)
288293{
289   m_gfx0_vram[offset] = data;
294   m_gfx0_vram.target()[offset] = data;
290295   m_gfx0a_tilemap->mark_tile_dirty(offset);
291296   m_gfx0b_tilemap->mark_tile_dirty(offset);
292297}
293298
294299WRITE8_MEMBER(witch_state::gfx0_cram_w)
295300{
296   m_gfx0_cram[offset] = data;
301   m_gfx0_cram.target()[offset] = data;
297302   m_gfx0a_tilemap->mark_tile_dirty(offset);
298303   m_gfx0b_tilemap->mark_tile_dirty(offset);
299304}
300305READ8_MEMBER(witch_state::gfx0_vram_r)
301306{
302   return m_gfx0_vram[offset];
307   return m_gfx0_vram.target()[offset];
303308}
304309
305310READ8_MEMBER(witch_state::gfx0_cram_r)
306311{
307   return m_gfx0_cram[offset];
312   return m_gfx0_cram.target()[offset];
308313}
309314
310315#define FIX_OFFSET() do { \
r14896r14897
313318WRITE8_MEMBER(witch_state::gfx1_vram_w)
314319{
315320   FIX_OFFSET();
316   m_gfx1_vram[offset] = data;
321   m_gfx1_vram.target()[offset] = data;
317322   m_gfx1_tilemap->mark_tile_dirty(offset);
318323}
319324
320325WRITE8_MEMBER(witch_state::gfx1_cram_w)
321326{
322327   FIX_OFFSET();
323   m_gfx1_cram[offset] = data;
328   m_gfx1_cram.target()[offset] = data;
324329   m_gfx1_tilemap->mark_tile_dirty(offset);
325330}
326331READ8_MEMBER(witch_state::gfx1_vram_r)
327332{
328333   FIX_OFFSET();
329   return m_gfx1_vram[offset];
334   return m_gfx1_vram.target()[offset];
330335}
331336
332337READ8_MEMBER(witch_state::gfx1_cram_r)
333338{
334339   FIX_OFFSET();
335   return m_gfx1_cram[offset];
340   return m_gfx1_cram.target()[offset];
336341}
337342
338343READ8_MEMBER(witch_state::read_a00x)
r14896r14897
466471   AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
467472   AM_RANGE(0x8008, 0x8009) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r, ym2203_w)
468473   AM_RANGE(0xa000, 0xa00f) AM_READWRITE(read_a00x, write_a00x)
469   AM_RANGE(0xc000, 0xc3ff) AM_READWRITE(gfx0_vram_r, gfx0_vram_w) AM_BASE(m_gfx0_vram)
470   AM_RANGE(0xc400, 0xc7ff) AM_READWRITE(gfx0_cram_r, gfx0_cram_w) AM_BASE(m_gfx0_cram)
471   AM_RANGE(0xc800, 0xcbff) AM_READWRITE(gfx1_vram_r, gfx1_vram_w) AM_BASE(m_gfx1_vram)
472   AM_RANGE(0xcc00, 0xcfff) AM_READWRITE(gfx1_cram_r, gfx1_cram_w) AM_BASE(m_gfx1_cram)
473   AM_RANGE(0xd000, 0xdfff) AM_RAM AM_BASE(m_sprite_ram)
474   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w) AM_SHARE("paletteram")
475   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w) AM_SHARE("paletteram2")
474   AM_RANGE(0xc000, 0xc3ff) AM_READWRITE(gfx0_vram_r, gfx0_vram_w) AM_SHARE("gfx0_vram")
475   AM_RANGE(0xc400, 0xc7ff) AM_READWRITE(gfx0_cram_r, gfx0_cram_w) AM_SHARE("gfx0_cram")
476   AM_RANGE(0xc800, 0xcbff) AM_READWRITE(gfx1_vram_r, gfx1_vram_w) AM_SHARE("gfx1_vram")
477   AM_RANGE(0xcc00, 0xcfff) AM_READWRITE(gfx1_cram_r, gfx1_cram_w) AM_SHARE("gfx1_cram")
478   AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("sprite_ram")
479   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w) AM_SHARE("paletteram")
480   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
476481   AM_RANGE(0xf000, 0xf0ff) AM_RAM AM_SHARE("share1")
477482   AM_RANGE(0xf100, 0xf17f) AM_RAM AM_SHARE("nvram")
478483   AM_RANGE(0xf180, 0xffff) AM_RAM AM_SHARE("share2")
r14896r14897
719724   for(i=0;i<0x800;i+=0x20) {
720725
721726
722      sx     = state->m_sprite_ram[i+1];
727      sx     = state->m_sprite_ram.target()[i+1];
723728      if(sx!=0xF8) {
724         tileno = (state->m_sprite_ram[i]<<2)  | (( state->m_sprite_ram[i+0x800] & 0x07 ) << 10 );
729         tileno = (state->m_sprite_ram.target()[i]<<2)  | (( state->m_sprite_ram.target()[i+0x800] & 0x07 ) << 10 );
725730
726         sy     = state->m_sprite_ram[i+2];
727         flags  = state->m_sprite_ram[i+3];
731         sy     = state->m_sprite_ram.target()[i+2];
732         flags  = state->m_sprite_ram.target()[i+3];
728733
729734         flipx  = (flags & 0x10 ) ? 1 : 0;
730735         flipy  = (flags & 0x20 ) ? 1 : 0;
src/mame/drivers/luckgrln.c
r14896r14897
8787{
8888public:
8989   luckgrln_state(const machine_config &mconfig, device_type type, const char *tag)
90      : driver_device(mconfig, type, tag) { }
90      : driver_device(mconfig, type, tag) ,
91      m_reel1_ram(*this, "reel1_ram"),
92      m_reel1_attr(*this, "reel1_attr"),
93      m_reel1_scroll(*this, "reel1_scroll"),
94      m_reel2_ram(*this, "reel2_ram"),
95      m_reel2_attr(*this, "reel2_attr"),
96      m_reel2_scroll(*this, "reel2_scroll"),
97      m_reel3_ram(*this, "reel3_ram"),
98      m_reel3_attr(*this, "reel3_attr"),
99      m_reel3_scroll(*this, "reel3_scroll"),
100      m_reel4_ram(*this, "reel4_ram"),
101      m_reel4_attr(*this, "reel4_attr"),
102      m_reel4_scroll(*this, "reel4_scroll"),
103      m_luck_vram1(*this, "luck_vram1"),
104      m_luck_vram2(*this, "luck_vram2"),
105      m_luck_vram3(*this, "luck_vram3"){ }
91106
92   UINT8 *m_luck_vram1;
93   UINT8 *m_luck_vram2;
94   UINT8 *m_luck_vram3;
95107   UINT8 m_nmi_enable;
96108   tilemap_t *m_reel1_tilemap;
97109   tilemap_t *m_reel2_tilemap;
98110   tilemap_t *m_reel3_tilemap;
99111   tilemap_t *m_reel4_tilemap;
100   UINT8* m_reel1_ram;
101   UINT8* m_reel2_ram;
102   UINT8* m_reel3_ram;
103   UINT8* m_reel4_ram;
104   UINT8* m_reel1_scroll;
105   UINT8* m_reel2_scroll;
106   UINT8* m_reel3_scroll;
107   UINT8* m_reel4_scroll;
108   UINT8* m_reel1_attr;
109   UINT8* m_reel2_attr;
110   UINT8* m_reel3_attr;
111   UINT8* m_reel4_attr;
112   required_shared_ptr<UINT8> m_reel1_ram;
113   required_shared_ptr<UINT8> m_reel1_attr;
114   required_shared_ptr<UINT8> m_reel1_scroll;
115   required_shared_ptr<UINT8> m_reel2_ram;
116   required_shared_ptr<UINT8> m_reel2_attr;
117   required_shared_ptr<UINT8> m_reel2_scroll;
118   required_shared_ptr<UINT8> m_reel3_ram;
119   required_shared_ptr<UINT8> m_reel3_attr;
120   required_shared_ptr<UINT8> m_reel3_scroll;
121   required_shared_ptr<UINT8> m_reel4_ram;
122   required_shared_ptr<UINT8> m_reel4_attr;
123   required_shared_ptr<UINT8> m_reel4_scroll;
124   required_shared_ptr<UINT8> m_luck_vram1;
125   required_shared_ptr<UINT8> m_luck_vram2;
126   required_shared_ptr<UINT8> m_luck_vram3;
127
112128   int m_palette_count;
113129   UINT8 m_palette_ram[0x10000];
114130   DECLARE_WRITE8_MEMBER(luckgrln_reel1_ram_w);
r14896r14897
133149
134150WRITE8_MEMBER(luckgrln_state::luckgrln_reel1_ram_w)
135151{
136   m_reel1_ram[offset] = data;
152   m_reel1_ram.target()[offset] = data;
137153   m_reel1_tilemap->mark_tile_dirty(offset);
138154}
139155
140156WRITE8_MEMBER(luckgrln_state::luckgrln_reel1_attr_w)
141157{
142   m_reel1_attr[offset] = data;
158   m_reel1_attr.target()[offset] = data;
143159   m_reel1_tilemap->mark_tile_dirty(offset);
144160}
145161
r14896r14897
148164static TILE_GET_INFO( get_luckgrln_reel1_tile_info )
149165{
150166   luckgrln_state *state = machine.driver_data<luckgrln_state>();
151   int code = state->m_reel1_ram[tile_index];
152   int attr = state->m_reel1_attr[tile_index];
167   int code = state->m_reel1_ram.target()[tile_index];
168   int attr = state->m_reel1_attr.target()[tile_index];
153169   int col = (attr & 0x1f);
154170
155171   code |= (attr & 0xe0)<<3;
r14896r14897
165181
166182WRITE8_MEMBER(luckgrln_state::luckgrln_reel2_ram_w)
167183{
168   m_reel2_ram[offset] = data;
184   m_reel2_ram.target()[offset] = data;
169185   m_reel2_tilemap->mark_tile_dirty(offset);
170186}
171187
172188WRITE8_MEMBER(luckgrln_state::luckgrln_reel2_attr_w)
173189{
174   m_reel2_attr[offset] = data;
190   m_reel2_attr.target()[offset] = data;
175191   m_reel2_tilemap->mark_tile_dirty(offset);
176192}
177193
r14896r14897
179195static TILE_GET_INFO( get_luckgrln_reel2_tile_info )
180196{
181197   luckgrln_state *state = machine.driver_data<luckgrln_state>();
182   int code = state->m_reel2_ram[tile_index];
183   int attr = state->m_reel2_attr[tile_index];
198   int code = state->m_reel2_ram.target()[tile_index];
199   int attr = state->m_reel2_attr.target()[tile_index];
184200   int col = (attr & 0x1f);
185201
186202   code |= (attr & 0xe0)<<3;
r14896r14897
195211
196212WRITE8_MEMBER(luckgrln_state::luckgrln_reel3_ram_w)
197213{
198   m_reel3_ram[offset] = data;
214   m_reel3_ram.target()[offset] = data;
199215   m_reel3_tilemap->mark_tile_dirty(offset);
200216}
201217
202218WRITE8_MEMBER(luckgrln_state::luckgrln_reel3_attr_w)
203219{
204   m_reel3_attr[offset] = data;
220   m_reel3_attr.target()[offset] = data;
205221   m_reel3_tilemap->mark_tile_dirty(offset);
206222}
207223
r14896r14897
209225static TILE_GET_INFO( get_luckgrln_reel3_tile_info )
210226{
211227   luckgrln_state *state = machine.driver_data<luckgrln_state>();
212   int code = state->m_reel3_ram[tile_index];
213   int attr = state->m_reel3_attr[tile_index];
228   int code = state->m_reel3_ram.target()[tile_index];
229   int attr = state->m_reel3_attr.target()[tile_index];
214230   int col = (attr & 0x1f);
215231
216232   code |= (attr & 0xe0)<<3;
r14896r14897
224240
225241WRITE8_MEMBER(luckgrln_state::luckgrln_reel4_ram_w)
226242{
227   m_reel4_ram[offset] = data;
243   m_reel4_ram.target()[offset] = data;
228244   m_reel4_tilemap->mark_tile_dirty(offset);
229245}
230246
231247WRITE8_MEMBER(luckgrln_state::luckgrln_reel4_attr_w)
232248{
233   m_reel4_attr[offset] = data;
249   m_reel4_attr.target()[offset] = data;
234250   m_reel4_tilemap->mark_tile_dirty(offset);
235251}
236252
r14896r14897
238254static TILE_GET_INFO( get_luckgrln_reel4_tile_info )
239255{
240256   luckgrln_state *state = machine.driver_data<luckgrln_state>();
241   int code = state->m_reel4_ram[tile_index];
242   int attr = state->m_reel4_attr[tile_index];
257   int code = state->m_reel4_ram.target()[tile_index];
258   int attr = state->m_reel4_attr.target()[tile_index];
243259   int col = (attr & 0x1f);
244260
245261   code |= (attr & 0xe0)<<3;
r14896r14897
284300
285301   for (i= 0;i < 64;i++)
286302   {
287      state->m_reel1_tilemap->set_scrolly(i, state->m_reel1_scroll[i]);
288      state->m_reel2_tilemap->set_scrolly(i, state->m_reel2_scroll[i]);
289      state->m_reel3_tilemap->set_scrolly(i, state->m_reel3_scroll[i]);
290      state->m_reel4_tilemap->set_scrolly(i, state->m_reel4_scroll[i]);
303      state->m_reel1_tilemap->set_scrolly(i, state->m_reel1_scroll.target()[i]);
304      state->m_reel2_tilemap->set_scrolly(i, state->m_reel2_scroll.target()[i]);
305      state->m_reel3_tilemap->set_scrolly(i, state->m_reel3_scroll.target()[i]);
306      state->m_reel4_tilemap->set_scrolly(i, state->m_reel4_scroll.target()[i]);
291307   }
292308
293309
r14896r14897
301317
302318      for (x=0;x<64;x++)
303319      {
304         UINT16 tile = (state->m_luck_vram1[count] & 0xff);
305         UINT16 tile_high = (state->m_luck_vram2[count]);
306         UINT16 tileattr = (state->m_luck_vram3[count]);
320         UINT16 tile = (state->m_luck_vram1.target()[count] & 0xff);
321         UINT16 tile_high = (state->m_luck_vram2.target()[count]);
322         UINT16 tileattr = (state->m_luck_vram3.target()[count]);
307323         UINT8 col = 0;
308324         UINT8 region = 0;
309325         UINT8 bgenable;
r14896r14897
372388   AM_RANGE(0x10000, 0x1ffff) AM_ROM AM_REGION("rom_data",0x10000)
373389   AM_RANGE(0x20000, 0x2ffff) AM_ROM AM_REGION("rom_data",0x00000)
374390
375   AM_RANGE(0x0c000, 0x0c1ff) AM_RAM_WRITE(luckgrln_reel1_ram_w)  AM_BASE(m_reel1_ram) // only written to half way
376   AM_RANGE(0x0c800, 0x0c9ff) AM_RAM_WRITE(luckgrln_reel1_attr_w) AM_BASE(m_reel1_attr)
377   AM_RANGE(0x0d000, 0x0d03f) AM_RAM AM_BASE(m_reel1_scroll) AM_MIRROR(0x000c0)
391   AM_RANGE(0x0c000, 0x0c1ff) AM_RAM_WRITE(luckgrln_reel1_ram_w)  AM_SHARE("reel1_ram") // only written to half way
392   AM_RANGE(0x0c800, 0x0c9ff) AM_RAM_WRITE(luckgrln_reel1_attr_w) AM_SHARE("reel1_attr")
393   AM_RANGE(0x0d000, 0x0d03f) AM_RAM AM_SHARE("reel1_scroll") AM_MIRROR(0x000c0)
378394
379   AM_RANGE(0x0c200, 0x0c3ff) AM_RAM_WRITE(luckgrln_reel2_ram_w)  AM_BASE(m_reel2_ram)
380   AM_RANGE(0x0ca00, 0x0cbff) AM_RAM_WRITE(luckgrln_reel2_attr_w) AM_BASE(m_reel2_attr)
381   AM_RANGE(0x0d200, 0x0d23f) AM_RAM AM_BASE(m_reel2_scroll) AM_MIRROR(0x000c0)
395   AM_RANGE(0x0c200, 0x0c3ff) AM_RAM_WRITE(luckgrln_reel2_ram_w)  AM_SHARE("reel2_ram")
396   AM_RANGE(0x0ca00, 0x0cbff) AM_RAM_WRITE(luckgrln_reel2_attr_w) AM_SHARE("reel2_attr")
397   AM_RANGE(0x0d200, 0x0d23f) AM_RAM AM_SHARE("reel2_scroll") AM_MIRROR(0x000c0)
382398
383   AM_RANGE(0x0c400, 0x0c5ff) AM_RAM_WRITE(luckgrln_reel3_ram_w ) AM_BASE(m_reel3_ram)
384   AM_RANGE(0x0cc00, 0x0cdff) AM_RAM_WRITE(luckgrln_reel3_attr_w) AM_BASE(m_reel3_attr)
385   AM_RANGE(0x0d400, 0x0d43f) AM_RAM AM_BASE(m_reel3_scroll) AM_MIRROR(0x000c0)
399   AM_RANGE(0x0c400, 0x0c5ff) AM_RAM_WRITE(luckgrln_reel3_ram_w ) AM_SHARE("reel3_ram")
400   AM_RANGE(0x0cc00, 0x0cdff) AM_RAM_WRITE(luckgrln_reel3_attr_w) AM_SHARE("reel3_attr")
401   AM_RANGE(0x0d400, 0x0d43f) AM_RAM AM_SHARE("reel3_scroll") AM_MIRROR(0x000c0)
386402
387   AM_RANGE(0x0c600, 0x0c7ff) AM_RAM_WRITE(luckgrln_reel4_ram_w ) AM_BASE(m_reel4_ram)
388   AM_RANGE(0x0ce00, 0x0cfff) AM_RAM_WRITE(luckgrln_reel4_attr_w) AM_BASE(m_reel4_attr)
389   AM_RANGE(0x0d600, 0x0d63f) AM_RAM AM_BASE(m_reel4_scroll)
403   AM_RANGE(0x0c600, 0x0c7ff) AM_RAM_WRITE(luckgrln_reel4_ram_w ) AM_SHARE("reel4_ram")
404   AM_RANGE(0x0ce00, 0x0cfff) AM_RAM_WRITE(luckgrln_reel4_attr_w) AM_SHARE("reel4_attr")
405   AM_RANGE(0x0d600, 0x0d63f) AM_RAM AM_SHARE("reel4_scroll")
390406
391407//  AM_RANGE(0x0d200, 0x0d2ff) AM_RAM
392408
393409
394410   AM_RANGE(0x0d800, 0x0dfff) AM_RAM // nvram
395411
396   AM_RANGE(0x0e000, 0x0e7ff) AM_RAM AM_BASE(m_luck_vram1)
397   AM_RANGE(0x0e800, 0x0efff) AM_RAM AM_BASE(m_luck_vram2)
398   AM_RANGE(0x0f000, 0x0f7ff) AM_RAM AM_BASE(m_luck_vram3)
412   AM_RANGE(0x0e000, 0x0e7ff) AM_RAM AM_SHARE("luck_vram1")
413   AM_RANGE(0x0e800, 0x0efff) AM_RAM AM_SHARE("luck_vram2")
414   AM_RANGE(0x0f000, 0x0f7ff) AM_RAM AM_SHARE("luck_vram3")
399415
400416
401417   AM_RANGE(0x0f800, 0x0ffff) AM_RAM
src/mame/drivers/sigmab98.c
r14896r14897
101101public:
102102   sigmab98_state(const machine_config &mconfig, device_type type, const char *tag)
103103      : driver_device(mconfig, type, tag),
104      m_maincpu(*this,"maincpu")
105      { }
104      m_maincpu(*this,"maincpu"),
105      m_spriteram(*this, "spriteram"),
106      m_nvram(*this, "nvram"){ }
106107
107   UINT8 *m_spriteram;
108   size_t m_spriteram_size;
108   required_device<cpu_device> m_maincpu;
109   required_shared_ptr<UINT8> m_spriteram;
110   required_shared_ptr<UINT8> m_nvram;
111
109112   UINT8 m_reg;
110113   UINT8 m_rombank;
111114   UINT8 m_reg2;
r14896r14897
116119   UINT8 m_c8;
117120   UINT8 m_vblank;
118121   UINT8 m_out[3];
119   UINT8 *m_nvram;
120122
121   required_device<cpu_device> m_maincpu;
122123   UINT8 m_vblank_vector;
123124   UINT8 m_timer0_vector;
124125   UINT8 m_timer1_vector;
r14896r14897
212213static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_mask)
213214{
214215   sigmab98_state *state = machine.driver_data<sigmab98_state>();
215   UINT8 *end      =   state->m_spriteram - 0x10;
216   UINT8 *s      =   end + state->m_spriteram_size;
216   UINT8 *end      =   state->m_spriteram.target() - 0x10;
217   UINT8 *s      =   end + state->m_spriteram.bytes();
217218
218219   for ( ; s != end; s -= 0x10 )
219220   {
r14896r14897
479480// 02 hopper motor on (active low)?
480481WRITE8_MEMBER(sigmab98_state::c8_w)
481482{
482   ticket_dispenser_w(machine().device("hopper"), 0, (!(data & 0x02) && (data & 0x01)) ? 0x00 : 0x80);
483   machine().device<ticket_dispenser_device>("hopper")->write(space, 0, (!(data & 0x02) && (data & 0x01)) ? 0x00 : 0x80);
483484
484485   m_c8 = data;
485486   show_outputs();
r14896r14897
489490   AM_RANGE( 0x0000, 0x7fff ) AM_ROM
490491   AM_RANGE( 0x8000, 0x9fff ) AM_ROMBANK("rombank")
491492
492   AM_RANGE( 0xa000, 0xafff ) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
493   AM_RANGE( 0xa000, 0xafff ) AM_RAM AM_SHARE("spriteram")
493494
494   AM_RANGE( 0xc000, 0xc1ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_be_w) AM_SHARE("paletteram")
495   AM_RANGE( 0xc000, 0xc1ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_be_w) AM_SHARE("paletteram")
495496
496497   AM_RANGE( 0xc800, 0xc87f ) AM_RAM
497498
r14896r14897
712713// 01 hopper motor on (active low)?
713714WRITE8_MEMBER(sigmab98_state::sammymdl_hopper_w)
714715{
715   ticket_dispenser_w(machine().device("hopper"), 0, (!(data & 0x01) && (data & 0x02)) ? 0x00 : 0x80);
716   machine().device<ticket_dispenser_device>("hopper")->write(space, 0, (!(data & 0x01) && (data & 0x02)) ? 0x00 : 0x80);
716717
717718   m_out[2] = data;
718719   show_3_outputs();
r14896r14897
722723{
723724   UINT8 ret = input_port_read(machine(), "COIN");
724725
725//  if ( !ticket_dispenser_r(machine().device("hopper"), 0) )
726//  if ( !machine().device<ticket_dispenser_device>("hopper")->read(0) )
726727//      ret &= ~0x01;
727728
728729   return ret;
r14896r14897
737738   AM_RANGE( 0xa000, 0xafff ) AM_RAM
738739   AM_RANGE( 0xb000, 0xbfff ) AM_RAMBANK("sprbank")
739740
740   AM_RANGE( 0xd000, 0xd1ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_be_w ) AM_SHARE("paletteram")
741   AM_RANGE( 0xd000, 0xd1ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_be_w ) AM_SHARE("paletteram")
741742   AM_RANGE( 0xd800, 0xd87f ) AM_RAM   // table?
742743
743744   AM_RANGE( 0xe011, 0xe011 ) AM_WRITENOP   // IRQ Enable? Screen disable?
r14896r14897
901902
902903      case 0x65:   // SPRITERAM
903904         if (offset < 0x1000)
904            return m_spriteram[offset];
905            return m_spriteram.target()[offset];
905906
906907      case 0x67:   // PALETTERAM + TABLE? + REGS
907908         if (offset < 0x200)
r14896r14897
922923      case 0x65:   // SPRITERAM
923924         if (offset < 0x1000)
924925         {
925            m_spriteram[offset] = data;
926            m_spriteram.target()[offset] = data;
926927            return;
927928         }
928929         break;
r14896r14897
930931      case 0x67:   // PALETTERAM + TABLE? + REGS
931932         if (offset < 0x200)
932933         {
933            paletteram_xRRRRRGGGGGBBBBB_be_w(space, offset, data);
934            paletteram_xRRRRRGGGGGBBBBB_byte_be_w(space, offset, data);
934935//              m_generic_paletteram_8[offset] = data;
935936            return;
936937         }
r14896r14897
10731074               break;
10741075
10751076            case 0x6c:   // 3800 IS RAM! (1000 bytes) - SPRITERAM
1076               memory_set_bankptr(machine(), "rombank0", m_spriteram);
1077               memory_set_bankptr(machine(), "sprbank0", m_spriteram);
1077               memory_set_bankptr(machine(), "rombank0", m_spriteram.target());
1078               memory_set_bankptr(machine(), "sprbank0", m_spriteram.target());
10781079//                  memory_set_bankptr(machine(), "sprbank1", m_spriteram + 0x1000*4);    // scratch
10791080               break;
10801081
r14896r14897
11381139         m_rambank = data;
11391140         switch (data)
11401141         {
1141            case 0x52:   memory_set_bankptr(machine(), "palbank", m_nvram);                           break;
1142            case 0x52:   memory_set_bankptr(machine(), "palbank", m_nvram.target());                           break;
11421143            case 0x64:   memory_set_bankptr(machine(), "palbank", m_generic_paletteram_8);   break;
11431144            default:
11441145               logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", machine().describe_context(), data, m_reg2);
r14896r14897
11711172{
11721173   if (m_rambank == 0x64)
11731174   {
1174      paletteram_xRRRRRGGGGGBBBBB_be_w(space, offset, data);
1175      paletteram_xRRRRRGGGGGBBBBB_byte_be_w(space, offset, data);
11751176//      m_generic_paletteram_8[offset] = data;
11761177   }
11771178   else if (m_rambank == 0x52)
11781179   {
1179      m_nvram[offset] = data;
1180      m_nvram.target()[offset] = data;
11801181   }
11811182   else
11821183   {
r14896r14897
11891190   if (m_rombank == 0x6c)
11901191   {
11911192      if (offset < 0x200)
1192         paletteram_xRRRRRGGGGGBBBBB_be_w(space, offset, data);
1193         paletteram_xRRRRRGGGGGBBBBB_byte_be_w(space, offset, data);
11931194//          m_generic_paletteram_8[offset] = data;
11941195   }
11951196   else
r14896r14897
13771378
13781379      case 0x64:   // SPRITERAM
13791380         if (offset < 0x1000)
1380            return m_spriteram[offset];
1381            return m_spriteram.target()[offset];
13811382         break;
13821383
13831384      case 0x66:   // PALETTERAM + TABLE?
r14896r14897
14021403      case 0x64:   // SPRITERAM
14031404         if (offset < 0x1000)
14041405         {
1405            m_spriteram[offset] = data;
1406            m_spriteram.target()[offset] = data;
14061407            return;
14071408         }
14081409         break;
r14896r14897
14101411      case 0x66:   // PALETTERAM + TABLE?
14111412         if (offset < 0x200)
14121413         {
1413            paletteram_xRRRRRGGGGGBBBBB_be_w(space, offset, data);
1414            paletteram_xRRRRRGGGGGBBBBB_byte_be_w(space, offset, data);
14141415//              m_generic_paletteram_8[offset] = data;
14151416            return;
14161417         }
r14896r14897
15091510   PORT_START("IN1")
15101511   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN2   ) PORT_IMPULSE(5)   // ? (coin error, pulses mask 4 of port c6)
15111512   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN1   ) PORT_IMPULSE(5) PORT_NAME("Medal")   // coin/medal in (coin error)
1512   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("hopper", ticket_dispenser_line_r)
1513   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r)
15131514   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
15141515   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_NAME("Bet")   // bet / select in test menu
15151516   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_NAME("Play")   // play game / select in test menu
r14896r14897
15471548   PORT_START("IN1")
15481549   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN2   ) PORT_IMPULSE(5)   // ? (coin error, pulses mask 4 of port c6)
15491550   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN1   ) PORT_IMPULSE(5) PORT_NAME("Medal")   // coin/medal in (coin error)
1550   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("hopper", ticket_dispenser_line_r)
1551   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r)
15511552   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
15521553   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_GAMBLE_BET ) PORT_CODE(KEYCODE_1)   // bet / select in test menu
15531554   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_NAME("Rock (Gu)")
r14896r14897
15851586   PORT_START("IN1")
15861587   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN2   ) PORT_IMPULSE(10)   // ? (coin error, pulses mask 4 of port c6)
15871588   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN1   ) PORT_IMPULSE(10) PORT_NAME("Medal")   // coin/medal in (coin error)
1588   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("hopper", ticket_dispenser_line_r)
1589   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r)
15891590   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
15901591   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_GAMBLE_BET ) PORT_CODE(KEYCODE_1)   // bet / enter in test menu
15911592   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN  )
r14896r14897
16251626   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_COIN3   ) PORT_IMPULSE(5) PORT_NAME("Medal")   // medal in
16261627   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE )   // test sw
16271628   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1628   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("hopper", ticket_dispenser_line_r)
1629   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r)
16291630   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
16301631   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
16311632INPUT_PORTS_END
r14896r14897
16471648   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN  )
16481649   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE  )   // test sw
16491650   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON1  )   // button
1650   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL  ) PORT_READ_LINE_DEVICE("hopper", ticket_dispenser_line_r)
1651   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL  ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r)
16511652   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_SERVICE1 )   // service coin / set in test mode
16521653   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN  )
16531654INPUT_PORTS_END
r14896r14897
16901691   MCFG_NVRAM_ADD_0FILL("nvram")
16911692   MCFG_EEPROM_ADD("eeprom", eeprom_intf)
16921693
1693   MCFG_TICKET_DISPENSER_ADD("hopper", 200, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW )
1694   MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW )
16941695
16951696   MCFG_SCREEN_ADD("screen", RASTER)
16961697   MCFG_SCREEN_REFRESH_RATE(60)               // ?
r14896r14897
17441745   MCFG_NVRAM_ADD_0FILL("nvram")   // battery
17451746   MCFG_EEPROM_ADD("eeprom", eeprom_interface_93C46_8bit)
17461747
1747   MCFG_TICKET_DISPENSER_ADD("hopper", 200, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW )
1748   MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW )
17481749
17491750   // video hardware
17501751   MCFG_SCREEN_ADD("screen", RASTER)
r14896r14897
21132114   memory_configure_bank(machine, "rambank", 1, 4, bankedram, 0x1000);
21142115   memory_set_bank(machine, "rambank", 0);
21152116
2116   state->m_spriteram = auto_alloc_array(machine, UINT8, 0x1000 * 5);
2117   memset(state->m_spriteram, 0, 0x1000 * 5);
2118   state->m_spriteram_size = 0x1000;
2117   //state->m_spriteram = auto_alloc_array(machine, UINT8, 0x1000 * 5);
2118   //memset(state->m_spriteram, 0, 0x1000 * 5);
2119   //state->m_spriteram_size = 0x1000;
21192120   memory_configure_bank(machine, "sprbank", 0, 5, state->m_spriteram, 0x1000);
21202121   memory_set_bank(machine, "sprbank", 0);
21212122
r14896r14897
21612162   memory_set_bankptr(machine, "palbank", state->m_generic_paletteram_8);
21622163   state->m_rambank = 0x64;
21632164
2164   state->m_spriteram = auto_alloc_array(machine, UINT8, 0x1000 * 5);
2165   memset(state->m_spriteram, 0, 0x1000 * 5);
2166   state->m_spriteram_size = 0x1000;
2165   //state->m_spriteram = auto_alloc_array(machine, UINT8, 0x1000 * 5);
2166   //memset(state->m_spriteram, 0, 0x1000 * 5);
2167   //state->m_spriteram_size = 0x1000;
21672168   memory_set_bankptr(machine, "sprbank0",  state->m_spriteram + 0x1000*4);   // scratch
21682169   memory_set_bankptr(machine, "sprbank1",  state->m_spriteram + 0x1000*4);   // scratch
21692170
r14896r14897
22732274   state->m_generic_paletteram_8.allocate(0x200);
22742275   memset(state->m_generic_paletteram_8, 0, 0x200);
22752276
2276   state->m_spriteram = auto_alloc_array(machine, UINT8, 0x1000);
2277   memset(state->m_spriteram, 0, 0x1000);
2278   state->m_spriteram_size = 0x1000;
2277   //state->m_spriteram = auto_alloc_array(machine, UINT8, 0x1000);
2278   //memset(state->m_spriteram, 0, 0x1000);
2279   //state->m_spriteram_size = 0x1000;
22792280
22802281   state->m_rombank = 0x65;
22812282   state->m_rambank = 0x53;
src/mame/drivers/shootout.c
r14896r14897
4848
4949WRITE8_MEMBER(shootout_state::sound_cpu_command_w)
5050{
51   soundlatch_w( space, offset, data );
51   soundlatch_byte_w( space, offset, data );
5252   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE );
5353}
5454
5555WRITE8_MEMBER(shootout_state::shootout_flipscreen_w)
5656{
57   flip_screen_set(machine(), data & 0x01);
57   flip_screen_set(data & 0x01);
5858}
5959
6060WRITE8_MEMBER(shootout_state::shootout_coin_counter_w)
r14896r14897
9999static ADDRESS_MAP_START( shootout_sound_map, AS_PROGRAM, 8, shootout_state )
100100   AM_RANGE(0x0000, 0x07ff) AM_RAM
101101   AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r,ym2203_w)
102   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
102   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
103103   AM_RANGE(0xc000, 0xffff) AM_ROM
104104   AM_RANGE(0xd000, 0xd000) AM_WRITENOP // unknown, NOT irq/nmi mask
105105ADDRESS_MAP_END
src/mame/drivers/volfied.c
r14896r14897
6767   AM_RANGE(0x100000, 0x103fff) AM_RAM      /* main    */
6868   AM_RANGE(0x200000, 0x203fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)
6969   AM_RANGE(0x400000, 0x47ffff) AM_READWRITE(volfied_video_ram_r, volfied_video_ram_w)
70   AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
70   AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
7171   AM_RANGE(0x600000, 0x600001) AM_WRITE(volfied_video_mask_w)
7272   AM_RANGE(0x700000, 0x700001) AM_WRITE(volfied_sprite_ctrl_w)
7373   AM_RANGE(0xd00000, 0xd00001) AM_READWRITE(volfied_video_ctrl_r, volfied_video_ctrl_w)
src/mame/drivers/itech32.c
r14896r14897
706706   set_led_status(space->machine(), 1, data & 0x01);
707707   set_led_status(space->machine(), 2, data & 0x02);
708708   set_led_status(space->machine(), 3, data & 0x04);
709   ticket_dispenser_w(device->machine().device("ticket"), 0, (data & 0x10) << 3);
709   device->machine().device<ticket_dispenser_device>("ticket")->write(*device->machine().memory().first_space(), 0, (data & 0x10) << 3);
710710   coin_counter_w(space->machine(), 0, (data & 0x20) >> 5);
711711}
712712
r14896r14897
725725   /* bit 4 controls the ticket dispenser */
726726   /* bit 5 controls the coin counter */
727727   /* bit 6 controls the diagnostic sound LED */
728   ticket_dispenser_w(device->machine().device("ticket"), 0, (data & 0x10) << 3);
728   device->machine().device<ticket_dispenser_device>("ticket")->write(*device->machine().memory().first_space(), 0, (data & 0x10) << 3);
729729   coin_counter_w(space->machine(), 0, (data & 0x20) >> 5);
730730}
731731
r14896r14897
16921692   MCFG_MACHINE_RESET(itech32)
16931693   MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", itech32_state, nvram_init)
16941694
1695   MCFG_TICKET_DISPENSER_ADD("ticket", 200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
1695   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
16961696
16971697   /* video hardware */
16981698   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
src/mame/drivers/calchase.c
r14896r14897
147147
148148   UINT32 m_idle_skip_ram;
149149   required_device<cpu_device> m_maincpu;
150   DECLARE_READ8_MEMBER(at_page8_r);
151   DECLARE_WRITE8_MEMBER(at_page8_w);
152   DECLARE_READ8_MEMBER(pc_dma_read_byte);
153   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
154   DECLARE_WRITE32_MEMBER(bios_ram_w);
155   DECLARE_READ16_MEMBER(calchase_iocard1_r);
156   DECLARE_READ16_MEMBER(calchase_iocard2_r);
157   DECLARE_READ16_MEMBER(calchase_iocard3_r);
158   DECLARE_READ16_MEMBER(calchase_iocard4_r);
159   DECLARE_READ16_MEMBER(calchase_iocard5_r);
160   DECLARE_READ32_MEMBER(calchase_idle_skip_r);
161   DECLARE_WRITE32_MEMBER(calchase_idle_skip_w);
150162};
151163
152164
r14896r14897
175187
176188
177189
178static READ8_HANDLER(at_page8_r)
190READ8_MEMBER(calchase_state::at_page8_r)
179191{
180   calchase_state *state = space->machine().driver_data<calchase_state>();
181   UINT8 data = state->m_at_pages[offset % 0x10];
192   UINT8 data = m_at_pages[offset % 0x10];
182193
183194   switch(offset % 8) {
184195   case 1:
185      data = state->m_dma_offset[(offset / 8) & 1][2];
196      data = m_dma_offset[(offset / 8) & 1][2];
186197      break;
187198   case 2:
188      data = state->m_dma_offset[(offset / 8) & 1][3];
199      data = m_dma_offset[(offset / 8) & 1][3];
189200      break;
190201   case 3:
191      data = state->m_dma_offset[(offset / 8) & 1][1];
202      data = m_dma_offset[(offset / 8) & 1][1];
192203      break;
193204   case 7:
194      data = state->m_dma_offset[(offset / 8) & 1][0];
205      data = m_dma_offset[(offset / 8) & 1][0];
195206      break;
196207   }
197208   return data;
198209}
199210
200211
201static WRITE8_HANDLER(at_page8_w)
212WRITE8_MEMBER(calchase_state::at_page8_w)
202213{
203   calchase_state *state = space->machine().driver_data<calchase_state>();
204   state->m_at_pages[offset % 0x10] = data;
214   m_at_pages[offset % 0x10] = data;
205215
206216   switch(offset % 8) {
207217   case 1:
208      state->m_dma_offset[(offset / 8) & 1][2] = data;
218      m_dma_offset[(offset / 8) & 1][2] = data;
209219      break;
210220   case 2:
211      state->m_dma_offset[(offset / 8) & 1][3] = data;
221      m_dma_offset[(offset / 8) & 1][3] = data;
212222      break;
213223   case 3:
214      state->m_dma_offset[(offset / 8) & 1][1] = data;
224      m_dma_offset[(offset / 8) & 1][1] = data;
215225      break;
216226   case 7:
217      state->m_dma_offset[(offset / 8) & 1][0] = data;
227      m_dma_offset[(offset / 8) & 1][0] = data;
218228      break;
219229   }
220230}
r14896r14897
229239}
230240
231241
232static READ8_HANDLER( pc_dma_read_byte )
242READ8_MEMBER(calchase_state::pc_dma_read_byte)
233243{
234   calchase_state *state = space->machine().driver_data<calchase_state>();
235   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
244   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
236245      & 0xFF0000;
237246
238   return space->read_byte(page_offset + offset);
247   return space.read_byte(page_offset + offset);
239248}
240249
241250
242static WRITE8_HANDLER( pc_dma_write_byte )
251WRITE8_MEMBER(calchase_state::pc_dma_write_byte)
243252{
244   calchase_state *state = space->machine().driver_data<calchase_state>();
245   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
253   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
246254      & 0xFF0000;
247255
248   space->write_byte(page_offset + offset, data);
256   space.write_byte(page_offset + offset, data);
249257}
250258
251259static void set_dma_channel(device_t *device, int channel, int state)
r14896r14897
263271{
264272   DEVCB_LINE(pc_dma_hrq_changed),
265273   DEVCB_NULL,
266   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
267   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
274   DEVCB_DRIVER_MEMBER(calchase_state, pc_dma_read_byte),
275   DEVCB_DRIVER_MEMBER(calchase_state, pc_dma_write_byte),
268276   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
269277   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
270278   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
281289   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }
282290};
283291
284static READ32_HANDLER(at_page32_r)
285{
286   return read32le_with_read8_handler(at_page8_r, space, offset, mem_mask);
287}
288
289
290static WRITE32_HANDLER(at_page32_w)
291{
292   write32le_with_write8_handler(at_page8_w, space, offset, data, mem_mask);
293}
294
295292static READ32_DEVICE_HANDLER( ide_r )
296293{
297294   return ide_controller32_r(device, 0x1f0/4 + offset, mem_mask);
r14896r14897
485482   }
486483}
487484
488static WRITE32_HANDLER(bios_ram_w)
485WRITE32_MEMBER(calchase_state::bios_ram_w)
489486{
490   calchase_state *state = space->machine().driver_data<calchase_state>();
491   //if (state->m_mxtc_config_reg[0x59] & 0x20)       // write to RAM if this region is write-enabled
492          if (state->m_mxtc_config_reg[0x63] & 0x50)
487   //if (m_mxtc_config_reg[0x59] & 0x20)       // write to RAM if this region is write-enabled
488          if (m_mxtc_config_reg[0x63] & 0x50)
493489   {
494      COMBINE_DATA(state->m_bios_ram + offset);
490      COMBINE_DATA(m_bios_ram + offset);
495491   }
496492}
497493
498static READ16_HANDLER( calchase_iocard1_r )
494READ16_MEMBER(calchase_state::calchase_iocard1_r)
499495{
500   return input_port_read(space->machine(), "IOCARD1");
496   return input_port_read(machine(), "IOCARD1");
501497}
502498
503static READ16_HANDLER( calchase_iocard2_r )
499READ16_MEMBER(calchase_state::calchase_iocard2_r)
504500{
505   return input_port_read(space->machine(), "IOCARD2");
501   return input_port_read(machine(), "IOCARD2");
506502}
507503
508static READ16_HANDLER( calchase_iocard3_r )
504READ16_MEMBER(calchase_state::calchase_iocard3_r)
509505{
510   return input_port_read(space->machine(), "IOCARD3");
506   return input_port_read(machine(), "IOCARD3");
511507}
512508
513509/* These two controls wheel pot or whatever this game uses ... */
514static READ16_HANDLER( calchase_iocard4_r )
510READ16_MEMBER(calchase_state::calchase_iocard4_r)
515511{
516   return input_port_read(space->machine(), "IOCARD4");
512   return input_port_read(machine(), "IOCARD4");
517513}
518514
519static READ16_HANDLER( calchase_iocard5_r )
515READ16_MEMBER(calchase_state::calchase_iocard5_r)
520516{
521   return input_port_read(space->machine(), "IOCARD5");
517   return input_port_read(machine(), "IOCARD5");
522518}
523519
524520
r14896r14897
533529   AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0)
534530   AM_RANGE(0x000c8000, 0x000cffff) AM_NOP
535531   //AM_RANGE(0x000d0000, 0x000d0003) AM_RAM  // XYLINX - Sincronus serial communication
536   AM_RANGE(0x000d0004, 0x000d0007) AM_READ16_LEGACY(calchase_iocard1_r, 0x0000ffff)
537   AM_RANGE(0x000d000c, 0x000d000f) AM_READ16_LEGACY(calchase_iocard2_r, 0x0000ffff)
538   AM_RANGE(0x000d0030, 0x000d0033) AM_READ16_LEGACY(calchase_iocard3_r, 0xffff0000)
539   AM_RANGE(0x000d0030, 0x000d0033) AM_READ16_LEGACY(calchase_iocard4_r, 0x0000ffff)
540   AM_RANGE(0x000d0034, 0x000d0037) AM_READ16_LEGACY(calchase_iocard5_r, 0x0000ffff)
532   AM_RANGE(0x000d0004, 0x000d0007) AM_READ16(calchase_iocard1_r, 0x0000ffff)
533   AM_RANGE(0x000d000c, 0x000d000f) AM_READ16(calchase_iocard2_r, 0x0000ffff)
534   AM_RANGE(0x000d0030, 0x000d0033) AM_READ16(calchase_iocard3_r, 0xffff0000)
535   AM_RANGE(0x000d0030, 0x000d0033) AM_READ16(calchase_iocard4_r, 0x0000ffff)
536   AM_RANGE(0x000d0034, 0x000d0037) AM_READ16(calchase_iocard5_r, 0x0000ffff)
541537   AM_RANGE(0x000d0008, 0x000d000b) AM_WRITENOP // ???
542538   AM_RANGE(0x000d0024, 0x000d0027) AM_DEVWRITE16_LEGACY("dac_l",calchase_dac_w,0x0000ffff)
543539   AM_RANGE(0x000d0028, 0x000d002b) AM_DEVWRITE16_LEGACY("dac_r",calchase_dac_w,0x0000ffff)
r14896r14897
546542
547543   //GRULL AM_RANGE(0x000e0000, 0x000effff) AM_RAM
548544   //GRULL-AM_RANGE(0x000f0000, 0x000fffff) AM_ROMBANK("bank1")
549   //GRULL AM_RANGE(0x000f0000, 0x000fffff) AM_WRITE_LEGACY(bios_ram_w)
545   //GRULL AM_RANGE(0x000f0000, 0x000fffff) AM_WRITE(bios_ram_w)
550546   AM_RANGE(0x000e0000, 0x000fffff) AM_ROMBANK("bank1")
551   AM_RANGE(0x000e0000, 0x000fffff) AM_WRITE_LEGACY(bios_ram_w)
547   AM_RANGE(0x000e0000, 0x000fffff) AM_WRITE(bios_ram_w)
552548   AM_RANGE(0x00100000, 0x03ffffff) AM_RAM  // 64MB
553549   AM_RANGE(0x02000000, 0x28ffffff) AM_NOP
554550   //AM_RANGE(0x04000000, 0x040001ff) AM_RAM
r14896r14897
568564   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
569565   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
570566   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
571   AM_RANGE(0x0080, 0x009f) AM_READWRITE_LEGACY(at_page32_r,            at_page32_w)
567   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
572568   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
573569   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
574570   //AM_RANGE(0x00e8, 0x00eb) AM_NOP
r14896r14897
941937MACHINE_CONFIG_END
942938
943939
944static READ32_HANDLER( calchase_idle_skip_r )
940READ32_MEMBER(calchase_state::calchase_idle_skip_r)
945941{
946   calchase_state *state = space->machine().driver_data<calchase_state>();
947942
948   if(cpu_get_pc(&space->device())==0x1406f48)
949      device_spin_until_interrupt(state->m_maincpu);
943   if(cpu_get_pc(&space.device())==0x1406f48)
944      device_spin_until_interrupt(m_maincpu);
950945
951   return state->m_idle_skip_ram;
946   return m_idle_skip_ram;
952947}
953948
954static WRITE32_HANDLER( calchase_idle_skip_w )
949WRITE32_MEMBER(calchase_state::calchase_idle_skip_w)
955950{
956   calchase_state *state = space->machine().driver_data<calchase_state>();
957951
958   COMBINE_DATA(&state->m_idle_skip_ram);
952   COMBINE_DATA(&m_idle_skip_ram);
959953}
960954
961955static DRIVER_INIT( calchase )
r14896r14897
971965
972966   kbdc8042_init(machine, &at8042);
973967
974   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x3f0b160, 0x3f0b163, FUNC(calchase_idle_skip_r), FUNC(calchase_idle_skip_w));
968   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x3f0b160, 0x3f0b163, read32_delegate(FUNC(calchase_state::calchase_idle_skip_r),state), write32_delegate(FUNC(calchase_state::calchase_idle_skip_w),state));
975969}
976970
977971ROM_START( calchase )
src/mame/drivers/ashnojoe.c
r14896r14897
9191   if (ACCESSING_BITS_0_7)
9292   {
9393      m_soundlatch_status = 1;
94      soundlatch_w(space, 0, data & 0xff);
94      soundlatch_byte_w(space, 0, data & 0xff);
9595   }
9696}
9797
r14896r14897
104104   AM_RANGE(0x046000, 0x046fff) AM_RAM_WRITE(ashnojoe_tileram6_w) AM_BASE(m_tileram_6)
105105   AM_RANGE(0x047000, 0x047fff) AM_RAM_WRITE(ashnojoe_tileram7_w) AM_BASE(m_tileram_7)
106106   AM_RANGE(0x048000, 0x048fff) AM_RAM_WRITE(ashnojoe_tileram_w) AM_BASE(m_tileram)
107   AM_RANGE(0x049000, 0x049fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
107   AM_RANGE(0x049000, 0x049fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
108108   AM_RANGE(0x04a000, 0x04a001) AM_READ_PORT("P1")
109109   AM_RANGE(0x04a002, 0x04a003) AM_READ_PORT("P2")
110110   AM_RANGE(0x04a004, 0x04a005) AM_READ_PORT("DSW")
r14896r14897
126126READ8_MEMBER(ashnojoe_state::sound_latch_r)
127127{
128128   m_soundlatch_status = 0;
129   return soundlatch_r(space, 0);
129   return soundlatch_byte_r(space, 0);
130130}
131131
132132READ8_MEMBER(ashnojoe_state::sound_latch_status_r)
src/mame/drivers/popobear.c
r14896r14897
8383public:
8484   popobear_state(const machine_config &mconfig, device_type type, const char *tag)
8585      : driver_device(mconfig, type, tag),
86      m_maincpu(*this,"maincpu")
87      { }
86      m_maincpu(*this,"maincpu"),
87      m_spr(*this, "spr"),
88      m_vram(*this, "vram"),
89      m_vregs(*this, "vregs"){ }
8890
89   UINT16 *m_vregs;
90   UINT16 *m_vram;
91   UINT16 *m_spr;
9291   required_device<cpu_device> m_maincpu;
92   required_shared_ptr<UINT16> m_spr;
93   required_shared_ptr<UINT16> m_vram;
94   required_shared_ptr<UINT16> m_vregs;
9395   DECLARE_READ8_MEMBER(popo_620000_r);
9496   DECLARE_WRITE8_MEMBER(popobear_irq_ack_w);
9597};
r14896r14897
102104static void draw_layer(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8 layer_n)
103105{
104106   popobear_state *state = machine.driver_data<popobear_state>();
105   UINT8* vram = (UINT8 *)state->m_vram;
106   UINT16* vreg = (UINT16 *)state->m_vregs;
107   UINT8* vram = (UINT8 *)state->m_vram.target();
108   UINT16* vreg = (UINT16 *)state->m_vregs.target();
107109   int count;
108110   const UINT8 vreg_base[] = { 0x10/2, 0x14/2 };
109111   int xscroll,yscroll;
110112
111//  count = (state->m_vregs[vreg_base[layer_n]]<<5);
113//  count = (state->m_vregs.target()[vreg_base[layer_n]]<<5);
112114//  count &= 0xfc000;
113115   count = (0xf0000+layer_n*0x4000);
114116   if(layer_n & 2)
r14896r14897
175177static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
176178{
177179   popobear_state *state = machine.driver_data<popobear_state>();
178   UINT8* vram = (UINT8 *)state->m_spr;
180   UINT8* vram = (UINT8 *)state->m_spr.target();
179181   int i;
180182   #if 0
181183   static int bank_test = 1;
r14896r14897
257259
258260   bitmap.fill(0, cliprect);
259261
260   //popmessage("%04x",state->m_vregs[0/2]);
262   //popmessage("%04x",state->m_vregs.target()[0/2]);
261263
262264   draw_layer(screen.machine(),bitmap,cliprect,3);
263265   draw_layer(screen.machine(),bitmap,cliprect,2);
r14896r14897
289291   ADDRESS_MAP_UNMAP_HIGH
290292   AM_RANGE(0x000000, 0x03ffff) AM_ROM
291293   AM_RANGE(0x210000, 0x21ffff) AM_RAM
292   AM_RANGE(0x280000, 0x2fffff) AM_RAM AM_BASE(m_spr) // unknown boundaries, 0x2ff800 contains a sprite list
293   AM_RANGE(0x300000, 0x3fffff) AM_RAM AM_BASE(m_vram)
294   AM_RANGE(0x280000, 0x2fffff) AM_RAM AM_SHARE("spr") // unknown boundaries, 0x2ff800 contains a sprite list
295   AM_RANGE(0x300000, 0x3fffff) AM_RAM AM_SHARE("vram")
294296
295297   /* Most if not all of these are vregs */
296   AM_RANGE(0x480000, 0x48001f) AM_RAM AM_BASE(m_vregs)
298   AM_RANGE(0x480000, 0x48001f) AM_RAM AM_SHARE("vregs")
297299   AM_RANGE(0x480020, 0x480023) AM_RAM
298300   AM_RANGE(0x480028, 0x48002d) AM_RAM
299301//  AM_RANGE(0x480020, 0x480021) AM_NOP //AM_READ_LEGACY(popo_480020_r) AM_WRITE_LEGACY(popo_480020_w)
r14896r14897
303305   AM_RANGE(0x480034, 0x480035) AM_RAM // coin counter or coin lockout
304306   AM_RANGE(0x48003a, 0x48003b) AM_RAM //AM_READ_LEGACY(popo_48003a_r) AM_WRITE_LEGACY(popo_48003a_w)
305307
306   AM_RANGE(0x480400, 0x4807ff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
308   AM_RANGE(0x480400, 0x4807ff) AM_RAM AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
307309
308310   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("IN0")
309311   AM_RANGE(0x520000, 0x520001) AM_READ_PORT("IN1")
src/mame/drivers/minivadr.c
r14896r14897
1818{
1919public:
2020   minivadr_state(const machine_config &mconfig, device_type type, const char *tag)
21      : driver_device(mconfig, type, tag) { }
21      : driver_device(mconfig, type, tag) ,
22      m_videoram(*this, "videoram"){ }
2223
2324   /* memory pointers */
24   UINT8 *  m_videoram;
25   size_t   m_videoram_size;
25   required_shared_ptr<UINT8> m_videoram;
2626};
2727
2828/*************************************
r14896r14897
3636   minivadr_state *state = screen.machine().driver_data<minivadr_state>();
3737   offs_t offs;
3838
39   for (offs = 0; offs < state->m_videoram_size; offs++)
39   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
4040   {
4141      int i;
4242
4343      UINT8 x = offs << 3;
4444      int y = offs >> 5;
45      UINT8 data = state->m_videoram[offs];
45      UINT8 data = state->m_videoram.target()[offs];
4646
4747      for (i = 0; i < 8; i++)
4848      {
r14896r14897
6060
6161static ADDRESS_MAP_START( minivadr_map, AS_PROGRAM, 8, minivadr_state )
6262   AM_RANGE(0x0000, 0x1fff) AM_ROM
63   AM_RANGE(0xa000, 0xbfff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
63   AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("videoram")
6464   AM_RANGE(0xe008, 0xe008) AM_READ_PORT("INPUTS") AM_WRITENOP      // W - ???
6565ADDRESS_MAP_END
6666
src/mame/drivers/grchamp.c
r14896r14897
189189
190190      case 0x0e:   /* OUT14 */
191191         /* O-21 connector */
192         soundlatch_w(space, 0, data);
192         soundlatch_byte_w(space, 0, data);
193193         cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
194194         break;
195195   }
r14896r14897
563563   AM_RANGE(0x4803, 0x4803) AM_MIRROR(0x07f8) AM_DEVREAD_LEGACY("ay2", ay8910_r)
564564   AM_RANGE(0x4804, 0x4805) AM_MIRROR(0x07fa) AM_DEVWRITE_LEGACY("ay3", ay8910_address_data_w)
565565   AM_RANGE(0x4805, 0x4805) AM_MIRROR(0x07fa) AM_DEVREAD_LEGACY("ay3", ay8910_r)
566   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_r)
566   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_byte_r)
567567ADDRESS_MAP_END
568568
569569
src/mame/drivers/lkage.c
r14896r14897
106106
107107WRITE8_MEMBER(lkage_state::lkage_sound_command_w)
108108{
109   soundlatch_w(space, offset, data);
109   soundlatch_byte_w(space, offset, data);
110110   machine().scheduler().synchronize(FUNC(nmi_callback), data);
111111}
112112
r14896r14897
135135static ADDRESS_MAP_START( lkage_map, AS_PROGRAM, 8, lkage_state )
136136   AM_RANGE(0x0000, 0xdfff) AM_ROM
137137   AM_RANGE(0xe000, 0xe7ff) AM_RAM /* work ram */
138   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_le_w) AM_SHARE("paletteram")
138   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_le_w) AM_SHARE("paletteram")
139139   AM_RANGE(0xf000, 0xf003) AM_RAM AM_BASE(m_vreg) /* video registers */
140140   AM_RANGE(0xf060, 0xf060) AM_WRITE(lkage_sound_command_w)
141141   AM_RANGE(0xf061, 0xf061) AM_WRITENOP AM_READ(sound_status_r)
r14896r14897
187187   AM_RANGE(0x8000, 0x87ff) AM_RAM
188188   AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r,ym2203_w)
189189   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r,ym2203_w)
190   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_r) AM_WRITENOP   /* ??? */
190   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_byte_r) AM_WRITENOP   /* ??? */
191191   AM_RANGE(0xb001, 0xb001) AM_READNOP   /* ??? */ AM_WRITE(lkage_sh_nmi_enable_w)
192192   AM_RANGE(0xb002, 0xb002) AM_WRITE(lkage_sh_nmi_disable_w)
193193   AM_RANGE(0xb003, 0xb003) AM_WRITENOP
src/mame/drivers/goodejan.c
r14896r14897
107107   AM_RANGE(0x00000, 0x0afff) AM_RAM
108108   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE_LEGACY(seibucrtc_sc0vram_w) AM_BASE_LEGACY(&seibucrtc_sc0vram)
109109   AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE_LEGACY(seibucrtc_sc3vram_w) AM_BASE_LEGACY(&seibucrtc_sc3vram)
110   AM_RANGE(0x0d000, 0x0dfff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
110   AM_RANGE(0x0d000, 0x0dfff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
111111   /*Guess: these two aren't used/initialized at all.*/
112112   AM_RANGE(0x0e000, 0x0e7ff) AM_RAM_WRITE_LEGACY(seibucrtc_sc1vram_w) AM_BASE_LEGACY(&seibucrtc_sc1vram)
113113   AM_RANGE(0x0e800, 0x0efff) AM_RAM_WRITE_LEGACY(seibucrtc_sc2vram_w) AM_BASE_LEGACY(&seibucrtc_sc2vram)
src/mame/drivers/gaiden.c
r14896r14897
140140{
141141
142142   if (ACCESSING_BITS_0_7)
143      soundlatch_w(space, 0, data & 0xff);   /* Ninja Gaiden */
143      soundlatch_byte_w(space, 0, data & 0xff);   /* Ninja Gaiden */
144144   if (ACCESSING_BITS_8_15)
145      soundlatch_w(space, 0, data >> 8);   /* Tecmo Knight */
145      soundlatch_byte_w(space, 0, data >> 8);   /* Tecmo Knight */
146146   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
147147}
148148
r14896r14897
151151
152152   if (ACCESSING_BITS_8_15)
153153   {
154      soundlatch_w(space, 0, data >> 8);
154      soundlatch_byte_w(space, 0, data >> 8);
155155      device_set_input_line(m_audiocpu, 0, HOLD_LINE);
156156   }
157157}
r14896r14897
394394   AM_RANGE(0x072000, 0x073fff) AM_READWRITE(gaiden_videoram2_r, gaiden_videoram2_w) AM_BASE(m_videoram2)
395395   AM_RANGE(0x074000, 0x075fff) AM_READWRITE(gaiden_videoram3_r, gaiden_videoram3_w) AM_BASE(m_videoram3)
396396   AM_RANGE(0x076000, 0x077fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
397   AM_RANGE(0x078000, 0x079fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
397   AM_RANGE(0x078000, 0x079fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
398398   AM_RANGE(0x07a000, 0x07a001) AM_READ_PORT("SYSTEM")
399399   AM_RANGE(0x07a002, 0x07a003) AM_READ_PORT("P1_P2") AM_WRITE(gaiden_sproffsety_w)
400400   AM_RANGE(0x07a004, 0x07a005) AM_READ_PORT("DSW")
r14896r14897
420420   AM_RANGE(0x072000, 0x073fff) AM_RAM_WRITE(gaiden_videoram2_w) AM_BASE(m_videoram2)
421421   AM_RANGE(0x074000, 0x075fff) AM_RAM_WRITE(gaiden_videoram3_w) AM_BASE(m_videoram3)
422422   AM_RANGE(0x076000, 0x077fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
423   AM_RANGE(0x078000, 0x079fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
423   AM_RANGE(0x078000, 0x079fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
424424   AM_RANGE(0x07a000, 0x07a001) AM_READ_PORT("SYSTEM")
425425   AM_RANGE(0x07a002, 0x07a003) AM_READ_PORT("P1_P2")
426426   AM_RANGE(0x07a004, 0x07a005) AM_READ_PORT("DSW")
r14896r14897
440440   AM_RANGE(0xf810, 0xf811) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
441441   AM_RANGE(0xf820, 0xf821) AM_DEVWRITE_LEGACY("ym2", ym2203_w)
442442   AM_RANGE(0xfc00, 0xfc00) AM_NOP /* ?? */
443   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
443   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_byte_r)
444444ADDRESS_MAP_END
445445
446446static ADDRESS_MAP_START( drgnbowl_sound_map, AS_PROGRAM, 8, gaiden_state )
r14896r14897
452452   ADDRESS_MAP_GLOBAL_MASK(0xff)
453453   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
454454   AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki", okim6295_device, read, write)
455   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
455   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
456456ADDRESS_MAP_END
457457
458458static INPUT_PORTS_START( common )
r14896r14897
906906   AM_RANGE(0xc400, 0xc401) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
907907   AM_RANGE(0xc800, 0xc801) AM_DEVWRITE_LEGACY("ym2", ym2203_w)
908908//  AM_RANGE(0xfc00, 0xfc00) AM_NOP /* ?? */
909//  AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
909//  AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_byte_r)
910910ADDRESS_MAP_END
911911
912912static ADDRESS_MAP_START( mastninj_map, AS_PROGRAM, 16, gaiden_state )
r14896r14897
916916   AM_RANGE(0x072000, 0x073fff) AM_READWRITE(gaiden_videoram2_r, gaiden_videoram2_w) AM_BASE(m_videoram2)
917917   AM_RANGE(0x074000, 0x075fff) AM_READWRITE(gaiden_videoram3_r, gaiden_videoram3_w) AM_BASE(m_videoram3)
918918   AM_RANGE(0x076000, 0x077fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
919   AM_RANGE(0x078000, 0x079fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
919   AM_RANGE(0x078000, 0x079fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
920920//  AM_RANGE(0x078800, 0x079fff) AM_RAM
921921   AM_RANGE(0x07a000, 0x07a001) AM_READ_PORT("SYSTEM")
922922   AM_RANGE(0x07a002, 0x07a003) AM_READ_PORT("P1_P2")
src/mame/drivers/quizshow.c
r14896r14897
3636{
3737public:
3838   quizshow_state(const machine_config &mconfig, device_type type, const char *tag)
39      : driver_device(mconfig, type, tag) { }
39      : driver_device(mconfig, type, tag) ,
40      m_main_ram(*this, "main_ram"),
41      m_fo_state(*this, "fo_state"){ }
4042
4143   tilemap_t *m_tilemap;
42   UINT8* m_fo_state;
43   UINT8* m_main_ram;
44   required_shared_ptr<UINT8> m_main_ram;
45   required_shared_ptr<UINT8> m_fo_state;
4446   UINT32 m_clocks;
4547   int m_blink_state;
4648   int m_category_enable;
r14896r14897
8688static TILE_GET_INFO( get_tile_info )
8789{
8890   quizshow_state *state = machine.driver_data<quizshow_state>();
89   UINT8 code = state->m_main_ram[tile_index];
91   UINT8 code = state->m_main_ram.target()[tile_index];
9092
9193   // d6: blink, d7: invert
9294   UINT8 color = (code & (state->m_blink_state | 0x80)) >> 6;
r14896r14897
198200
199201WRITE8_MEMBER(quizshow_state::quizshow_main_ram_w)
200202{
201   m_main_ram[offset]=data;
203   m_main_ram.target()[offset]=data;
202204   m_tilemap->mark_tile_dirty(offset);
203205}
204206
r14896r14897
217219   AM_RANGE(0x1884, 0x1884) AM_READ_PORT("IN2")
218220   AM_RANGE(0x1888, 0x1888) AM_READ_PORT("IN3")
219221   AM_RANGE(0x1900, 0x1900) AM_READ(quizshow_timing_r)
220   AM_RANGE(0x1e00, 0x1fff) AM_RAM_WRITE(quizshow_main_ram_w) AM_BASE(m_main_ram)
222   AM_RANGE(0x1e00, 0x1fff) AM_RAM_WRITE(quizshow_main_ram_w) AM_SHARE("main_ram")
221223ADDRESS_MAP_END
222224
223225static ADDRESS_MAP_START( quizshow_io_map, AS_IO, 8, quizshow_state )
r14896r14897
225227//  AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_NOP // unused
226228//  AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_NOP // unused
227229   AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(quizshow_tape_signal_r)
228   AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_BASE(m_fo_state)
230   AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_SHARE("fo_state")
229231ADDRESS_MAP_END
230232
231233
src/mame/drivers/trackfld.c
r14896r14897
232232   AM_RANGE(0x1085, 0x1085) AM_MIRROR(0x0078) AM_WRITENOP                  /* CN3.2 */
233233   AM_RANGE(0x1086, 0x1086) AM_MIRROR(0x0078) AM_WRITENOP                  /* CN3.4 */
234234   AM_RANGE(0x1087, 0x1087) AM_MIRROR(0x0078) AM_WRITE(irq_mask_w)            /* INT */
235   AM_RANGE(0x1100, 0x1100) AM_MIRROR(0x007f) AM_WRITE(soundlatch_w)         /* 32 */
235   AM_RANGE(0x1100, 0x1100) AM_MIRROR(0x007f) AM_WRITE(soundlatch_byte_w)         /* 32 */
236236   AM_RANGE(0x1200, 0x1200) AM_MIRROR(0x007f) AM_READ_PORT("DSW2")
237237   AM_RANGE(0x1280, 0x1280) AM_MIRROR(0x007c) AM_READ_PORT("SYSTEM")
238238   AM_RANGE(0x1281, 0x1281) AM_MIRROR(0x007c) AM_READ_PORT("IN0")
r14896r14897
271271   AM_RANGE(0x1085, 0x1085) AM_MIRROR(0x0078) AM_WRITENOP                  /* CN3.2 */
272272   AM_RANGE(0x1086, 0x1086) AM_MIRROR(0x0078) AM_WRITENOP                  /* CN3.4 */
273273   AM_RANGE(0x1087, 0x1087) AM_MIRROR(0x0078) AM_WRITE(irq_mask_w)            /* INT */
274//  AM_RANGE(0x1100, 0x1100) AM_MIRROR(0x007f) AM_WRITE(soundlatch_w)           /* 32 */
274//  AM_RANGE(0x1100, 0x1100) AM_MIRROR(0x007f) AM_WRITE(soundlatch_byte_w)           /* 32 */
275275   AM_RANGE(0x1200, 0x1200) AM_MIRROR(0x007f) AM_READ_PORT("DSW2")
276276   AM_RANGE(0x1280, 0x1280) AM_MIRROR(0x007c) AM_READ_PORT("SYSTEM")
277277   AM_RANGE(0x1281, 0x1281) AM_MIRROR(0x007c) AM_READ_PORT("IN0")
r14896r14897
298298   AM_RANGE(0x9081, 0x9081) AM_WRITE_LEGACY(konami_sh_irqtrigger_w)  /* cause interrupt on audio CPU */
299299   AM_RANGE(0x9083, 0x9084) AM_WRITE(coin_w)
300300   AM_RANGE(0x9087, 0x9087) AM_WRITE(irq_mask_w)
301   AM_RANGE(0x9100, 0x9100) AM_WRITE(soundlatch_w)
301   AM_RANGE(0x9100, 0x9100) AM_WRITE(soundlatch_byte_w)
302302   AM_RANGE(0x9200, 0x9200) AM_READ_PORT("DSW2")
303303   AM_RANGE(0x9280, 0x9280) AM_READ_PORT("SYSTEM")
304304   AM_RANGE(0x9281, 0x9281) AM_READ_PORT("IN0")
r14896r14897
331331   AM_RANGE(0x10b1, 0x10b1) AM_READNOP AM_WRITE_LEGACY(konami_sh_irqtrigger_w)
332332   AM_RANGE(0x10b3, 0x10b4) AM_WRITE(coin_w) // actually not used
333333   AM_RANGE(0x10b7, 0x10b7) AM_READNOP AM_WRITE(irq_mask_w)
334   AM_RANGE(0x1100, 0x1100) AM_WRITE(soundlatch_w)
334   AM_RANGE(0x1100, 0x1100) AM_WRITE(soundlatch_byte_w)
335335   AM_RANGE(0x1200, 0x1200) AM_READ_PORT("DSW2")
336336   AM_RANGE(0x1280, 0x1280) AM_READ_PORT("SYSTEM")
337337   AM_RANGE(0x1281, 0x1281) AM_READ_PORT("IN0")
r14896r14897
358358   AM_RANGE(0x1081, 0x1081) AM_WRITE_LEGACY(konami_sh_irqtrigger_w)  /* cause interrupt on audio CPU */
359359   AM_RANGE(0x1083, 0x1084) AM_WRITE(coin_w)
360360   AM_RANGE(0x1087, 0x1087) AM_WRITE(irq_mask_w)
361   AM_RANGE(0x1100, 0x1100) AM_WRITE(soundlatch_w)
361   AM_RANGE(0x1100, 0x1100) AM_WRITE(soundlatch_byte_w)
362362   AM_RANGE(0x1200, 0x1200) AM_READ_PORT("DSW2")
363363   AM_RANGE(0x1280, 0x1280) AM_READ_PORT("SYSTEM")
364364   AM_RANGE(0x1281, 0x1281) AM_READ_PORT("IN0")
r14896r14897
389389static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, trackfld_state )
390390   AM_RANGE(0x0000, 0x3fff) AM_ROM
391391   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x1c00) AM_RAM
392   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_READ(soundlatch_r)
392   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_READ(soundlatch_byte_r)
393393   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1fff) AM_READ_LEGACY(trackfld_sh_timer_r)
394394   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1fff) AM_WRITE_LEGACY(konami_SN76496_latch_w)
395395   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fff) AM_DEVREADWRITE_LEGACY("snsnd", trackfld_SN76496_r, konami_SN76496_w)
r14896r14897
403403static ADDRESS_MAP_START( hyprolyb_sound_map, AS_PROGRAM, 8, trackfld_state )
404404   AM_RANGE(0x0000, 0x3fff) AM_ROM
405405   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x1c00) AM_RAM
406   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_READ(soundlatch_r)
406   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_READ(soundlatch_byte_r)
407407   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1fff) AM_READ_LEGACY(trackfld_sh_timer_r)
408408   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1fff) AM_WRITE_LEGACY(konami_SN76496_latch_w)
409409   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fff) AM_DEVREADWRITE_LEGACY("snsnd", trackfld_SN76496_r, konami_SN76496_w)
src/mame/drivers/astrof.c
r14896r14897
585585   AM_RANGE(0x8003, 0x8003) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITEONLY AM_BASE(m_astrof_color)
586586   AM_RANGE(0x8004, 0x8004) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(video_control_1_w)
587587   AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(astrof_video_control_2_w)
588   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE_LEGACY(astrof_audio_1_w)
589   AM_RANGE(0x8007, 0x8007) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE_LEGACY(astrof_audio_2_w)
588   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(astrof_audio_1_w)
589   AM_RANGE(0x8007, 0x8007) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(astrof_audio_2_w)
590590   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ff8) AM_READ_PORT("IN") AM_WRITENOP
591591   AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ff8) AM_READ_PORT("DSW") AM_WRITENOP
592592   AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x1ff8) AM_READ(irq_clear_r) AM_WRITENOP
r14896r14897
604604   AM_RANGE(0x8003, 0x8003) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITEONLY AM_BASE(m_astrof_color)
605605   AM_RANGE(0x8004, 0x8004) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(video_control_1_w)
606606   AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(spfghmk2_video_control_2_w)
607   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE_LEGACY(spfghmk2_audio_w)
607   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(spfghmk2_audio_w)
608608   AM_RANGE(0x8007, 0x8007) AM_MIRROR(0x1ff8) AM_NOP
609609   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ff8) AM_READ_PORT("IN") AM_WRITENOP
610610   AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ff8) AM_READ_PORT("DSW") AM_WRITENOP
r14896r14897
623623   AM_RANGE(0x8003, 0x8003) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITEONLY AM_BASE(m_astrof_color)
624624   AM_RANGE(0x8004, 0x8004) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(video_control_1_w)
625625   AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(tomahawk_video_control_2_w)
626   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE_LEGACY(tomahawk_audio_w)
626   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITE(tomahawk_audio_w)
627627   AM_RANGE(0x8007, 0x8007) AM_MIRROR(0x1ff8) AM_READNOP AM_WRITEONLY AM_BASE(m_tomahawk_protection)
628628   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ff8) AM_READ_PORT("IN") AM_WRITENOP
629629   AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ff8) AM_READ_PORT("DSW") AM_WRITENOP
src/mame/drivers/vegas.c
r14896r14897
460460public:
461461   vegas_state(const machine_config &mconfig, device_type type, const char *tag)
462462      : driver_device(mconfig, type, tag),
463        m_timekeeper(*this, "timekeeper") { }
463        m_timekeeper(*this, "timekeeper") ,
464      m_rambase(*this, "rambase"),
465      m_nile_regs(*this, "nile_regs"),
466      m_rombase(*this, "rombase"){ }
464467
465468   required_device<m48t37_device> m_timekeeper;
466   UINT32 *m_rambase;
467   UINT32 *m_rombase;
468   size_t m_ramsize;
469   UINT32 *m_nile_regs;
469   required_shared_ptr<UINT32> m_rambase;
470   required_shared_ptr<UINT32> m_nile_regs;
471   required_shared_ptr<UINT32> m_rombase;
470472   UINT16 m_nile_irq_state;
471473   UINT16 m_ide_irq_state;
472474   UINT32 m_pci_bridge_regs[0x40];
r14896r14897
544546   mips3drc_set_options(machine.device("maincpu"), MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY + MIPS3DRC_FLUSH_PC);
545547
546548   /* configure fast RAM regions for DRC */
547   mips3drc_add_fastram(machine.device("maincpu"), 0x00000000, state->m_ramsize - 1, FALSE, state->m_rambase);
548   mips3drc_add_fastram(machine.device("maincpu"), 0x1fc00000, 0x1fc7ffff, TRUE, state->m_rombase);
549   mips3drc_add_fastram(machine.device("maincpu"), 0x00000000, state->m_rambase.bytes() - 1, FALSE, state->m_rambase.target());
550   mips3drc_add_fastram(machine.device("maincpu"), 0x1fc00000, 0x1fc7ffff, TRUE, state->m_rombase.target());
549551
550552   /* register for save states */
551553   state_save_register_global(machine, state->m_nile_irq_state);
r14896r14897
843845static void update_nile_irqs(running_machine &machine)
844846{
845847   vegas_state *state = machine.driver_data<vegas_state>();
846   UINT32 intctll = state->m_nile_regs[NREG_INTCTRL+0];
847   UINT32 intctlh = state->m_nile_regs[NREG_INTCTRL+1];
848   UINT32 intctll = state->m_nile_regs.target()[NREG_INTCTRL+0];
849   UINT32 intctlh = state->m_nile_regs.target()[NREG_INTCTRL+1];
848850   UINT8 irq[6];
849851   int i;
850852
851853   /* check for UART transmit IRQ enable and synthsize one */
852   if (state->m_nile_regs[NREG_UARTIER] & 2)
854   if (state->m_nile_regs.target()[NREG_UARTIER] & 2)
853855      state->m_nile_irq_state |= 0x0010;
854856   else
855857      state->m_nile_irq_state &= ~0x0010;
856858
857859   irq[0] = irq[1] = irq[2] = irq[3] = irq[4] = irq[5] = 0;
858   state->m_nile_regs[NREG_INTSTAT0+0] = 0;
859   state->m_nile_regs[NREG_INTSTAT0+1] = 0;
860   state->m_nile_regs[NREG_INTSTAT1+0] = 0;
861   state->m_nile_regs[NREG_INTSTAT1+1] = 0;
860   state->m_nile_regs.target()[NREG_INTSTAT0+0] = 0;
861   state->m_nile_regs.target()[NREG_INTSTAT0+1] = 0;
862   state->m_nile_regs.target()[NREG_INTSTAT1+0] = 0;
863   state->m_nile_regs.target()[NREG_INTSTAT1+1] = 0;
862864
863865   /* handle the lower interrupts */
864866   for (i = 0; i < 8; i++)
r14896r14897
869871            if (vector < 6)
870872            {
871873               irq[vector] = 1;
872               state->m_nile_regs[NREG_INTSTAT0 + vector/2] |= 1 << (i + 16*(vector&1));
874               state->m_nile_regs.target()[NREG_INTSTAT0 + vector/2] |= 1 << (i + 16*(vector&1));
873875            }
874876         }
875877
r14896r14897
882884            if (vector < 6)
883885            {
884886               irq[vector] = 1;
885               state->m_nile_regs[NREG_INTSTAT0 + vector/2] |= 1 << (i + 8 + 16*(vector&1));
887               state->m_nile_regs.target()[NREG_INTSTAT0 + vector/2] |= 1 << (i + 8 + 16*(vector&1));
886888            }
887889         }
888890
r14896r14897
909911{
910912   vegas_state *state = machine.driver_data<vegas_state>();
911913   int which = param;
912   UINT32 *regs = &state->m_nile_regs[NREG_T0CTRL + which * 4];
914   UINT32 *regs = &state->m_nile_regs.target()[NREG_T0CTRL + which * 4];
913915   if (LOG_TIMERS) logerror("timer %d fired\n", which);
914916
915917   /* adjust the timer to fire again */
r14896r14897
941943static READ32_HANDLER( nile_r )
942944{
943945   vegas_state *state = space->machine().driver_data<vegas_state>();
944   UINT32 result = state->m_nile_regs[offset];
946   UINT32 result = state->m_nile_regs.target()[offset];
945947   int logit = 1, which;
946948
947949   switch (offset)
r14896r14897
9981000      case NREG_T2CNTR:      /* general purpose timer control (counter) */
9991001      case NREG_T3CNTR:      /* watchdog timer control (counter) */
10001002         which = (offset - NREG_T0CTRL) / 4;
1001         if (state->m_nile_regs[offset - 1] & 1)
1003         if (state->m_nile_regs.target()[offset - 1] & 1)
10021004         {
1003            if (state->m_nile_regs[offset] & 2)
1005            if (state->m_nile_regs.target()[offset] & 2)
10041006               logerror("Unexpected value: timer %d is prescaled\n", which);
1005            result = state->m_nile_regs[offset + 1] = state->m_timer[which]->remaining().as_double() * (double)SYSTEM_CLOCK;
1007            result = state->m_nile_regs.target()[offset + 1] = state->m_timer[which]->remaining().as_double() * (double)SYSTEM_CLOCK;
10061008         }
10071009
10081010         if (LOG_TIMERS) logerror("%08X:NILE READ: timer %d counter(%03X) = %08X\n", cpu_get_pc(&space->device()), which, offset*4, result);
r14896r14897
10101012         break;
10111013
10121014      case NREG_UARTIIR:         /* serial port interrupt ID */
1013         if (state->m_nile_regs[NREG_UARTIER] & 2)
1015         if (state->m_nile_regs.target()[NREG_UARTIER] & 2)
10141016            result = 0x02;         /* transmitter buffer IRQ pending */
10151017         else
10161018            result = 0x01;         /* no IRQ pending */
r14896r14897
10541056static WRITE32_HANDLER( nile_w )
10551057{
10561058   vegas_state *state = space->machine().driver_data<vegas_state>();
1057   UINT32 olddata = state->m_nile_regs[offset];
1059   UINT32 olddata = state->m_nile_regs.target()[offset];
10581060   int logit = 1, which;
10591061
1060   COMBINE_DATA(&state->m_nile_regs[offset]);
1062   COMBINE_DATA(&state->m_nile_regs.target()[offset]);
10611063
10621064   switch (offset)
10631065   {
r14896r14897
10921094      case NREG_INTCLR+1:      /* Interrupt clear */
10931095         if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt clear(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
10941096         logit = 0;
1095         state->m_nile_irq_state &= ~(state->m_nile_regs[offset] & ~0xf00);
1097         state->m_nile_irq_state &= ~(state->m_nile_regs.target()[offset] & ~0xf00);
10961098         update_nile_irqs(space->machine());
10971099         break;
10981100
r14896r14897
11131115         break;
11141116
11151117      case NREG_PCIINIT1+0:   /* PCI master */
1116         if (((olddata & 0xe) == 0xa) != ((state->m_nile_regs[offset] & 0xe) == 0xa))
1118         if (((olddata & 0xe) == 0xa) != ((state->m_nile_regs.target()[offset] & 0xe) == 0xa))
11171119            remap_dynamic_addresses(space->machine());
11181120         logit = 0;
11191121         break;
r14896r14897
11271129         logit = 0;
11281130
11291131         /* timer just enabled? */
1130         if (!(olddata & 1) && (state->m_nile_regs[offset] & 1))
1132         if (!(olddata & 1) && (state->m_nile_regs.target()[offset] & 1))
11311133         {
1132            UINT32 scale = state->m_nile_regs[offset + 1];
1133            if (state->m_nile_regs[offset] & 2)
1134            UINT32 scale = state->m_nile_regs.target()[offset + 1];
1135            if (state->m_nile_regs.target()[offset] & 2)
11341136               logerror("Unexpected value: timer %d is prescaled\n", which);
11351137            if (scale != 0)
11361138               state->m_timer[which]->adjust(TIMER_PERIOD * scale, which);
1137            if (LOG_TIMERS) logerror("Starting timer %d at a rate of %d Hz\n", which, (int)ATTOSECONDS_TO_HZ((TIMER_PERIOD * (state->m_nile_regs[offset + 1] + 1)).attoseconds));
1139            if (LOG_TIMERS) logerror("Starting timer %d at a rate of %d Hz\n", which, (int)ATTOSECONDS_TO_HZ((TIMER_PERIOD * (state->m_nile_regs.target()[offset + 1] + 1)).attoseconds));
11381140         }
11391141
11401142         /* timer disabled? */
1141         else if ((olddata & 1) && !(state->m_nile_regs[offset] & 1))
1143         else if ((olddata & 1) && !(state->m_nile_regs.target()[offset] & 1))
11421144         {
1143            if (state->m_nile_regs[offset] & 2)
1145            if (state->m_nile_regs.target()[offset] & 2)
11441146               logerror("Unexpected value: timer %d is prescaled\n", which);
1145            state->m_nile_regs[offset + 1] = state->m_timer[which]->remaining().as_double() * SYSTEM_CLOCK;
1147            state->m_nile_regs.target()[offset + 1] = state->m_timer[which]->remaining().as_double() * SYSTEM_CLOCK;
11461148            state->m_timer[which]->adjust(attotime::never, which);
11471149         }
11481150         break;
r14896r14897
11551157         if (LOG_TIMERS) logerror("%08X:NILE WRITE: timer %d counter(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), which, offset*4, data, mem_mask);
11561158         logit = 0;
11571159
1158         if (state->m_nile_regs[offset - 1] & 1)
1160         if (state->m_nile_regs.target()[offset - 1] & 1)
11591161         {
1160            if (state->m_nile_regs[offset - 1] & 2)
1162            if (state->m_nile_regs.target()[offset - 1] & 2)
11611163               logerror("Unexpected value: timer %d is prescaled\n", which);
1162            state->m_timer[which]->adjust(TIMER_PERIOD * state->m_nile_regs[offset], which);
1164            state->m_timer[which]->adjust(TIMER_PERIOD * state->m_nile_regs.target()[offset], which);
11631165         }
11641166         break;
11651167
r14896r14897
15581560   state->m_dynamic_count = 0;
15591561
15601562   /* DCS2 */
1561   base = state->m_nile_regs[NREG_DCS2] & 0x1fffff00;
1562   if (base >= state->m_ramsize)
1563   base = state->m_nile_regs.target()[NREG_DCS2] & 0x1fffff00;
1564   if (base >= state->m_rambase.bytes())
15631565   {
15641566      add_dynamic_address(state, base + 0x0000, base + 0x0003, sio_irq_clear_r, sio_irq_clear_w);
15651567      add_dynamic_address(state, base + 0x1000, base + 0x1003, sio_irq_enable_r, sio_irq_enable_w);
r14896r14897
15721574   }
15731575
15741576   /* DCS3 */
1575   base = state->m_nile_regs[NREG_DCS3] & 0x1fffff00;
1576   if (base >= state->m_ramsize)
1577   base = state->m_nile_regs.target()[NREG_DCS3] & 0x1fffff00;
1578   if (base >= state->m_rambase.bytes())
15771579      add_dynamic_address(state, base + 0x0000, base + 0x0003, analog_port_r, analog_port_w);
15781580
15791581   /* DCS4 */
1580   base = state->m_nile_regs[NREG_DCS4] & 0x1fffff00;
1581   if (base >= state->m_ramsize)
1582   base = state->m_nile_regs.target()[NREG_DCS4] & 0x1fffff00;
1583   if (base >= state->m_rambase.bytes())
15821584      add_dynamic_address(state, base + 0x0000, base + 0x7fff, timekeeper_r, timekeeper_w);
15831585
15841586   /* DCS5 */
1585   base = state->m_nile_regs[NREG_DCS5] & 0x1fffff00;
1586   if (base >= state->m_ramsize)
1587   base = state->m_nile_regs.target()[NREG_DCS5] & 0x1fffff00;
1588   if (base >= state->m_rambase.bytes())
15871589      add_dynamic_address(state, base + 0x0000, base + 0x0003, sio_r, sio_w);
15881590
15891591   /* DCS6 */
1590   base = state->m_nile_regs[NREG_DCS6] & 0x1fffff00;
1591   if (base >= state->m_ramsize)
1592   base = state->m_nile_regs.target()[NREG_DCS6] & 0x1fffff00;
1593   if (base >= state->m_rambase.bytes())
15921594   {
15931595      add_dynamic_address(state, base + 0x0000, base + 0x003f, midway_ioasic_packed_r, midway_ioasic_packed_w);
15941596      add_dynamic_address(state, base + 0x1000, base + 0x1003, NULL, asic_fifo_w);
r14896r14897
16021604   }
16031605
16041606   /* DCS7 */
1605   base = state->m_nile_regs[NREG_DCS7] & 0x1fffff00;
1606   if (base >= state->m_ramsize)
1607   base = state->m_nile_regs.target()[NREG_DCS7] & 0x1fffff00;
1608   if (base >= state->m_rambase.bytes())
16071609   {
16081610      add_dynamic_device_address(state, ethernet, base + 0x1000, base + 0x100f, ethernet_r, ethernet_w);
16091611      if (state->m_dcs_idma_cs == 7)
r14896r14897
16141616   }
16151617
16161618   /* PCI config space */
1617   if ((state->m_nile_regs[NREG_PCIINIT1] & 0xe) == 0xa)
1619   if ((state->m_nile_regs.target()[NREG_PCIINIT1] & 0xe) == 0xa)
16181620   {
1619      base = state->m_nile_regs[NREG_PCIW1] & 0x1fffff00;
1620      if (base >= state->m_ramsize)
1621      base = state->m_nile_regs.target()[NREG_PCIW1] & 0x1fffff00;
1622      if (base >= state->m_rambase.bytes())
16211623      {
16221624         add_dynamic_address(state, base + (1 << (21 + 4)) + 0x0000, base + (1 << (21 + 4)) + 0x00ff, pci_3dfx_r, pci_3dfx_w);
16231625         add_dynamic_address(state, base + (1 << (21 + 5)) + 0x0000, base + (1 << (21 + 5)) + 0x00ff, pci_ide_r, pci_ide_w);
r14896r14897
16291631   {
16301632      /* IDE controller */
16311633      base = state->m_pci_ide_regs[0x04] & 0xfffffff0;
1632      if (base >= state->m_ramsize && base < 0x20000000)
1634      if (base >= state->m_rambase.bytes() && base < 0x20000000)
16331635         add_dynamic_device_address(state, ide, base + 0x0000, base + 0x000f, ide_main_r, ide_main_w);
16341636
16351637      base = state->m_pci_ide_regs[0x05] & 0xfffffffc;
1636      if (base >= state->m_ramsize && base < 0x20000000)
1638      if (base >= state->m_rambase.bytes() && base < 0x20000000)
16371639         add_dynamic_device_address(state, ide, base + 0x0000, base + 0x0003, ide_alt_r, ide_alt_w);
16381640
16391641      base = state->m_pci_ide_regs[0x08] & 0xfffffff0;
1640      if (base >= state->m_ramsize && base < 0x20000000)
1642      if (base >= state->m_rambase.bytes() && base < 0x20000000)
16411643         add_dynamic_device_address(state, ide, base + 0x0000, base + 0x0007, ide_bus_master32_r, ide_bus_master32_w);
16421644
16431645      /* 3dfx card */
16441646      base = state->m_pci_3dfx_regs[0x04] & 0xfffffff0;
1645      if (base >= state->m_ramsize && base < 0x20000000)
1647      if (base >= state->m_rambase.bytes() && base < 0x20000000)
16461648      {
16471649         if (voodoo_type == VOODOO_2)
16481650            add_dynamic_device_address(state, state->m_voodoo, base + 0x000000, base + 0xffffff, voodoo_r, voodoo_w);
r14896r14897
16531655      if (voodoo_type >= VOODOO_BANSHEE)
16541656      {
16551657         base = state->m_pci_3dfx_regs[0x05] & 0xfffffff0;
1656            if (base >= state->m_ramsize && base < 0x20000000)
1658            if (base >= state->m_rambase.bytes() && base < 0x20000000)
16571659            add_dynamic_device_address(state, state->m_voodoo, base + 0x0000000, base + 0x1ffffff, banshee_fb_r, banshee_fb_w);
16581660
16591661         base = state->m_pci_3dfx_regs[0x06] & 0xfffffff0;
1660            if (base >= state->m_ramsize && base < 0x20000000)
1662            if (base >= state->m_rambase.bytes() && base < 0x20000000)
16611663            add_dynamic_device_address(state, state->m_voodoo, base + 0x0000000, base + 0x00000ff, banshee_io_r, banshee_io_w);
16621664
16631665         base = state->m_pci_3dfx_regs[0x0c] & 0xffff0000;
1664            if (base >= state->m_ramsize && base < 0x20000000)
1666            if (base >= state->m_rambase.bytes() && base < 0x20000000)
16651667            add_dynamic_device_address(state, state->m_voodoo, base + 0x0000000, base + 0x000ffff, banshee_rom_r, NULL);
16661668      }
16671669   }
r14896r14897
17021704
17031705static ADDRESS_MAP_START( vegas_map_8mb, AS_PROGRAM, 32, vegas_state )
17041706   ADDRESS_MAP_UNMAP_HIGH
1705   AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_BASE(m_rambase) AM_SIZE(m_ramsize)
1706   AM_RANGE(0x1fa00000, 0x1fa00fff) AM_READWRITE_LEGACY(nile_r, nile_w) AM_BASE(m_nile_regs)
1707   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_BASE(m_rombase)
1707   AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("rambase")
1708   AM_RANGE(0x1fa00000, 0x1fa00fff) AM_READWRITE_LEGACY(nile_r, nile_w) AM_SHARE("nile_regs")
1709   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("rombase")
17081710ADDRESS_MAP_END
17091711
17101712
17111713static ADDRESS_MAP_START( vegas_map_32mb, AS_PROGRAM, 32, vegas_state )
17121714   ADDRESS_MAP_UNMAP_HIGH
1713   AM_RANGE(0x00000000, 0x01ffffff) AM_RAM AM_BASE(m_rambase) AM_SIZE(m_ramsize)
1714   AM_RANGE(0x1fa00000, 0x1fa00fff) AM_READWRITE_LEGACY(nile_r, nile_w) AM_BASE(m_nile_regs)
1715   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_BASE(m_rombase)
1715   AM_RANGE(0x00000000, 0x01ffffff) AM_RAM AM_SHARE("rambase")
1716   AM_RANGE(0x1fa00000, 0x1fa00fff) AM_READWRITE_LEGACY(nile_r, nile_w) AM_SHARE("nile_regs")
1717   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("rombase")
17161718ADDRESS_MAP_END
17171719
17181720
src/mame/drivers/tecmo.c
r14896r14897
6464
6565WRITE8_MEMBER(tecmo_state::tecmo_sound_command_w)
6666{
67   soundlatch_w(space, offset, data);
67   soundlatch_byte_w(space, offset, data);
6868   cputag_set_input_line(machine(), "soundcpu",INPUT_LINE_NMI,PULSE_LINE);
6969}
7070
r14896r14897
139139   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(tecmo_fgvideoram_w) AM_BASE(m_fgvideoram)
140140   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(tecmo_bgvideoram_w) AM_BASE(m_bgvideoram)
141141   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
142   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_be_w) AM_SHARE("paletteram")
142   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_be_w) AM_SHARE("paletteram")
143143   AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank1")
144144   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("JOY1")
145145   AM_RANGE(0xf801, 0xf801) AM_READ_PORT("BUTTONS1")
r14896r14897
166166   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(tecmo_txvideoram_w) AM_BASE(m_txvideoram)
167167   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(tecmo_fgvideoram_w) AM_BASE(m_fgvideoram)
168168   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(tecmo_bgvideoram_w) AM_BASE(m_bgvideoram)
169   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_be_w) AM_SHARE("paletteram")
169   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_be_w) AM_SHARE("paletteram")
170170   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
171171   AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank1")
172172   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("JOY1")
r14896r14897
195195   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(tecmo_txvideoram_w) AM_BASE(m_txvideoram)
196196   AM_RANGE(0xd000, 0xdfff) AM_RAM
197197   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
198   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_be_w) AM_SHARE("paletteram")
198   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_be_w) AM_SHARE("paletteram")
199199   AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank1")
200200   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("JOY1")
201201   AM_RANGE(0xf801, 0xf801) AM_READ_PORT("BUTTONS1")
r14896r14897
221221   AM_RANGE(0x0000, 0x3fff) AM_ROM
222222   AM_RANGE(0x4000, 0x47ff) AM_RAM
223223   AM_RANGE(0x8000, 0x8001) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w)
224   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r) AM_DEVWRITE_LEGACY("msm", tecmo_adpcm_start_w)
224   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r) AM_DEVWRITE_LEGACY("msm", tecmo_adpcm_start_w)
225225   AM_RANGE(0xd000, 0xd000) AM_WRITE(tecmo_adpcm_end_w)
226226   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE_LEGACY("msm", tecmo_adpcm_vol_w)
227227   AM_RANGE(0xf000, 0xf000) AM_WRITENOP   /* NMI acknowledge */
r14896r14897
233233   AM_RANGE(0x0000, 0x7fff) AM_ROM
234234   AM_RANGE(0x8000, 0x87ff) AM_RAM
235235   AM_RANGE(0xa000, 0xa001) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w)
236   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r) AM_DEVWRITE_LEGACY("msm", tecmo_adpcm_start_w)
236   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r) AM_DEVWRITE_LEGACY("msm", tecmo_adpcm_start_w)
237237   AM_RANGE(0xc400, 0xc400) AM_WRITE(tecmo_adpcm_end_w)
238238   AM_RANGE(0xc800, 0xc800) AM_DEVWRITE_LEGACY("msm", tecmo_adpcm_vol_w)
239239   AM_RANGE(0xcc00, 0xcc00) AM_WRITENOP   /* NMI acknowledge */
src/mame/drivers/magictg.c
r14896r14897
132132      m_mips(*this, "mips"),
133133      m_adsp(*this, "adsp"),
134134      m_pci(*this, "pcibus")
135   { }
135   ,
136      m_adsp_pram(*this, "adsp_pram"){ }
136137
137138   required_device<cpu_device>         m_mips;
138139   required_device<adsp2181_device>   m_adsp;
r14896r14897
150151
151152
152153   /* ADSP-2181 */
153   UINT32*                        m_adsp_pram;
154   required_shared_ptr<UINT32> m_adsp_pram;
154155
155156   struct
156157   {
r14896r14897
241242      word |= adsp_boot[i*3 + 1] << 8;
242243      word |= adsp_boot[i*3 + 2];
243244
244      m_adsp_pram[i] = word;
245      m_adsp_pram.target()[i] = word;
245246   }
246247}
247248
r14896r14897
851852
852853static ADDRESS_MAP_START( adsp_program_map, AS_PROGRAM, 32, magictg_state )
853854   ADDRESS_MAP_UNMAP_HIGH
854   AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE(m_adsp_pram)
855   AM_RANGE(0x0000, 0x3fff) AM_RAM AM_SHARE("adsp_pram")
855856ADDRESS_MAP_END
856857
857858static ADDRESS_MAP_START( adsp_data_map, AS_DATA, 16, magictg_state )
src/mame/drivers/xtom3d.c
r14896r14897
9999   DECLARE_WRITE32_MEMBER( bios_ext4_ram_w );
100100
101101   DECLARE_WRITE32_MEMBER( bios_ram_w );
102   DECLARE_READ8_MEMBER(at_page8_r);
103   DECLARE_WRITE8_MEMBER(at_page8_w);
104   DECLARE_READ8_MEMBER(pc_dma_read_byte);
105   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
102106};
103107
104108// Intel 82439TX System Controller (MXTC)
r14896r14897
389393   ide_controller32_w(device, 0x3f0/4 + offset, data, mem_mask);
390394}
391395
392static READ8_HANDLER(at_page8_r)
396READ8_MEMBER(xtom3d_state::at_page8_r)
393397{
394   xtom3d_state *state = space->machine().driver_data<xtom3d_state>();
395   UINT8 data = state->m_at_pages[offset % 0x10];
398   UINT8 data = m_at_pages[offset % 0x10];
396399
397400   switch(offset % 8) {
398401   case 1:
399      data = state->m_dma_offset[(offset / 8) & 1][2];
402      data = m_dma_offset[(offset / 8) & 1][2];
400403      break;
401404   case 2:
402      data = state->m_dma_offset[(offset / 8) & 1][3];
405      data = m_dma_offset[(offset / 8) & 1][3];
403406      break;
404407   case 3:
405      data = state->m_dma_offset[(offset / 8) & 1][1];
408      data = m_dma_offset[(offset / 8) & 1][1];
406409      break;
407410   case 7:
408      data = state->m_dma_offset[(offset / 8) & 1][0];
411      data = m_dma_offset[(offset / 8) & 1][0];
409412      break;
410413   }
411414   return data;
412415}
413416
414417
415static WRITE8_HANDLER(at_page8_w)
418WRITE8_MEMBER(xtom3d_state::at_page8_w)
416419{
417   xtom3d_state *state = space->machine().driver_data<xtom3d_state>();
418   state->m_at_pages[offset % 0x10] = data;
420   m_at_pages[offset % 0x10] = data;
419421
420422   switch(offset % 8) {
421423   case 1:
422      state->m_dma_offset[(offset / 8) & 1][2] = data;
424      m_dma_offset[(offset / 8) & 1][2] = data;
423425      break;
424426   case 2:
425      state->m_dma_offset[(offset / 8) & 1][3] = data;
427      m_dma_offset[(offset / 8) & 1][3] = data;
426428      break;
427429   case 3:
428      state->m_dma_offset[(offset / 8) & 1][1] = data;
430      m_dma_offset[(offset / 8) & 1][1] = data;
429431      break;
430432   case 7:
431      state->m_dma_offset[(offset / 8) & 1][0] = data;
433      m_dma_offset[(offset / 8) & 1][0] = data;
432434      break;
433435   }
434436}
435437
436static READ32_HANDLER(at_page32_r)
437{
438   return read32le_with_read8_handler(at_page8_r, space, offset, mem_mask);
439}
440438
441
442static WRITE32_HANDLER(at_page32_w)
443{
444   write32le_with_write8_handler(at_page8_w, space, offset, data, mem_mask);
445}
446
447439static READ8_DEVICE_HANDLER(at_dma8237_2_r)
448440{
449441   return i8237_r(device, offset / 2);
r14896r14897
476468}
477469
478470
479static READ8_HANDLER( pc_dma_read_byte )
471READ8_MEMBER(xtom3d_state::pc_dma_read_byte)
480472{
481   xtom3d_state *state = space->machine().driver_data<xtom3d_state>();
482   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
473   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
483474      & 0xFF0000;
484475
485   return space->read_byte(page_offset + offset);
476   return space.read_byte(page_offset + offset);
486477}
487478
488479
489static WRITE8_HANDLER( pc_dma_write_byte )
480WRITE8_MEMBER(xtom3d_state::pc_dma_write_byte)
490481{
491   xtom3d_state *state = space->machine().driver_data<xtom3d_state>();
492   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
482   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
493483      & 0xFF0000;
494484
495   space->write_byte(page_offset + offset, data);
485   space.write_byte(page_offset + offset, data);
496486}
497487
498488static void set_dma_channel(device_t *device, int channel, int state)
r14896r14897
510500{
511501   DEVCB_LINE(pc_dma_hrq_changed),
512502   DEVCB_NULL,
513   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
514   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
503   DEVCB_DRIVER_MEMBER(xtom3d_state, pc_dma_read_byte),
504   DEVCB_DRIVER_MEMBER(xtom3d_state, pc_dma_write_byte),
515505   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
516506   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
517507   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
548538   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
549539   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
550540   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
551   AM_RANGE(0x0080, 0x009f) AM_READWRITE_LEGACY(at_page32_r,            at_page32_w)
541   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,   at_page8_w, 0xffffffff)
552542   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
553543   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
554544   AM_RANGE(0x00e8, 0x00ef) AM_NOP
src/mame/drivers/galpanic.c
r14896r14897
164164}
165165
166166
167static WRITE16_HANDLER( galpanic_6295_bankswitch_w )
167WRITE16_MEMBER(galpanic_state::galpanic_6295_bankswitch_w)
168168{
169   device_t *pandora = space->machine().device("pandora");
169   device_t *pandora = machine().device("pandora");
170170
171171   if (ACCESSING_BITS_8_15)
172172   {
173      UINT8 *rom = space->machine().region("oki")->base();
173      UINT8 *rom = machine().region("oki")->base();
174174
175175      memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000);
176176
r14896r14897
179179   }
180180}
181181
182static WRITE16_HANDLER( galpanica_6295_bankswitch_w )
182WRITE16_MEMBER(galpanic_state::galpanica_6295_bankswitch_w)
183183{
184184   if (ACCESSING_BITS_8_15)
185185   {
186      UINT8 *rom = space->machine().region("oki")->base();
186      UINT8 *rom = machine().region("oki")->base();
187187
188188      memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000);
189189   }
190190}
191191
192192#ifdef UNUSED_FUNCTION
193static WRITE16_HANDLER( galpanica_misc_w )
193WRITE16_MEMBER(galpanic_state::galpanica_misc_w)
194194{
195195   device_t *pandora = machine.device("pandora");
196196
r14896r14897
203203}
204204#endif
205205
206static WRITE16_HANDLER( galpanic_coin_w )
206WRITE16_MEMBER(galpanic_state::galpanic_coin_w)
207207{
208208   if (ACCESSING_BITS_8_15)
209209   {
210      coin_counter_w(space->machine(), 0, data & 0x100);
211      coin_counter_w(space->machine(), 1, data & 0x200);
210      coin_counter_w(machine(), 0, data & 0x100);
211      coin_counter_w(machine(), 1, data & 0x200);
212212
213      coin_lockout_w(space->machine(), 0, ~data & 0x400);
214      coin_lockout_w(space->machine(), 1, ~data & 0x800);
213      coin_lockout_w(machine(), 0, ~data & 0x400);
214      coin_lockout_w(machine(), 1, ~data & 0x800);
215215   }
216216}
217217
218static WRITE16_HANDLER( galpanic_bgvideoram_mirror_w )
218WRITE16_MEMBER(galpanic_state::galpanic_bgvideoram_mirror_w)
219219{
220220   int i;
221221   for(i = 0; i < 8; i++)
222222   {
223223      // or offset + i * 0x2000 ?
224      galpanic_bgvideoram_w(space, offset * 8 + i, data, mem_mask);
224      galpanic_bgvideoram_w(&space, offset * 8 + i, data, mem_mask);
225225   }
226226}
227227
228228static ADDRESS_MAP_START( galpanic_map, AS_PROGRAM, 16, galpanic_state )
229229   AM_RANGE(0x000000, 0x3fffff) AM_ROM
230230   AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
231   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE(m_fgvideoram) AM_SIZE(m_fgvideoram_size)
231   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE_SIZE(m_fgvideoram,m_fgvideoram_size)
232232   AM_RANGE(0x520000, 0x53ffff) AM_RAM_WRITE_LEGACY(galpanic_bgvideoram_w) AM_BASE(m_bgvideoram)   /* + work RAM */
233233   AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE_LEGACY(galpanic_paletteram_w) AM_SHARE("paletteram")   /* 1024 colors, but only 512 seem to be used */
234234   AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
r14896r14897
236236   AM_RANGE(0x800000, 0x800001) AM_READ_PORT("DSW1")
237237   AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2")
238238   AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM")
239   AM_RANGE(0x900000, 0x900001) AM_WRITE_LEGACY(galpanic_6295_bankswitch_w)
240   AM_RANGE(0xa00000, 0xa00001) AM_WRITE_LEGACY(galpanic_coin_w)   /* coin counters */
239   AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanic_6295_bankswitch_w)
240   AM_RANGE(0xa00000, 0xa00001) AM_WRITE(galpanic_coin_w)   /* coin counters */
241241   AM_RANGE(0xb00000, 0xb00001) AM_WRITENOP   /* ??? */
242242   AM_RANGE(0xc00000, 0xc00001) AM_WRITENOP   /* ??? */
243243   AM_RANGE(0xd00000, 0xd00001) AM_WRITENOP   /* ??? */
244244   AM_RANGE(0xe00000, 0xe00015) AM_READWRITE(galpanib_calc_r,galpanib_calc_w) /* CALC1 MCU interaction (simulated) */
245245ADDRESS_MAP_END
246246
247static READ16_HANDLER( comad_timer_r )
247READ16_MEMBER(galpanic_state::comad_timer_r)
248248{
249   return (space->machine().primary_screen->vpos() & 0x07) << 8;
249   return (machine().primary_screen->vpos() & 0x07) << 8;
250250}
251251
252252/* a kludge! */
r14896r14897
263263
264264static ADDRESS_MAP_START( comad_map, AS_PROGRAM, 16, galpanic_state )
265265   AM_RANGE(0x000000, 0x4fffff) AM_ROM
266   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE(m_fgvideoram) AM_SIZE(m_fgvideoram_size)
266   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE_SIZE(m_fgvideoram,m_fgvideoram_size)
267267   AM_RANGE(0x520000, 0x53ffff) AM_RAM_WRITE_LEGACY(galpanic_bgvideoram_w) AM_BASE(m_bgvideoram)   /* + work RAM */
268268   AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE_LEGACY(galpanic_paletteram_w) AM_SHARE("paletteram")   /* 1024 colors, but only 512 seem to be used */
269269   AM_RANGE(0x700000, 0x700fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
271271   AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2")
272272   AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM")
273273//  AM_RANGE(0x800006, 0x800007)    ??
274   AM_RANGE(0x80000a, 0x80000b) AM_READ_LEGACY(comad_timer_r)   /* bits 8-a = timer? palette update code waits for them to be 111 */
275   AM_RANGE(0x80000c, 0x80000d) AM_READ_LEGACY(comad_timer_r)   /* missw96 bits 8-a = timer? palette update code waits for them to be 111 */
276   AM_RANGE(0x900000, 0x900001) AM_WRITE_LEGACY(galpanica_6295_bankswitch_w)   /* not sure */
274   AM_RANGE(0x80000a, 0x80000b) AM_READ(comad_timer_r)   /* bits 8-a = timer? palette update code waits for them to be 111 */
275   AM_RANGE(0x80000c, 0x80000d) AM_READ(comad_timer_r)   /* missw96 bits 8-a = timer? palette update code waits for them to be 111 */
276   AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanica_6295_bankswitch_w)   /* not sure */
277277   AM_RANGE(0xc00000, 0xc0ffff) AM_RAM            /* missw96 */
278278   AM_RANGE(0xc80000, 0xc8ffff) AM_RAM            /* fantasia, newfant */
279279   AM_RANGE(0xf00000, 0xf00001) AM_DEVREAD8_LEGACY("oki", comad_okim6295_r, 0xff00) AM_DEVWRITE8("oki", okim6295_device, write, 0xff00)   /* fantasia, missw96 */
r14896r14897
282282
283283static ADDRESS_MAP_START( fantsia2_map, AS_PROGRAM, 16, galpanic_state )
284284   AM_RANGE(0x000000, 0x4fffff) AM_ROM
285   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE(m_fgvideoram) AM_SIZE(m_fgvideoram_size)
285   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE_SIZE(m_fgvideoram,m_fgvideoram_size)
286286   AM_RANGE(0x520000, 0x53ffff) AM_RAM_WRITE_LEGACY(galpanic_bgvideoram_w) AM_BASE(m_bgvideoram)   /* + work RAM */
287287   AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE_LEGACY(galpanic_paletteram_w) AM_SHARE("paletteram")   /* 1024 colors, but only 512 seem to be used */
288288   AM_RANGE(0x700000, 0x700fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
290290   AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2")
291291   AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM")
292292//  AM_RANGE(0x800006, 0x800007)    ??
293   AM_RANGE(0x800008, 0x800009) AM_READ_LEGACY(comad_timer_r)   /* bits 8-a = timer? palette update code waits for them to be 111 */
294   AM_RANGE(0x900000, 0x900001) AM_WRITE_LEGACY(galpanica_6295_bankswitch_w)   /* not sure */
293   AM_RANGE(0x800008, 0x800009) AM_READ(comad_timer_r)   /* bits 8-a = timer? palette update code waits for them to be 111 */
294   AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanica_6295_bankswitch_w)   /* not sure */
295295   AM_RANGE(0xa00000, 0xa00001) AM_WRITENOP   /* coin counters, + ? */
296296   AM_RANGE(0xc80000, 0xc80001) AM_DEVREAD8_LEGACY("oki", comad_okim6295_r, 0xff00) AM_DEVWRITE8("oki", okim6295_device, write, 0xff00)
297297   AM_RANGE(0xf80000, 0xf8ffff) AM_RAM
r14896r14897
300300
301301static ADDRESS_MAP_START( galhustl_map, AS_PROGRAM, 16, galpanic_state )
302302   AM_RANGE(0x000000, 0x0fffff) AM_ROM
303    AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE(m_fgvideoram) AM_SIZE(m_fgvideoram_size)
303    AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE_SIZE(m_fgvideoram,m_fgvideoram_size)
304304   AM_RANGE(0x520000, 0x53ffff) AM_WRITE_LEGACY(galpanic_bgvideoram_w) AM_BASE(m_bgvideoram)
305   AM_RANGE(0x580000, 0x583fff) AM_RAM_WRITE_LEGACY(galpanic_bgvideoram_mirror_w)
305   AM_RANGE(0x580000, 0x583fff) AM_RAM_WRITE(galpanic_bgvideoram_mirror_w)
306306   AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE_LEGACY(galpanic_paletteram_w) AM_SHARE("paletteram")   /* 1024 colors, but only 512 seem to be used */
307307   AM_RANGE(0x600800, 0x600fff) AM_RAM   // writes only 1?
308308   AM_RANGE(0x680000, 0x68001f) AM_RAM   // regs?
r14896r14897
311311   AM_RANGE(0x800000, 0x800001) AM_READ_PORT("DSW1")
312312   AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2")
313313   AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM")
314   AM_RANGE(0x900000, 0x900001) AM_WRITE_LEGACY(galpanica_6295_bankswitch_w)
314   AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanica_6295_bankswitch_w)
315315   AM_RANGE(0xa00000, 0xa00001) AM_WRITENOP // ?
316316   AM_RANGE(0xd00000, 0xd00001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0xff00)
317317   AM_RANGE(0xe80000, 0xe8ffff) AM_RAM
318318ADDRESS_MAP_END
319319
320320#ifdef UNUSED_FUNCTION
321READ16_HANDLER( zipzap_random_read )
321READ16_MEMBER(galpanic_state::zipzap_random_read)
322322{
323    return space->machine().rand();
323    return machine().rand();
324324}
325325#endif
326326
327327static ADDRESS_MAP_START( zipzap_map, AS_PROGRAM, 16, galpanic_state )
328328   AM_RANGE(0x000000, 0x4fffff) AM_ROM
329   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE(m_fgvideoram) AM_SIZE(m_fgvideoram_size)
329   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE_SIZE(m_fgvideoram,m_fgvideoram_size)
330330   AM_RANGE(0x520000, 0x53ffff) AM_RAM_WRITE_LEGACY(galpanic_bgvideoram_w) AM_BASE(m_bgvideoram)
331   AM_RANGE(0x580000, 0x583fff) AM_RAM_WRITE_LEGACY(galpanic_bgvideoram_mirror_w)
331   AM_RANGE(0x580000, 0x583fff) AM_RAM_WRITE(galpanic_bgvideoram_mirror_w)
332332   AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE_LEGACY(galpanic_paletteram_w) AM_SHARE("paletteram")   /* 1024 colors, but only 512 seem to be used */
333333   AM_RANGE(0x680000, 0x68001f) AM_RAM
334334   AM_RANGE(0x700000, 0x700fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
338338   AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2")
339339   AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM")
340340
341   AM_RANGE(0x900000, 0x900001) AM_WRITE_LEGACY(galpanica_6295_bankswitch_w)
341   AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanica_6295_bankswitch_w)
342342
343343   AM_RANGE(0xc00000, 0xc00001) AM_DEVREAD8_LEGACY("oki", comad_okim6295_r, 0xff00) AM_DEVWRITE8("oki", okim6295_device, write, 0xff00)   /* fantasia, missw96 */
344344
r14896r14897
347347
348348static ADDRESS_MAP_START( supmodel_map, AS_PROGRAM, 16, galpanic_state )
349349   AM_RANGE(0x000000, 0x4fffff) AM_ROM
350   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE(m_fgvideoram) AM_SIZE(m_fgvideoram_size)
350   AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE_SIZE(m_fgvideoram,m_fgvideoram_size)
351351   AM_RANGE(0x520000, 0x53ffff) AM_RAM_WRITE_LEGACY(galpanic_bgvideoram_w) AM_BASE(m_bgvideoram)
352//  AM_RANGE(0x580000, 0x583fff) AM_RAM_WRITE_LEGACY(galpanic_bgvideoram_mirror_w) // can't be right, causes half the display to vanish at times!
352//  AM_RANGE(0x580000, 0x583fff) AM_RAM_WRITE(galpanic_bgvideoram_mirror_w) // can't be right, causes half the display to vanish at times!
353353   AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE_LEGACY(galpanic_paletteram_w) AM_SHARE("paletteram")   /* 1024 colors, but only 512 seem to be used */
354354   AM_RANGE(0x680000, 0x68001f) AM_RAM
355355   AM_RANGE(0x700000, 0x700fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
357357   AM_RANGE(0x800000, 0x800001) AM_READ_PORT("DSW1")
358358   AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2")
359359   AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM")
360   AM_RANGE(0x800006, 0x800007) AM_READ_LEGACY(comad_timer_r)
361   AM_RANGE(0x800008, 0x800009) AM_READ_LEGACY(comad_timer_r)
362   AM_RANGE(0x900000, 0x900001) AM_WRITE_LEGACY(galpanica_6295_bankswitch_w)   /* not sure */
360   AM_RANGE(0x800006, 0x800007) AM_READ(comad_timer_r)
361   AM_RANGE(0x800008, 0x800009) AM_READ(comad_timer_r)
362   AM_RANGE(0x900000, 0x900001) AM_WRITE(galpanica_6295_bankswitch_w)   /* not sure */
363363   AM_RANGE(0xa00000, 0xa00001) AM_WRITENOP
364364   AM_RANGE(0xc80000, 0xc8ffff) AM_RAM
365365   AM_RANGE(0xd80000, 0xd80001) AM_WRITENOP
src/mame/drivers/finalizr.c
r14896r14897
4545   m_nmi_enable = data & 0x01;
4646   m_irq_enable = data & 0x02;
4747
48   flip_screen_set(machine(), ~data & 0x08);
48   flip_screen_set(~data & 0x08);
4949}
5050
5151WRITE8_MEMBER(finalizr_state::finalizr_i8039_irq_w)
r14896r14897
109109   AM_RANGE(0x081a, 0x081a) AM_DEVWRITE_LEGACY("snsnd", sn76496_w)   /* This address triggers the SN chip to read the data port. */
110110   AM_RANGE(0x081b, 0x081b) AM_WRITENOP      /* Loads the snd command into the snd latch */
111111   AM_RANGE(0x081c, 0x081c) AM_WRITE(finalizr_i8039_irq_w)   /* custom sound chip */
112   AM_RANGE(0x081d, 0x081d) AM_WRITE(soundlatch_w)         /* custom sound chip */
112   AM_RANGE(0x081d, 0x081d) AM_WRITE(soundlatch_byte_w)         /* custom sound chip */
113113   AM_RANGE(0x2000, 0x23ff) AM_RAM AM_BASE(m_colorram)
114114   AM_RANGE(0x2400, 0x27ff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
115115   AM_RANGE(0x2800, 0x2bff) AM_RAM AM_BASE(m_colorram2)
r14896r14897
126126ADDRESS_MAP_END
127127
128128static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, finalizr_state )
129   AM_RANGE(0x00, 0xff)                   AM_READ(soundlatch_r)
129   AM_RANGE(0x00, 0xff)                   AM_READ(soundlatch_byte_r)
130130   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE_LEGACY("dac", dac_w)
131131   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(i8039_irqen_w)
132132   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_WRITE(i8039_T0_w)
src/mame/drivers/shuuz.c
r14896r14897
4545 *
4646 *************************************/
4747
48static READ16_HANDLER( shuuz_atarivc_r )
48READ16_MEMBER(shuuz_state::shuuz_atarivc_r)
4949{
50   return atarivc_r(*space->machine().primary_screen, offset);
50   return atarivc_r(*machine().primary_screen, offset);
5151}
5252
5353
54static WRITE16_HANDLER( shuuz_atarivc_w )
54WRITE16_MEMBER(shuuz_state::shuuz_atarivc_w)
5555{
56   atarivc_w(*space->machine().primary_screen, offset, data, mem_mask);
56   atarivc_w(*machine().primary_screen, offset, data, mem_mask);
5757}
5858
5959
r14896r14897
8080}
8181
8282
83static WRITE16_HANDLER( latch_w )
83WRITE16_MEMBER(shuuz_state::latch_w)
8484{
8585}
8686
r14896r14897
9292 *
9393 *************************************/
9494
95static READ16_HANDLER( leta_r )
95READ16_MEMBER(shuuz_state::leta_r)
9696{
97   shuuz_state *state = space->machine().driver_data<shuuz_state>();
9897   /* trackball -- rotated 45 degrees? */
9998   int which = offset & 1;
10099
101100   /* when reading the even ports, do a real analog port update */
102101   if (which == 0)
103102   {
104      int dx = (INT8)input_port_read(space->machine(), "TRACKX");
105      int dy = (INT8)input_port_read(space->machine(), "TRACKY");
103      int dx = (INT8)input_port_read(machine(), "TRACKX");
104      int dy = (INT8)input_port_read(machine(), "TRACKY");
106105
107      state->m_cur[0] = dx + dy;
108      state->m_cur[1] = dx - dy;
106      m_cur[0] = dx + dy;
107      m_cur[1] = dx - dy;
109108   }
110109
111110   /* clip the result to -0x3f to +0x3f to remove directional ambiguities */
112   return state->m_cur[which];
111   return m_cur[which];
113112}
114113
115114
r14896r14897
120119 *
121120 *************************************/
122121
123static READ16_HANDLER( special_port0_r )
122READ16_MEMBER(shuuz_state::special_port0_r)
124123{
125   int result = input_port_read(space->machine(), "SYSTEM");
124   int result = input_port_read(machine(), "SYSTEM");
126125
127   if ((result & 0x0800) && atarigen_get_hblank(*space->machine().primary_screen))
126   if ((result & 0x0800) && atarigen_get_hblank(*machine().primary_screen))
128127      result &= ~0x0800;
129128
130129   return result;
r14896r14897
143142   AM_RANGE(0x100000, 0x100fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
144143   AM_RANGE(0x101000, 0x101fff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
145144   AM_RANGE(0x102000, 0x102001) AM_WRITE(watchdog_reset16_w)
146   AM_RANGE(0x103000, 0x103003) AM_READ_LEGACY(leta_r)
147   AM_RANGE(0x105000, 0x105001) AM_READWRITE_LEGACY(special_port0_r, latch_w)
145   AM_RANGE(0x103000, 0x103003) AM_READ(leta_r)
146   AM_RANGE(0x105000, 0x105001) AM_READWRITE(special_port0_r, latch_w)
148147   AM_RANGE(0x105002, 0x105003) AM_READ_PORT("BUTTONS")
149148   AM_RANGE(0x106000, 0x106001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
150149   AM_RANGE(0x107000, 0x107007) AM_NOP
151150   AM_RANGE(0x3e0000, 0x3e087f) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram_w) AM_SHARE("paletteram")
152   AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE_LEGACY(shuuz_atarivc_r, shuuz_atarivc_w) AM_BASE(m_atarivc_data)
151   AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(shuuz_atarivc_r, shuuz_atarivc_w) AM_BASE(m_atarivc_data)
153152   AM_RANGE(0x3f4000, 0x3f5eff) AM_RAM_WRITE_LEGACY(atarigen_playfield_latched_msb_w) AM_BASE(m_playfield)
154153   AM_RANGE(0x3f5f00, 0x3f5f7f) AM_RAM AM_BASE(m_atarivc_eof_data)
155154   AM_RANGE(0x3f5f80, 0x3f5fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
src/mame/drivers/speedspn.c
r14896r14897
9292
9393WRITE8_MEMBER(speedspn_state::speedspn_sound_w)
9494{
95   soundlatch_w(space, 1, data);
95   soundlatch_byte_w(space, 1, data);
9696   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
9797}
9898
r14896r14897
107107
108108static ADDRESS_MAP_START( speedspn_map, AS_PROGRAM, 8, speedspn_state )
109109   AM_RANGE(0x0000, 0x7fff) AM_ROM
110   AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_le_w) AM_SHARE("paletteram")   /* RAM COLOUR */
110   AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_le_w) AM_SHARE("paletteram")   /* RAM COLOUR */
111111   AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(speedspn_attram_w) AM_BASE(m_attram)
112112   AM_RANGE(0x9000, 0x9fff) AM_READWRITE(speedspn_vidram_r,speedspn_vidram_w)   /* RAM FIX / RAM OBJECTS (selected by bit 0 of port 17) */
113113   AM_RANGE(0xa000, 0xa7ff) AM_RAM
r14896r14897
135135   AM_RANGE(0x8000, 0x87ff) AM_RAM
136136   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("oki", oki_banking_w)
137137   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
138   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
138   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
139139ADDRESS_MAP_END
140140
141141
src/mame/drivers/enigma2.c
r14896r14897
6060{
6161public:
6262   enigma2_state(const machine_config &mconfig, device_type type, const char *tag)
63      : driver_device(mconfig, type, tag) { }
63      : driver_device(mconfig, type, tag) ,
64      m_videoram(*this, "videoram"){ }
6465
6566   /* memory pointers */
66   UINT8 * m_videoram;
67   required_shared_ptr<UINT8> m_videoram;
6768
6869   /* misc */
6970   int m_blink_count;
r14896r14897
231232         offs_t color_map_address = (y >> 3 << 5) | (x >> 3);
232233         /* the schematics shows it like this, but it doesn't work as this would
233234               produce no stars, due to the contents of the PROM -- maybe there is
234               a star disabled bit somewhere that's connected here instead of flip_screen_get(screen.machine()) */
235               a star disabled bit somewhere that's connected here instead of flip_screen() */
235236         /* star_map_address = (y >> 4 << 6) | (engima2_flip_screen_get() << 5) | (x >> 3); */
236237         offs_t star_map_address = (y >> 4 << 6) | 0x20 | (x >> 3);
237238
r14896r14897
241242               and the adder at 16A is activated */
242243         if (state->m_flip_screen)  videoram_address = (~videoram_address + 0x0400) & 0x1fff;
243244
244         video_data = state->m_videoram[videoram_address];
245         video_data = state->m_videoram.target()[videoram_address];
245246
246247         fore_color = color_map_base[color_map_address] & 0x07;
247248         star_color = star_map_base[star_map_address] & 0x07;
r14896r14897
312313               and the adder at 16A is activated */
313314         if (state->m_flip_screen)  videoram_address = (~videoram_address + 0x0400) & 0x1fff;
314315
315         video_data = state->m_videoram[videoram_address];
316         video_data = state->m_videoram.target()[videoram_address];
316317      }
317318
318319      /* plot the current pixel */
r14896r14897
447448static ADDRESS_MAP_START( engima2_main_cpu_map, AS_PROGRAM, 8, enigma2_state )
448449   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
449450   AM_RANGE(0x0000, 0x1fff) AM_ROM AM_WRITENOP
450   AM_RANGE(0x2000, 0x3fff) AM_MIRROR(0x4000) AM_RAM AM_BASE(m_videoram)
451   AM_RANGE(0x2000, 0x3fff) AM_MIRROR(0x4000) AM_RAM AM_SHARE("videoram")
451452   AM_RANGE(0x4000, 0x4fff) AM_ROM AM_WRITENOP
452453   AM_RANGE(0x5000, 0x57ff) AM_READ(dip_switch_r) AM_WRITENOP
453454   AM_RANGE(0x5800, 0x5800) AM_MIRROR(0x07f8) AM_NOP
r14896r14897
462463
463464static ADDRESS_MAP_START( engima2a_main_cpu_map, AS_PROGRAM, 8, enigma2_state )
464465   AM_RANGE(0x0000, 0x1fff) AM_ROM AM_WRITENOP
465   AM_RANGE(0x2000, 0x3fff) AM_MIRROR(0x4000) AM_RAM AM_BASE(m_videoram)
466   AM_RANGE(0x2000, 0x3fff) AM_MIRROR(0x4000) AM_RAM AM_SHARE("videoram")
466467   AM_RANGE(0x4000, 0x4fff) AM_ROM AM_WRITENOP
467468   AM_RANGE(0x5000, 0x57ff) AM_READ(dip_switch_r) AM_WRITENOP
468469   AM_RANGE(0x5800, 0x5fff) AM_NOP
src/mame/drivers/igspoker.c
r14896r14897
7676public:
7777   igspoker_state(const machine_config &mconfig, device_type type, const char *tag)
7878      : driver_device(mconfig, type, tag),
79      m_maincpu(*this, "maincpu")
80      { }
79      m_maincpu(*this, "maincpu"),
80      m_bg_tile_ram(*this, "bg_tile_ram"),
81      m_fg_tile_ram(*this, "fg_tile_ram"),
82      m_fg_color_ram(*this, "fg_color_ram"){ }
8183
84   required_device<cpu_device> m_maincpu;
85   required_shared_ptr<UINT8> m_bg_tile_ram;
86   required_shared_ptr<UINT8> m_fg_tile_ram;
87   required_shared_ptr<UINT8> m_fg_color_ram;
8288   int m_nmi_enable;
8389   int m_bg_enable;
8490   int m_hopper;
85   UINT8 *m_fg_tile_ram;
86   UINT8 *m_fg_color_ram;
87   UINT8 *m_bg_tile_ram;
8891   tilemap_t *m_fg_tilemap;
8992   tilemap_t *m_bg_tilemap;
9093   UINT8 m_out[3];
9194   size_t m_protection_res;
9295
93   required_device<cpu_device> m_maincpu;
9496   DECLARE_READ8_MEMBER(igs_irqack_r);
9597   DECLARE_WRITE8_MEMBER(igs_irqack_w);
9698   DECLARE_WRITE8_MEMBER(bg_tile_w);
r14896r14897
146148static TILE_GET_INFO( get_bg_tile_info )
147149{
148150   igspoker_state *state = machine.driver_data<igspoker_state>();
149   int code = state->m_bg_tile_ram[tile_index];
151   int code = state->m_bg_tile_ram.target()[tile_index];
150152   SET_TILE_INFO(1 + (tile_index & 3), code, 0, 0);
151153}
152154
153155static TILE_GET_INFO( get_fg_tile_info )
154156{
155157   igspoker_state *state = machine.driver_data<igspoker_state>();
156   int code = state->m_fg_tile_ram[tile_index] | (state->m_fg_color_ram[tile_index] << 8);
158   int code = state->m_fg_tile_ram.target()[tile_index] | (state->m_fg_color_ram.target()[tile_index] << 8);
157159   int tile = code & 0x1fff;
158160   SET_TILE_INFO(0, code, tile != 0x1fff ? ((code >> 12) & 0xe) + 1 : 0, 0);
159161}
160162
161163WRITE8_MEMBER(igspoker_state::bg_tile_w)
162164{
163   m_bg_tile_ram[offset] = data;
165   m_bg_tile_ram.target()[offset] = data;
164166   m_bg_tilemap->mark_tile_dirty(offset);
165167}
166168
167169WRITE8_MEMBER(igspoker_state::fg_tile_w)
168170{
169   m_fg_tile_ram[offset] = data;
171   m_fg_tile_ram.target()[offset] = data;
170172   m_fg_tilemap->mark_tile_dirty(offset);
171173}
172174
173175WRITE8_MEMBER(igspoker_state::fg_color_w)
174176{
175   m_fg_color_ram[offset] = data;
177   m_fg_color_ram.target()[offset] = data;
176178   m_fg_tilemap->mark_tile_dirty(offset);
177179}
178180
r14896r14897
351353ADDRESS_MAP_END
352354
353355static ADDRESS_MAP_START( igspoker_io_map, AS_IO, 8, igspoker_state )
354   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_SHARE("paletteram")
355   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_SHARE("paletteram2")
356   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) AM_SHARE("paletteram")
357   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) AM_SHARE("paletteram2")
356358   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW1")         /* DSW1 */
357359   AM_RANGE(0x4001, 0x4001) AM_READ_PORT("DSW2")         /* DSW2 */
358360   AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3")         /* DSW3 */
r14896r14897
11051107
11061108
11071109static ADDRESS_MAP_START( number10_io_map, AS_IO, 8, igspoker_state )
1108   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_SHARE("paletteram")
1109   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_SHARE("paletteram2")
1110   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) AM_SHARE("paletteram")
1111   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) AM_SHARE("paletteram2")
11101112   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW1")         /* DSW1 */
11111113   AM_RANGE(0x4001, 0x4001) AM_READ_PORT("DSW2")         /* DSW2 */
11121114   AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3")         /* DSW3 */
r14896r14897
11281130ADDRESS_MAP_END
11291131
11301132static ADDRESS_MAP_START( cpokerpk_io_map, AS_IO, 8, igspoker_state )
1131   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_SHARE("paletteram")
1132   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_SHARE("paletteram2")
1133   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) AM_SHARE("paletteram")
1134   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) AM_SHARE("paletteram2")
11331135   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW1")         /* DSW1 */
11341136   AM_RANGE(0x4001, 0x4001) AM_READ_PORT("DSW2")         /* DSW2 */
11351137   AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3")         /* DSW3 */
src/mame/drivers/segaorun.c
r14896r14897
369369{
370370   segas1x_state *state = machine.driver_data<segas1x_state>();
371371   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
372   state->soundlatch_w(*space, 0, param);
372   state->soundlatch_byte_w(*space, 0, param);
373373   device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, ASSERT_LINE);
374374}
375375
r14896r14897
385385   segas1x_state *state = space->machine().driver_data<segas1x_state>();
386386
387387   device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, CLEAR_LINE);
388   return state->soundlatch_r(*space, offset);
388   return state->soundlatch_byte_r(*space, offset);
389389}
390390
391391
src/mame/drivers/koikoi.c
r14896r14897
4949{
5050public:
5151   koikoi_state(const machine_config &mconfig, device_type type, const char *tag)
52      : driver_device(mconfig, type, tag) { }
52      : driver_device(mconfig, type, tag) ,
53      m_videoram(*this, "videoram"){ }
5354
5455   /* memory pointers */
55   UINT8 * m_videoram;
56   required_shared_ptr<UINT8> m_videoram;
5657
5758   /* video-related */
5859   tilemap_t  *m_tmap;
r14896r14897
7778static TILE_GET_INFO( get_tile_info )
7879{
7980   koikoi_state *state = machine.driver_data<koikoi_state>();
80   int code  = state->m_videoram[tile_index] | ((state->m_videoram[tile_index + 0x400] & 0x40) << 2);
81   int color = (state->m_videoram[tile_index + 0x400] & 0x1f);
82   int flip  = (state->m_videoram[tile_index + 0x400] & 0x80) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0;
81   int code  = state->m_videoram.target()[tile_index] | ((state->m_videoram.target()[tile_index + 0x400] & 0x40) << 2);
82   int color = (state->m_videoram.target()[tile_index + 0x400] & 0x1f);
83   int flip  = (state->m_videoram.target()[tile_index + 0x400] & 0x80) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0;
8384
8485   SET_TILE_INFO( 0, code, color, flip);
8586}
r14896r14897
150151
151152WRITE8_MEMBER(koikoi_state::vram_w)
152153{
153   m_videoram[offset] = data;
154   m_videoram.target()[offset] = data;
154155   m_tmap->mark_tile_dirty(offset & 0x3ff);
155156}
156157
r14896r14897
222223static ADDRESS_MAP_START( koikoi_map, AS_PROGRAM, 8, koikoi_state )
223224   AM_RANGE(0x0000, 0x2fff) AM_ROM
224225   AM_RANGE(0x6000, 0x67ff) AM_RAM
225   AM_RANGE(0x7000, 0x77ff) AM_RAM_WRITE(vram_w) AM_BASE(m_videoram)
226   AM_RANGE(0x7000, 0x77ff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram")
226227   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("DSW")
227228   AM_RANGE(0x9000, 0x9007) AM_READWRITE(io_r, io_w)
228229ADDRESS_MAP_END
src/mame/drivers/mil4000.c
r14896r14897
9595{
9696public:
9797   mil4000_state(const machine_config &mconfig, device_type type, const char *tag)
98      : driver_device(mconfig, type, tag) { }
98      : driver_device(mconfig, type, tag) ,
99      m_sc0_vram(*this, "sc0_vram"),
100      m_sc1_vram(*this, "sc1_vram"),
101      m_sc2_vram(*this, "sc2_vram"),
102      m_sc3_vram(*this, "sc3_vram"){ }
99103
100   UINT16 *m_sc0_vram;
101   UINT16 *m_sc1_vram;
102   UINT16 *m_sc2_vram;
103   UINT16 *m_sc3_vram;
104   required_shared_ptr<UINT16> m_sc0_vram;
105   required_shared_ptr<UINT16> m_sc1_vram;
106   required_shared_ptr<UINT16> m_sc2_vram;
107   required_shared_ptr<UINT16> m_sc3_vram;
104108   tilemap_t *m_sc0_tilemap;
105109   tilemap_t *m_sc1_tilemap;
106110   tilemap_t *m_sc2_tilemap;
r14896r14897
119123static TILE_GET_INFO( get_sc0_tile_info )
120124{
121125   mil4000_state *state = machine.driver_data<mil4000_state>();
122   UINT32 data = (state->m_sc0_vram[tile_index*2]<<16) | state->m_sc0_vram[tile_index*2+1];
126   UINT32 data = (state->m_sc0_vram.target()[tile_index*2]<<16) | state->m_sc0_vram.target()[tile_index*2+1];
123127   int tile = data >> 14;
124   int color = (state->m_sc0_vram[tile_index*2+1] & 0x1f)+0;
128   int color = (state->m_sc0_vram.target()[tile_index*2+1] & 0x1f)+0;
125129
126130   SET_TILE_INFO(
127131         0,
r14896r14897
133137static TILE_GET_INFO( get_sc1_tile_info )
134138{
135139   mil4000_state *state = machine.driver_data<mil4000_state>();
136   UINT32 data = (state->m_sc1_vram[tile_index*2]<<16) | state->m_sc1_vram[tile_index*2+1];
140   UINT32 data = (state->m_sc1_vram.target()[tile_index*2]<<16) | state->m_sc1_vram.target()[tile_index*2+1];
137141   int tile = data >> 14;
138   int color = (state->m_sc1_vram[tile_index*2+1] & 0x1f)+0x10;
142   int color = (state->m_sc1_vram.target()[tile_index*2+1] & 0x1f)+0x10;
139143
140144   SET_TILE_INFO(
141145         0,
r14896r14897
147151static TILE_GET_INFO( get_sc2_tile_info )
148152{
149153   mil4000_state *state = machine.driver_data<mil4000_state>();
150   UINT32 data = (state->m_sc2_vram[tile_index*2]<<16) | state->m_sc2_vram[tile_index*2+1];
154   UINT32 data = (state->m_sc2_vram.target()[tile_index*2]<<16) | state->m_sc2_vram.target()[tile_index*2+1];
151155   int tile = data >> 14;
152   int color = (state->m_sc2_vram[tile_index*2+1] & 0x1f)+0x20;
156   int color = (state->m_sc2_vram.target()[tile_index*2+1] & 0x1f)+0x20;
153157
154158   SET_TILE_INFO(
155159         0,
r14896r14897
161165static TILE_GET_INFO( get_sc3_tile_info )
162166{
163167   mil4000_state *state = machine.driver_data<mil4000_state>();
164   UINT32 data = (state->m_sc3_vram[tile_index*2]<<16) | state->m_sc3_vram[tile_index*2+1];
168   UINT32 data = (state->m_sc3_vram.target()[tile_index*2]<<16) | state->m_sc3_vram.target()[tile_index*2+1];
165169   int tile = data >> 14;
166   int color = (state->m_sc3_vram[tile_index*2+1] & 0x1f)+0x30;
170   int color = (state->m_sc3_vram.target()[tile_index*2+1] & 0x1f)+0x30;
167171
168172   SET_TILE_INFO(
169173         0,
r14896r14897
219223
220224WRITE16_MEMBER(mil4000_state::sc0_vram_w)
221225{
222   m_sc0_vram[offset] = data;
226   m_sc0_vram.target()[offset] = data;
223227   m_sc0_tilemap->mark_tile_dirty(offset/2);
224228}
225229
226230WRITE16_MEMBER(mil4000_state::sc1_vram_w)
227231{
228   m_sc1_vram[offset] = data;
232   m_sc1_vram.target()[offset] = data;
229233   m_sc1_tilemap->mark_tile_dirty(offset/2);
230234}
231235
232236WRITE16_MEMBER(mil4000_state::sc2_vram_w)
233237{
234   m_sc2_vram[offset] = data;
238   m_sc2_vram.target()[offset] = data;
235239   m_sc2_tilemap->mark_tile_dirty(offset/2);
236240}
237241
238242WRITE16_MEMBER(mil4000_state::sc3_vram_w)
239243{
240   m_sc3_vram[offset] = data;
244   m_sc3_vram.target()[offset] = data;
241245   m_sc3_tilemap->mark_tile_dirty(offset/2);
242246}
243247
r14896r14897
273277
274278static ADDRESS_MAP_START( mil4000_map, AS_PROGRAM, 16, mil4000_state )
275279   AM_RANGE(0x000000, 0x03ffff) AM_ROM
276   AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(sc0_vram_w) AM_BASE(m_sc0_vram)   // CY62256L-70, U77
277   AM_RANGE(0x504000, 0x507fff) AM_RAM_WRITE(sc1_vram_w) AM_BASE(m_sc1_vram)   // CY62256L-70, U77
278   AM_RANGE(0x508000, 0x50bfff) AM_RAM_WRITE(sc2_vram_w) AM_BASE(m_sc2_vram)   // CY62256L-70, U78
279   AM_RANGE(0x50c000, 0x50ffff) AM_RAM_WRITE(sc3_vram_w) AM_BASE(m_sc3_vram)   // CY62256L-70, U78
280   AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(sc0_vram_w) AM_SHARE("sc0_vram")   // CY62256L-70, U77
281   AM_RANGE(0x504000, 0x507fff) AM_RAM_WRITE(sc1_vram_w) AM_SHARE("sc1_vram")   // CY62256L-70, U77
282   AM_RANGE(0x508000, 0x50bfff) AM_RAM_WRITE(sc2_vram_w) AM_SHARE("sc2_vram")   // CY62256L-70, U78
283   AM_RANGE(0x50c000, 0x50ffff) AM_RAM_WRITE(sc3_vram_w) AM_SHARE("sc3_vram")   // CY62256L-70, U78
280284
281285   AM_RANGE(0x708000, 0x708001) AM_READ_PORT("IN0")
282286   AM_RANGE(0x708002, 0x708003) AM_READ_PORT("IN1")
r14896r14897
286290   AM_RANGE(0x708010, 0x708011) AM_NOP //touch screen
287291   AM_RANGE(0x70801e, 0x70801f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
288292
289   AM_RANGE(0x780000, 0x780fff) AM_RAM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
293   AM_RANGE(0x780000, 0x780fff) AM_RAM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
290294   AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("nvram") // 2x CY62256L-70 (U7 & U8).
291295
292296ADDRESS_MAP_END
src/mame/drivers/gticlub.c
r14896r14897
239239{
240240public:
241241   gticlub_state(const machine_config &mconfig, device_type type, const char *tag)
242      : driver_device(mconfig, type, tag) { }
242      : driver_device(mconfig, type, tag) ,
243      m_work_ram(*this, "work_ram"){ }
243244
244   UINT32 *m_work_ram;
245   required_shared_ptr<UINT32> m_work_ram;
245246   UINT32 *m_sharc_dataram_0;
246247   UINT32 *m_sharc_dataram_1;
247248   DECLARE_WRITE32_MEMBER(paletteram32_w);
r14896r14897
410411   ppcdrc_set_options(machine.device("maincpu"), PPCDRC_COMPATIBLE_OPTIONS);
411412
412413   /* configure fast RAM regions for DRC */
413   ppcdrc_add_fastram(machine.device("maincpu"), 0x00000000, 0x000fffff, FALSE, state->m_work_ram);
414   ppcdrc_add_fastram(machine.device("maincpu"), 0x00000000, 0x000fffff, FALSE, state->m_work_ram.target());
414415}
415416
416417static ADDRESS_MAP_START( gticlub_map, AS_PROGRAM, 32, gticlub_state )
417   AM_RANGE(0x00000000, 0x000fffff) AM_RAM AM_BASE(m_work_ram)      /* Work RAM */
418   AM_RANGE(0x00000000, 0x000fffff) AM_RAM AM_SHARE("work_ram")      /* Work RAM */
418419   AM_RANGE(0x74000000, 0x740000ff) AM_READWRITE(gticlub_k001604_reg_r, gticlub_k001604_reg_w)
419420   AM_RANGE(0x74010000, 0x7401ffff) AM_RAM_WRITE(paletteram32_w) AM_SHARE("paletteram")
420421   AM_RANGE(0x74020000, 0x7403ffff) AM_READWRITE(gticlub_k001604_tile_r, gticlub_k001604_tile_w)
src/mame/drivers/mazerbla.c
r14896r14897
5252{
5353public:
5454   mazerbla_state(const machine_config &mconfig, device_type type, const char *tag)
55      : driver_device(mconfig, type, tag) { }
55      : driver_device(mconfig, type, tag) ,
56      m_videoram(*this, "videoram"),
57      m_cfb_ram(*this, "cfb_ram"){ }
5658
5759   /* memory pointers */
58   UINT8 *   m_cfb_ram;
59   UINT8 *   m_videoram;
60   size_t    m_videoram_size;
60   required_shared_ptr<UINT8> m_videoram;
61   required_shared_ptr<UINT8> m_cfb_ram;
6162
6263   /* video-related */
6364   bitmap_ind16 m_tmpbitmaps[4];
r14896r14897
394395   m_vcu_gfx_param_addr = offset;
395396
396397   /* offset  = 0 is not known */
397   m_xpos      = m_cfb_ram[m_vcu_gfx_param_addr + 1] | (m_cfb_ram[m_vcu_gfx_param_addr + 2]<<8);
398   m_ypos      = m_cfb_ram[m_vcu_gfx_param_addr + 3] | (m_cfb_ram[m_vcu_gfx_param_addr + 4]<<8);
399   m_color1    = m_cfb_ram[m_vcu_gfx_param_addr + 5];
400   m_color2    = m_cfb_ram[m_vcu_gfx_param_addr + 6];
401   m_mode      = m_cfb_ram[m_vcu_gfx_param_addr + 7];
402   m_pix_xsize = m_cfb_ram[m_vcu_gfx_param_addr + 8];
403   m_pix_ysize = m_cfb_ram[m_vcu_gfx_param_addr + 9];
398   m_xpos      = m_cfb_ram.target()[m_vcu_gfx_param_addr + 1] | (m_cfb_ram.target()[m_vcu_gfx_param_addr + 2]<<8);
399   m_ypos      = m_cfb_ram.target()[m_vcu_gfx_param_addr + 3] | (m_cfb_ram.target()[m_vcu_gfx_param_addr + 4]<<8);
400   m_color1    = m_cfb_ram.target()[m_vcu_gfx_param_addr + 5];
401   m_color2    = m_cfb_ram.target()[m_vcu_gfx_param_addr + 6];
402   m_mode      = m_cfb_ram.target()[m_vcu_gfx_param_addr + 7];
403   m_pix_xsize = m_cfb_ram.target()[m_vcu_gfx_param_addr + 8];
404   m_pix_ysize = m_cfb_ram.target()[m_vcu_gfx_param_addr + 9];
404405
405406   m_plane = m_mode & 3;
406407
r14896r14897
427428        logerror("paradr=");
428429        logerror("%3x ", m_vcu_gfx_param_addr );
429430
430        logerror("%02x ", m_cfb_ram[vcu_gfx_param_addr + 0] );
431        logerror("%02x ", m_cfb_ram.target()[vcu_gfx_param_addr + 0] );
431432        logerror("x=%04x ", m_xpos );                 //1,2
432433        logerror("y=%04x ", m_ypos );                 //3,4
433434        logerror("color1=%02x ", m_color1);             //5
r14896r14897
570571        logerror("paladr=");
571572        logerror("%3x ", m_vcu_gfx_param_addr );
572573
573        logerror("%02x ", m_cfb_ram[m_vcu_gfx_param_addr + 0] );
574        logerror("%02x ", m_cfb_ram.target()[m_vcu_gfx_param_addr + 0] );
574575        logerror("x=%04x ", m_xpos );                 //1,2
575576        logerror("y=%04x ", m_ypos );                 //3,4
576577        logerror("color1=%02x ", m_color1);             //5
r14896r14897
586587            logerror("%04x: ", offset + y * 16);
587588            for (x = 0; x < 16; x++)
588589            {
589                logerror("%02x ", m_cfb_ram[offset + x + y * 16]);
590                logerror("%02x ", m_cfb_ram.target()[offset + x + y * 16]);
590591            }
591592            logerror("\n");
592593        }
r14896r14897
663664            {
664665               for (x = 0; x < 16; x++)
665666               {
666                  UINT8 colour = m_cfb_ram[offs + x + y * 16];
667                  UINT8 colour = m_cfb_ram.target()[offs + x + y * 16];
667668
668669                  /* red component */
669670                  bit1 = (colour >> 7) & 0x01;
r14896r14897
698699            {
699700               for (x = 0; x < 16; x++)
700701               {
701                  UINT8 dat = m_cfb_ram[offs + x + y * 16];
702                  UINT8 dat = m_cfb_ram.target()[offs + x + y * 16];
702703                  m_lookup_ram[lookup_offs + x + y * 16] = dat;
703704               }
704705            }
r14896r14897
712713            {
713714               for (x = 0; x < 16; x++)
714715               {
715                  UINT8 dat = m_cfb_ram[offs + x + y * 16];
716                  UINT8 dat = m_cfb_ram.target()[offs + x + y * 16];
716717                  m_lookup_ram[lookup_offs + x + y * 16] = dat;
717718               }
718719            }
r14896r14897
726727            {
727728               for (x = 0; x < 16; x++)
728729               {
729                  UINT8 dat = m_cfb_ram[offs + x + y * 16];
730                  UINT8 dat = m_cfb_ram.target()[offs + x + y * 16];
730731                  m_lookup_ram[lookup_offs + x + y * 16] = dat;
731732               }
732733            }
r14896r14897
983984   AM_RANGE(0x0000, 0x7fff) AM_ROM
984985   AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_SHARE("share1")
985986   AM_RANGE(0xd800, 0xd800) AM_READ(cfb_zpu_int_req_clr)
986   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
987   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("videoram")
987988   AM_RANGE(0xe800, 0xefff) AM_RAM
988989ADDRESS_MAP_END
989990
r14896r14897
10141015   AM_RANGE(0x3800, 0x3fff) AM_RAM AM_SHARE("share1")
10151016   AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank1")               /* GFX roms */
10161017   AM_RANGE(0x4000, 0x4003) AM_WRITE(vcu_video_reg_w)
1017   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE(m_cfb_ram)      /* Color Frame Buffer PCB, a.k.a. RAM for VCU commands and parameters */
1018   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_SHARE("cfb_ram")      /* Color Frame Buffer PCB, a.k.a. RAM for VCU commands and parameters */
10181019   AM_RANGE(0xa000, 0xa7ff) AM_READ(vcu_set_cmd_param_r)   /* VCU command and parameters LOAD */
10191020   AM_RANGE(0xc000, 0xdfff) AM_READ(vcu_set_gfx_addr_r)   /* gfx LOAD (blit) */
10201021   AM_RANGE(0xe000, 0xffff) AM_READ(vcu_set_clr_addr_r)   /* palette? LOAD */
src/mame/drivers/armedf.c
r14896r14897
325325   coin_counter_w(machine(), 0, (data & 1) >> 0);
326326   coin_counter_w(machine(), 1, (data & 2) >> 1);
327327
328   flip_screen_set(machine(), m_vreg & 0x1000);
328   flip_screen_set(m_vreg & 0x1000);
329329}
330330
331331WRITE16_MEMBER(armedf_state::terrafb_io_w)
r14896r14897
339339   coin_counter_w(machine(), 0, (data & 1) >> 0);
340340   coin_counter_w(machine(), 1, (data & 2) >> 1);
341341
342   flip_screen_set(machine(), m_vreg & 0x1000);
342   flip_screen_set(m_vreg & 0x1000);
343343}
344344
345345WRITE16_MEMBER(armedf_state::bootleg_io_w)
r14896r14897
355355   coin_counter_w(machine(), 0, (data & 1) >> 0);
356356   coin_counter_w(machine(), 1, (data & 2) >> 1);
357357
358   flip_screen_set(machine(), m_vreg & 0x1000);
358   flip_screen_set(m_vreg & 0x1000);
359359}
360360
361361WRITE16_MEMBER(armedf_state::sound_command_w)
362362{
363363   if (ACCESSING_BITS_0_7)
364      soundlatch_w(space, 0, ((data & 0x7f) << 1) | 1);
364      soundlatch_byte_w(space, 0, ((data & 0x7f) << 1) | 1);
365365}
366366
367367READ8_MEMBER(armedf_state::soundlatch_clear_r)
368368{
369   soundlatch_clear_w(space, 0, 0);
369   soundlatch_clear_byte_w(space, 0, 0);
370370   return 0;
371371}
372372
r14896r14897
392392   AM_RANGE(0x000000, 0x05ffff) AM_ROM
393393   AM_RANGE(0x060000, 0x0603ff) AM_RAM AM_SHARE("spriteram")
394394   AM_RANGE(0x060400, 0x063fff) AM_RAM
395   AM_RANGE(0x064000, 0x064fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
395   AM_RANGE(0x064000, 0x064fff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
396396   AM_RANGE(0x068000, 0x069fff) AM_READWRITE8(nb1414m4_text_videoram_r,nb1414m4_text_videoram_w,0x00ff)
397397   AM_RANGE(0x06a000, 0x06a9ff) AM_RAM
398398   AM_RANGE(0x06c000, 0x06cfff) AM_RAM AM_BASE(m_spr_pal_clut)
r14896r14897
423423   AM_RANGE(0x000000, 0x05ffff) AM_ROM
424424   AM_RANGE(0x060000, 0x060fff) AM_RAM AM_SHARE("spriteram")
425425   AM_RANGE(0x061000, 0x063fff) AM_RAM
426   AM_RANGE(0x064000, 0x064fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
426   AM_RANGE(0x064000, 0x064fff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
427427   AM_RANGE(0x068000, 0x069fff) AM_READWRITE8(nb1414m4_text_videoram_r,nb1414m4_text_videoram_w,0x00ff)
428428   AM_RANGE(0x06a000, 0x06a9ff) AM_RAM
429429   AM_RANGE(0x06c000, 0x06cfff) AM_RAM AM_BASE(m_spr_pal_clut)
r14896r14897
445445   AM_RANGE(0x000000, 0x05ffff) AM_ROM
446446   AM_RANGE(0x060000, 0x060fff) AM_RAM AM_SHARE("spriteram")
447447   AM_RANGE(0x061000, 0x063fff) AM_RAM
448   AM_RANGE(0x064000, 0x064fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
448   AM_RANGE(0x064000, 0x064fff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
449449   AM_RANGE(0x068000, 0x069fff) AM_READWRITE8(nb1414m4_text_videoram_r,nb1414m4_text_videoram_w,0x00ff)
450450   AM_RANGE(0x06a000, 0x06a9ff) AM_RAM
451451   AM_RANGE(0x06c000, 0x06cfff) AM_RAM AM_BASE(m_spr_pal_clut)
r14896r14897
478478   AM_RANGE(0x000000, 0x05ffff) AM_ROM
479479   AM_RANGE(0x060000, 0x060fff) AM_RAM AM_SHARE("spriteram")
480480   AM_RANGE(0x061000, 0x063fff) AM_RAM
481   AM_RANGE(0x064000, 0x064fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
481   AM_RANGE(0x064000, 0x064fff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
482482   AM_RANGE(0x068000, 0x069fff) AM_READWRITE8(nb1414m4_text_videoram_r,nb1414m4_text_videoram_w,0x00ff)
483483   AM_RANGE(0x06a000, 0x06a9ff) AM_RAM
484484   AM_RANGE(0x06c000, 0x06cfff) AM_RAM AM_BASE(m_spr_pal_clut)
r14896r14897
503503   AM_RANGE(0x066000, 0x066fff) AM_RAM_WRITE(armedf_bg_videoram_w) AM_BASE(m_bg_videoram)
504504   AM_RANGE(0x067000, 0x067fff) AM_RAM_WRITE(armedf_fg_videoram_w) AM_BASE(m_fg_videoram)
505505   AM_RANGE(0x068000, 0x069fff) AM_READWRITE8(armedf_text_videoram_r,armedf_text_videoram_w,0x00ff)
506   AM_RANGE(0x06a000, 0x06afff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
506   AM_RANGE(0x06a000, 0x06afff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
507507   AM_RANGE(0x06b000, 0x06bfff) AM_RAM AM_BASE(m_spr_pal_clut)
508508   AM_RANGE(0x06c000, 0x06c001) AM_READ_PORT("P1")
509509   AM_RANGE(0x06c002, 0x06c003) AM_READ_PORT("P2")
r14896r14897
678678   AM_RANGE(0x086000, 0x086fff) AM_RAM_WRITE(armedf_bg_videoram_w) AM_BASE(m_bg_videoram)
679679   AM_RANGE(0x087000, 0x087fff) AM_RAM_WRITE(armedf_fg_videoram_w) AM_BASE(m_fg_videoram)
680680   AM_RANGE(0x088000, 0x089fff) AM_READWRITE8(armedf_text_videoram_r,armedf_text_videoram_w,0x00ff)
681   AM_RANGE(0x08a000, 0x08afff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
681   AM_RANGE(0x08a000, 0x08afff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
682682   AM_RANGE(0x08b000, 0x08bfff) AM_RAM AM_BASE(m_spr_pal_clut)
683683   AM_RANGE(0x08c000, 0x08c001) AM_READ_PORT("P1")
684684   AM_RANGE(0x08c002, 0x08c003) AM_READ_PORT("P2")
r14896r14897
758758   AM_RANGE(0x2, 0x2) AM_DEVWRITE_LEGACY("dac1", dac_signed_w)
759759   AM_RANGE(0x3, 0x3) AM_DEVWRITE_LEGACY("dac2", dac_signed_w)
760760   AM_RANGE(0x4, 0x4) AM_READ(soundlatch_clear_r)
761   AM_RANGE(0x6, 0x6) AM_READ(soundlatch_r)
761   AM_RANGE(0x6, 0x6) AM_READ(soundlatch_byte_r)
762762ADDRESS_MAP_END
763763
764764
src/mame/drivers/dkong.c
r14896r14897
780780    AM_RANGE(0x7d00, 0x7d00) AM_READ(dkong_in2_r)                               /* IN2 */
781781    AM_RANGE(0x7d00, 0x7d07) AM_DEVWRITE_LEGACY("ls259.6h", latch8_bit0_w)        /* Sound signals */
782782
783    AM_RANGE(0x7d80, 0x7d80) AM_READ_PORT("DSW0") AM_WRITE_LEGACY(dkong_audio_irq_w)   /* DSW0 */
783    AM_RANGE(0x7d80, 0x7d80) AM_READ_PORT("DSW0") AM_WRITE(dkong_audio_irq_w)   /* DSW0 */
784784    AM_RANGE(0x7d81, 0x7d81) AM_WRITE(radarscp_grid_enable_w)
785785    AM_RANGE(0x7d82, 0x7d82) AM_WRITE(dkong_flipscreen_w)
786786    AM_RANGE(0x7d83, 0x7d83) AM_WRITE(dkong_spritebank_w)                       /* 2 PSL Signal */
r14896r14897
805805    AM_RANGE(0x7d00, 0x7d00) AM_READ(dkongjr_in2_r)                             /* IN2 */
806806    AM_RANGE(0x7d00, 0x7d07) AM_DEVWRITE_LEGACY("ls259.6h",latch8_bit0_w)      /* Sound addrs */
807807
808    AM_RANGE(0x7d80, 0x7d80) AM_READ_PORT("DSW0") AM_WRITE_LEGACY(dkong_audio_irq_w)   /* DSW0 */
808    AM_RANGE(0x7d80, 0x7d80) AM_READ_PORT("DSW0") AM_WRITE(dkong_audio_irq_w)   /* DSW0 */
809809    AM_RANGE(0x7d82, 0x7d82) AM_WRITE(dkong_flipscreen_w)
810810    AM_RANGE(0x7d83, 0x7d83) AM_WRITE(dkong_spritebank_w)                       /* 2 PSL Signal */
811811    AM_RANGE(0x7d84, 0x7d84) AM_WRITE(nmi_mask_w)
r14896r14897
859859    AM_RANGE(0x1480, 0x1480) AM_READ_PORT("IN1")
860860    AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x007f) AM_READ(dkong_in2_r)                                 /* IN2 */
861861    AM_RANGE(0x1500, 0x1507) AM_DEVWRITE_LEGACY("ls259.6h", latch8_bit0_w)       /* Sound signals */
862    AM_RANGE(0x1580, 0x1580) AM_READ_PORT("DSW0") AM_WRITE_LEGACY(dkong_audio_irq_w)     /* DSW0 */
862    AM_RANGE(0x1580, 0x1580) AM_READ_PORT("DSW0") AM_WRITE(dkong_audio_irq_w)     /* DSW0 */
863863    AM_RANGE(0x1582, 0x1582) AM_WRITE(dkong_flipscreen_w)
864864    AM_RANGE(0x1583, 0x1583) AM_WRITE(dkong_spritebank_w)                         /* 2 PSL Signal */
865865    AM_RANGE(0x1584, 0x1584) AM_NOP                                               /* Possibly still interrupt enable */
src/mame/drivers/acefruit.c
r14896r14897
1919{
2020public:
2121   acefruit_state(const machine_config &mconfig, device_type type, const char *tag)
22      : driver_device(mconfig, type, tag) { }
22      : driver_device(mconfig, type, tag) ,
23      m_videoram(*this, "videoram"),
24      m_colorram(*this, "colorram"),
25      m_spriteram(*this, "spriteram"){ }
2326
24   UINT8 *m_spriteram;
25   UINT8 *m_colorram;
26   UINT8 *m_videoram;
27   required_shared_ptr<UINT8> m_videoram;
28   required_shared_ptr<UINT8> m_colorram;
29   required_shared_ptr<UINT8> m_spriteram;
2730   emu_timer *m_refresh_timer;
2831   DECLARE_WRITE8_MEMBER(acefruit_colorram_w);
2932   DECLARE_WRITE8_MEMBER(acefruit_coin_w);
r14896r14897
4649   for( col = 0; col < 32; col++ )
4750   {
4851      int tile_index = ( col * 32 ) + row;
49      int color = state->m_colorram[ tile_index ];
52      int color = state->m_colorram.target()[ tile_index ];
5053
5154      switch( color )
5255      {
r14896r14897
101104      for( col = 0; col < 32; col++ )
102105      {
103106         int tile_index = ( col * 32 ) + row;
104         int code = state->m_videoram[ tile_index ];
105         int color = state->m_colorram[ tile_index ];
107         int code = state->m_videoram.target()[ tile_index ];
108         int color = state->m_colorram.target()[ tile_index ];
106109
107110         if( color < 0x4 )
108111         {
r14896r14897
118121
119122            for( x = 0; x < 16; x++ )
120123            {
121               int sprite = ( state->m_spriteram[ ( spriteindex / 64 ) % 6 ] & 0xf ) ^ 0xf;
124               int sprite = ( state->m_spriteram.target()[ ( spriteindex / 64 ) % 6 ] & 0xf ) ^ 0xf;
122125               const UINT8 *gfxdata = gfx_element_get_data(gfx, sprite);
123126
124127               for( y = 0; y < 8; y++ )
r14896r14897
225228
226229WRITE8_MEMBER(acefruit_state::acefruit_colorram_w)
227230{
228   m_colorram[ offset ] = data & 0xf;
231   m_colorram.target()[ offset ] = data & 0xf;
229232}
230233
231234WRITE8_MEMBER(acefruit_state::acefruit_coin_w)
r14896r14897
284287static ADDRESS_MAP_START( acefruit_map, AS_PROGRAM, 8, acefruit_state )
285288   AM_RANGE(0x0000, 0x1fff) AM_ROM
286289   AM_RANGE(0x2000, 0x20ff) AM_RAM AM_SHARE("nvram")
287   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(m_videoram)
288   AM_RANGE(0x4400, 0x47ff) AM_RAM_WRITE(acefruit_colorram_w) AM_BASE(m_colorram)
290   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_SHARE("videoram")
291   AM_RANGE(0x4400, 0x47ff) AM_RAM_WRITE(acefruit_colorram_w) AM_SHARE("colorram")
289292   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN0")
290293   AM_RANGE(0x8001, 0x8001) AM_READ_PORT("IN1")
291294   AM_RANGE(0x8002, 0x8002) AM_READ_PORT("IN2")
r14896r14897
294297   AM_RANGE(0x8005, 0x8005) AM_READ_PORT("IN5")
295298   AM_RANGE(0x8006, 0x8006) AM_READ_PORT("IN6")
296299   AM_RANGE(0x8007, 0x8007) AM_READ_PORT("IN7")
297   AM_RANGE(0x6000, 0x6005) AM_RAM AM_BASE(m_spriteram)
300   AM_RANGE(0x6000, 0x6005) AM_RAM AM_SHARE("spriteram")
298301   AM_RANGE(0xa000, 0xa001) AM_WRITE(acefruit_lamp_w)
299302   AM_RANGE(0xa002, 0xa003) AM_WRITE(acefruit_coin_w)
300303   AM_RANGE(0xa004, 0xa004) AM_WRITE(acefruit_solenoid_w)
src/mame/drivers/metlclsh.c
r14896r14897
6565   AM_RANGE(0xc080, 0xc080) AM_WRITENOP                     // ? 0
6666   AM_RANGE(0xc0c2, 0xc0c2) AM_WRITE(metlclsh_cause_irq)         // cause irq on cpu #2
6767   AM_RANGE(0xc0c3, 0xc0c3) AM_WRITE(metlclsh_ack_nmi)            // nmi ack
68/**/AM_RANGE(0xc800, 0xc82f) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("paletteram")
69/**/AM_RANGE(0xcc00, 0xcc2f) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("paletteram2")
68/**/AM_RANGE(0xc800, 0xc82f) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram")
69/**/AM_RANGE(0xcc00, 0xcc2f) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
7070   AM_RANGE(0xd000, 0xd001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r,ym2203_w)
7171/**/AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(metlclsh_fgram_w) AM_BASE(m_fgram)
7272   AM_RANGE(0xe000, 0xe001) AM_DEVWRITE_LEGACY("ym2", ym3526_w   )
r14896r14897
9898
9999WRITE8_MEMBER(metlclsh_state::metlclsh_flipscreen_w)
100100{
101   flip_screen_set(machine(), data & 1);
101   flip_screen_set(data & 1);
102102}
103103
104104static ADDRESS_MAP_START( metlclsh_slave_map, AS_PROGRAM, 8, metlclsh_state )
r14896r14897
275275{
276276   metlclsh_state *state = machine.driver_data<metlclsh_state>();
277277
278   flip_screen_set(machine, 0);
278   state->flip_screen_set(0);
279279
280280   state->m_write_mask = 0;
281281   state->m_gfxbank = 0;
src/mame/drivers/goldstar.c
r14896r14897
163163   AM_RANGE(0xf840, 0xf840) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
164164   AM_RANGE(0xfa00, 0xfa00) AM_WRITE(goldstar_fa00_w)
165165   AM_RANGE(0xfb00, 0xfb00) AM_DEVREADWRITE("oki", okim6295_device, read, write)
166   AM_RANGE(0xfd00, 0xfdff) AM_RAM_WRITE(paletteram_BBGGGRRR_w) AM_SHARE("paletteram")
166   AM_RANGE(0xfd00, 0xfdff) AM_RAM_WRITE(paletteram_BBGGGRRR_byte_w) AM_SHARE("paletteram")
167167   AM_RANGE(0xfe00, 0xfe00) AM_READWRITE(protection_r,protection_w)
168168ADDRESS_MAP_END
169169
r14896r14897
522522/* newer / more capable hw */
523523static ADDRESS_MAP_START( unkch_map, AS_PROGRAM, 8, goldstar_state )
524524   AM_RANGE(0x0000, 0x9fff) AM_ROM
525   AM_RANGE(0xc000, 0xc1ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w) AM_SHARE("paletteram")
526   AM_RANGE(0xc800, 0xc9ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w) AM_SHARE("paletteram2")
525   AM_RANGE(0xc000, 0xc1ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w) AM_SHARE("paletteram")
526   AM_RANGE(0xc800, 0xc9ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
527527
528528   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("nvram")
529529
src/mame/drivers/dbz.c
r14896r14897
9797
9898WRITE16_MEMBER(dbz_state::dbz_sound_command_w)
9999{
100   soundlatch_w(space, 0, data >> 8);
100   soundlatch_byte_w(space, 0, data >> 8);
101101}
102102
103103WRITE16_MEMBER(dbz_state::dbz_sound_cause_nmi)
r14896r14897
120120   AM_RANGE(0x498000, 0x49ffff) AM_DEVREAD_LEGACY("k056832", k056832_rom_word_8000_r)   // code near a60 in dbz2, subroutine at 730 in dbz
121121   AM_RANGE(0x4a0000, 0x4a0fff) AM_DEVREADWRITE_LEGACY("k053246", k053247_word_r, k053247_word_w)
122122   AM_RANGE(0x4a1000, 0x4a3fff) AM_RAM
123   AM_RANGE(0x4a8000, 0x4abfff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // palette
123   AM_RANGE(0x4a8000, 0x4abfff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // palette
124124   AM_RANGE(0x4c0000, 0x4c0001) AM_DEVREAD_LEGACY("k053246", k053246_word_r)
125125   AM_RANGE(0x4c0000, 0x4c0007) AM_DEVWRITE_LEGACY("k053246", k053246_word_w)
126126   AM_RANGE(0x4c4000, 0x4c4007) AM_DEVWRITE_LEGACY("k053246", k053246_word_w)
r14896r14897
154154   AM_RANGE(0x8000, 0xbfff) AM_RAM
155155   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
156156   AM_RANGE(0xd000, 0xd002) AM_DEVREADWRITE("oki", okim6295_device, read, write)
157   AM_RANGE(0xe000, 0xe001) AM_READ(soundlatch_r)
157   AM_RANGE(0xe000, 0xe001) AM_READ(soundlatch_byte_r)
158158ADDRESS_MAP_END
159159
160160static ADDRESS_MAP_START( dbz_sound_io_map, AS_IO, 8, dbz_state )
src/mame/drivers/skylncr.c
r14896r14897
4343{
4444public:
4545   skylncr_state(const machine_config &mconfig, device_type type, const char *tag)
46      : driver_device(mconfig, type, tag) { }
46      : driver_device(mconfig, type, tag) ,
47      m_videoram(*this, "videoram"),
48      m_colorram(*this, "colorram"),
49      m_reeltiles_1_ram(*this, "reeltiles_1_ram"),
50      m_reeltiles_2_ram(*this, "reeltiles_2_ram"),
51      m_reeltiles_3_ram(*this, "reeltiles_3_ram"),
52      m_reeltiles_4_ram(*this, "reeltiles_4_ram"),
53      m_reeltileshigh_1_ram(*this, "reeltileshigh_1_ram"),
54      m_reeltileshigh_2_ram(*this, "reeltileshigh_2_ram"),
55      m_reeltileshigh_3_ram(*this, "reeltileshigh_3_ram"),
56      m_reeltileshigh_4_ram(*this, "reeltileshigh_4_ram"),
57      m_reelscroll1(*this, "reelscroll1"),
58      m_reelscroll2(*this, "reelscroll2"),
59      m_reelscroll3(*this, "reelscroll3"),
60      m_reelscroll4(*this, "reelscroll4"){ }
4761
4862   tilemap_t *m_tmap;
49   UINT8 *m_videoram;
50   UINT8 *m_colorram;
51   UINT8* m_reeltiles_1_ram;
52   UINT8* m_reeltiles_2_ram;
53   UINT8* m_reeltiles_3_ram;
54   UINT8* m_reeltiles_4_ram;
55   UINT8* m_reeltileshigh_1_ram;
56   UINT8* m_reeltileshigh_2_ram;
57   UINT8* m_reeltileshigh_3_ram;
58   UINT8* m_reeltileshigh_4_ram;
63   required_shared_ptr<UINT8> m_videoram;
64   required_shared_ptr<UINT8> m_colorram;
65   required_shared_ptr<UINT8> m_reeltiles_1_ram;
66   required_shared_ptr<UINT8> m_reeltiles_2_ram;
67   required_shared_ptr<UINT8> m_reeltiles_3_ram;
68   required_shared_ptr<UINT8> m_reeltiles_4_ram;
69   required_shared_ptr<UINT8> m_reeltileshigh_1_ram;
70   required_shared_ptr<UINT8> m_reeltileshigh_2_ram;
71   required_shared_ptr<UINT8> m_reeltileshigh_3_ram;
72   required_shared_ptr<UINT8> m_reeltileshigh_4_ram;
5973   tilemap_t *m_reel_1_tilemap;
6074   tilemap_t *m_reel_2_tilemap;
6175   tilemap_t *m_reel_3_tilemap;
6276   tilemap_t *m_reel_4_tilemap;
63   UINT8* m_reelscroll1;
64   UINT8* m_reelscroll2;
65   UINT8* m_reelscroll3;
66   UINT8* m_reelscroll4;
77   required_shared_ptr<UINT8> m_reelscroll1;
78   required_shared_ptr<UINT8> m_reelscroll2;
79   required_shared_ptr<UINT8> m_reelscroll3;
80   required_shared_ptr<UINT8> m_reelscroll4;
6781   UINT8 m_nmi_enable;
6882   int m_color;
6983   int m_color2;
r14896r14897
96110
97111WRITE8_MEMBER(skylncr_state::skylncr_videoram_w)
98112{
99   m_videoram[offset] = data;
113   m_videoram.target()[offset] = data;
100114   m_tmap->mark_tile_dirty(offset);
101115}
102116
103117WRITE8_MEMBER(skylncr_state::skylncr_colorram_w)
104118{
105   m_colorram[offset] = data;
119   m_colorram.target()[offset] = data;
106120   m_tmap->mark_tile_dirty(offset);
107121}
108122
r14896r14897
110124static TILE_GET_INFO( get_tile_info )
111125{
112126   skylncr_state *state = machine.driver_data<skylncr_state>();
113   UINT16 code = state->m_videoram[ tile_index ] + (state->m_colorram[ tile_index ] << 8);
127   UINT16 code = state->m_videoram.target()[ tile_index ] + (state->m_colorram.target()[ tile_index ] << 8);
114128   SET_TILE_INFO(0, code, 0, TILE_FLIPYX( 0 ));
115129}
116130
117131static TILE_GET_INFO( get_reel_1_tile_info )
118132{
119133   skylncr_state *state = machine.driver_data<skylncr_state>();
120   UINT16 code = state->m_reeltiles_1_ram[ tile_index ] + (state->m_reeltileshigh_1_ram[ tile_index ] << 8);
134   UINT16 code = state->m_reeltiles_1_ram.target()[ tile_index ] + (state->m_reeltileshigh_1_ram.target()[ tile_index ] << 8);
121135   SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 ));
122136}
123137
124138static TILE_GET_INFO( get_reel_2_tile_info )
125139{
126140   skylncr_state *state = machine.driver_data<skylncr_state>();
127   UINT16 code = state->m_reeltiles_2_ram[ tile_index ] + (state->m_reeltileshigh_2_ram[ tile_index ] << 8);
141   UINT16 code = state->m_reeltiles_2_ram.target()[ tile_index ] + (state->m_reeltileshigh_2_ram.target()[ tile_index ] << 8);
128142   SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 ));
129143}
130144
131145static TILE_GET_INFO( get_reel_3_tile_info )
132146{
133147   skylncr_state *state = machine.driver_data<skylncr_state>();
134   UINT16 code = state->m_reeltiles_3_ram[ tile_index ] + (state->m_reeltileshigh_3_ram[ tile_index ] << 8);
148   UINT16 code = state->m_reeltiles_3_ram.target()[ tile_index ] + (state->m_reeltileshigh_3_ram.target()[ tile_index ] << 8);
135149   SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 ));
136150}
137151
138152static TILE_GET_INFO( get_reel_4_tile_info )
139153{
140154   skylncr_state *state = machine.driver_data<skylncr_state>();
141   UINT16 code = state->m_reeltiles_4_ram[ tile_index ] + (state->m_reeltileshigh_4_ram[ tile_index ] << 8);
155   UINT16 code = state->m_reeltiles_4_ram.target()[ tile_index ] + (state->m_reeltileshigh_4_ram.target()[ tile_index ] << 8);
142156   SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 ));
143157}
144158
r14896r14897
182196
183197   for (i= 0;i < 64;i++)
184198   {
185      state->m_reel_2_tilemap->set_scrolly(i, state->m_reelscroll2[i]);
186      state->m_reel_3_tilemap->set_scrolly(i, state->m_reelscroll3[i]);
187      state->m_reel_4_tilemap->set_scrolly(i, state->m_reelscroll4[i]);
199      state->m_reel_2_tilemap->set_scrolly(i, state->m_reelscroll2.target()[i]);
200      state->m_reel_3_tilemap->set_scrolly(i, state->m_reelscroll3.target()[i]);
201      state->m_reel_4_tilemap->set_scrolly(i, state->m_reelscroll4.target()[i]);
188202   }
189203
190204   state->m_reel_2_tilemap->draw(bitmap, visible1, 0, 0);
r14896r14897
198212
199213WRITE8_MEMBER(skylncr_state::reeltiles_1_w)
200214{
201   m_reeltiles_1_ram[offset] = data;
215   m_reeltiles_1_ram.target()[offset] = data;
202216   m_reel_1_tilemap->mark_tile_dirty(offset);
203217}
204218
205219WRITE8_MEMBER(skylncr_state::reeltiles_2_w)
206220{
207   m_reeltiles_2_ram[offset] = data;
221   m_reeltiles_2_ram.target()[offset] = data;
208222   m_reel_2_tilemap->mark_tile_dirty(offset);
209223}
210224
211225WRITE8_MEMBER(skylncr_state::reeltiles_3_w)
212226{
213   m_reeltiles_3_ram[offset] = data;
227   m_reeltiles_3_ram.target()[offset] = data;
214228   m_reel_3_tilemap->mark_tile_dirty(offset);
215229}
216230
217231WRITE8_MEMBER(skylncr_state::reeltiles_4_w)
218232{
219   m_reeltiles_4_ram[offset] = data;
233   m_reeltiles_4_ram.target()[offset] = data;
220234   m_reel_4_tilemap->mark_tile_dirty(offset);
221235}
222236
223237WRITE8_MEMBER(skylncr_state::reeltileshigh_1_w)
224238{
225   m_reeltileshigh_1_ram[offset] = data;
239   m_reeltileshigh_1_ram.target()[offset] = data;
226240   m_reel_1_tilemap->mark_tile_dirty(offset);
227241}
228242
229243WRITE8_MEMBER(skylncr_state::reeltileshigh_2_w)
230244{
231   m_reeltileshigh_2_ram[offset] = data;
245   m_reeltileshigh_2_ram.target()[offset] = data;
232246   m_reel_2_tilemap->mark_tile_dirty(offset);
233247}
234248
235249WRITE8_MEMBER(skylncr_state::reeltileshigh_3_w)
236250{
237   m_reeltileshigh_3_ram[offset] = data;
251   m_reeltileshigh_3_ram.target()[offset] = data;
238252   m_reel_3_tilemap->mark_tile_dirty(offset);
239253}
240254
241255WRITE8_MEMBER(skylncr_state::reeltileshigh_4_w)
242256{
243   m_reeltileshigh_4_ram[offset] = data;
257   m_reeltileshigh_4_ram.target()[offset] = data;
244258   m_reel_4_tilemap->mark_tile_dirty(offset);
245259}
246260
r14896r14897
295309
296310WRITE8_MEMBER(skylncr_state::reelscroll1_w)
297311{
298   m_reelscroll1[offset] = data;
312   m_reelscroll1.target()[offset] = data;
299313}
300314
301315WRITE8_MEMBER(skylncr_state::reelscroll2_w)
302316{
303   m_reelscroll2[offset] = data;
317   m_reelscroll2.target()[offset] = data;
304318}
305319
306320WRITE8_MEMBER(skylncr_state::reelscroll3_w)
307321{
308   m_reelscroll3[offset] = data;
322   m_reelscroll3.target()[offset] = data;
309323}
310324
311325WRITE8_MEMBER(skylncr_state::reelscroll4_w)
312326{
313   m_reelscroll4[offset] = data;
327   m_reelscroll4.target()[offset] = data;
314328}
315329
316330
r14896r14897
363377
364378   AM_RANGE(0xaa55, 0xaa55) AM_READ(ret_ff )
365379
366   AM_RANGE(0xb000, 0xb03f) AM_RAM_WRITE(reelscroll1_w) AM_BASE(m_reelscroll1)
380   AM_RANGE(0xb000, 0xb03f) AM_RAM_WRITE(reelscroll1_w) AM_SHARE("reelscroll1")
367381   AM_RANGE(0xb040, 0xb07f) AM_RAM_WRITE(reelscroll1_w)
368382   AM_RANGE(0xb080, 0xb0bf) AM_RAM_WRITE(reelscroll1_w)
369383   AM_RANGE(0xb0c0, 0xb0ff) AM_RAM_WRITE(reelscroll1_w)
r14896r14897
372386   AM_RANGE(0xb180, 0xb1bf) AM_RAM_WRITE(reelscroll1_w)
373387   AM_RANGE(0xb1c0, 0xb1ff) AM_RAM_WRITE(reelscroll1_w)
374388
375   AM_RANGE(0xb200, 0xb23f) AM_RAM_WRITE(reelscroll2_w) AM_BASE(m_reelscroll2)
389   AM_RANGE(0xb200, 0xb23f) AM_RAM_WRITE(reelscroll2_w) AM_SHARE("reelscroll2")
376390   AM_RANGE(0xb240, 0xb27f) AM_RAM_WRITE(reelscroll2_w)
377391   AM_RANGE(0xb280, 0xb2bf) AM_RAM_WRITE(reelscroll2_w)
378392   AM_RANGE(0xb2c0, 0xb2ff) AM_RAM_WRITE(reelscroll2_w)
r14896r14897
381395   AM_RANGE(0xb380, 0xb3bf) AM_RAM_WRITE(reelscroll2_w)
382396   AM_RANGE(0xb3c0, 0xb3ff) AM_RAM_WRITE(reelscroll2_w)
383397
384   AM_RANGE(0xb400, 0xb43f) AM_RAM_WRITE(reelscroll3_w) AM_BASE(m_reelscroll3)
398   AM_RANGE(0xb400, 0xb43f) AM_RAM_WRITE(reelscroll3_w) AM_SHARE("reelscroll3")
385399   AM_RANGE(0xb440, 0xb47f) AM_RAM_WRITE(reelscroll3_w)
386400   AM_RANGE(0xb480, 0xb4bf) AM_RAM_WRITE(reelscroll3_w)
387401   AM_RANGE(0xb4c0, 0xb4ff) AM_RAM_WRITE(reelscroll3_w)
r14896r14897
390404   AM_RANGE(0xb580, 0xb5bf) AM_RAM_WRITE(reelscroll3_w)
391405   AM_RANGE(0xb5c0, 0xb5ff) AM_RAM_WRITE(reelscroll3_w)
392406
393   AM_RANGE(0xb600, 0xb63f) AM_RAM_WRITE(reelscroll4_w) AM_BASE(m_reelscroll4)
407   AM_RANGE(0xb600, 0xb63f) AM_RAM_WRITE(reelscroll4_w) AM_SHARE("reelscroll4")
394408   AM_RANGE(0xb640, 0xb67f) AM_RAM_WRITE(reelscroll4_w)
395409   AM_RANGE(0xb680, 0xb6bf) AM_RAM_WRITE(reelscroll4_w)
396410   AM_RANGE(0xb6c0, 0xb6ff) AM_RAM_WRITE(reelscroll4_w)
src/mame/drivers/spbactn.c
r14896r14897
135135{
136136   if (ACCESSING_BITS_0_7)
137137   {
138      soundlatch_w(space, offset, data & 0xff);
138      soundlatch_byte_w(space, offset, data & 0xff);
139139      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
140140   }
141141}
r14896r14897
146146   AM_RANGE(0x50000, 0x50fff) AM_RAM AM_BASE(m_spvideoram)
147147   AM_RANGE(0x60000, 0x67fff) AM_RAM AM_BASE(m_fgvideoram)
148148   AM_RANGE(0x70000, 0x77fff) AM_RAM AM_BASE(m_bgvideoram)
149   AM_RANGE(0x80000, 0x827ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
149   AM_RANGE(0x80000, 0x827ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
150150   AM_RANGE(0x90000, 0x90001) AM_READ_PORT("IN0")
151151   AM_RANGE(0x90010, 0x90011) AM_READ_PORT("IN1")
152152   AM_RANGE(0x90020, 0x90021) AM_READ_PORT("SYSTEM")
r14896r14897
193193   AM_RANGE(0xf810, 0xf811) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w)
194194
195195   AM_RANGE(0xfc00, 0xfc00) AM_READNOP   AM_WRITENOP /* irq ack ?? */
196   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
196   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_byte_r)
197197ADDRESS_MAP_END
198198
199199
src/mame/drivers/system16.c
r14896r14897
113113
114114   if (ACCESSING_BITS_0_7)
115115   {
116      soundlatch_w(space, 0, data & 0xff);
116      soundlatch_byte_w(space, 0, data & 0xff);
117117      device_set_input_line(m_soundcpu, INPUT_LINE_NMI, PULSE_LINE);
118118   }
119119}
r14896r14897
151151
152152   if (ACCESSING_BITS_0_7)
153153   {
154      soundlatch_w(space, 0, data & 0xff);
154      soundlatch_byte_w(space, 0, data & 0xff);
155155      device_set_input_line(m_soundcpu, 0, HOLD_LINE);
156156   }
157157}
r14896r14897
422422   AM_RANGE(0x0000, 0x7fff) AM_ROM
423423   AM_RANGE(0x8000, 0xbfff) AM_READ(tturfbl_soundbank_r)
424424   AM_RANGE(0xe000, 0xe000) AM_WRITE(tturfbl_soundbank_w)
425   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_r)
425   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r)
426426   AM_RANGE(0xf000, 0xf000) AM_WRITE(tturfbl_msm5205_data_w)
427427   AM_RANGE(0xf800, 0xffff) AM_RAM
428428ADDRESS_MAP_END
r14896r14897
438438
439439static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, segas1x_bootleg_state )
440440   AM_RANGE(0x0000, 0x7fff) AM_ROM
441   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_r)
441   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r)
442442   AM_RANGE(0xf800, 0xffff) AM_RAM
443443ADDRESS_MAP_END
444444
445445static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, segas1x_bootleg_state )
446446   ADDRESS_MAP_GLOBAL_MASK(0xff)
447447   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
448   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
448   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
449449ADDRESS_MAP_END
450450
451451
r14896r14897
453453static ADDRESS_MAP_START( sound_7759_map, AS_PROGRAM, 8, segas1x_bootleg_state )
454454   AM_RANGE(0x0000, 0x7fff) AM_ROM
455455   AM_RANGE(0x8000, 0xdfff) AM_ROMBANK("bank1")
456   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_r)
456   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r)
457457   AM_RANGE(0xf800, 0xffff) AM_RAM
458458ADDRESS_MAP_END
459459
r14896r14897
473473   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
474474   AM_RANGE(0x40, 0x40) AM_DEVWRITE_LEGACY("7759", upd7759_bank_w)
475475   AM_RANGE(0x80, 0x80) AM_DEVWRITE_LEGACY("7759", upd7759_port_w)
476   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
476   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
477477ADDRESS_MAP_END
478478
479479
r14896r14897
532532*/
533533static ADDRESS_MAP_START( fpointbl_sound_map, AS_PROGRAM, 8, segas1x_bootleg_state )
534534   AM_RANGE(0x0000, 0x7fff) AM_ROM
535   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
535   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
536536   AM_RANGE(0xf800, 0xffff) AM_RAM
537537ADDRESS_MAP_END
538538
r14896r14897
10561056   AM_RANGE(0x80, 0x83) AM_DEVREADWRITE_LEGACY("3438.0", ym3438_r, ym3438_w)
10571057   AM_RANGE(0x90, 0x93) AM_DEVREADWRITE_LEGACY("3438.1", ym3438_r, ym3438_w)
10581058   AM_RANGE(0xa0, 0xa0) AM_WRITE(sys18_soundbank_w)
1059   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
1059   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
10601060ADDRESS_MAP_END
10611061
10621062
r14896r14897
11071107
11081108   if (ACCESSING_BITS_0_7)
11091109   {
1110      soundlatch_w(space, 0, data & 0xff);
1110      soundlatch_byte_w(space, 0, data & 0xff);
11111111      device_set_input_line(m_soundcpu, 0, HOLD_LINE);
11121112   }
11131113}
r14896r14897
12301230   AM_RANGE(0x0000, 0x7fff) AM_ROM
12311231   AM_RANGE(0x8000, 0xbfff) AM_READ(shdancbl_soundbank_r)
12321232   AM_RANGE(0xc000, 0xc00f) AM_WRITENOP
1233   AM_RANGE(0xc400, 0xc400) AM_READ(soundlatch_r)
1233   AM_RANGE(0xc400, 0xc400) AM_READ(soundlatch_byte_r)
12341234   AM_RANGE(0xc800, 0xc800) AM_WRITE(shdancbl_msm5205_data_w)
12351235   AM_RANGE(0xcc00, 0xcc03) AM_DEVREADWRITE_LEGACY("3438.0", ym3438_r, ym3438_w)
12361236   AM_RANGE(0xd000, 0xd003) AM_DEVREADWRITE_LEGACY("3438.1", ym3438_r, ym3438_w)
src/mame/drivers/nyny.c
r14896r14897
8888{
8989public:
9090   nyny_state(const machine_config &mconfig, device_type type, const char *tag)
91      : driver_device(mconfig, type, tag) { }
91      : driver_device(mconfig, type, tag) ,
92      m_videoram1(*this, "videoram1"),
93      m_colorram1(*this, "colorram1"),
94      m_videoram2(*this, "videoram2"),
95      m_colorram2(*this, "colorram2"){ }
9296
9397   /* memory pointers */
94   UINT8 *  m_videoram1;
95   UINT8 *  m_videoram2;
96   UINT8 *  m_colorram1;
97   UINT8 *  m_colorram2;
98   required_shared_ptr<UINT8> m_videoram1;
99   required_shared_ptr<UINT8> m_colorram1;
100   required_shared_ptr<UINT8> m_videoram2;
101   required_shared_ptr<UINT8> m_colorram2;
98102
99103   /* video-related */
100104   int      m_flipscreen;
r14896r14897
323327      if (state->m_flipscreen)
324328         offs = offs ^ 0x9fff;
325329
326      data1 = state->m_videoram1[offs];
327      data2 = state->m_videoram2[offs];
328      color1 = state->m_colorram1[offs] & 0x07;
329      color2 = state->m_colorram2[offs] & 0x07;
330      data1 = state->m_videoram1.target()[offs];
331      data2 = state->m_videoram2.target()[offs];
332      color1 = state->m_colorram1.target()[offs] & 0x07;
333      color2 = state->m_colorram2.target()[offs] & 0x07;
330334
331335      for (i = 0; i < 8; i++)
332336      {
r14896r14897
442446WRITE8_MEMBER(nyny_state::audio_1_command_w)
443447{
444448
445   soundlatch_w(space, 0, data);
449   soundlatch_byte_w(space, 0, data);
446450   device_set_input_line(m_audiocpu, M6800_IRQ_LINE, HOLD_LINE);
447451}
448452
r14896r14897
450454WRITE8_MEMBER(nyny_state::audio_1_answer_w)
451455{
452456
453   soundlatch3_w(space, 0, data);
457   soundlatch3_byte_w(space, 0, data);
454458   device_set_input_line(m_maincpu, M6809_IRQ_LINE, HOLD_LINE);
455459}
456460
r14896r14897
495499WRITE8_MEMBER(nyny_state::audio_2_command_w)
496500{
497501
498   soundlatch2_w(space, 0, (data & 0x60) >> 5);
502   soundlatch2_byte_w(space, 0, (data & 0x60) >> 5);
499503   device_set_input_line(m_audiocpu2, M6800_IRQ_LINE, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE);
500504}
501505
r14896r14897
529533
530534
531535static ADDRESS_MAP_START( nyny_main_map, AS_PROGRAM, 8, nyny_state )
532   AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(m_videoram1)
533   AM_RANGE(0x2000, 0x3fff) AM_RAM AM_BASE(m_colorram1)
534   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(m_videoram2)
535   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_BASE(m_colorram2)
536   AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("videoram1")
537   AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("colorram1")
538   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videoram2")
539   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE("colorram2")
536540   AM_RANGE(0x8000, 0x9fff) AM_RAM
537541   AM_RANGE(0xa000, 0xa0ff) AM_RAM AM_SHARE("nvram") /* SRAM (coin counter, shown when holding F2) */
538542   AM_RANGE(0xa100, 0xa100) AM_MIRROR(0x00fe) AM_DEVWRITE("crtc", mc6845_device, address_w)
539543   AM_RANGE(0xa101, 0xa101) AM_MIRROR(0x00fe) AM_DEVWRITE("crtc", mc6845_device, register_w)
540544   AM_RANGE(0xa200, 0xa20f) AM_MIRROR(0x00f0) AM_READWRITE(nyny_pia_1_2_r, nyny_pia_1_2_w)
541   AM_RANGE(0xa300, 0xa300) AM_MIRROR(0x00ff) AM_READ(soundlatch3_r) AM_WRITE(audio_1_command_w)
545   AM_RANGE(0xa300, 0xa300) AM_MIRROR(0x00ff) AM_READ(soundlatch3_byte_r) AM_WRITE(audio_1_command_w)
542546   AM_RANGE(0xa400, 0xa7ff) AM_NOP
543547   AM_RANGE(0xa800, 0xbfff) AM_ROM
544548   AM_RANGE(0xc000, 0xdfff) AM_RAM
r14896r14897
550554   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
551555   AM_RANGE(0x0000, 0x007f) AM_RAM      /* internal RAM */
552556   AM_RANGE(0x0080, 0x0fff) AM_NOP
553   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_READ(soundlatch_r) AM_WRITE(audio_1_answer_w)
557   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_READ(soundlatch_byte_r) AM_WRITE(audio_1_answer_w)
554558   AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0fff) AM_READ_PORT("SW3")
555559   AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffc) AM_DEVREAD_LEGACY("ay1", ay8910_r)
556560   AM_RANGE(0x3000, 0x3001) AM_MIRROR(0x0ffc) AM_DEVWRITE_LEGACY("ay1", ay8910_data_address_w)
r14896r14897
567571   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
568572   AM_RANGE(0x0000, 0x007f) AM_RAM      /* internal RAM */
569573   AM_RANGE(0x0080, 0x0fff) AM_NOP
570   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_READ(soundlatch2_r)
574   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_READ(soundlatch2_byte_r)
571575   AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_DEVREAD_LEGACY("ay3", ay8910_r)
572576   AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x0ffe) AM_DEVWRITE_LEGACY("ay3", ay8910_data_address_w)
573577   AM_RANGE(0x3000, 0x6fff) AM_NOP
src/mame/drivers/limenko.c
r14896r14897
3434{
3535public:
3636   limenko_state(const machine_config &mconfig, device_type type, const char *tag)
37      : driver_device(mconfig, type, tag) { }
37      : driver_device(mconfig, type, tag) ,
38      m_mainram(*this, "mainram"),
39      m_fg_videoram(*this, "fg_videoram"),
40      m_md_videoram(*this, "md_videoram"),
41      m_bg_videoram(*this, "bg_videoram"),
42      m_spriteram(*this, "spriteram"),
43      m_spriteram2(*this, "spriteram2"),
44      m_videoreg(*this, "videoreg"){ }
3845
39   UINT32 *m_spriteram;
40   UINT32 *m_spriteram2;
41   size_t m_spriteram_size;
46   required_shared_ptr<UINT32> m_mainram;
47   required_shared_ptr<UINT32> m_fg_videoram;
48   required_shared_ptr<UINT32> m_md_videoram;
49   required_shared_ptr<UINT32> m_bg_videoram;
50   required_shared_ptr<UINT32> m_spriteram;
51   required_shared_ptr<UINT32> m_spriteram2;
52   required_shared_ptr<UINT32> m_videoreg;
4253   tilemap_t *m_bg_tilemap;
4354   tilemap_t *m_md_tilemap;
4455   tilemap_t *m_fg_tilemap;
45   UINT32 *m_bg_videoram;
46   UINT32 *m_md_videoram;
47   UINT32 *m_fg_videoram;
48   UINT32 *m_videoreg;
49   UINT32 *m_mainram;
5056   int m_spriteram_bit;
5157   bitmap_ind16 m_sprites_bitmap;
5258   bitmap_ind8 m_sprites_bitmap_pri;
r14896r14897
101107
102108WRITE32_MEMBER(limenko_state::bg_videoram_w)
103109{
104   COMBINE_DATA(&m_bg_videoram[offset]);
110   COMBINE_DATA(&m_bg_videoram.target()[offset]);
105111   m_bg_tilemap->mark_tile_dirty(offset);
106112}
107113
108114WRITE32_MEMBER(limenko_state::md_videoram_w)
109115{
110   COMBINE_DATA(&m_md_videoram[offset]);
116   COMBINE_DATA(&m_md_videoram.target()[offset]);
111117   m_md_tilemap->mark_tile_dirty(offset);
112118}
113119
114120WRITE32_MEMBER(limenko_state::fg_videoram_w)
115121{
116   COMBINE_DATA(&m_fg_videoram[offset]);
122   COMBINE_DATA(&m_fg_videoram.target()[offset]);
117123   m_fg_tilemap->mark_tile_dirty(offset);
118124}
119125
120126WRITE32_MEMBER(limenko_state::spotty_soundlatch_w)
121127{
122   soundlatch_w(space, 0, (data >> 16) & 0xff);
128   soundlatch_byte_w(space, 0, (data >> 16) & 0xff);
123129}
124130
125131CUSTOM_INPUT_MEMBER(limenko_state::spriteram_bit_r)
r14896r14897
149155   }
150156
151157   // buffer the next number of sprites to draw
152   m_prev_sprites_count = (m_videoreg[0] & 0x1ff0000) >> 16;
158   m_prev_sprites_count = (m_videoreg.target()[0] & 0x1ff0000) >> 16;
153159}
154160
155161/*****************************************************************************************************
r14896r14897
157163*****************************************************************************************************/
158164
159165static ADDRESS_MAP_START( limenko_map, AS_PROGRAM, 32, limenko_state )
160   AM_RANGE(0x00000000, 0x001fffff) AM_RAM   AM_BASE(m_mainram)
166   AM_RANGE(0x00000000, 0x001fffff) AM_RAM   AM_SHARE("mainram")
161167   AM_RANGE(0x40000000, 0x403fffff) AM_ROM AM_REGION("user2",0)
162   AM_RANGE(0x80000000, 0x80007fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(m_fg_videoram)
163   AM_RANGE(0x80008000, 0x8000ffff) AM_RAM_WRITE(md_videoram_w) AM_BASE(m_md_videoram)
164   AM_RANGE(0x80010000, 0x80017fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(m_bg_videoram)
165   AM_RANGE(0x80018000, 0x80018fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
166   AM_RANGE(0x80019000, 0x80019fff) AM_RAM AM_BASE(m_spriteram2)
168   AM_RANGE(0x80000000, 0x80007fff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fg_videoram")
169   AM_RANGE(0x80008000, 0x8000ffff) AM_RAM_WRITE(md_videoram_w) AM_SHARE("md_videoram")
170   AM_RANGE(0x80010000, 0x80017fff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram")
171   AM_RANGE(0x80018000, 0x80018fff) AM_RAM AM_SHARE("spriteram")
172   AM_RANGE(0x80019000, 0x80019fff) AM_RAM AM_SHARE("spriteram2")
167173   AM_RANGE(0x8001c000, 0x8001dfff) AM_RAM_WRITE(limenko_paletteram_w) AM_SHARE("paletteram")
168174   AM_RANGE(0x8001e000, 0x8001ebff) AM_RAM // ? not used
169   AM_RANGE(0x8001ffec, 0x8001ffff) AM_RAM AM_BASE(m_videoreg)
175   AM_RANGE(0x8001ffec, 0x8001ffff) AM_RAM AM_SHARE("videoreg")
170176   AM_RANGE(0x8003e000, 0x8003e003) AM_WRITE(spriteram_buffer_w)
171177   AM_RANGE(0xffe00000, 0xffffffff) AM_ROM AM_REGION("user1",0)
172178ADDRESS_MAP_END
r14896r14897
184190/* Spotty memory map */
185191
186192static ADDRESS_MAP_START( spotty_map, AS_PROGRAM, 32, limenko_state )
187   AM_RANGE(0x00000000, 0x001fffff) AM_RAM   AM_BASE(m_mainram)
193   AM_RANGE(0x00000000, 0x001fffff) AM_RAM   AM_SHARE("mainram")
188194   AM_RANGE(0x40002000, 0x400024d3) AM_RAM //?
189   AM_RANGE(0x80000000, 0x80007fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(m_fg_videoram)
190   AM_RANGE(0x80008000, 0x8000ffff) AM_RAM_WRITE(md_videoram_w) AM_BASE(m_md_videoram)
191   AM_RANGE(0x80010000, 0x80017fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(m_bg_videoram)
192   AM_RANGE(0x80018000, 0x80018fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
193   AM_RANGE(0x80019000, 0x80019fff) AM_RAM AM_BASE(m_spriteram2)
195   AM_RANGE(0x80000000, 0x80007fff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fg_videoram")
196   AM_RANGE(0x80008000, 0x8000ffff) AM_RAM_WRITE(md_videoram_w) AM_SHARE("md_videoram")
197   AM_RANGE(0x80010000, 0x80017fff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram")
198   AM_RANGE(0x80018000, 0x80018fff) AM_RAM AM_SHARE("spriteram")
199   AM_RANGE(0x80019000, 0x80019fff) AM_RAM AM_SHARE("spriteram2")
194200   AM_RANGE(0x8001c000, 0x8001dfff) AM_RAM_WRITE(limenko_paletteram_w) AM_SHARE("paletteram")
195201   AM_RANGE(0x8001e000, 0x8001ebff) AM_RAM // ? not used
196   AM_RANGE(0x8001ffec, 0x8001ffff) AM_RAM AM_BASE(m_videoreg)
202   AM_RANGE(0x8001ffec, 0x8001ffff) AM_RAM AM_SHARE("videoreg")
197203   AM_RANGE(0x8003e000, 0x8003e003) AM_WRITE(spriteram_buffer_w)
198204   AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("user1",0)
199205ADDRESS_MAP_END
r14896r14897
222228   // check m_spotty_sound_cmd bits...
223229
224230   if(m_spotty_sound_cmd == 0xf7)
225      return soundlatch_r(space,0);
231      return soundlatch_byte_r(space,0);
226232   else
227233      return machine().device<okim6295_device>("oki")->read(space,0);
228234}
r14896r14897
239245static TILE_GET_INFO( get_bg_tile_info )
240246{
241247   limenko_state *state = machine.driver_data<limenko_state>();
242   int tile  = state->m_bg_videoram[tile_index] & 0x7ffff;
243   int color = (state->m_bg_videoram[tile_index]>>28) & 0xf;
248   int tile  = state->m_bg_videoram.target()[tile_index] & 0x7ffff;
249   int color = (state->m_bg_videoram.target()[tile_index]>>28) & 0xf;
244250   SET_TILE_INFO(0,tile,color,0);
245251}
246252
247253static TILE_GET_INFO( get_md_tile_info )
248254{
249255   limenko_state *state = machine.driver_data<limenko_state>();
250   int tile  = state->m_md_videoram[tile_index] & 0x7ffff;
251   int color = (state->m_md_videoram[tile_index]>>28) & 0xf;
256   int tile  = state->m_md_videoram.target()[tile_index] & 0x7ffff;
257   int color = (state->m_md_videoram.target()[tile_index]>>28) & 0xf;
252258   SET_TILE_INFO(0,tile,color,0);
253259}
254260
255261static TILE_GET_INFO( get_fg_tile_info )
256262{
257263   limenko_state *state = machine.driver_data<limenko_state>();
258   int tile  = state->m_fg_videoram[tile_index] & 0x7ffff;
259   int color = (state->m_fg_videoram[tile_index]>>28) & 0xf;
264   int tile  = state->m_fg_videoram.target()[tile_index] & 0x7ffff;
265   int color = (state->m_fg_videoram.target()[tile_index]>>28) & 0xf;
260266   SET_TILE_INFO(0,tile,color,0);
261267}
262268
r14896r14897
459465static SCREEN_UPDATE_IND16( limenko )
460466{
461467   limenko_state *state = screen.machine().driver_data<limenko_state>();
462   // state->m_videoreg[4] ???? It always has this value: 0xffeffff8 (2 signed bytes? values: -17 and -8 ?)
468   // state->m_videoreg.target()[4] ???? It always has this value: 0xffeffff8 (2 signed bytes? values: -17 and -8 ?)
463469
464470   screen.machine().priority_bitmap.fill(0, cliprect);
465471
466   state->m_bg_tilemap->enable(state->m_videoreg[0] & 4);
467   state->m_md_tilemap->enable(state->m_videoreg[0] & 2);
468   state->m_fg_tilemap->enable(state->m_videoreg[0] & 1);
472   state->m_bg_tilemap->enable(state->m_videoreg.target()[0] & 4);
473   state->m_md_tilemap->enable(state->m_videoreg.target()[0] & 2);
474   state->m_fg_tilemap->enable(state->m_videoreg.target()[0] & 1);
469475
470   state->m_bg_tilemap->set_scrolly(0, state->m_videoreg[3] & 0xffff);
471   state->m_md_tilemap->set_scrolly(0, state->m_videoreg[2] & 0xffff);
472   state->m_fg_tilemap->set_scrolly(0, state->m_videoreg[1] & 0xffff);
476   state->m_bg_tilemap->set_scrolly(0, state->m_videoreg.target()[3] & 0xffff);
477   state->m_md_tilemap->set_scrolly(0, state->m_videoreg.target()[2] & 0xffff);
478   state->m_fg_tilemap->set_scrolly(0, state->m_videoreg.target()[1] & 0xffff);
473479
474   state->m_bg_tilemap->set_scrollx(0, (state->m_videoreg[3] & 0xffff0000) >> 16);
475   state->m_md_tilemap->set_scrollx(0, (state->m_videoreg[2] & 0xffff0000) >> 16);
476   state->m_fg_tilemap->set_scrollx(0, (state->m_videoreg[1] & 0xffff0000) >> 16);
480   state->m_bg_tilemap->set_scrollx(0, (state->m_videoreg.target()[3] & 0xffff0000) >> 16);
481   state->m_md_tilemap->set_scrollx(0, (state->m_videoreg.target()[2] & 0xffff0000) >> 16);
482   state->m_fg_tilemap->set_scrollx(0, (state->m_videoreg.target()[1] & 0xffff0000) >> 16);
477483
478484   state->m_bg_tilemap->draw(bitmap, cliprect, 0,0);
479485   state->m_md_tilemap->draw(bitmap, cliprect, 0,0);
480486   state->m_fg_tilemap->draw(bitmap, cliprect, 0,1);
481487
482   if(state->m_videoreg[0] & 8)
488   if(state->m_videoreg.target()[0] & 8)
483489      copy_sprites(screen.machine(), bitmap, state->m_sprites_bitmap, screen.machine().priority_bitmap, cliprect);
484490
485491   return 0;
r14896r14897
10001006      machine().firstcpu->eat_cycles(50);
10011007   }
10021008
1003   return m_mainram[0xe2784/4];
1009   return m_mainram.target()[0xe2784/4];
10041010}
10051011
10061012READ32_MEMBER(limenko_state::legendoh_speedup_r)
r14896r14897
10101016      machine().firstcpu->eat_cycles(50);
10111017   }
10121018
1013   return m_mainram[0x32ab0/4];
1019   return m_mainram.target()[0x32ab0/4];
10141020}
10151021
10161022READ32_MEMBER(limenko_state::sb2003_speedup_r)
r14896r14897
10201026      machine().firstcpu->eat_cycles(50);
10211027   }
10221028
1023   return m_mainram[0x135800/4];
1029   return m_mainram.target()[0x135800/4];
10241030}
10251031
10261032READ32_MEMBER(limenko_state::spotty_speedup_r)
r14896r14897
10301036      machine().firstcpu->eat_cycles(50);
10311037   }
10321038
1033   return m_mainram[0x6626c/4];
1039   return m_mainram.target()[0x6626c/4];
10341040}
10351041
10361042static DRIVER_INIT( dynabomb )
src/mame/drivers/whitestar.c
r14896r14897
1717        m_dmdcpu(*this, "dmdcpu"),
1818      m_mc6845(*this, "mc6845"),
1919      m_decobsmt(*this, "decobsmt")
20        { }
20        ,
21      m_vram(*this, "vram"){ }
2122
2223   required_device<cpu_device> m_maincpu;
2324   required_device<cpu_device> m_dmdcpu;
r14896r14897
2930   UINT8 m_dmd_status;
3031   UINT8 m_dmd_busy;
3132
32    UINT8 *m_vram;
33   required_shared_ptr<UINT8> m_vram;
3334
3435   DECLARE_WRITE8_MEMBER(dmd_latch_w);
3536    DECLARE_READ8_MEMBER(dmd_latch_r);
r14896r14897
157158
158159static ADDRESS_MAP_START( whitestar_dmd_map, AS_PROGRAM, 8, whitestar_state )
159160   AM_RANGE(0x0000, 0x1fff) AM_RAM
160   AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE(m_vram) // video out
161   AM_RANGE(0x2000, 0x2fff) AM_RAM AM_SHARE("vram") // video out
161162   AM_RANGE(0x3000, 0x3000) AM_DEVREADWRITE("mc6845", mc6845_device, register_r, address_w)
162163   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE("mc6845", mc6845_device, register_w)
163164   AM_RANGE(0x3002, 0x3002) AM_WRITE(dmd_bank_w)
src/mame/drivers/prehisle.c
r14896r14897
1919
2020WRITE16_MEMBER(prehisle_state::prehisle_sound16_w)
2121{
22   soundlatch_w(space, 0, data & 0xff);
22   soundlatch_byte_w(space, 0, data & 0xff);
2323   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
2424}
2525
r14896r14897
3131   AM_RANGE(0x090000, 0x0907ff) AM_RAM_WRITE(prehisle_fg_videoram16_w) AM_BASE(m_videoram)
3232   AM_RANGE(0x0a0000, 0x0a07ff) AM_RAM AM_BASE(m_spriteram)
3333   AM_RANGE(0x0b0000, 0x0b3fff) AM_RAM_WRITE(prehisle_bg_videoram16_w) AM_BASE(m_bg_videoram16)
34   AM_RANGE(0x0d0000, 0x0d07ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
34   AM_RANGE(0x0d0000, 0x0d07ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
3535   AM_RANGE(0x0e0000, 0x0e00ff) AM_READ(prehisle_control16_r)
3636   AM_RANGE(0x0f0070, 0x0ff071) AM_WRITE(prehisle_sound16_w)
3737   AM_RANGE(0x0f0000, 0x0ff0ff) AM_WRITE(prehisle_control16_w)
r14896r14897
5454static ADDRESS_MAP_START( prehisle_sound_map, AS_PROGRAM, 8, prehisle_state )
5555   AM_RANGE(0x0000, 0xefff) AM_ROM
5656   AM_RANGE(0xf000, 0xf7ff) AM_RAM
57   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
57   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
5858   AM_RANGE(0xf800, 0xf800) AM_WRITENOP   // ???
5959ADDRESS_MAP_END
6060
src/mame/drivers/bfm_sc4.c
r14896r14897
33573357ROM_START( sc4cfqpsg )
33583358   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
33593359   ROM_LOAD16_BYTE( "95420324.lo", 0x00001, 0x080000, CRC(14f2328e) SHA1(95a05b37e21ce3c729f2000baeb1308008ad13c2) )
3360   ROM_LOAD16_BYTE( "95420325.hi", 0x00000, 0x080000, NO_DUMP ) // 95420325.hi missing (but we have a combined 95420324.bin???, check it)
3360   ROM_LOAD16_BYTE( "95420325.hi", 0x00000, 0x080000, CRC(4759bfec) SHA1(0fabe8b9005d05ca7466446719b834120ee3ab9a) )
33613361   sc_cfqps_others
33623362ROM_END
33633363
r14896r14897
1630916309   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1631016310   ROM_LOAD16_BYTE( "95402217.lo", 0x00001, 0x080000, CRC(5f86e26e) SHA1(293d3700844dcfaf2a5c6e9a4ee817893e11cf1b) )
1631116311   ROM_LOAD16_BYTE( "95402218.hi", 0x00000, 0x080000, CRC(72792a3e) SHA1(efbf3fcf7f7b40424c8b7fa46d35c9bb484fe431) )
16312   sc_czfr_others
16312   SOUND_95004150_CRAZY_FRUITS_PR6982
1631316313ROM_END
1631416314
1631516315ROM_START( sc4czfra )
1631616316   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1631716317   ROM_LOAD16_BYTE( "95406394.lo", 0x00001, 0x080000, CRC(c07a8695) SHA1(3670e547530452f21a937f34072d812f25a480ce) )
1631816318   ROM_LOAD16_BYTE( "95406395.hi", 0x00000, 0x080000, CRC(e469252b) SHA1(a7861f3d215c70b57263501af158f86257bf37c0) )
16319   sc_czfr_others
16319   PR1152_CRAZY_FRUITS_SOUNDS11
1632016320ROM_END
1632116321
1632216322ROM_START( sc4czfrb )
r14896r14897
1633716337   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1633816338   ROM_LOAD16_BYTE( "95401701.lo", 0x00001, 0x080000, CRC(5c09007e) SHA1(d69290225f08ed5dcf0204bd96f7f09a73c2f243) )
1633916339   ROM_LOAD16_BYTE( "95401702.hi", 0x00000, 0x080000, NO_DUMP )
16340   sc_czfr_others
16340   SOUND_95004150_CRAZY_FRUITS_PR6982
1634116341ROM_END
1634216342
1634316343
r14896r14897
1636116361   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1636216362   ROM_LOAD16_BYTE( "95418430.lo", 0x00001, 0x080000, CRC(16632394) SHA1(76fc5f14d2b0895959580979d9973094fa10c63a) )
1636316363   ROM_LOAD16_BYTE( "95418431.hi", 0x00000, 0x080000, CRC(25e91233) SHA1(8814c4f48299f07e1836ff4e86ceead5fc91e7c9) )
16364   sc_dnd_others
16364   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1636516365ROM_END
1636616366
1636716367
r14896r14897
1636916369   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1637016370   ROM_LOAD16_BYTE( "95418628.lo", 0x00001, 0x080000, CRC(534e6f8b) SHA1(8b89b691eac6415344e5e91a6682cd2030ffba6e) )
1637116371   ROM_LOAD16_BYTE( "95418629.hi", 0x00000, 0x080000, NO_DUMP )
16372   sc_dnd_others
16372   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1637316373ROM_END
1637416374
1637516375
r14896r14897
1637716377   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1637816378   ROM_LOAD16_BYTE( "95419430.lo", 0x00001, 0x080000, CRC(1a510dfc) SHA1(e4620c76a56539e93d90d7f9729b4daab2278256) )
1637916379   ROM_LOAD16_BYTE( "95419431.hi", 0x00000, 0x080000, CRC(d4f546b5) SHA1(10d9df4dec30f9f1a9ffecd8c74de491a20ddf56) )
16380   sc_dnd_others
16380   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1638116381ROM_END
1638216382
1638316383
r14896r14897
1638616386   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1638716387   ROM_LOAD16_BYTE( "95419628.lo", 0x00001, 0x080000, CRC(5a6f07e9) SHA1(db21ee37d9a4fd421593fc9eb8ef27bad6788c4e) )
1638816388   ROM_LOAD16_BYTE( "95419629.hi", 0x00000, 0x080000, CRC(cdf330d0) SHA1(aa5030ae3ec64ce4ead9688e51bfcd8ff1bbf543) )
16389   sc_dnd_others
16389   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1639016390ROM_END
1639116391
1639216392
r14896r14897
1639416394   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1639516395   ROM_LOAD16_BYTE( "95422036.lo", 0x00001, 0x080000, CRC(b1d048dc) SHA1(bde75f8797ebd668eb8c9cf6c05da562874df540) )
1639616396   ROM_LOAD16_BYTE( "95422037.hi", 0x00000, 0x080000, CRC(2d881f97) SHA1(aec94590f8cd7d21b386804b05bd53c9dee17968) )
16397   sc_dnd_others
16397   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1639816398ROM_END
1639916399
1640016400ROM_START( sc4dnde )
1640116401   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1640216402   ROM_LOAD16_BYTE( "95422866.lo", 0x00001, 0x080000, CRC(9fd063d1) SHA1(6e7dc034c2b6da609b5f200e4ede20faecf1104c) )
1640316403   ROM_LOAD16_BYTE( "95422867.hi", 0x00000, 0x080000, CRC(982b5826) SHA1(46be9e735c16300553a4b37d6d98ff97cdb43aed) )
16404   sc_dnd_others
16404   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1640516405ROM_END
1640616406
1640716407ROM_START( sc4dndf )
1640816408   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1640916409   ROM_LOAD16_BYTE( "95422890.lo", 0x00001, 0x080000, CRC(ae29311c) SHA1(1bdd12b2cd2e96d4704da044b251fdb111ee0cb1) )
1641016410   ROM_LOAD16_BYTE( "95422891.hi", 0x00000, 0x080000, CRC(d79559eb) SHA1(ef5f27b5b84bf1072f1b5a13ee17143a06515712) )
16411   sc_dnd_others
16411   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1641216412ROM_END
1641316413
1641416414ROM_START( sc4dndg )
1641516415   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1641616416   ROM_LOAD16_BYTE( "95423036.lo", 0x00001, 0x080000, CRC(e484b7fb) SHA1(6489fe890ca6cfeb4eb2043253c6bd0bab185724) )
1641716417   ROM_LOAD16_BYTE( "95423037.hi", 0x00000, 0x080000, CRC(e2c36879) SHA1(8978ed2c7c1510b62eedb0353e435b89b648670a) )
16418   sc_dnd_others
16418   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1641916419ROM_END
1642016420
1642116421ROM_START( sc4dndh )
1642216422   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1642316423   ROM_LOAD16_BYTE( "95423866.lo", 0x00001, 0x080000, CRC(f99b2b86) SHA1(f04e154c1887d4225075802e3618261bf444ae26) )
1642416424   ROM_LOAD16_BYTE( "95423867.hi", 0x00000, 0x080000, CRC(fe6b1130) SHA1(2de60e150829acde7f7f3453fd5397ed549ab421) )
16425   sc_dnd_others
16425   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1642616426ROM_END
1642716427
1642816428ROM_START( sc4dndi )
1642916429   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1643016430   ROM_LOAD16_BYTE( "95423890.lo", 0x00001, 0x080000, CRC(9b6d3415) SHA1(b14bc3ede63184f7d3be0703e7170f85671350d5) )
1643116431   ROM_LOAD16_BYTE( "95423891.hi", 0x00000, 0x080000, CRC(58c37a50) SHA1(09fde3c464bab08b95e2609cde64cf2fc4ddce7e) )
16432   sc_dnd_others
16432   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1643316433ROM_END
1643416434
1643516435ROM_START( sc4dndj )
1643616436   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1643716437   ROM_LOAD16_BYTE( "95426154.lo", 0x00001, 0x080000, CRC(17169e09) SHA1(e9e6752ab858c1d14253d27842c269c8e9e6fb5f) )
1643816438   ROM_LOAD16_BYTE( "95426155.hi", 0x00000, 0x080000, CRC(7eb7893e) SHA1(a97f35be2d494da19dcb6f4b235a83d46fabba3e) )
16439   sc_dnd_others
16439   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1644016440ROM_END
1644116441
1644216442ROM_START( sc4dndk )
1644316443   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1644416444   ROM_LOAD16_BYTE( "95426170.lo", 0x00001, 0x080000, CRC(99951add) SHA1(640401c6b412dd0d2a186a134e4fb77c92001614) )
1644516445   ROM_LOAD16_BYTE( "95426171.hi", 0x00000, 0x080000, CRC(eb65bbe5) SHA1(f8c384086a335a02985ed938b405fffd4aa37bbb) )
16446   sc_dnd_others
16446   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1644716447ROM_END
1644816448
1644916449ROM_START( sc4dndl )
1645016450   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1645116451   ROM_LOAD16_BYTE( "95427154.lo", 0x00001, 0x080000, CRC(745ac559) SHA1(3fff27727fdf6b34f4500bc42dacacb9a807e848) )
1645216452   ROM_LOAD16_BYTE( "95427155.hi", 0x00000, 0x080000, CRC(15a28fd8) SHA1(4fe2fb60d447bfcc4996643badcf5440b76a951d) )
16453   sc_dnd_others
16453   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1645416454ROM_END
1645516455
1645616456ROM_START( sc4dndm )
1645716457   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1645816458   ROM_LOAD16_BYTE( "95427170.lo", 0x00001, 0x080000, CRC(65cf387c) SHA1(3436e81927c00551d3eaa7d21922187ac9b93bf5) )
1645916459   ROM_LOAD16_BYTE( "95427171.hi", 0x00000, 0x080000, CRC(f4021af5) SHA1(15eb7c36da5ab02a14021ec02af5861431bb318b) )
16460   sc_dnd_others
16460   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1646116461ROM_END
1646216462
1646316463ROM_START( sc4dndn )
1646416464   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1646516465   ROM_LOAD16_BYTE( "95422038.lo", 0x00001, 0x080000, CRC(c75da829) SHA1(b240a1aa1056c3227a23ae1df37eacece7832a97) )
1646616466   ROM_LOAD16_BYTE( "95422039.hi", 0x00000, 0x080000, CRC(c9c8661b) SHA1(c8ad798e4807da659015a9925cdb0eb6e837a9af) )
16467   sc_dnd_others
16467   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1646816468ROM_END
1646916469
1647016470ROM_START( sc4dndo )
1647116471   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1647216472   ROM_LOAD16_BYTE( "95423038.lo", 0x00001, 0x080000, CRC(00adce65) SHA1(917a882f6e28198795ee056914433dd1ce361803) )
1647316473   ROM_LOAD16_BYTE( "95423039.hi", 0x00000, 0x080000, CRC(556af108) SHA1(7a88c1311ab7aa7773dd6b70a3891ebbe2d340d1) )
16474   sc_dnd_others
16474   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1647516475ROM_END
1647616476
1647716477ROM_START( sc4dndcs )
1647816478   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1647916479   ROM_LOAD16_BYTE( "95418528.lo", 0x00001, 0x080000, CRC(d0192ab5) SHA1(b1e98d901ea0ea0010f02e76c296418da775a8c6) )
1648016480   ROM_LOAD16_BYTE( "95418529.hi", 0x00000, 0x080000, CRC(10ce1fa8) SHA1(a207f8c1b4fa40f95f5c3cba64648f87efa5d903) )
16481   sc_dnd_others
16481   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1648216482ROM_END
1648316483
1648416484ROM_START( sc4dndcsa )
1648516485   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1648616486   ROM_LOAD16_BYTE( "95418752.lo", 0x00001, 0x080000, CRC(ea381dee) SHA1(e68557b00fbbac86d7c153470050da0980751fa1) )
1648716487   ROM_LOAD16_BYTE( "95418753.hi", 0x00000, 0x080000, CRC(de953115) SHA1(98443f633997be3e7a8c43e6692a9dd0c4fcf0b1) )
16488   sc_dnd_others
16488   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1648916489ROM_END
1649016490
1649116491ROM_START( sc4dndcsb )
1649216492   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1649316493   ROM_LOAD16_BYTE( "95419528.lo", 0x00001, 0x080000, CRC(0498ed27) SHA1(cab277385393410dbe54a72f7f778d67aeb42ba1) )
1649416494   ROM_LOAD16_BYTE( "95419529.hi", 0x00000, 0x080000, CRC(524a6e36) SHA1(0f8639a83eefcb3cf8f7541a2a77e984cf1688d5) )
16495   sc_dnd_others
16495   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1649616496ROM_END
1649716497
1649816498ROM_START( sc4dndcsc )
1649916499   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
1650016500   ROM_LOAD16_BYTE( "95419752.lo", 0x00001, 0x080000, CRC(c06b60aa) SHA1(b40e4412db1f57511e0b2586fd65df56874a23bb) )
1650116501   ROM_LOAD16_BYTE( "95419753.hi", 0x00000, 0x080000, CRC(76da2127) SHA1(2a06c5fb329a6045671f92073c2e1dd78dc79769) )
16502   sc_dnd_others
16502   PR1907_DEAL_OR_NO_DEAL_SOUNDS11
1650316503ROM_END
1650416504
1650516505
r14896r14897
2208922089   sc_dndbe_others
2209022090ROM_END
2209122091
22092/*
22093ROM_START( sc4dndbea )
22094    ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
22095    ROM_LOAD16_BYTE( "95418410.lo", 0x00001, 0x080000, CRC(ddd534d0) SHA1(1c8acd74d79fc7f169ed54e2d603100775610e5a) )
22096    ROM_LOAD16_BYTE( "95418411.hi", 0x00000, 0x080000, CRC(5346fd2a) SHA1(ada8ed84a173bf3f68af0a2e1b92dbfe94f2d6c9) )
22097    sc_dndbe_others
22098ROM_END
22099*/
2210022092
2210122093ROM_START( sc4dndbeb )
2210222094   ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF )
src/mame/drivers/actfancr.c
r14896r14897
5555
5656WRITE8_MEMBER(actfancr_state::actfancr_sound_w)
5757{
58   soundlatch_w(space, 0, data & 0xff);
58   soundlatch_byte_w(space, 0, data & 0xff);
5959   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
6060}
6161
r14896r14897
8282   AM_RANGE(0x072000, 0x0727ff) AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_data_8bit_swap_r, deco_bac06_pf_data_8bit_swap_w)
8383   AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_SHARE("spriteram")
8484   AM_RANGE(0x110000, 0x110001) AM_WRITE(actfancr_buffer_spriteram_w)
85   AM_RANGE(0x120000, 0x1205ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_SHARE("paletteram")
85   AM_RANGE(0x120000, 0x1205ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
8686   AM_RANGE(0x130000, 0x130000) AM_READ_PORT("P1")
8787   AM_RANGE(0x130001, 0x130001) AM_READ_PORT("P2")
8888   AM_RANGE(0x130002, 0x130002) AM_READ_PORT("DSW1")
r14896r14897
105105   AM_RANGE(0x100000, 0x100001) AM_WRITE(actfancr_sound_w)
106106   AM_RANGE(0x110000, 0x110001) AM_WRITE(actfancr_buffer_spriteram_w)
107107   AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_SHARE("spriteram")
108   AM_RANGE(0x130000, 0x1305ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_SHARE("paletteram")
108   AM_RANGE(0x130000, 0x1305ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
109109   AM_RANGE(0x140000, 0x140001) AM_READNOP /* Value doesn't matter */
110110   AM_RANGE(0x1f0000, 0x1f3fff) AM_RAM AM_BASE(m_main_ram) /* Main ram */
111111   AM_RANGE(0x1ff000, 0x1ff001) AM_READWRITE(triothep_control_r, triothep_control_select_w)
r14896r14897
118118   AM_RANGE(0x0000, 0x07ff) AM_RAM
119119   AM_RANGE(0x0800, 0x0801) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
120120   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym2", ym3812_w)
121   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
121   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
122122   AM_RANGE(0x3800, 0x3800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
123123   AM_RANGE(0x4000, 0xffff) AM_ROM
124124ADDRESS_MAP_END
src/mame/drivers/model1.c
r14896r14897
798798WRITE16_MEMBER(model1_state::p_w)
799799{
800800   UINT16 old = m_generic_paletteram_16[offset];
801   paletteram16_xBBBBBGGGGGRRRRR_word_w(space, offset, data, mem_mask);
801   paletteram_xBBBBBGGGGGRRRRR_word_w(space, offset, data, mem_mask);
802802   if(0 && m_generic_paletteram_16[offset] != old)
803803      logerror("XVIDEO: p_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()));
804804}
src/mame/drivers/poo.c
r14896r14897
5050{
5151public:
5252   poo_state(const machine_config &mconfig, device_type type, const char *tag)
53      : driver_device(mconfig, type, tag) { }
53      : driver_device(mconfig, type, tag) ,
54      m_sprites(*this, "sprites"),
55      m_scrolly(*this, "scrolly"),
56      m_vram(*this, "vram"){ }
5457
55   UINT8 *m_vram;
56   UINT8 *m_scrolly;
57   UINT8 *m_sprites;
58   required_shared_ptr<UINT8> m_sprites;
59   required_shared_ptr<UINT8> m_scrolly;
60   required_shared_ptr<UINT8> m_vram;
5861   UINT8 m_vram_colbank;
5962   DECLARE_READ8_MEMBER(unk_inp_r);
6063   DECLARE_READ8_MEMBER(unk_inp2_r);
r14896r14897
8386   {
8487      for (y=0;y<32;y++)
8588      {
86         int tile = state->m_vram[count+0x000] | ((state->m_vram[count+0x400] & 3) <<8);
87         int color = (state->m_vram[count+0x400] & 0x38) >> 3;
88         int scrolly = (state->m_scrolly[x*4]);
89         int tile = state->m_vram.target()[count+0x000] | ((state->m_vram.target()[count+0x400] & 3) <<8);
90         int color = (state->m_vram.target()[count+0x400] & 0x38) >> 3;
91         int scrolly = (state->m_scrolly.target()[x*4]);
8992
9093         drawgfx_opaque(bitmap,cliprect,gfx,tile,color+state->m_vram_colbank,0,0,x*8,256-(y*8)+scrolly);
9194         drawgfx_opaque(bitmap,cliprect,gfx,tile,color+state->m_vram_colbank,0,0,x*8,0-(y*8)+scrolly);
r14896r14897
99102
100103      for(i=0;i<0x80;i+=4)
101104      {
102         spr_offs = state->m_sprites[i+2] | (state->m_sprites[i+3] & 3) << 8;
103         y = state->m_sprites[i+0]+8;
104         x = state->m_sprites[i+1];
105         col = (state->m_sprites[i+3] & 0xf8) >> 3;
105         spr_offs = state->m_sprites.target()[i+2] | (state->m_sprites.target()[i+3] & 3) << 8;
106         y = state->m_sprites.target()[i+0]+8;
107         x = state->m_sprites.target()[i+1];
108         col = (state->m_sprites.target()[i+3] & 0xf8) >> 3;
106109         fx = 0;
107110         fy = 0;
108111
r14896r14897
142145/* soundlatch write */
143146WRITE8_MEMBER(poo_state::sound_cmd_w)
144147{
145   soundlatch_w(space, 0, (data & 0xff));
148   soundlatch_byte_w(space, 0, (data & 0xff));
146149   cputag_set_input_line(machine(), "subcpu", 0, HOLD_LINE);
147150}
148151
r14896r14897
158161   AM_RANGE(0x9000, 0x97ff) AM_RAM
159162   AM_RANGE(0x9800, 0x9801) AM_READ(unk_inp_r) //AM_WRITE(unk_w )
160163
161   AM_RANGE(0xb000, 0xb07f) AM_RAM AM_BASE(m_sprites)
162   AM_RANGE(0xb080, 0xb0ff) AM_RAM AM_BASE(m_scrolly)
164   AM_RANGE(0xb000, 0xb07f) AM_RAM AM_SHARE("sprites")
165   AM_RANGE(0xb080, 0xb0ff) AM_RAM AM_SHARE("scrolly")
163166
164167   AM_RANGE(0xb400, 0xb400) AM_WRITE(sound_cmd_w)
165168
r14896r14897
171174
172175   AM_RANGE(0xb700, 0xb700) AM_WRITE(poo_vregs_w)
173176
174   AM_RANGE(0xb800, 0xbfff) AM_RAM AM_BASE(m_vram)
177   AM_RANGE(0xb800, 0xbfff) AM_RAM AM_SHARE("vram")
175178
176179ADDRESS_MAP_END
177180
r14896r14897
322325{
323326   AY8910_LEGACY_OUTPUT,
324327   AY8910_DEFAULT_LOADS,
325   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
328   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
326329   DEVCB_DRIVER_MEMBER(poo_state, timer_r),
327330   DEVCB_NULL,
328331   DEVCB_NULL
src/mame/drivers/qdrmfgp.c
r14896r14897
334334   AM_RANGE(0x000000, 0x0fffff) AM_ROM
335335   AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_BASE(m_workram)                              /* work ram */
336336   AM_RANGE(0x180000, 0x183fff) AM_RAM AM_SHARE("nvram")   /* backup ram */
337   AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
337   AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
338338   AM_RANGE(0x300000, 0x30003f) AM_DEVWRITE_LEGACY("k056832", k056832_word_w)                              /* video reg */
339339   AM_RANGE(0x320000, 0x32001f) AM_DEVREADWRITE8_LEGACY("k053252", k053252_r, k053252_w,0x00ff)               /* ccu */
340340   AM_RANGE(0x330000, 0x330001) AM_READ_PORT("SENSOR")                                 /* battery power & service sw */
r14896r14897
357357   AM_RANGE(0x000000, 0x0fffff) AM_ROM
358358   AM_RANGE(0x100000, 0x110fff) AM_RAM AM_BASE(m_workram)                              /* work ram */
359359   AM_RANGE(0x180000, 0x183fff) AM_RAM AM_SHARE("nvram")   /* backup ram */
360   AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
360   AM_RANGE(0x280000, 0x280fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
361361   AM_RANGE(0x300000, 0x30003f) AM_DEVWRITE_LEGACY("k056832", k056832_word_w)                              /* video reg */
362362   AM_RANGE(0x320000, 0x32001f) AM_DEVREADWRITE8_LEGACY("k053252", k053252_r, k053252_w,0xff00)               /* ccu */
363363   AM_RANGE(0x330000, 0x330001) AM_READ_PORT("SENSOR")                                 /* battery power & service */
src/mame/drivers/cps1.c
r14896r14897
292292WRITE16_MEMBER(cps_state::cps1_soundlatch_w)
293293{
294294   if (ACCESSING_BITS_0_7)
295      soundlatch_w(space, 0, data & 0xff);
295      soundlatch_byte_w(space, 0, data & 0xff);
296296}
297297
298298WRITE16_MEMBER(cps_state::cps1_soundlatch2_w)
299299{
300300   if (ACCESSING_BITS_0_7)
301      soundlatch2_w(space, 0, data & 0xff);
301      soundlatch2_byte_w(space, 0, data & 0xff);
302302}
303303
304304WRITE16_MEMBER(cps_state::cps1_coinctrl_w)
r14896r14897
582582   AM_RANGE(0xf002, 0xf002) AM_DEVREADWRITE("oki", okim6295_device, read, write)
583583   AM_RANGE(0xf004, 0xf004) AM_WRITE(cps1_snd_bankswitch_w)
584584   AM_RANGE(0xf006, 0xf006) AM_DEVWRITE_LEGACY("oki", cps1_oki_pin7_w) /* controls pin 7 of OKI chip */
585   AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_r)   /* Sound command */
586   AM_RANGE(0xf00a, 0xf00a) AM_READ(soundlatch2_r) /* Sound timer fade */
585   AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_byte_r)   /* Sound command */
586   AM_RANGE(0xf00a, 0xf00a) AM_READ(soundlatch2_byte_r) /* Sound timer fade */
587587ADDRESS_MAP_END
588588
589589static ADDRESS_MAP_START( qsound_main_map, AS_PROGRAM, 16, cps_state )
src/mame/drivers/yunsun16.c
r14896r14897
129129   AM_RANGE(0x800180, 0x800181) AM_WRITE(yunsun16_sound_bank_w)   // Sound
130130   AM_RANGE(0x800188, 0x800189) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)   // Sound
131131   AM_RANGE(0x8001fe, 0x8001ff) AM_WRITENOP   // ? 0 (during int)
132   AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
132   AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
133133   AM_RANGE(0x908000, 0x90bfff) AM_RAM_WRITE(yunsun16_vram_1_w) AM_BASE(m_vram_1)   // Layer 1
134134   AM_RANGE(0x90c000, 0x90ffff) AM_RAM_WRITE(yunsun16_vram_0_w) AM_BASE(m_vram_0)   // Layer 0
135135   AM_RANGE(0x910000, 0x910fff) AM_RAM   AM_BASE_SIZE(m_spriteram, m_spriteram_size)   // Sprites
r14896r14897
147147*/
148148      if ((data & 0xff) != 0x3a)
149149      {
150         soundlatch_w(space, 0, data & 0xff);
150         soundlatch_byte_w(space, 0, data & 0xff);
151151         device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
152152      }
153153   }
r14896r14897
176176static ADDRESS_MAP_START( sound_port_map, AS_IO, 8, yunsun16_state )
177177   ADDRESS_MAP_GLOBAL_MASK(0xff)
178178   AM_RANGE(0x10, 0x11) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w )
179   AM_RANGE(0x18, 0x18) AM_READ(soundlatch_r )                  // From Main CPU
179   AM_RANGE(0x18, 0x18) AM_READ(soundlatch_byte_r )                  // From Main CPU
180180   AM_RANGE(0x1c, 0x1c) AM_DEVREADWRITE("oki", okim6295_device, read, write)      // M6295
181181ADDRESS_MAP_END
182182
src/mame/drivers/wiz.c
r14896r14897
180180   {
181181      // 0x90 triggers a jump to non-existant address(development system?) and must be filtered
182182      case 0x00:
183         if (data != 0x90) soundlatch_w(space, 0, data);
183         if (data != 0x90) soundlatch_byte_w(space, 0, data);
184184      break;
185185
186186      // explosion sound trigger(analog?)
r14896r14897
227227   AM_RANGE(0xd000, 0xd3ff) AM_BASE(m_videoram2)               /* Fallthrough */
228228   AM_RANGE(0xd400, 0xd7ff) AM_BASE(m_colorram2)
229229   AM_RANGE(0xd800, 0xd83f) AM_BASE(m_attributesram2)
230   AM_RANGE(0xd840, 0xd85f) AM_BASE(m_spriteram2) AM_SIZE(m_spriteram_size)
230   AM_RANGE(0xd840, 0xd85f) AM_BASE_SIZE(m_spriteram2,m_spriteram_size)
231231   AM_RANGE(0xd000, 0xd85f) AM_RAM
232232   AM_RANGE(0xe000, 0xe3ff) AM_BASE(m_videoram)   /* Fallthrough */
233233   AM_RANGE(0xe400, 0xe7ff) AM_RAM
r14896r14897
261261static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, wiz_state )
262262   AM_RANGE(0x0000, 0x1fff) AM_ROM
263263   AM_RANGE(0x2000, 0x23ff) AM_RAM
264   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) AM_WRITE(wiz_sound_nmi_mask_w)   /* Stinger/Scion */
264   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r) AM_WRITE(wiz_sound_nmi_mask_w)   /* Stinger/Scion */
265265   AM_RANGE(0x4000, 0x4001) AM_DEVWRITE_LEGACY("8910.3", ay8910_address_data_w)
266266   AM_RANGE(0x5000, 0x5001) AM_DEVWRITE_LEGACY("8910.1", ay8910_address_data_w)
267267   AM_RANGE(0x6000, 0x6001) AM_DEVWRITE_LEGACY("8910.2", ay8910_address_data_w)      /* Wiz only */
268   AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_r) AM_WRITE(wiz_sound_nmi_mask_w)   /* Wiz */
268   AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_byte_r) AM_WRITE(wiz_sound_nmi_mask_w)   /* Wiz */
269269ADDRESS_MAP_END
270270
271271static ADDRESS_MAP_START( stinger_sound_map, AS_PROGRAM, 8, wiz_state )
272272   AM_RANGE(0x0000, 0x1fff) AM_ROM
273273   AM_RANGE(0x2000, 0x23ff) AM_RAM
274   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) AM_WRITE(wiz_sound_nmi_mask_w)   /* Stinger/Scion */
274   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r) AM_WRITE(wiz_sound_nmi_mask_w)   /* Stinger/Scion */
275275   AM_RANGE(0x5000, 0x5001) AM_DEVWRITE_LEGACY("8910.1", ay8910_address_data_w)
276276   AM_RANGE(0x6000, 0x6001) AM_DEVWRITE_LEGACY("8910.2", ay8910_address_data_w)      /* Wiz only */
277   AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_r) AM_WRITE(wiz_sound_nmi_mask_w)   /* Wiz */
277   AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_byte_r) AM_WRITE(wiz_sound_nmi_mask_w)   /* Wiz */
278278ADDRESS_MAP_END
279279
280280
src/mame/drivers/scobra.c
r14896r14897
8989{
9090   AY8910_LEGACY_OUTPUT,
9191   AY8910_DEFAULT_LOADS,
92   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
92   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
9393   DEVCB_HANDLER(frogger_portB_r),
9494   DEVCB_NULL,
9595   DEVCB_NULL
r14896r14897
122122   AM_RANGE(0x8c00, 0x8fff) AM_RAM_WRITE(galaxold_videoram_w)   /* mirror */
123123   AM_RANGE(0x8c00, 0x8fff) AM_READ(galaxold_videoram_r)   /* mirror */
124124   AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
125   AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
126   AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
125   AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
126   AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
127127   AM_RANGE(0x9080, 0x90ff) AM_RAM
128128   AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)
129129   AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
r14896r14897
139139   AM_RANGE(0x0000, 0x7fff) AM_ROM
140140   AM_RANGE(0x8000, 0x87ff) AM_RAM
141141   AM_RANGE(0x8800, 0x883f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
142   AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
143   AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
142   AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
143   AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
144144   AM_RANGE(0x8880, 0x88ff) AM_RAM
145145   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
146146   AM_RANGE(0x9400, 0x97ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w)   /* mirror */
r14896r14897
160160   AM_RANGE(0x8000, 0x87ff) AM_RAM
161161   AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
162162   AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
163   AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
164   AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
163   AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
164   AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
165165   AM_RANGE(0x9080, 0x90ff) AM_RAM
166166   AM_RANGE(0xa802, 0xa802) AM_WRITE(galaxold_flip_screen_x_w)
167167   AM_RANGE(0xa804, 0xa804) AM_WRITE(galaxold_nmi_enable_w)
r14896r14897
177177   AM_RANGE(0x8000, 0x87ff) AM_RAM
178178   AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
179179   AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
180   AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
181   AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
180   AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
181   AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
182182   AM_RANGE(0x9080, 0x90ff) AM_RAM
183183   AM_RANGE(0xa801, 0xa801) AM_WRITE(galaxold_nmi_enable_w)
184184   AM_RANGE(0xa802, 0xa802) AM_WRITENOP   /* coin counters */
r14896r14897
195195   AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
196196   AM_RANGE(0x8c00, 0x8fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w)   /* mirror */
197197   AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
198   AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
199   AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
198   AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
199   AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
200200   AM_RANGE(0x9080, 0x90ff) AM_RAM
201201   AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)
202202   AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
r14896r14897
225225   AM_RANGE(0x0000, 0x2fff) AM_ROM
226226   AM_RANGE(0x8000, 0x8fff) AM_READWRITE(scobra_soundram_r, scobra_soundram_w)
227227   AM_RANGE(0x8000, 0x83ff) AM_WRITENOP AM_BASE(m_soundram)  /* only here to initialize pointer */
228   AM_RANGE(0x9000, 0x9fff) AM_WRITE_LEGACY(scramble_filter_w)
228   AM_RANGE(0x9000, 0x9fff) AM_WRITE(scramble_filter_w)
229229ADDRESS_MAP_END
230230
231231
232232static ADDRESS_MAP_START( hustlerb_sound_map, AS_PROGRAM, 8, scobra_state )
233233   AM_RANGE(0x0000, 0x2fff) AM_ROM
234   AM_RANGE(0x6000, 0x6fff) AM_WRITE_LEGACY(frogger_filter_w)
234   AM_RANGE(0x6000, 0x6fff) AM_WRITE(frogger_filter_w)
235235   AM_RANGE(0x8000, 0x8fff) AM_RAM_READ(scobra_soundram_r) AM_BASE(m_soundram)  /* only here to initialize pointer */
236236ADDRESS_MAP_END
237237
r14896r14897
247247static ADDRESS_MAP_START( hustler_sound_map, AS_PROGRAM, 8, scobra_state )
248248   AM_RANGE(0x0000, 0x1fff) AM_ROM
249249   AM_RANGE(0x4000, 0x43ff) AM_RAM
250    AM_RANGE(0x6000, 0x6fff) AM_WRITE_LEGACY(frogger_filter_w)
250    AM_RANGE(0x6000, 0x6fff) AM_WRITE(frogger_filter_w)
251251ADDRESS_MAP_END
252252
253253static ADDRESS_MAP_START( hustler_sound_io_map, AS_IO, 8, scobra_state )
r14896r14897
647647{
648648   AY8910_LEGACY_OUTPUT,
649649   AY8910_DEFAULT_LOADS,
650   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
650   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
651651   DEVCB_HANDLER(scramble_portB_r),
652652   DEVCB_NULL,
653653   DEVCB_NULL
src/mame/drivers/drtomy.c
r14896r14897
1515{
1616public:
1717   drtomy_state(const machine_config &mconfig, device_type type, const char *tag)
18      : driver_device(mconfig, type, tag) { }
18      : driver_device(mconfig, type, tag) ,
19      m_videoram_fg(*this, "videorafg"),
20      m_videoram_bg(*this, "videorabg"),
21      m_spriteram(*this, "spriteram"){ }
1922
2023   /* memory pointers */
21   UINT16 *  m_spriteram;
22   UINT16 *  m_videoram_bg;
23   UINT16 *  m_videoram_fg;
24   required_shared_ptr<UINT16> m_videoram_fg;
25   required_shared_ptr<UINT16> m_videoram_bg;
26   required_shared_ptr<UINT16> m_spriteram;
2427//  UINT16 *  m_paletteram16; // currently this uses generic palette handling
2528
2629   /* video-related */
r14896r14897
3841static TILE_GET_INFO( get_tile_info_fg )
3942{
4043   drtomy_state *state = machine.driver_data<drtomy_state>();
41   int code  = state->m_videoram_fg[tile_index] & 0xfff;
42   int color = (state->m_videoram_fg[tile_index] & 0xf000) >> 12;
44   int code  = state->m_videoram_fg.target()[tile_index] & 0xfff;
45   int color = (state->m_videoram_fg.target()[tile_index] & 0xf000) >> 12;
4346   SET_TILE_INFO(2, code, color, 0);
4447}
4548
r14896r14897
4750static TILE_GET_INFO( get_tile_info_bg )
4851{
4952   drtomy_state *state = machine.driver_data<drtomy_state>();
50   int code  = state->m_videoram_bg[tile_index] & 0xfff;
51   int color = (state->m_videoram_bg[tile_index] & 0xf000) >> 12;
53   int code  = state->m_videoram_bg.target()[tile_index] & 0xfff;
54   int color = (state->m_videoram_bg.target()[tile_index] & 0xf000) >> 12;
5255   SET_TILE_INFO(1, code, color, 0);
5356}
5457
r14896r14897
8184
8285   for (i = 3; i < 0x1000 / 2; i += 4)
8386   {
84      int sx = state->m_spriteram[i + 2] & 0x01ff;
85      int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff;
86      int number = state->m_spriteram[i + 3];
87      int color = (state->m_spriteram[i + 2] & 0x1e00) >> 9;
88      int attr = (state->m_spriteram[i] & 0xfe00) >> 9;
87      int sx = state->m_spriteram.target()[i + 2] & 0x01ff;
88      int sy = (240 - (state->m_spriteram.target()[i] & 0x00ff)) & 0x00ff;
89      int number = state->m_spriteram.target()[i + 3];
90      int color = (state->m_spriteram.target()[i + 2] & 0x1e00) >> 9;
91      int attr = (state->m_spriteram.target()[i] & 0xfe00) >> 9;
8992
9093      int xflip = attr & 0x20;
9194      int yflip = attr & 0x40;
r14896r14897
137140
138141WRITE16_MEMBER(drtomy_state::drtomy_vram_fg_w)
139142{
140   COMBINE_DATA(&m_videoram_fg[offset]);
143   COMBINE_DATA(&m_videoram_fg.target()[offset]);
141144   m_tilemap_fg->mark_tile_dirty(offset);
142145}
143146
144147WRITE16_MEMBER(drtomy_state::drtomy_vram_bg_w)
145148{
146   COMBINE_DATA(&m_videoram_bg[offset]);
149   COMBINE_DATA(&m_videoram_bg.target()[offset]);
147150   m_tilemap_bg->mark_tile_dirty(offset);
148151}
149152
r14896r14897
162165
163166static ADDRESS_MAP_START( drtomy_map, AS_PROGRAM, 16, drtomy_state )
164167   AM_RANGE(0x000000, 0x03ffff) AM_ROM   /* ROM */
165   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(drtomy_vram_fg_w) AM_BASE(m_videoram_fg)   /* Video RAM FG */
166   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(drtomy_vram_bg_w) AM_BASE(m_videoram_bg) /* Video RAM BG */
167   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") /* Palette */
168   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(m_spriteram) /* Sprite RAM */
168   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(drtomy_vram_fg_w) AM_SHARE("videorafg")   /* Video RAM FG */
169   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(drtomy_vram_bg_w) AM_SHARE("videorabg") /* Video RAM BG */
170   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") /* Palette */
171   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_SHARE("spriteram") /* Sprite RAM */
169172   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW1")
170173   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW2")
171174   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
src/mame/drivers/calorie.c
r14896r14897
8787{
8888public:
8989   calorie_state(const machine_config &mconfig, device_type type, const char *tag)
90      : driver_device(mconfig, type, tag) { }
90      : driver_device(mconfig, type, tag) ,
91      m_fg_ram(*this, "fg_ram"),
92      m_sprites(*this, "sprites"){ }
9193
9294   /* memory pointers */
93   UINT8 *  m_fg_ram;
94   UINT8 *  m_sprites;
95   required_shared_ptr<UINT8> m_fg_ram;
96   required_shared_ptr<UINT8> m_sprites;
9597//  UINT8 *  m_paletteram;    // currently this uses generic palette handling
9698
9799   /* video-related */
r14896r14897
127129static TILE_GET_INFO( get_fg_tile_info )
128130{
129131   calorie_state *state = machine.driver_data<calorie_state>();
130   int code  = ((state->m_fg_ram[tile_index + 0x400] & 0x30) << 4) | state->m_fg_ram[tile_index];
131   int color = state->m_fg_ram[tile_index + 0x400] & 0x0f;
132   int code  = ((state->m_fg_ram.target()[tile_index + 0x400] & 0x30) << 4) | state->m_fg_ram.target()[tile_index];
133   int color = state->m_fg_ram.target()[tile_index + 0x400] & 0x0f;
132134
133   SET_TILE_INFO(0, code, color, TILE_FLIPYX((state->m_fg_ram[tile_index + 0x400] & 0xc0) >> 6));
135   SET_TILE_INFO(0, code, color, TILE_FLIPYX((state->m_fg_ram.target()[tile_index + 0x400] & 0xc0) >> 6));
134136}
135137
136138
r14896r14897
164166   {
165167      int xpos, ypos, tileno, color, flipx, flipy;
166168
167      tileno = state->m_sprites[x + 0];
168      color = state->m_sprites[x + 1] & 0x0f;
169      flipx = state->m_sprites[x + 1] & 0x40;
169      tileno = state->m_sprites.target()[x + 0];
170      color = state->m_sprites.target()[x + 1] & 0x0f;
171      flipx = state->m_sprites.target()[x + 1] & 0x40;
170172      flipy = 0;
171      ypos = 0xff - state->m_sprites[x + 2];
172      xpos = state->m_sprites[x + 3];
173      ypos = 0xff - state->m_sprites.target()[x + 2];
174      xpos = state->m_sprites.target()[x + 3];
173175
174      if (flip_screen_get(screen.machine()))
176      if (state->flip_screen())
175177      {
176         if (state->m_sprites[x + 1] & 0x10)
178         if (state->m_sprites.target()[x + 1] & 0x10)
177179            ypos = 0xff - ypos + 32;
178180         else
179181            ypos = 0xff - ypos + 16;
r14896r14897
183185         flipy = !flipy;
184186      }
185187
186      if (state->m_sprites[x + 1] & 0x10)
188      if (state->m_sprites.target()[x + 1] & 0x10)
187189      {
188190          /* 32x32 sprites */
189191         drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[3], tileno | 0x40, color, flipx, flipy, xpos, ypos - 31, 0);
r14896r14897
205207
206208WRITE8_MEMBER(calorie_state::fg_ram_w)
207209{
208   m_fg_ram[offset] = data;
210   m_fg_ram.target()[offset] = data;
209211   m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
210212}
211213
r14896r14897
219221
220222WRITE8_MEMBER(calorie_state::calorie_flipscreen_w)
221223{
222   flip_screen_set(machine(), data & 1);
224   flip_screen_set(data & 1);
223225}
224226
225227READ8_MEMBER(calorie_state::calorie_soundlatch_r)
226228{
227   UINT8 latch = soundlatch_r(space, 0);
228   soundlatch_clear_w(space, 0, 0);
229   UINT8 latch = soundlatch_byte_r(space, 0);
230   soundlatch_clear_byte_w(space, 0, 0);
229231   return latch;
230232}
231233
r14896r14897
244246   AM_RANGE(0x0000, 0x7fff) AM_ROM
245247   AM_RANGE(0x8000, 0xbfff) AM_ROM
246248   AM_RANGE(0xc000, 0xcfff) AM_RAM
247   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(fg_ram_w) AM_BASE(m_fg_ram)
248   AM_RANGE(0xd800, 0xdbff) AM_RAM AM_BASE(m_sprites)
249   AM_RANGE(0xdc00, 0xdcff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_SHARE("paletteram")
249   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(fg_ram_w) AM_SHARE("fg_ram")
250   AM_RANGE(0xd800, 0xdbff) AM_RAM AM_SHARE("sprites")
251   AM_RANGE(0xdc00, 0xdcff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
250252   AM_RANGE(0xde00, 0xde00) AM_WRITE(bg_bank_w)
251253   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("P1")
252254   AM_RANGE(0xf001, 0xf001) AM_READ_PORT("P2")
253255   AM_RANGE(0xf002, 0xf002) AM_READ_PORT("SYSTEM")
254256   AM_RANGE(0xf004, 0xf004) AM_READ_PORT("DSW1") AM_WRITE(calorie_flipscreen_w)
255257   AM_RANGE(0xf005, 0xf005) AM_READ_PORT("DSW2")
256   AM_RANGE(0xf800, 0xf800) AM_WRITE(soundlatch_w)
258   AM_RANGE(0xf800, 0xf800) AM_WRITE(soundlatch_byte_w)
257259ADDRESS_MAP_END
258260
259261
src/mame/drivers/namcos11.c
r14896r14897
297297
298298   required_device<cpu_device> m_maincpu;
299299   required_device<cpu_device> m_mcu;
300   DECLARE_WRITE32_MEMBER(keycus_w);
301   DECLARE_READ32_MEMBER(keycus_c406_r);
302   DECLARE_READ32_MEMBER(keycus_c409_r);
303   DECLARE_READ32_MEMBER(keycus_c410_r);
304   DECLARE_READ32_MEMBER(keycus_c411_r);
305   DECLARE_READ32_MEMBER(keycus_c430_r);
306   DECLARE_READ32_MEMBER(keycus_c431_r);
307   DECLARE_READ32_MEMBER(keycus_c432_r);
308   DECLARE_READ32_MEMBER(keycus_c442_r);
309   DECLARE_READ32_MEMBER(keycus_c443_r);
310   DECLARE_WRITE32_MEMBER(bankswitch_rom32_w);
311   DECLARE_WRITE32_MEMBER(bankswitch_rom64_upper_w);
312   DECLARE_WRITE32_MEMBER(bankswitch_rom64_w);
313   DECLARE_WRITE32_MEMBER(lightgun_w);
314   DECLARE_READ32_MEMBER(lightgun_r);
315   DECLARE_READ16_MEMBER(c76_shared_r);
316   DECLARE_WRITE16_MEMBER(c76_shared_w);
317   DECLARE_READ16_MEMBER(c76_inputs_r);
318   DECLARE_READ8_MEMBER(dac7_r);
319   DECLARE_READ8_MEMBER(dac6_r);
320   DECLARE_READ8_MEMBER(dac5_r);
321   DECLARE_READ8_MEMBER(dac4_r);
322   DECLARE_READ8_MEMBER(dac3_r);
323   DECLARE_READ8_MEMBER(dac2_r);
324   DECLARE_READ8_MEMBER(dac1_r);
325   DECLARE_READ8_MEMBER(dac0_r);
326   DECLARE_READ8_MEMBER(pocketrc_gas_r);
327   DECLARE_READ8_MEMBER(pocketrc_steer_r);
328   DECLARE_READ16_MEMBER(c76_speedup_r);
329   DECLARE_WRITE16_MEMBER(c76_speedup_w);
300330};
301331
302332INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
r14896r14897
312342   }
313343}
314344
315static WRITE32_HANDLER( keycus_w )
345WRITE32_MEMBER(namcos11_state::keycus_w)
316346{
317   namcos11_state *state = space->machine().driver_data<namcos11_state>();
318347
319   verboselog( space->machine(), 1, "keycus_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
320   COMBINE_DATA( &state->m_keycus[ offset ] );
348   verboselog( machine(), 1, "keycus_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
349   COMBINE_DATA( &m_keycus[ offset ] );
321350}
322351
323352/* tekken 2 */
324static READ32_HANDLER( keycus_c406_r )
353READ32_MEMBER(namcos11_state::keycus_c406_r)
325354{
326355   /* todo: verify behaviour */
327   namcos11_state *state = space->machine().driver_data<namcos11_state>();
328   UINT32 *namcos11_keycus = state->m_keycus;
356   UINT32 *namcos11_keycus = m_keycus;
329357   UINT32 data;
330358
331359   data = namcos11_keycus[ offset ];
r14896r14897
339367         ( ( namcos11_keycus[ 1 ] >> 8 ) & 0xf );
340368      break;
341369   }
342   verboselog( space->machine(), 1, "keycus_c406_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
370   verboselog( machine(), 1, "keycus_c406_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
343371   return data;
344372}
345373
346374/* soul edge */
347static READ32_HANDLER( keycus_c409_r )
375READ32_MEMBER(namcos11_state::keycus_c409_r)
348376{
349377   /* todo: verify behaviour */
350   namcos11_state *state = space->machine().driver_data<namcos11_state>();
351378   UINT32 data;
352379
353   data = state->m_keycus[ offset ];
380   data = m_keycus[ offset ];
354381   switch( offset )
355382   {
356383   case 3:
357384      data = ( data & 0x0000ffff ) | 0x000f0000;
358385      break;
359386   }
360   verboselog( space->machine(), 1, "keycus_c409_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
387   verboselog( machine(), 1, "keycus_c409_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
361388   return data;
362389}
363390
364391/* dunk mania */
365static READ32_HANDLER( keycus_c410_r )
392READ32_MEMBER(namcos11_state::keycus_c410_r)
366393{
367   namcos11_state *state = space->machine().driver_data<namcos11_state>();
368   UINT32 *namcos11_keycus = state->m_keycus;
394   UINT32 *namcos11_keycus = m_keycus;
369395   UINT32 data;
370396   UINT32 n_value;
371397
r14896r14897
393419         ( ( ( n_value / 10000 ) % 10 ) << 16 );
394420      break;
395421   }
396   verboselog( space->machine(), 1, "keycus_c410_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
422   verboselog( machine(), 1, "keycus_c410_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
397423   return data;
398424}
399425
400426/* prime goal ex */
401static READ32_HANDLER( keycus_c411_r )
427READ32_MEMBER(namcos11_state::keycus_c411_r)
402428{
403   namcos11_state *state = space->machine().driver_data<namcos11_state>();
404   UINT32 *namcos11_keycus = state->m_keycus;
429   UINT32 *namcos11_keycus = m_keycus;
405430   UINT32 data;
406431   UINT32 n_value;
407432
r14896r14897
428453      break;
429454   }
430455
431   verboselog( space->machine(), 1, "keycus_c411_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
456   verboselog( machine(), 1, "keycus_c411_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
432457   return data;
433458}
434459
435460/* xevious 3d/g */
436static READ32_HANDLER( keycus_c430_r )
461READ32_MEMBER(namcos11_state::keycus_c430_r)
437462{
438   namcos11_state *state = space->machine().driver_data<namcos11_state>();
439   UINT32 *namcos11_keycus = state->m_keycus;
463   UINT32 *namcos11_keycus = m_keycus;
440464   UINT32 data;
441465   UINT16 n_value;
442466
r14896r14897
464488         ( ( ( n_value / 1 ) % 10 ) << 16 );
465489      break;
466490   }
467   verboselog( space->machine(), 1, "keycus_c430_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
491   verboselog( machine(), 1, "keycus_c430_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
468492   return data;
469493}
470494
471495/* dancing eyes */
472static READ32_HANDLER( keycus_c431_r )
496READ32_MEMBER(namcos11_state::keycus_c431_r)
473497{
474   namcos11_state *state = space->machine().driver_data<namcos11_state>();
475   UINT32 *namcos11_keycus = state->m_keycus;
498   UINT32 *namcos11_keycus = m_keycus;
476499   UINT32 data;
477500   UINT16 n_value;
478501
r14896r14897
498521      data = ( data & 0xffff0000 ) | ( ( n_value / 10000 ) % 10 );
499522      break;
500523   }
501   verboselog( space->machine(), 1, "keycus_c431_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
524   verboselog( machine(), 1, "keycus_c431_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
502525   return data;
503526}
504527
505528/* pocket racer */
506static READ32_HANDLER( keycus_c432_r )
529READ32_MEMBER(namcos11_state::keycus_c432_r)
507530{
508   namcos11_state *state = space->machine().driver_data<namcos11_state>();
509   UINT32 *namcos11_keycus = state->m_keycus;
531   UINT32 *namcos11_keycus = m_keycus;
510532   UINT32 data;
511533   UINT16 n_value;
512534
r14896r14897
533555      break;
534556   }
535557
536   verboselog( space->machine(), 1, "keycus_c432_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
558   verboselog( machine(), 1, "keycus_c432_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
537559   return data;
538560}
539561
540562/* star sweep */
541static READ32_HANDLER( keycus_c442_r )
563READ32_MEMBER(namcos11_state::keycus_c442_r)
542564{
543565   /* todo: verify behaviour */
544   namcos11_state *state = space->machine().driver_data<namcos11_state>();
545566   UINT32 data;
546567
547   data = state->m_keycus[ offset ];
568   data = m_keycus[ offset ];
548569
549570   switch( offset )
550571   {
r14896r14897
555576      }
556577      break;
557578   }
558   verboselog( space->machine(), 1, "keycus_c442_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
579   verboselog( machine(), 1, "keycus_c442_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
559580   return data;
560581}
561582
562583/* kosodate quiz my angel 3 / point blank 2 */
563static READ32_HANDLER( keycus_c443_r )
584READ32_MEMBER(namcos11_state::keycus_c443_r)
564585{
565586   /* todo: verify behaviour */
566   namcos11_state *state = space->machine().driver_data<namcos11_state>();
567587   UINT32 data;
568588
569   data = state->m_keycus[ offset ];
589   data = m_keycus[ offset ];
570590
571591   switch( offset )
572592   {
r14896r14897
589609      }
590610      break;
591611   }
592   verboselog( space->machine(), 1, "keycus_c443_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
612   verboselog( machine(), 1, "keycus_c443_r( %08x, %08x, %08x )\n", offset, data, mem_mask );
593613   return data;
594614}
595615
r14896r14897
600620
601621static const char * const bankname[] = { "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7", "bank8" };
602622
603static WRITE32_HANDLER( bankswitch_rom32_w )
623WRITE32_MEMBER(namcos11_state::bankswitch_rom32_w)
604624{
605   verboselog( space->machine(), 2, "bankswitch_rom32_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
625   verboselog( machine(), 2, "bankswitch_rom32_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
606626
607627   if( ACCESSING_BITS_0_15 )
608628   {
609      bankswitch_rom8( space, bankname[offset * 2], data & 0xffff );
629      bankswitch_rom8( &space, bankname[offset * 2], data & 0xffff );
610630   }
611631   if( ACCESSING_BITS_16_31 )
612632   {
613      bankswitch_rom8( space, bankname[offset * 2 + 1], data >> 16 );
633      bankswitch_rom8( &space, bankname[offset * 2 + 1], data >> 16 );
614634   }
615635}
616636
617static WRITE32_HANDLER( bankswitch_rom64_upper_w )
637WRITE32_MEMBER(namcos11_state::bankswitch_rom64_upper_w)
618638{
619   namcos11_state *state = space->machine().driver_data<namcos11_state>();
620639
621   verboselog( space->machine(), 2, "bankswitch_rom64_upper_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
640   verboselog( machine(), 2, "bankswitch_rom64_upper_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
622641
623642   if( ACCESSING_BITS_0_15 )
624643   {
625      state->m_n_bankoffset = 0;
644      m_n_bankoffset = 0;
626645   }
627646   if( ACCESSING_BITS_16_31 )
628647   {
629      state->m_n_bankoffset = 16;
648      m_n_bankoffset = 16;
630649   }
631650}
632651
r14896r14897
638657   memory_set_bank( space->machine(), bank, ( ( ( ( n_data & 0xc0 ) >> 3 ) + ( n_data & 0x07 ) ) ^ state->m_n_bankoffset ) );
639658}
640659
641static WRITE32_HANDLER( bankswitch_rom64_w )
660WRITE32_MEMBER(namcos11_state::bankswitch_rom64_w)
642661{
643   verboselog( space->machine(), 2, "bankswitch_rom64_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
662   verboselog( machine(), 2, "bankswitch_rom64_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
644663
645664   if( ACCESSING_BITS_0_15 )
646665   {
647      bankswitch_rom64( space, bankname[offset * 2], data & 0xffff );
666      bankswitch_rom64( &space, bankname[offset * 2], data & 0xffff );
648667   }
649668   if( ACCESSING_BITS_16_31 )
650669   {
651      bankswitch_rom64( space, bankname[offset * 2 + 1], data >> 16 );
670      bankswitch_rom64( &space, bankname[offset * 2 + 1], data >> 16 );
652671   }
653672}
654673
655static WRITE32_HANDLER( lightgun_w )
674WRITE32_MEMBER(namcos11_state::lightgun_w)
656675{
657676   if( ACCESSING_BITS_0_15 )
658677   {
r14896r14897
661680      output_set_value( "recoil0", !( data & 0x02 ) );
662681      output_set_value( "recoil1", !( data & 0x01 ) );
663682
664      verboselog( space->machine(), 1, "lightgun_w: outputs (%08x %08x)\n", data, mem_mask );
683      verboselog( machine(), 1, "lightgun_w: outputs (%08x %08x)\n", data, mem_mask );
665684   }
666685   if( ACCESSING_BITS_16_31 )
667686   {
668      verboselog( space->machine(), 2, "lightgun_w: start reading (%08x %08x)\n", data, mem_mask );
687      verboselog( machine(), 2, "lightgun_w: start reading (%08x %08x)\n", data, mem_mask );
669688   }
670689}
671690
672static READ32_HANDLER( lightgun_r )
691READ32_MEMBER(namcos11_state::lightgun_r)
673692{
674693   UINT32 data = 0;
675694   switch( offset )
676695   {
677696   case 0:
678      data = input_port_read( space->machine(), "GUN1X" );
697      data = input_port_read( machine(), "GUN1X" );
679698      break;
680699   case 1:
681      data = ( input_port_read( space->machine(), "GUN1Y" ) ) | ( ( input_port_read( space->machine(), "GUN1Y" ) + 1 ) << 16 );
700      data = ( input_port_read( machine(), "GUN1Y" ) ) | ( ( input_port_read( machine(), "GUN1Y" ) + 1 ) << 16 );
682701      break;
683702   case 2:
684      data = input_port_read( space->machine(), "GUN2X" );
703      data = input_port_read( machine(), "GUN2X" );
685704      break;
686705   case 3:
687      data = ( input_port_read( space->machine(), "GUN2Y" ) ) | ( ( input_port_read( space->machine(), "GUN2Y" ) + 1 ) << 16 );
706      data = ( input_port_read( machine(), "GUN2Y" ) ) | ( ( input_port_read( machine(), "GUN2Y" ) + 1 ) << 16 );
688707      break;
689708   }
690   verboselog( space->machine(), 2, "lightgun_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
709   verboselog( machine(), 2, "lightgun_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
691710   return data;
692711}
693712
694713static ADDRESS_MAP_START( namcos11_map, AS_PROGRAM, 32, namcos11_state )
695714   AM_RANGE(0x00000000, 0x003fffff) AM_RAM   AM_SHARE("share1") /* ram */
696715   AM_RANGE(0x1fa04000, 0x1fa0ffff) AM_RAM AM_BASE(m_sharedram) /* shared ram with C76 */
697   AM_RANGE(0x1fa20000, 0x1fa2ffff) AM_WRITE_LEGACY(keycus_w) AM_BASE_SIZE(m_keycus, m_keycus_size) /* keycus */
716   AM_RANGE(0x1fa20000, 0x1fa2ffff) AM_WRITE(keycus_w) AM_BASE_SIZE(m_keycus, m_keycus_size) /* keycus */
698717   AM_RANGE(0x1fa30000, 0x1fa30fff) AM_DEVREADWRITE8_LEGACY("at28c16", at28c16_r, at28c16_w, 0x00ff00ff) /* eeprom */
699718   AM_RANGE(0x1fb00000, 0x1fb00003) AM_WRITENOP /* ?? */
700719   AM_RANGE(0x1fbf6000, 0x1fbf6003) AM_WRITENOP /* ?? */
r14896r14897
706725   AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP
707726ADDRESS_MAP_END
708727
709static READ16_HANDLER( c76_shared_r )
728READ16_MEMBER(namcos11_state::c76_shared_r)
710729{
711   namcos11_state *state = space->machine().driver_data<namcos11_state>();
712   UINT16 *share16 = (UINT16 *)state->m_sharedram;
730   UINT16 *share16 = (UINT16 *)m_sharedram;
713731
714732   return share16[offset];
715733}
716734
717static WRITE16_HANDLER( c76_shared_w )
735WRITE16_MEMBER(namcos11_state::c76_shared_w)
718736{
719   namcos11_state *state = space->machine().driver_data<namcos11_state>();
720   UINT16 *share16 = (UINT16 *)state->m_sharedram;
737   UINT16 *share16 = (UINT16 *)m_sharedram;
721738
722739   COMBINE_DATA(&share16[offset]);
723740}
724741
725static READ16_HANDLER( c76_inputs_r )
742READ16_MEMBER(namcos11_state::c76_inputs_r)
726743{
727//  logerror("'c76' Read port %d @ %06X\n", offset, cpu_get_pc(&space->device()));
744//  logerror("'c76' Read port %d @ %06X\n", offset, cpu_get_pc(&space.device()));
728745
729746   switch (offset)
730747   {
731748      case 0:
732         return input_port_read(space->machine(), "PLAYER4");
749         return input_port_read(machine(), "PLAYER4");
733750
734751      case 1:
735         return input_port_read(space->machine(), "SWITCH");
752         return input_port_read(machine(), "SWITCH");
736753
737754      case 2:
738         return input_port_read(space->machine(), "PLAYER1");
755         return input_port_read(machine(), "PLAYER1");
739756
740757      case 3:
741         return input_port_read(space->machine(), "PLAYER2");
758         return input_port_read(machine(), "PLAYER2");
742759   }
743760
744761   return 0xff;
r14896r14897
746763
747764ADDRESS_MAP_START( c76_map, AS_PROGRAM, 16, namcos11_state )
748765   AM_RANGE(0x002000, 0x002fff) AM_DEVREADWRITE("c352", c352_device, read, write)
749   AM_RANGE(0x001000, 0x001007) AM_READ_LEGACY(c76_inputs_r )
750   AM_RANGE(0x004000, 0x00bfff) AM_READWRITE_LEGACY(c76_shared_r, c76_shared_w )
766   AM_RANGE(0x001000, 0x001007) AM_READ(c76_inputs_r )
767   AM_RANGE(0x004000, 0x00bfff) AM_READWRITE(c76_shared_r, c76_shared_w )
751768   AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("c76", 0x40000)
752769   AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("c76", 0)
753770   AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("c76", 0)
r14896r14897
756773   AM_RANGE(0x301000, 0x301001) AM_WRITENOP
757774ADDRESS_MAP_END
758775
759static READ8_HANDLER(dac7_r)      // bit 7
776READ8_MEMBER(namcos11_state::dac7_r)// bit 7
760777{
761   return input_port_read_safe(space->machine(), "PLAYER3", 0xff)&0x80;
778   return input_port_read_safe(machine(), "PLAYER3", 0xff)&0x80;
762779}
763780
764static READ8_HANDLER(dac6_r)      // bit 3
781READ8_MEMBER(namcos11_state::dac6_r)// bit 3
765782{
766   return (input_port_read_safe(space->machine(), "PLAYER3", 0xff)<<4)&0x80;
783   return (input_port_read_safe(machine(), "PLAYER3", 0xff)<<4)&0x80;
767784}
768785
769static READ8_HANDLER(dac5_r)      // bit 2
786READ8_MEMBER(namcos11_state::dac5_r)// bit 2
770787{
771   return (input_port_read_safe(space->machine(), "PLAYER3", 0xff)<<5)&0x80;
788   return (input_port_read_safe(machine(), "PLAYER3", 0xff)<<5)&0x80;
772789}
773790
774static READ8_HANDLER(dac4_r)      // bit 1
791READ8_MEMBER(namcos11_state::dac4_r)// bit 1
775792{
776   return (input_port_read_safe(space->machine(), "PLAYER3", 0xff)<<6)&0x80;
793   return (input_port_read_safe(machine(), "PLAYER3", 0xff)<<6)&0x80;
777794}
778795
779static READ8_HANDLER(dac3_r)      // bit 0
796READ8_MEMBER(namcos11_state::dac3_r)// bit 0
780797{
781   return (input_port_read_safe(space->machine(), "PLAYER3", 0xff)<<7)&0x80;
798   return (input_port_read_safe(machine(), "PLAYER3", 0xff)<<7)&0x80;
782799}
783800
784static READ8_HANDLER(dac2_r)      // bit 4
801READ8_MEMBER(namcos11_state::dac2_r)// bit 4
785802{
786   return (input_port_read_safe(space->machine(), "PLAYER3", 0xff)<<3)&0x80;
803   return (input_port_read_safe(machine(), "PLAYER3", 0xff)<<3)&0x80;
787804}
788805
789static READ8_HANDLER(dac1_r)      // bit 5
806READ8_MEMBER(namcos11_state::dac1_r)// bit 5
790807{
791   return (input_port_read_safe(space->machine(), "PLAYER3", 0xff)<<2)&0x80;
808   return (input_port_read_safe(machine(), "PLAYER3", 0xff)<<2)&0x80;
792809}
793810
794static READ8_HANDLER(dac0_r)      // bit 6
811READ8_MEMBER(namcos11_state::dac0_r)// bit 6
795812{
796   return (input_port_read_safe(space->machine(), "PLAYER3", 0xff)<<1)&0x80;
813   return (input_port_read_safe(machine(), "PLAYER3", 0xff)<<1)&0x80;
797814}
798815
799static READ8_HANDLER(pocketrc_gas_r)
816READ8_MEMBER(namcos11_state::pocketrc_gas_r)
800817{
801   return input_port_read(space->machine(), "GAS");
818   return input_port_read(machine(), "GAS");
802819}
803820
804static READ8_HANDLER(pocketrc_steer_r)
821READ8_MEMBER(namcos11_state::pocketrc_steer_r)
805822{
806   return input_port_read(space->machine(), "STEERING");
823   return input_port_read(machine(), "STEERING");
807824}
808825
809826ADDRESS_MAP_START( c76_io_map, AS_IO, 8, namcos11_state )
810   AM_RANGE(M37710_ADC7_L, M37710_ADC7_L) AM_READ_LEGACY(dac7_r)
811   AM_RANGE(M37710_ADC6_L, M37710_ADC6_L) AM_READ_LEGACY(dac6_r)
812   AM_RANGE(M37710_ADC5_L, M37710_ADC5_L) AM_READ_LEGACY(dac5_r)
813   AM_RANGE(M37710_ADC4_L, M37710_ADC4_L) AM_READ_LEGACY(dac4_r)
814   AM_RANGE(M37710_ADC3_L, M37710_ADC3_L) AM_READ_LEGACY(dac3_r)
815   AM_RANGE(M37710_ADC2_L, M37710_ADC2_L) AM_READ_LEGACY(dac2_r)
816   AM_RANGE(M37710_ADC1_L, M37710_ADC1_L) AM_READ_LEGACY(dac1_r)
817   AM_RANGE(M37710_ADC0_L, M37710_ADC0_L) AM_READ_LEGACY(dac0_r)
827   AM_RANGE(M37710_ADC7_L, M37710_ADC7_L) AM_READ(dac7_r)
828   AM_RANGE(M37710_ADC6_L, M37710_ADC6_L) AM_READ(dac6_r)
829   AM_RANGE(M37710_ADC5_L, M37710_ADC5_L) AM_READ(dac5_r)
830   AM_RANGE(M37710_ADC4_L, M37710_ADC4_L) AM_READ(dac4_r)
831   AM_RANGE(M37710_ADC3_L, M37710_ADC3_L) AM_READ(dac3_r)
832   AM_RANGE(M37710_ADC2_L, M37710_ADC2_L) AM_READ(dac2_r)
833   AM_RANGE(M37710_ADC1_L, M37710_ADC1_L) AM_READ(dac1_r)
834   AM_RANGE(M37710_ADC0_L, M37710_ADC0_L) AM_READ(dac0_r)
818835
819836   AM_RANGE(M37710_ADC0_H, M37710_ADC7_H) AM_READNOP
820837ADDRESS_MAP_END
821838
822static READ16_HANDLER( c76_speedup_r )
839READ16_MEMBER(namcos11_state::c76_speedup_r)
823840{
824   namcos11_state *state = space->machine().driver_data<namcos11_state>();
825841
826   if ((cpu_get_pc(&space->device()) == 0xc153) && (!(state->m_su_83 & 0xff00)))
842   if ((cpu_get_pc(&space.device()) == 0xc153) && (!(m_su_83 & 0xff00)))
827843   {
828      device_spin_until_interrupt(&space->device());
844      device_spin_until_interrupt(&space.device());
829845   }
830846
831   return state->m_su_83;
847   return m_su_83;
832848}
833849
834static WRITE16_HANDLER( c76_speedup_w )
850WRITE16_MEMBER(namcos11_state::c76_speedup_w)
835851{
836   namcos11_state *state = space->machine().driver_data<namcos11_state>();
837852
838   COMBINE_DATA(&state->m_su_83);
853   COMBINE_DATA(&m_su_83);
839854}
840855
841856static void namcos11_init_common(running_machine &machine, int n_daughterboard)
r14896r14897
847862   if (C76_SPEEDUP)
848863   {
849864      state->save_item( NAME(state->m_su_83) );
850      machine.device("c76")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x82, 0x83, FUNC(c76_speedup_r), FUNC(c76_speedup_w));
865      machine.device("c76")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos11_state::c76_speedup_r),state), write16_delegate(FUNC(namcos11_state::c76_speedup_w),state));
851866   }
852867
853868   if (!n_daughterboard)
r14896r14897
878893
879894   if (n_daughterboard == 32)
880895   {
881      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x1fa10020, 0x1fa1002f, FUNC(bankswitch_rom32_w) );
896      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1fa10020, 0x1fa1002f, write32_delegate(FUNC(namcos11_state::bankswitch_rom32_w),state));
882897   }
883898   if (n_daughterboard == 64)
884899   {
885900      state->m_n_bankoffset = 0;
886      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x1f080000, 0x1f080003, FUNC(bankswitch_rom64_upper_w) );
901      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f080000, 0x1f080003, write32_delegate(FUNC(namcos11_state::bankswitch_rom64_upper_w),state));
887902      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x1fa10020, 0x1fa1002f);
888      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x1fa10020, 0x1fa1002f, FUNC(bankswitch_rom64_w) );
903      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1fa10020, 0x1fa1002f, write32_delegate(FUNC(namcos11_state::bankswitch_rom64_w),state));
889904      state->save_item( NAME(state->m_n_bankoffset) );
890905   }
891906}
r14896r14897
897912
898913static DRIVER_INIT( tekken2 )
899914{
900   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c406_r) );
915   namcos11_state *state = machine.driver_data<namcos11_state>();
916   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c406_r),state));
901917   namcos11_init_common(machine, 32);
902918}
903919
904920static DRIVER_INIT( souledge )
905921{
906   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c409_r) );
922   namcos11_state *state = machine.driver_data<namcos11_state>();
923   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c409_r),state));
907924   namcos11_init_common(machine, 32);
908925}
909926
910927static DRIVER_INIT( dunkmnia )
911928{
912   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c410_r) );
929   namcos11_state *state = machine.driver_data<namcos11_state>();
930   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c410_r),state));
913931   namcos11_init_common(machine, 32);
914932}
915933
916934static DRIVER_INIT( primglex )
917935{
918   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c411_r) );
936   namcos11_state *state = machine.driver_data<namcos11_state>();
937   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c411_r),state));
919938   namcos11_init_common(machine, 32);
920939}
921940
922941static DRIVER_INIT( xevi3dg )
923942{
924   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c430_r) );
943   namcos11_state *state = machine.driver_data<namcos11_state>();
944   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c430_r),state));
925945   namcos11_init_common(machine, 32);
926946}
927947
928948static DRIVER_INIT( danceyes )
929949{
930   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c431_r) );
950   namcos11_state *state = machine.driver_data<namcos11_state>();
951   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c431_r),state));
931952   namcos11_init_common(machine, 32);
932953}
933954
934955static DRIVER_INIT( pocketrc )
935956{
936   machine.device("c76")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC0_L, FUNC(pocketrc_steer_r));
937   machine.device("c76")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC1_L, M37710_ADC1_L, FUNC(pocketrc_gas_r));
957   namcos11_state *state = machine.driver_data<namcos11_state>();
958   machine.device("c76")->memory().space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC0_L, read8_delegate(FUNC(namcos11_state::pocketrc_steer_r),state));
959   machine.device("c76")->memory().space(AS_IO)->install_read_handler(M37710_ADC1_L, M37710_ADC1_L, read8_delegate(FUNC(namcos11_state::pocketrc_gas_r),state));
938960
939   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c432_r) );
961   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c432_r),state));
940962   namcos11_init_common(machine, 32);
941963}
942964
943965static DRIVER_INIT( starswep )
944966{
945   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c442_r) );
967   namcos11_state *state = machine.driver_data<namcos11_state>();
968   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c442_r),state));
946969   namcos11_init_common(machine, 0);
947970}
948971
949972static DRIVER_INIT( myangel3 )
950973{
951   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c443_r) );
974   namcos11_state *state = machine.driver_data<namcos11_state>();
975   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c443_r),state));
952976   namcos11_init_common(machine, 64);
953977}
954978
955979static DRIVER_INIT( ptblank2ua )
956980{
957   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(keycus_c443_r) );
981   namcos11_state *state = machine.driver_data<namcos11_state>();
982   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c443_r),state));
958983   namcos11_init_common(machine, 64);
959984
960   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x1f788000, 0x1f788003, FUNC(lightgun_w) );
961   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x1f780000, 0x1f78000f, FUNC(lightgun_r) );
985   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f788000, 0x1f788003, write32_delegate(FUNC(namcos11_state::lightgun_w),state));
986   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler (0x1f780000, 0x1f78000f, read32_delegate(FUNC(namcos11_state::lightgun_r),state));
962987}
963988
964989static MACHINE_RESET( namcos11 )
src/mame/drivers/lethalj.c
r14896r14897
176176WRITE16_MEMBER(lethalj_state::ripribit_control_w)
177177{
178178   coin_counter_w(machine(), 0, data & 1);
179   ticket_dispenser_w(machine().device("ticket"), 0, ((data >> 1) & 1) << 7);
179   machine().device<ticket_dispenser_device>("ticket")->write(space, 0, ((data >> 1) & 1) << 7);
180180   output_set_lamp_value(0, (data >> 2) & 1);
181181}
182182
183183
184184WRITE16_MEMBER(lethalj_state::cfarm_control_w)
185185{
186   ticket_dispenser_w(machine().device("ticket"), 0, ((data >> 0) & 1) << 7);
186   machine().device<ticket_dispenser_device>("ticket")->write(space, 0, ((data >> 0) & 1) << 7);
187187   output_set_lamp_value(0, (data >> 2) & 1);
188188   output_set_lamp_value(1, (data >> 3) & 1);
189189   output_set_lamp_value(2, (data >> 4) & 1);
r14896r14897
193193
194194WRITE16_MEMBER(lethalj_state::cclownz_control_w)
195195{
196   ticket_dispenser_w(machine().device("ticket"), 0, ((data >> 0) & 1) << 7);
196   machine().device<ticket_dispenser_device>("ticket")->write(space, 0, ((data >> 0) & 1) << 7);
197197   output_set_lamp_value(0, (data >> 2) & 1);
198198   output_set_lamp_value(1, (data >> 4) & 1);
199199   output_set_lamp_value(2, (data >> 5) & 1);
r14896r14897
404404   PORT_START("IN0")
405405   PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED )
406406   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
407   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
407   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
408408   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNUSED )
409409
410410   PORT_START("IN1")
r14896r14897
491491   PORT_DIPSETTING(      0x0000, "10" )
492492
493493   PORT_START("IN1")
494   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
494   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
495495   PORT_BIT( 0x0006, IP_ACTIVE_LOW, IPT_UNUSED )
496496   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
497497   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
r14896r14897
542542
543543   PORT_START("IN1")
544544   PORT_BIT( 0x0f0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, lethalj_state,cclownz_paddle, NULL)
545   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
545   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
546546   PORT_BIT( 0x0060, IP_ACTIVE_LOW, IPT_UNUSED )
547547   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
548548   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
r14896r14897
598598   MCFG_CPU_CONFIG(tms_config)
599599   MCFG_CPU_PROGRAM_MAP(lethalj_map)
600600
601   MCFG_TICKET_DISPENSER_ADD("ticket", 200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
601   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
602602
603603   /* video hardware */
604604   MCFG_SCREEN_ADD("screen", RASTER)
src/mame/drivers/itech8.c
r14896r14897
531531static const pia6821_interface pia_interface =
532532{
533533   DEVCB_NULL,      /* port A in */
534   DEVCB_DEVICE_LINE("ticket", ticket_dispenser_line_r),         /* port B in */
534   DEVCB_DEVICE_LINE_MEMBER("ticket", ticket_dispenser_device, line_r),         /* port B in */
535535   DEVCB_NULL,      /* line CA1 in */
536536   DEVCB_NULL,      /* line CB1 in */
537537   DEVCB_NULL,      /* line CA2 in */
r14896r14897
755755   /* bit 5 controls the coin counter */
756756   /* bit 6 controls the diagnostic sound LED */
757757   m_pia_portb_data = data;
758   ticket_dispenser_w(machine().device("ticket"), 0, (data & 0x10) << 3);
758   machine().device<ticket_dispenser_device>("ticket")->write(space, 0, (data & 0x10) << 3);
759759   coin_counter_w(machine(), 0, (data & 0x20) >> 5);
760760}
761761
r14896r14897
770770   /* bit 6 controls the diagnostic sound LED */
771771   /* bit 7 controls the ticket dispenser */
772772   state->m_pia_portb_data = data;
773   ticket_dispenser_w(device->machine().device("ticket"), 0, data & 0x80);
773   device->machine().device<ticket_dispenser_device>("ticket")->write(*device->machine().memory().first_space(), 0, data & 0x80);
774774   coin_counter_w(device->machine(), 0, (data & 0x20) >> 5);
775775}
776776
r14896r14897
16871687   MCFG_MACHINE_RESET(itech8)
16881688   MCFG_NVRAM_ADD_RANDOM_FILL("nvram")
16891689
1690   MCFG_TICKET_DISPENSER_ADD("ticket", 200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
1690   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
16911691
16921692   /* video hardware */
16931693   MCFG_TLC34076_ADD("tlc34076", TLC34076_6_BIT)
src/mame/drivers/galaxian.c
r14896r14897
461461   }
462462}
463463
464static WRITE8_HANDLER( irq_enable_w )
464WRITE8_MEMBER(galaxian_state::irq_enable_w)
465465{
466   galaxian_state *state = space->machine().driver_data<galaxian_state>();
467466   /* the latched D0 bit here goes to the CLEAR line on the interrupt flip-flop */
468   state->m_irq_enabled = data & 1;
467   m_irq_enabled = data & 1;
469468
470469   /* if CLEAR is held low, we must make sure the interrupt signal is clear */
471   if (!state->m_irq_enabled)
472      device_set_input_line(&space->device(), state->m_irq_line, CLEAR_LINE);
470   if (!m_irq_enabled)
471      device_set_input_line(&space.device(), m_irq_line, CLEAR_LINE);
473472}
474473
475474/*************************************
r14896r14897
478477 *
479478 *************************************/
480479
481static WRITE8_HANDLER( start_lamp_w )
480WRITE8_MEMBER(galaxian_state::start_lamp_w)
482481{
483482   /* offset 0 = 1P START LAMP */
484483   /* offset 1 = 2P START LAMP */
485   set_led_status(space->machine(), offset, data & 1);
484   set_led_status(machine(), offset, data & 1);
486485}
487486
488487
489static WRITE8_HANDLER( coin_lock_w )
488WRITE8_MEMBER(galaxian_state::coin_lock_w)
490489{
491490   /* many variants and bootlegs don't have this */
492   coin_lockout_global_w(space->machine(), ~data & 1);
491   coin_lockout_global_w(machine(), ~data & 1);
493492}
494493
495494
496static WRITE8_HANDLER( coin_count_0_w )
495WRITE8_MEMBER(galaxian_state::coin_count_0_w)
497496{
498   coin_counter_w(space->machine(), 0, data & 1);
497   coin_counter_w(machine(), 0, data & 1);
499498}
500499
501500
502static WRITE8_HANDLER( coin_count_1_w )
501WRITE8_MEMBER(galaxian_state::coin_count_1_w)
503502{
504   coin_counter_w(space->machine(), 1, data & 1);
503   coin_counter_w(machine(), 1, data & 1);
505504}
506505
507506
r14896r14897
512511 *
513512 *************************************/
514513
515static READ8_HANDLER( konami_ay8910_r )
514READ8_MEMBER(galaxian_state::konami_ay8910_r)
516515{
517516   /* the decoding here is very simplistic, and you can address both simultaneously */
518517   UINT8 result = 0xff;
519   if (offset & 0x20) result &= ay8910_r(space->machine().device("8910.1"), 0);
520   if (offset & 0x80) result &= ay8910_r(space->machine().device("8910.0"), 0);
518   if (offset & 0x20) result &= ay8910_r(machine().device("8910.1"), 0);
519   if (offset & 0x80) result &= ay8910_r(machine().device("8910.0"), 0);
521520   return result;
522521}
523522
524523
525static WRITE8_HANDLER( konami_ay8910_w )
524WRITE8_MEMBER(galaxian_state::konami_ay8910_w)
526525{
527526   /* AV 4,5 ==> AY8910 #2 */
528527   /* the decoding here is very simplistic, and you can address two simultaneously */
529528   if (offset & 0x10)
530      ay8910_address_w(space->machine().device("8910.1"), 0, data);
529      ay8910_address_w(machine().device("8910.1"), 0, data);
531530   else if (offset & 0x20)
532      ay8910_data_w(space->machine().device("8910.1"), 0, data);
531      ay8910_data_w(machine().device("8910.1"), 0, data);
533532   /* AV6,7 ==> AY8910 #1 */
534533   if (offset & 0x40)
535      ay8910_address_w(space->machine().device("8910.0"), 0, data);
534      ay8910_address_w(machine().device("8910.0"), 0, data);
536535   else if (offset & 0x80)
537      ay8910_data_w(space->machine().device("8910.0"), 0, data);
536      ay8910_data_w(machine().device("8910.0"), 0, data);
538537}
539538
540539
r14896r14897
589588}
590589
591590
592static WRITE8_HANDLER( konami_sound_filter_w )
591WRITE8_MEMBER(galaxian_state::konami_sound_filter_w)
593592{
594   device_t *discrete = space->machine().device("konami");
593   device_t *discrete = machine().device("konami");
595594   static const char *const ayname[2] = { "8910.0", "8910.1" };
596595   int which, chan;
597596
r14896r14897
599598   /* AV0 .. AV5 ==> AY8910 #2 */
600599   /* AV6 .. AV11 ==> AY8910 #1 */
601600   for (which = 0; which < 2; which++)
602      if (space->machine().device(ayname[which]) != NULL)
601      if (machine().device(ayname[which]) != NULL)
603602         for (chan = 0; chan < 3; chan++)
604603         {
605604            UINT8 bits = (offset >> (2 * chan + 6 * (1 - which))) & 3;
r14896r14897
639638   DEVCB_NULL,                                    /* Port A read */
640639   DEVCB_NULL,                                    /* Port B read */
641640   DEVCB_INPUT_PORT("IN3"),                        /* Port C read */
642   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_w),      /* Port A write */
641   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),      /* Port A write */
643642   DEVCB_HANDLER(konami_sound_control_w),               /* Port B write */
644643   DEVCB_HANDLER(konami_portc_1_w)                     /* Port C write */
645644};
r14896r14897
652651 *
653652 *************************************/
654653
655static READ8_HANDLER( theend_ppi8255_r )
654READ8_MEMBER(galaxian_state::theend_ppi8255_r)
656655{
657656   /* the decoding here is very simplistic, and you can address both simultaneously */
658657   UINT8 result = 0xff;
659   if (offset & 0x0100) result &= ppi8255_r(space->machine().device("ppi8255_0"), offset & 3);
660   if (offset & 0x0200) result &= ppi8255_r(space->machine().device("ppi8255_1"), offset & 3);
658   if (offset & 0x0100) result &= ppi8255_r(machine().device("ppi8255_0"), offset & 3);
659   if (offset & 0x0200) result &= ppi8255_r(machine().device("ppi8255_1"), offset & 3);
661660   return result;
662661}
663662
664663
665static WRITE8_HANDLER( theend_ppi8255_w )
664WRITE8_MEMBER(galaxian_state::theend_ppi8255_w)
666665{
667666   /* the decoding here is very simplistic, and you can address both simultaneously */
668   if (offset & 0x0100) ppi8255_w(space->machine().device("ppi8255_0"), offset & 3, data);
669   if (offset & 0x0200) ppi8255_w(space->machine().device("ppi8255_1"), offset & 3, data);
667   if (offset & 0x0100) ppi8255_w(machine().device("ppi8255_0"), offset & 3, data);
668   if (offset & 0x0200) ppi8255_w(machine().device("ppi8255_1"), offset & 3, data);
670669}
671670
672671
r14896r14897
742741   DEVCB_NULL,                                    /* Port A read */
743742   DEVCB_NULL,                                    /* Port B read */
744743   DEVCB_HANDLER(scramble_protection_r),               /* Port C read */
745   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_w),      /* Port A write */
744   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),      /* Port A write */
746745   DEVCB_HANDLER(konami_sound_control_w),               /* Port B write */
747746   DEVCB_HANDLER(scramble_protection_w)               /* Port C write */
748747};
r14896r14897
755754 *
756755 *************************************/
757756
758static WRITE8_HANDLER( explorer_sound_control_w )
757WRITE8_MEMBER(galaxian_state::explorer_sound_control_w)
759758{
760   cputag_set_input_line(space->machine(), "audiocpu", 0, ASSERT_LINE);
759   cputag_set_input_line(machine(), "audiocpu", 0, ASSERT_LINE);
761760}
762761
763762
r14896r14897
765764{
766765   galaxian_state *state = device->machine().driver_data<galaxian_state>();
767766   cputag_set_input_line(device->machine(), "audiocpu", 0, CLEAR_LINE);
768   return state->soundlatch_r(*device->machine().device("audiocpu")->memory().space(AS_PROGRAM), 0);
767   return state->soundlatch_byte_r(*device->machine().device("audiocpu")->memory().space(AS_PROGRAM), 0);
769768}
770769
771770
r14896r14897
776775 *
777776 *************************************/
778777
779static READ8_HANDLER( sfx_sample_io_r )
778READ8_MEMBER(galaxian_state::sfx_sample_io_r)
780779{
781780   /* the decoding here is very simplistic, and you can address both simultaneously */
782781   UINT8 result = 0xff;
783   if (offset & 0x04) result &= ppi8255_r(space->machine().device("ppi8255_2"), offset & 3);
782   if (offset & 0x04) result &= ppi8255_r(machine().device("ppi8255_2"), offset & 3);
784783   return result;
785784}
786785
787786
788static WRITE8_HANDLER( sfx_sample_io_w )
787WRITE8_MEMBER(galaxian_state::sfx_sample_io_w)
789788{
790789   /* the decoding here is very simplistic, and you can address both simultaneously */
791   if (offset & 0x04) ppi8255_w(space->machine().device("ppi8255_2"), offset & 3, data);
792   if (offset & 0x10) dac_signed_data_w(space->machine().device("dac"), data);
790   if (offset & 0x04) ppi8255_w(machine().device("ppi8255_2"), offset & 3, data);
791   if (offset & 0x10) dac_signed_data_w(machine().device("dac"), data);
793792}
794793
795794
r14896r14897
808807
809808static const ppi8255_interface sfx_ppi8255_2_intf =
810809{
811   DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_r),      /* Port A read */
810   DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_byte_r),      /* Port A read */
812811   DEVCB_NULL,                                    /* Port B read */
813812   DEVCB_NULL,                                    /* Port C read */
814813   DEVCB_NULL,                                    /* Port A write */
r14896r14897
834833    The data(code) in the extra RAM is later jumped/called to in many parts of the game.
835834*/
836835
837static READ8_HANDLER( monsterz_protection_r )
836READ8_MEMBER(galaxian_state::monsterz_protection_r)
838837{
839   galaxian_state *state = space->machine().driver_data<galaxian_state>();
840   return state->m_protection_result;
838   return m_protection_result;
841839}
842840
843841
r14896r14897
899897 *
900898 *************************************/
901899
902static READ8_HANDLER( frogger_ppi8255_r )
900READ8_MEMBER(galaxian_state::frogger_ppi8255_r)
903901{
904902   /* the decoding here is very simplistic, and you can address both simultaneously */
905903   UINT8 result = 0xff;
906   if (offset & 0x1000) result &= ppi8255_r(space->machine().device("ppi8255_1"), (offset >> 1) & 3);
907   if (offset & 0x2000) result &= ppi8255_r(space->machine().device("ppi8255_0"), (offset >> 1) & 3);
904   if (offset & 0x1000) result &= ppi8255_r(machine().device("ppi8255_1"), (offset >> 1) & 3);
905   if (offset & 0x2000) result &= ppi8255_r(machine().device("ppi8255_0"), (offset >> 1) & 3);
908906   return result;
909907}
910908
911909
912static WRITE8_HANDLER( frogger_ppi8255_w )
910WRITE8_MEMBER(galaxian_state::frogger_ppi8255_w)
913911{
914912   /* the decoding here is very simplistic, and you can address both simultaneously */
915   if (offset & 0x1000) ppi8255_w(space->machine().device("ppi8255_1"), (offset >> 1) & 3, data);
916   if (offset & 0x2000) ppi8255_w(space->machine().device("ppi8255_0"), (offset >> 1) & 3, data);
913   if (offset & 0x1000) ppi8255_w(machine().device("ppi8255_1"), (offset >> 1) & 3, data);
914   if (offset & 0x2000) ppi8255_w(machine().device("ppi8255_0"), (offset >> 1) & 3, data);
917915}
918916
919917
920static READ8_HANDLER( frogger_ay8910_r )
918READ8_MEMBER(galaxian_state::frogger_ay8910_r)
921919{
922920   /* the decoding here is very simplistic */
923921   UINT8 result = 0xff;
924   if (offset & 0x40) result &= ay8910_r(space->machine().device("8910.0"), 0);
922   if (offset & 0x40) result &= ay8910_r(machine().device("8910.0"), 0);
925923   return result;
926924}
927925
928926
929static WRITE8_HANDLER( frogger_ay8910_w )
927WRITE8_MEMBER(galaxian_state::frogger_ay8910_w)
930928{
931929   /* the decoding here is very simplistic */
932930   /* AV6,7 ==> AY8910 #1 */
933931   if (offset & 0x40)
934      ay8910_data_w(space->machine().device("8910.0"), 0, data);
932      ay8910_data_w(machine().device("8910.0"), 0, data);
935933   else if (offset & 0x80)
936      ay8910_address_w(space->machine().device("8910.0"), 0, data);
934      ay8910_address_w(machine().device("8910.0"), 0, data);
937935}
938936
939937
r14896r14897
945943}
946944
947945
948static WRITE8_HANDLER( froggrmc_sound_control_w )
946WRITE8_MEMBER(galaxian_state::froggrmc_sound_control_w)
949947{
950   cputag_set_input_line(space->machine(), "audiocpu", 0, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
948   cputag_set_input_line(machine(), "audiocpu", 0, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
951949}
952950
953951
r14896r14897
958956 *
959957 *************************************/
960958
961static READ8_HANDLER( frogf_ppi8255_r )
959READ8_MEMBER(galaxian_state::frogf_ppi8255_r)
962960{
963961   /* the decoding here is very simplistic, and you can address both simultaneously */
964962   UINT8 result = 0xff;
965   if (offset & 0x1000) result &= ppi8255_r(space->machine().device("ppi8255_0"), (offset >> 3) & 3);
966   if (offset & 0x2000) result &= ppi8255_r(space->machine().device("ppi8255_1"), (offset >> 3) & 3);
963   if (offset & 0x1000) result &= ppi8255_r(machine().device("ppi8255_0"), (offset >> 3) & 3);
964   if (offset & 0x2000) result &= ppi8255_r(machine().device("ppi8255_1"), (offset >> 3) & 3);
967965   return result;
968966}
969967
970968
971static WRITE8_HANDLER( frogf_ppi8255_w )
969WRITE8_MEMBER(galaxian_state::frogf_ppi8255_w)
972970{
973971   /* the decoding here is very simplistic, and you can address both simultaneously */
974   if (offset & 0x1000) ppi8255_w(space->machine().device("ppi8255_0"), (offset >> 3) & 3, data);
975   if (offset & 0x2000) ppi8255_w(space->machine().device("ppi8255_1"), (offset >> 3) & 3, data);
972   if (offset & 0x1000) ppi8255_w(machine().device("ppi8255_0"), (offset >> 3) & 3, data);
973   if (offset & 0x2000) ppi8255_w(machine().device("ppi8255_1"), (offset >> 3) & 3, data);
976974}
977975
978976
r14896r14897
983981 *
984982 *************************************/
985983
986static READ8_HANDLER( turtles_ppi8255_0_r ) { return ppi8255_r(space->machine().device("ppi8255_0"), (offset >> 4) & 3); }
987static READ8_HANDLER( turtles_ppi8255_1_r ) { return ppi8255_r(space->machine().device("ppi8255_1"), (offset >> 4) & 3); }
988static WRITE8_HANDLER( turtles_ppi8255_0_w ) { ppi8255_w(space->machine().device("ppi8255_0"), (offset >> 4) & 3, data); }
989static WRITE8_HANDLER( turtles_ppi8255_1_w ) { ppi8255_w(space->machine().device("ppi8255_1"), (offset >> 4) & 3, data); }
984READ8_MEMBER(galaxian_state::turtles_ppi8255_0_r){ return ppi8255_r(machine().device("ppi8255_0"), (offset >> 4) & 3); }
985READ8_MEMBER(galaxian_state::turtles_ppi8255_1_r){ return ppi8255_r(machine().device("ppi8255_1"), (offset >> 4) & 3); }
986WRITE8_MEMBER(galaxian_state::turtles_ppi8255_0_w){ ppi8255_w(machine().device("ppi8255_0"), (offset >> 4) & 3, data); }
987WRITE8_MEMBER(galaxian_state::turtles_ppi8255_1_w){ ppi8255_w(machine().device("ppi8255_1"), (offset >> 4) & 3, data); }
990988
991989
992990
r14896r14897
996994 *
997995 *************************************/
998996
999static READ8_HANDLER( scorpion_ay8910_r )
997READ8_MEMBER(galaxian_state::scorpion_ay8910_r)
1000998{
1001999   /* the decoding here is very simplistic, and you can address both simultaneously */
10021000   UINT8 result = 0xff;
1003   if (offset & 0x08) result &= ay8910_r(space->machine().device("8910.2"), 0);
1004   if (offset & 0x20) result &= ay8910_r(space->machine().device("8910.1"), 0);
1005   if (offset & 0x80) result &= ay8910_r(space->machine().device("8910.0"), 0);
1001   if (offset & 0x08) result &= ay8910_r(machine().device("8910.2"), 0);
1002   if (offset & 0x20) result &= ay8910_r(machine().device("8910.1"), 0);
1003   if (offset & 0x80) result &= ay8910_r(machine().device("8910.0"), 0);
10061004   return result;
10071005}
10081006
10091007
1010static WRITE8_HANDLER( scorpion_ay8910_w )
1008WRITE8_MEMBER(galaxian_state::scorpion_ay8910_w)
10111009{
10121010   /* the decoding here is very simplistic, and you can address all six simultaneously */
1013   if (offset & 0x04) ay8910_address_w(space->machine().device("8910.2"), 0, data);
1014   if (offset & 0x08) ay8910_data_w(space->machine().device("8910.2"), 0, data);
1015   if (offset & 0x10) ay8910_address_w(space->machine().device("8910.1"), 0, data);
1016   if (offset & 0x20) ay8910_data_w(space->machine().device("8910.1"), 0, data);
1017   if (offset & 0x40) ay8910_address_w(space->machine().device("8910.0"), 0, data);
1018   if (offset & 0x80) ay8910_data_w(space->machine().device("8910.0"), 0, data);
1011   if (offset & 0x04) ay8910_address_w(machine().device("8910.2"), 0, data);
1012   if (offset & 0x08) ay8910_data_w(machine().device("8910.2"), 0, data);
1013   if (offset & 0x10) ay8910_address_w(machine().device("8910.1"), 0, data);
1014   if (offset & 0x20) ay8910_data_w(machine().device("8910.1"), 0, data);
1015   if (offset & 0x40) ay8910_address_w(machine().device("8910.0"), 0, data);
1016   if (offset & 0x80) ay8910_data_w(machine().device("8910.0"), 0, data);
10191017}
10201018
10211019
r14896r14897
10501048   }
10511049}
10521050
1053static READ8_HANDLER( scorpion_digitalker_intr_r )
1051READ8_MEMBER(galaxian_state::scorpion_digitalker_intr_r)
10541052{
1055   device_t *digitalker = space->machine().device("digitalker");
1053   device_t *digitalker = machine().device("digitalker");
10561054   return digitalker_0_intr_r(digitalker);
10571055}
10581056
r14896r14897
10681066   DEVCB_NULL,                                    /* Port A read */
10691067   DEVCB_NULL,                                    /* Port B read */
10701068   DEVCB_HANDLER(scorpion_protection_r),               /* Port C read */
1071   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_w),      /* Port A write */
1069   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),      /* Port A write */
10721070   DEVCB_HANDLER(konami_sound_control_w),               /* Port B write */
10731071   DEVCB_HANDLER(scorpion_protection_w)               /* Port C write */
10741072};
r14896r14897
11171115 *
11181116 *************************************/
11191117
1120static WRITE8_HANDLER( zigzag_bankswap_w )
1118WRITE8_MEMBER(galaxian_state::zigzag_bankswap_w)
11211119{
1122   memory_set_bank(space->machine(), "bank1", data & 1);
1123   memory_set_bank(space->machine(), "bank2", ~data & 1);
1120   memory_set_bank(machine(), "bank1", data & 1);
1121   memory_set_bank(machine(), "bank2", ~data & 1);
11241122}
11251123
11261124
1127static WRITE8_HANDLER( zigzag_ay8910_w )
1125WRITE8_MEMBER(galaxian_state::zigzag_ay8910_w)
11281126{
1129   galaxian_state *state = space->machine().driver_data<galaxian_state>();
11301127   switch (offset & 0x300)
11311128   {
11321129      case 0x000:
r14896r14897
11341131         /* bit 0 = WRITE */
11351132         /* bit 1 = C/D */
11361133         if ((offset & 1) != 0)
1137            ay8910_data_address_w(space->machine().device("aysnd"), offset >> 1, state->m_zigzag_ay8910_latch);
1134            ay8910_data_address_w(machine().device("aysnd"), offset >> 1, m_zigzag_ay8910_latch);
11381135         break;
11391136
11401137      case 0x100:
11411138         /* data latch */
1142         state->m_zigzag_ay8910_latch = offset & 0xff;
1139         m_zigzag_ay8910_latch = offset & 0xff;
11431140         break;
11441141
11451142      case 0x200:
r14896r14897
11851182}
11861183
11871184
1188static WRITE8_HANDLER( kingball_speech_dip_w )
1185WRITE8_MEMBER(galaxian_state::kingball_speech_dip_w)
11891186{
1190   galaxian_state *state = space->machine().driver_data<galaxian_state>();
1191   state->m_kingball_speech_dip = data;
1187   m_kingball_speech_dip = data;
11921188}
11931189
11941190
1195static WRITE8_HANDLER( kingball_sound1_w )
1191WRITE8_MEMBER(galaxian_state::kingball_sound1_w)
11961192{
1197   galaxian_state *state = space->machine().driver_data<galaxian_state>();
1198   state->m_kingball_sound = (state->m_kingball_sound & ~0x01) | data;
1193   m_kingball_sound = (m_kingball_sound & ~0x01) | data;
11991194}
12001195
12011196
1202static WRITE8_HANDLER( kingball_sound2_w )
1197WRITE8_MEMBER(galaxian_state::kingball_sound2_w)
12031198{
1204   galaxian_state *state = space->machine().driver_data<galaxian_state>();
1205   state->m_kingball_sound = (state->m_kingball_sound & ~0x02) | (data << 1);
1206   state->soundlatch_w(*space, 0, state->m_kingball_sound | 0xf0);
1199   m_kingball_sound = (m_kingball_sound & ~0x02) | (data << 1);
1200   soundlatch_byte_w(*&space, 0, m_kingball_sound | 0xf0);
12071201}
12081202
12091203
r14896r14897
12201214 *
12211215 *************************************/
12221216
1223static WRITE8_HANDLER( mshuttle_ay8910_cs_w )
1217WRITE8_MEMBER(galaxian_state::mshuttle_ay8910_cs_w)
12241218{
1225   galaxian_state *state = space->machine().driver_data<galaxian_state>();
1226   state->m_mshuttle_ay8910_cs = data & 1;
1219   m_mshuttle_ay8910_cs = data & 1;
12271220}
12281221
12291222
1230static WRITE8_HANDLER( mshuttle_ay8910_control_w )
1223WRITE8_MEMBER(galaxian_state::mshuttle_ay8910_control_w)
12311224{
1232   galaxian_state *state = space->machine().driver_data<galaxian_state>();
1233   if (!state->m_mshuttle_ay8910_cs)
1234      ay8910_address_w(space->machine().device("aysnd"), offset, data);
1225   if (!m_mshuttle_ay8910_cs)
1226      ay8910_address_w(machine().device("aysnd"), offset, data);
12351227}
12361228
12371229
1238static WRITE8_HANDLER( mshuttle_ay8910_data_w )
1230WRITE8_MEMBER(galaxian_state::mshuttle_ay8910_data_w)
12391231{
1240   galaxian_state *state = space->machine().driver_data<galaxian_state>();
1241   if (!state->m_mshuttle_ay8910_cs)
1242      ay8910_data_w(space->machine().device("aysnd"), offset, data);
1232   if (!m_mshuttle_ay8910_cs)
1233      ay8910_data_w(machine().device("aysnd"), offset, data);
12431234}
12441235
12451236
1246static READ8_HANDLER( mshuttle_ay8910_data_r )
1237READ8_MEMBER(galaxian_state::mshuttle_ay8910_data_r)
12471238{
1248   galaxian_state *state = space->machine().driver_data<galaxian_state>();
1249   if (!state->m_mshuttle_ay8910_cs)
1250      return ay8910_r(space->machine().device("aysnd"), offset);
1239   if (!m_mshuttle_ay8910_cs)
1240      return ay8910_r(machine().device("aysnd"), offset);
12511241   return 0xff;
12521242}
12531243
r14896r14897
12591249 *
12601250 *************************************/
12611251
1262static READ8_HANDLER( jumpbug_protection_r )
1252READ8_MEMBER(galaxian_state::jumpbug_protection_r)
12631253{
12641254   switch (offset)
12651255   {
r14896r14897
12691259      case 0x0235:  return 0x02;
12701260      case 0x0311:  return 0xff;  /* not checked */
12711261   }
1272   logerror("Unknown protection read. Offset: %04X  PC=%04X\n",0xb000+offset,cpu_get_pc(&space->device()));
1262   logerror("Unknown protection read. Offset: %04X  PC=%04X\n",0xb000+offset,cpu_get_pc(&space.device()));
12731263   return 0xff;
12741264}
12751265
r14896r14897
12811271 *
12821272 *************************************/
12831273
1284static WRITE8_HANDLER( checkman_sound_command_w )
1274WRITE8_MEMBER(galaxian_state::checkman_sound_command_w)
12851275{
1286   galaxian_state *state = space->machine().driver_data<galaxian_state>();
1287   state->soundlatch_w(*space, 0, data);
1288   cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
1276   soundlatch_byte_w(*&space, 0, data);
1277   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
12891278}
12901279
12911280
r14896r14897
12951284}
12961285
12971286
1298static READ8_HANDLER( checkmaj_protection_r )
1287READ8_MEMBER(galaxian_state::checkmaj_protection_r)
12991288{
1300   switch (cpu_get_pc(&space->device()))
1289   switch (cpu_get_pc(&space.device()))
13011290   {
13021291      case 0x0f15:  return 0xf5;
13031292      case 0x0f8f:  return 0x7c;
r14896r14897
13061295      case 0x10f1:  return 0xaa;
13071296      case 0x1402:  return 0xaa;
13081297      default:
1309         logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space->device()));
1298         logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space.device()));
13101299   }
13111300
13121301   return 0;
r14896r14897
13201309 *
13211310 *************************************/
13221311
1323static READ8_HANDLER( dingo_3000_r )
1312READ8_MEMBER(galaxian_state::dingo_3000_r)
13241313{
13251314   return 0xaa;
13261315}
13271316
13281317
1329static READ8_HANDLER( dingo_3035_r )
1318READ8_MEMBER(galaxian_state::dingo_3035_r)
13301319{
13311320   return 0x8c;
13321321}
13331322
13341323
1335static READ8_HANDLER( dingoe_3001_r )
1324READ8_MEMBER(galaxian_state::dingoe_3001_r)
13361325{
13371326   return 0xaa;
13381327}
r14896r14897
14381427   AM_RANGE(0x5000, 0x53ff) AM_MIRROR(0x0400) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
14391428   AM_RANGE(0x5800, 0x58ff) AM_MIRROR(0x0700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
14401429   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x07ff) AM_READ_PORT("IN0")
1441   AM_RANGE(0x6000, 0x6001) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(start_lamp_w)
1442   AM_RANGE(0x6002, 0x6002) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(coin_lock_w)
1443   AM_RANGE(0x6003, 0x6003) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(coin_count_0_w)
1430   AM_RANGE(0x6000, 0x6001) AM_MIRROR(0x07f8) AM_WRITE(start_lamp_w)
1431   AM_RANGE(0x6002, 0x6002) AM_MIRROR(0x07f8) AM_WRITE(coin_lock_w)
1432   AM_RANGE(0x6003, 0x6003) AM_MIRROR(0x07f8) AM_WRITE(coin_count_0_w)
14441433   //AM_RANGE(0x6004, 0x6007) AM_MIRROR(0x07f8) AM_DEVWRITE_LEGACY(GAL_AUDIO, galaxian_lfo_freq_w)
14451434   AM_RANGE(0x6800, 0x6800) AM_MIRROR(0x07ff) AM_READ_PORT("IN1")
14461435   //AM_RANGE(0x6800, 0x6807) AM_MIRROR(0x07f8) AM_DEVWRITE_LEGACY(GAL_AUDIO, galaxian_sound_w)
14471436   AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x07ff) AM_READ_PORT("IN2")
1448   AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(irq_enable_w)
1437   AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x07f8) AM_WRITE(irq_enable_w)
14491438   AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x07f8) AM_WRITE(galaxian_stars_enable_w)
14501439   AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_x_w)
14511440   AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_y_w)
r14896r14897
14741463   AM_RANGE(0x9800, 0x98ff) AM_MIRROR(0x0700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
14751464   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x07ff) AM_READ_PORT("IN0")
14761465   AM_RANGE(0xa000, 0xa002) AM_MIRROR(0x07f8) AM_WRITE(galaxian_gfxbank_w)
1477   AM_RANGE(0xa003, 0xa003) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(coin_count_0_w)
1466   AM_RANGE(0xa003, 0xa003) AM_MIRROR(0x07f8) AM_WRITE(coin_count_0_w)
14781467//  AM_RANGE(0xa004, 0xa007) AM_MIRROR(0x07f8) AM_DEVWRITE_LEGACY(GAL_AUDIO, galaxian_lfo_freq_w)
14791468   AM_RANGE(0xa800, 0xa800) AM_MIRROR(0x07ff) AM_READ_PORT("IN1")
14801469//  AM_RANGE(0xa800, 0xa807) AM_MIRROR(0x07f8) AM_DEVWRITE_LEGACY(GAL_AUDIO, galaxian_sound_w)
14811470   AM_RANGE(0xb000, 0xb000) AM_MIRROR(0x07ff) AM_READ_PORT("IN2")
1482   AM_RANGE(0xb000, 0xb000) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(irq_enable_w)
1471   AM_RANGE(0xb000, 0xb000) AM_MIRROR(0x07f8) AM_WRITE(irq_enable_w)
14831472   AM_RANGE(0xb004, 0xb004) AM_MIRROR(0x07f8) AM_WRITE(galaxian_stars_enable_w)
14841473   AM_RANGE(0xb006, 0xb006) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_x_w)
14851474   AM_RANGE(0xb007, 0xb007) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_y_w)
r14896r14897
15061495   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x07ff) AM_READ_PORT("IN0")
15071496   AM_RANGE(0xa800, 0xa800) AM_MIRROR(0x07ff) AM_READ_PORT("IN1")
15081497   AM_RANGE(0xb000, 0xb000) AM_MIRROR(0x07ff) AM_READ_PORT("IN2")
1509   AM_RANGE(0xb000, 0xb000) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(irq_enable_w)
1498   AM_RANGE(0xb000, 0xb000) AM_MIRROR(0x07f8) AM_WRITE(irq_enable_w)
15101499   AM_RANGE(0xb800, 0xb800) AM_MIRROR(0x07ff) AM_READ(watchdog_reset_r)
15111500   AM_RANGE(0xfffe, 0xfffe) AM_NOP //?
15121501ADDRESS_MAP_END
r14896r14897
15271516   AM_RANGE(0xe800, 0xe800) AM_MIRROR(0x07ff) AM_READ_PORT("IN1")
15281517   AM_RANGE(0xe800, 0xe807) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(galaxian_sound_w)
15291518   AM_RANGE(0xf000, 0xf000) AM_MIRROR(0x07ff) AM_READ_PORT("IN2")
1530   AM_RANGE(0xf001, 0xf001) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(irq_enable_w)
1519   AM_RANGE(0xf001, 0xf001) AM_MIRROR(0x07f8) AM_WRITE(irq_enable_w)
15311520   AM_RANGE(0xf004, 0xf004) AM_MIRROR(0x07f8) AM_WRITE(galaxian_stars_enable_w)
15321521   AM_RANGE(0xf006, 0xf006) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_x_w)
15331522   AM_RANGE(0xf007, 0xf007) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_y_w)
r14896r14897
15441533   AM_RANGE(0x4000, 0x47ff) AM_RAM
15451534   AM_RANGE(0x4800, 0x4bff) AM_MIRROR(0x0400) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
15461535   AM_RANGE(0x5000, 0x50ff) AM_MIRROR(0x0700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
1547   AM_RANGE(0x6801, 0x6801) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(irq_enable_w)
1548   AM_RANGE(0x6802, 0x6802) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(coin_count_0_w)
1536   AM_RANGE(0x6801, 0x6801) AM_MIRROR(0x07f8) AM_WRITE(irq_enable_w)
1537   AM_RANGE(0x6802, 0x6802) AM_MIRROR(0x07f8) AM_WRITE(coin_count_0_w)
15491538   AM_RANGE(0x6803, 0x6803) AM_MIRROR(0x07f8) AM_WRITE(scramble_background_enable_w)
15501539   AM_RANGE(0x6804, 0x6804) AM_MIRROR(0x07f8) AM_WRITE(galaxian_stars_enable_w)
15511540   AM_RANGE(0x6805, 0x6805) AM_MIRROR(0x07f8) //POUT2
15521541   AM_RANGE(0x6806, 0x6806) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_x_w)
15531542   AM_RANGE(0x6807, 0x6807) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_y_w)
15541543   AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x07ff) AM_READ(watchdog_reset_r)
1555   AM_RANGE(0x8000, 0xffff) AM_READWRITE_LEGACY(theend_ppi8255_r, theend_ppi8255_w)
1544   AM_RANGE(0x8000, 0xffff) AM_READWRITE(theend_ppi8255_r, theend_ppi8255_w)
15561545ADDRESS_MAP_END
15571546
15581547
r14896r14897
15651554   AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x4700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
15661555   AM_RANGE(0x9800, 0x9803) AM_MIRROR(0x47fc) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)
15671556   AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x47fc) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
1568   AM_RANGE(0xa801, 0xa801) AM_MIRROR(0x47f8) AM_WRITE_LEGACY(irq_enable_w)
1569   AM_RANGE(0xa802, 0xa802) AM_MIRROR(0x47f8) AM_WRITE_LEGACY(coin_count_0_w)
1557   AM_RANGE(0xa801, 0xa801) AM_MIRROR(0x47f8) AM_WRITE(irq_enable_w)
1558   AM_RANGE(0xa802, 0xa802) AM_MIRROR(0x47f8) AM_WRITE(coin_count_0_w)
15701559   AM_RANGE(0xa803, 0xa803) AM_MIRROR(0x47f8) AM_WRITE(scramble_background_enable_w)
15711560   AM_RANGE(0xa804, 0xa804) AM_MIRROR(0x47f8) AM_WRITE(galaxian_stars_enable_w)
15721561   AM_RANGE(0xa805, 0xa805) AM_MIRROR(0x47f8) /* POUT2 */
r14896r14897
15811570   AM_RANGE(0x0000, 0x03ff) AM_ROM
15821571   AM_RANGE(0x0400, 0x0bff) AM_RAM
15831572   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
1584   AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x01f8) AM_WRITE_LEGACY(irq_enable_w)
1585   AM_RANGE(0x1002, 0x1002) AM_MIRROR(0x01f8) AM_WRITE_LEGACY(coin_count_0_w)
1573   AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x01f8) AM_WRITE(irq_enable_w)
1574   AM_RANGE(0x1002, 0x1002) AM_MIRROR(0x01f8) AM_WRITE(coin_count_0_w)
15861575   AM_RANGE(0x1003, 0x1003) AM_MIRROR(0x01f8) AM_WRITE(scramble_background_enable_w)
15871576   AM_RANGE(0x1004, 0x1004) AM_MIRROR(0x01f8) AM_WRITE(galaxian_stars_enable_w)
15881577   AM_RANGE(0x1005, 0x1005) AM_MIRROR(0x01f8) //POUT2
r14896r14897
16031592   AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
16041593   AM_RANGE(0x2000, 0x20ff) AM_MIRROR(0x0300) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
16051594   AM_RANGE(0x2400, 0x2403) AM_MIRROR(0x01fc) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
1606   AM_RANGE(0x2601, 0x2601) AM_MIRROR(0x01f8) AM_WRITE_LEGACY(irq_enable_w)
1607   AM_RANGE(0x2602, 0x2602) AM_MIRROR(0x01f8) AM_WRITE_LEGACY(coin_count_0_w)
1595   AM_RANGE(0x2601, 0x2601) AM_MIRROR(0x01f8) AM_WRITE(irq_enable_w)
1596   AM_RANGE(0x2602, 0x2602) AM_MIRROR(0x01f8) AM_WRITE(coin_count_0_w)
16081597   AM_RANGE(0x2603, 0x2603) AM_MIRROR(0x01f8) AM_WRITE(scramble_background_enable_w)
16091598   AM_RANGE(0x2604, 0x2604) AM_MIRROR(0x01f8) AM_WRITE(galaxian_stars_enable_w)
16101599   AM_RANGE(0x2605, 0x2605) AM_MIRROR(0x01f8) //POUT2
r14896r14897
16251614   AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x07ff) AM_READ(watchdog_reset_r)
16261615   AM_RANGE(0xa800, 0xabff) AM_MIRROR(0x0400) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
16271616   AM_RANGE(0xb000, 0xb0ff) AM_MIRROR(0x0700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
1628   AM_RANGE(0xb808, 0xb808) AM_MIRROR(0x07e3) AM_WRITE_LEGACY(irq_enable_w)
1617   AM_RANGE(0xb808, 0xb808) AM_MIRROR(0x07e3) AM_WRITE(irq_enable_w)
16291618   AM_RANGE(0xb80c, 0xb80c) AM_MIRROR(0x07e3) AM_WRITE(galaxian_flip_screen_y_w)
16301619   AM_RANGE(0xb810, 0xb810) AM_MIRROR(0x07e3) AM_WRITE(galaxian_flip_screen_x_w)
1631   AM_RANGE(0xb818, 0xb818) AM_MIRROR(0x07e3) AM_WRITE_LEGACY(coin_count_0_w)   /* IOPC7 */
1632   AM_RANGE(0xb81c, 0xb81c) AM_MIRROR(0x07e3) AM_WRITE_LEGACY(coin_count_1_w)   /* POUT1 */
1633   AM_RANGE(0xc000, 0xffff) AM_READWRITE_LEGACY(frogger_ppi8255_r, frogger_ppi8255_w)
1620   AM_RANGE(0xb818, 0xb818) AM_MIRROR(0x07e3) AM_WRITE(coin_count_0_w)   /* IOPC7 */
1621   AM_RANGE(0xb81c, 0xb81c) AM_MIRROR(0x07e3) AM_WRITE(coin_count_1_w)   /* POUT1 */
1622   AM_RANGE(0xc000, 0xffff) AM_READWRITE(frogger_ppi8255_r, frogger_ppi8255_w)
16341623ADDRESS_MAP_END
16351624
16361625
r14896r14897
16421631   AM_RANGE(0x9000, 0x93ff) AM_MIRROR(0x4400) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
16431632   AM_RANGE(0x9800, 0x98ff) AM_MIRROR(0x4700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
16441633   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x47c7) AM_WRITE(scramble_background_red_w)
1645   AM_RANGE(0xa008, 0xa008) AM_MIRROR(0x47c7) AM_WRITE_LEGACY(irq_enable_w)
1634   AM_RANGE(0xa008, 0xa008) AM_MIRROR(0x47c7) AM_WRITE(irq_enable_w)
16461635   AM_RANGE(0xa010, 0xa010) AM_MIRROR(0x47c7) AM_WRITE(galaxian_flip_screen_y_w)
16471636   AM_RANGE(0xa018, 0xa018) AM_MIRROR(0x47c7) AM_WRITE(galaxian_flip_screen_x_w)
16481637   AM_RANGE(0xa020, 0xa020) AM_MIRROR(0x47c7) AM_WRITE(scramble_background_green_w)
16491638   AM_RANGE(0xa028, 0xa028) AM_MIRROR(0x47c7) AM_WRITE(scramble_background_blue_w)
1650   AM_RANGE(0xa030, 0xa030) AM_MIRROR(0x47c7) AM_WRITE_LEGACY(coin_count_0_w)
1651   AM_RANGE(0xa038, 0xa038) AM_MIRROR(0x47c7) AM_WRITE_LEGACY(coin_count_1_w)
1639   AM_RANGE(0xa030, 0xa030) AM_MIRROR(0x47c7) AM_WRITE(coin_count_0_w)
1640   AM_RANGE(0xa038, 0xa038) AM_MIRROR(0x47c7) AM_WRITE(coin_count_1_w)
16521641   AM_RANGE(0xa800, 0xa800) AM_MIRROR(0x47ff) AM_READ(watchdog_reset_r)
1653   AM_RANGE(0xb000, 0xb03f) AM_MIRROR(0x47cf) AM_READWRITE_LEGACY(turtles_ppi8255_0_r, turtles_ppi8255_0_w)
1654   AM_RANGE(0xb800, 0xb83f) AM_MIRROR(0x47cf) AM_READWRITE_LEGACY(turtles_ppi8255_1_r, turtles_ppi8255_1_w)
1642   AM_RANGE(0xb000, 0xb03f) AM_MIRROR(0x47cf) AM_READWRITE(turtles_ppi8255_0_r, turtles_ppi8255_0_w)
1643   AM_RANGE(0xb800, 0xb83f) AM_MIRROR(0x47cf) AM_READWRITE(turtles_ppi8255_1_r, turtles_ppi8255_1_w)
16551644ADDRESS_MAP_END
16561645
16571646
r14896r14897
16631652   AM_RANGE(0x4800, 0x4bff) AM_MIRROR(0x0400) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
16641653   AM_RANGE(0x5000, 0x50ff) AM_MIRROR(0x0700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
16651654   AM_RANGE(0x6800, 0x6800) AM_MIRROR(0x07f8) AM_WRITE(scramble_background_red_w)
1666   AM_RANGE(0x6801, 0x6801) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(irq_enable_w)
1667   AM_RANGE(0x6802, 0x6802) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(coin_count_0_w)
1655   AM_RANGE(0x6801, 0x6801) AM_MIRROR(0x07f8) AM_WRITE(irq_enable_w)
1656   AM_RANGE(0x6802, 0x6802) AM_MIRROR(0x07f8) AM_WRITE(coin_count_0_w)
16681657   AM_RANGE(0x6803, 0x6803) AM_MIRROR(0x07f8) AM_WRITE(scramble_background_blue_w)
16691658   AM_RANGE(0x6804, 0x6804) AM_MIRROR(0x07f8) AM_WRITE(galaxian_stars_enable_w)
16701659   AM_RANGE(0x6805, 0x6805) AM_MIRROR(0x07f8) AM_WRITE(scramble_background_green_w)
16711660   AM_RANGE(0x6806, 0x6806) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_x_w)
16721661   AM_RANGE(0x6807, 0x6807) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_y_w)
16731662   AM_RANGE(0x7000, 0x7fff) AM_ROM
1674   AM_RANGE(0x8000, 0xbfff) AM_READWRITE_LEGACY(theend_ppi8255_r, theend_ppi8255_w)
1663   AM_RANGE(0x8000, 0xbfff) AM_READWRITE(theend_ppi8255_r, theend_ppi8255_w)
16751664   AM_RANGE(0xc000, 0xefff) AM_ROM
16761665ADDRESS_MAP_END
16771666
r14896r14897
16831672   AM_RANGE(0x4800, 0x4bff) AM_MIRROR(0x0400) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
16841673   AM_RANGE(0x5000, 0x50ff) AM_MIRROR(0x0700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
16851674   AM_RANGE(0x6800, 0x6800) AM_MIRROR(0x07f8) AM_WRITE(scramble_background_red_w)
1686   AM_RANGE(0x6801, 0x6801) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(irq_enable_w)
1687   AM_RANGE(0x6802, 0x6802) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(coin_count_0_w)
1675   AM_RANGE(0x6801, 0x6801) AM_MIRROR(0x07f8) AM_WRITE(irq_enable_w)
1676   AM_RANGE(0x6802, 0x6802) AM_MIRROR(0x07f8) AM_WRITE(coin_count_0_w)
16881677   AM_RANGE(0x6803, 0x6803) AM_MIRROR(0x07f8) AM_WRITE(scramble_background_blue_w)
16891678   AM_RANGE(0x6804, 0x6804) AM_MIRROR(0x07f8) AM_WRITE(galaxian_stars_enable_w)
16901679   AM_RANGE(0x6805, 0x6805) AM_MIRROR(0x07f8) AM_WRITE(scramble_background_green_w)
16911680   AM_RANGE(0x6806, 0x6806) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_x_w)
16921681   AM_RANGE(0x6807, 0x6807) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_y_w)
1693   AM_RANGE(0x8000, 0xbfff) AM_READWRITE_LEGACY(theend_ppi8255_r, theend_ppi8255_w)
1682   AM_RANGE(0x8000, 0xbfff) AM_READWRITE(theend_ppi8255_r, theend_ppi8255_w)
16941683   AM_RANGE(0xc000, 0xd7ff) AM_ROM
1695   AM_RANGE(0xd800, 0xd800) AM_READ_LEGACY(monsterz_protection_r)
1684   AM_RANGE(0xd800, 0xd800) AM_READ(monsterz_protection_r)
16961685ADDRESS_MAP_END
16971686
16981687
r14896r14897
17171706   AM_RANGE(0x6002, 0x6006) AM_MIRROR(0x07f8) AM_WRITE(galaxian_gfxbank_w)
17181707   AM_RANGE(0x6800, 0x6800) AM_MIRROR(0x07ff) AM_READ_PORT("IN1")
17191708   AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x07ff) AM_READ_PORT("IN2")
1720   AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(irq_enable_w)
1721   AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x07f8) AM_WRITE_LEGACY(coin_count_0_w)
1709   AM_RANGE(0x7001, 0x7001) AM_MIRROR(0x07f8) AM_WRITE(irq_enable_w)
1710   AM_RANGE(0x7002, 0x7002) AM_MIRROR(0x07f8) AM_WRITE(coin_count_0_w)
17221711   AM_RANGE(0x7004, 0x7004) AM_MIRROR(0x07f8) AM_WRITE(galaxian_stars_enable_w)
17231712   AM_RANGE(0x7006, 0x7006) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_x_w)
17241713   AM_RANGE(0x7007, 0x7007) AM_MIRROR(0x07f8) AM_WRITE(galaxian_flip_screen_y_w)
17251714   AM_RANGE(0x8000, 0xafff) AM_ROM
1726   AM_RANGE(0xb000, 0xbfff) AM_READ_LEGACY(jumpbug_protection_r)
1715   AM_RANGE(0xb000, 0xbfff) AM_READ(jumpbug_protection_r)
17271716ADDRESS_MAP_END
17281717
17291718
r14896r14897
17341723   AM_RANGE(0x8800, 0x8bff) AM_MIRROR(0x0400) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
17351724   AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x0700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
17361725   AM_RANGE(0xa802, 0xa802) AM_MIRROR(0x07f1) AM_WRITE(galaxian_flip_screen_x_w)
1737   AM_RANGE(0xa804, 0xa804) AM_MIRROR(0x07f1) AM_WRITE_LEGACY(irq_enable_w)
1726   AM_RANGE(0xa804, 0xa804) AM_MIRROR(0x07f1) AM_WRITE(irq_enable_w)
17381727   AM_RANGE(0xa806, 0xa806) AM_MIRROR(0x07f1) AM_WRITE(galaxian_flip_screen_y_w)
1739   AM_RANGE(0xa808, 0xa808) AM_MIRROR(0x07f1) AM_WRITE_LEGACY(coin_count_1_w)
1740   AM_RANGE(0xa80e, 0xa80e) AM_MIRROR(0x07f1) AM_WRITE_LEGACY(coin_count_0_w)
1728   AM_RANGE(0xa808, 0xa808) AM_MIRROR(0x07f1) AM_WRITE(coin_count_1_w)
1729   AM_RANGE(0xa80e, 0xa80e) AM_MIRROR(0x07f1) AM_WRITE(coin_count_0_w)
17411730   AM_RANGE(0xb800, 0xb800) AM_MIRROR(0x07ff) AM_READ(watchdog_reset_r)
1742   AM_RANGE(0xc000, 0xffff) AM_READWRITE_LEGACY(frogf_ppi8255_r, frogf_ppi8255_w)
1731   AM_RANGE(0xc000, 0xffff) AM_READWRITE(frogf_ppi8255_r, frogf_ppi8255_w)
17431732ADDRESS_MAP_END
17441733
17451734
r14896r14897
17511740   AM_RANGE(0x9000, 0x93ff) AM_MIRROR(0x0400) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(m_videoram)
17521741   AM_RANGE(0x9800, 0x98ff) AM_MIRROR(0x0700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
17531742   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
1754   AM_RANGE(0xa000, 0xa000) AM_WRITE_LEGACY(irq_enable_w)
1743   AM_RANGE(0xa000, 0xa000) AM_WRITE(irq_enable_w)
17551744   AM_RANGE(0xa001, 0xa001) AM_WRITE(galaxian_stars_enable_w)
17561745   AM_RANGE(0xa002, 0xa002) AM_WRITE(galaxian_flip_screen_xy_w)
17571746   AM_RANGE(0xa004, 0xa004) AM_WRITE_LEGACY(cclimber_sample_trigger_w)
1758   AM_RANGE(0xa007, 0xa007) AM_WRITE_LEGACY(mshuttle_ay8910_cs_w)
1747   AM_RANGE(0xa007, 0xa007) AM_WRITE(mshuttle_ay8910_cs_w)
17591748   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN1")
17601749   AM_RANGE(0xa800, 0xa800) AM_WRITE_LEGACY(cclimber_sample_rate_w)
17611750   AM_RANGE(0xb000, 0xb000) AM_READ_PORT("IN2")
r14896r14897
17661755static ADDRESS_MAP_START( mshuttle_portmap, AS_IO, 8, galaxian_state )
17671756   ADDRESS_MAP_UNMAP_HIGH
17681757   ADDRESS_MAP_GLOBAL_MASK(0x0f)
1769   AM_RANGE(0x08, 0x08) AM_WRITE_LEGACY(mshuttle_ay8910_control_w)
1770   AM_RANGE(0x09, 0x09) AM_WRITE_LEGACY(mshuttle_ay8910_data_w)
1771   AM_RANGE(0x0c, 0x0c) AM_READ_LEGACY(mshuttle_ay8910_data_r)
1758   AM_RANGE(0x08, 0x08) AM_WRITE(mshuttle_ay8910_control_w)
1759   AM_RANGE(0x09, 0x09) AM_WRITE(mshuttle_ay8910_data_w)
1760   AM_RANGE(0x0c, 0x0c) AM_READ(mshuttle_ay8910_data_r)
17721761ADDRESS_MAP_END
17731762
17741763
1775static WRITE8_HANDLER( tenspot_unk_6000_w )
1764WRITE8_MEMBER(galaxian_state::tenspot_unk_6000_w)
17761765{
17771766   logerror("tenspot_unk_6000_w %02x\n",data);
17781767}
17791768
1780static WRITE8_HANDLER( tenspot_unk_8000_w )
1769WRITE8_MEMBER(galaxian_state::tenspot_unk_8000_w)
17811770{
17821771   logerror("tenspot_unk_8000_w %02x\n",data);
17831772}
17841773
1785static WRITE8_HANDLER( tenspot_unk_e000_w )
1774WRITE8_MEMBER(galaxian_state::tenspot_unk_e000_w)
17861775{
17871776   logerror("tenspot_unk_e000_w %02x\n",data);
17881777}
r14896r14897
17921781   AM_RANGE(0x0000, 0x07ff) AM_ROM
17931782   AM_RANGE(0x2000, 0x23ff) AM_RAM
17941783   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("SELECT2")
1795   AM_RANGE(0x6000, 0x6000) AM_WRITE_LEGACY(tenspot_unk_6000_w)
1784   AM_RANGE(0x6000, 0x6000) AM_WRITE(tenspot_unk_6000_w)
17961785   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("SELECT")
1797   AM_RANGE(0x8000, 0x8000) AM_WRITE_LEGACY(tenspot_unk_8000_w)
1786   AM_RANGE(0x8000, 0x8000) AM_WRITE(tenspot_unk_8000_w)
17981787   AM_RANGE(0xa000, 0xa03f) AM_RAM
1799   AM_RANGE(0xe000, 0xe000) AM_WRITE_LEGACY(tenspot_unk_e000_w)
1788   AM_RANGE(0xe000, 0xe000) AM_WRITE(tenspot_unk_e000_w)
18001789ADDRESS_MAP_END
18011790
18021791/*************************************
r14896r14897
18101799   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
18111800   AM_RANGE(0x0000, 0x1fff) AM_ROM
18121801   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x1c00) AM_RAM
1813    AM_RANGE(0x6000, 0x6fff) AM_MIRROR(0x1000) AM_WRITE_LEGACY(konami_sound_filter_w)
1802    AM_RANGE(0x6000, 0x6fff) AM_MIRROR(0x1000) AM_WRITE(konami_sound_filter_w)
18141803ADDRESS_MAP_END
18151804
18161805static ADDRESS_MAP_START( frogger_sound_portmap, AS_IO, 8, galaxian_state )
18171806   ADDRESS_MAP_GLOBAL_MASK(0xff)
1818   AM_RANGE(0x00, 0xff) AM_READWRITE_LEGACY(frogger_ay8910_r, frogger_ay8910_w)
1807   AM_RANGE(0x00, 0xff) AM_READWRITE(frogger_ay8910_r, frogger_ay8910_w)
18191808ADDRESS_MAP_END
18201809
18211810
r14896r14897
18231812static ADDRESS_MAP_START( konami_sound_map, AS_PROGRAM, 8, galaxian_state )
18241813   AM_RANGE(0x0000, 0x2fff) AM_ROM
18251814   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x6c00) AM_RAM
1826    AM_RANGE(0x9000, 0x9fff) AM_MIRROR(0x6000) AM_WRITE_LEGACY(konami_sound_filter_w)
1815    AM_RANGE(0x9000, 0x9fff) AM_MIRROR(0x6000) AM_WRITE(konami_sound_filter_w)
18271816ADDRESS_MAP_END
18281817
18291818static ADDRESS_MAP_START( konami_sound_portmap, AS_IO, 8, galaxian_state )
18301819   ADDRESS_MAP_GLOBAL_MASK(0xff)
1831   AM_RANGE(0x00, 0xff) AM_READWRITE_LEGACY(konami_ay8910_r, konami_ay8910_w)
1820   AM_RANGE(0x00, 0xff) AM_READWRITE(konami_ay8910_r, konami_ay8910_w)
18321821ADDRESS_MAP_END
18331822
18341823
r14896r14897
18421831static ADDRESS_MAP_START( checkman_sound_portmap, AS_IO, 8, galaxian_state )
18431832   ADDRESS_MAP_UNMAP_HIGH
18441833   ADDRESS_MAP_GLOBAL_MASK(0xff)
1845   AM_RANGE(0x03, 0x03) AM_READ(soundlatch_r)
1834   AM_RANGE(0x03, 0x03) AM_READ(soundlatch_byte_r)
18461835   AM_RANGE(0x04, 0x05) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
18471836   AM_RANGE(0x06, 0x06) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
18481837ADDRESS_MAP_END
r14896r14897
18691858static ADDRESS_MAP_START( kingball_sound_portmap, AS_IO, 8, galaxian_state )
18701859   ADDRESS_MAP_UNMAP_HIGH
18711860   ADDRESS_MAP_GLOBAL_MASK(0xff)
1872   AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_READ(soundlatch_r) AM_DEVWRITE_LEGACY("dac", kingball_dac_w)
1861   AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_READ(soundlatch_byte_r) AM_DEVWRITE_LEGACY("dac", kingball_dac_w)
18731862ADDRESS_MAP_END
18741863
18751864
r14896r14897
18811870
18821871static ADDRESS_MAP_START( sfx_sample_portmap, AS_IO, 8, galaxian_state )
18831872   ADDRESS_MAP_GLOBAL_MASK(0xff)
1884   AM_RANGE(0x00, 0xff) AM_READWRITE_LEGACY(sfx_sample_io_r, sfx_sample_io_w)
1873   AM_RANGE(0x00, 0xff) AM_READWRITE(sfx_sample_io_r, sfx_sample_io_w)
18851874ADDRESS_MAP_END
18861875
18871876
r14896r14897
19741963{
19751964   AY8910_DISCRETE_OUTPUT,
19761965   {RES_K(5.1), RES_K(5.1), RES_K(5.1)},
1977   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
1966   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
19781967   DEVCB_HANDLER(frogger_sound_timer_r),
19791968   DEVCB_NULL,
19801969   DEVCB_NULL
r14896r14897
19841973{
19851974   AY8910_DISCRETE_OUTPUT,
19861975   {RES_K(5.1), RES_K(5.1), RES_K(5.1)},
1987   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
1976   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
19881977   DEVCB_HANDLER(konami_sound_timer_r),
19891978   DEVCB_NULL,
19901979   DEVCB_NULL
r14896r14897
20262015   AY8910_DEFAULT_LOADS,
20272016   DEVCB_NULL,
20282017   DEVCB_NULL,
2029   DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_w),
2018   DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_byte_w),
20302019   DEVCB_HANDLER(sfx_sample_control_w)
20312020};
20322021
r14896r14897
20442033{
20452034   AY8910_LEGACY_OUTPUT,
20462035   AY8910_DEFAULT_LOADS,
2047   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
2036   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
20482037   DEVCB_NULL,
20492038   DEVCB_NULL,
20502039   DEVCB_NULL
r14896r14897
29182907   space->set_decrypted_region(0x0000, 0x7fff, decrypt);
29192908}
29202909
2921static WRITE8_HANDLER( artic_gfxbank_w )
2910WRITE8_MEMBER(galaxian_state::artic_gfxbank_w)
29222911{
29232912//  printf("artic_gfxbank_w %02x\n",data);
29242913}
29252914
29262915static DRIVER_INIT( pacmanbl )
29272916{
2917   galaxian_state *state = machine.driver_data<galaxian_state>();
29282918   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
29292919
29302920   /* same as galaxian... */
29312921   DRIVER_INIT_CALL(galaxian);
29322922
29332923   /* ...but coin lockout disabled/disconnected */
2934   space->install_legacy_write_handler(0x6002, 0x6002, 0, 0x7f8, FUNC(artic_gfxbank_w));
2924   space->install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::artic_gfxbank_w),state));
29352925}
29362926
2937static READ8_HANDLER( tenspot_dsw_read )
2927READ8_MEMBER(galaxian_state::tenspot_dsw_read)
29382928{
2939   galaxian_state *state = space->machine().driver_data<galaxian_state>();
29402929   char tmp[64];
2941   sprintf(tmp,"IN2_GAME%d", state->m_tenspot_current_game);
2942   return input_port_read_safe(space->machine(), tmp, 0x00);
2930   sprintf(tmp,"IN2_GAME%d", m_tenspot_current_game);
2931   return input_port_read_safe(machine(), tmp, 0x00);
29432932}
29442933
29452934
r14896r14897
30032992
30042993   DRIVER_INIT_CALL(galaxian);
30052994
3006   space->install_legacy_write_handler(0x6002, 0x6002, 0, 0x7f8, FUNC(artic_gfxbank_w));
2995   space->install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::artic_gfxbank_w),state));
30072996
30082997   state->m_tenspot_current_game = 0;
30092998
30102999   tenspot_set_game_bank(machine, state->m_tenspot_current_game, 0);
30113000
3012   space->install_legacy_read_handler(0x7000, 0x7000, FUNC(tenspot_dsw_read));
3001   space->install_read_handler(0x7000, 0x7000, read8_delegate(FUNC(galaxian_state::tenspot_dsw_read),state));
30133002}
30143003
30153004
r14896r14897
30493038   memory_set_bankptr(machine, "bank3", machine.region("maincpu")->base() + 0x0000);
30503039
30513040   /* handler for doing the swaps */
3052   space->install_legacy_write_handler(0x7002, 0x7002, 0, 0x07f8, FUNC(zigzag_bankswap_w));
3053   zigzag_bankswap_w(space, 0, 0);
3041   space->install_write_handler(0x7002, 0x7002, 0, 0x07f8, write8_delegate(FUNC(galaxian_state::zigzag_bankswap_w),state));
3042   state->zigzag_bankswap_w(*space, 0, 0);
30543043
30553044   /* coin lockout disabled */
30563045   space->unmap_write(0x6002, 0x6002, 0, 0x7f8);
r14896r14897
30593048   unmap_galaxian_sound(machine, 0x6000);
30603049
30613050   /* install our AY-8910 handler */
3062   space->install_legacy_write_handler(0x4800, 0x4fff, FUNC(zigzag_ay8910_w));
3051   space->install_write_handler(0x4800, 0x4fff, write8_delegate(FUNC(galaxian_state::zigzag_ay8910_w),state));
30633052}
30643053
30653054
r14896r14897
30743063{
30753064   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
30763065   address_space *iospace = machine.device("maincpu")->memory().space(AS_IO);
3066   galaxian_state *state = machine.driver_data<galaxian_state>();
30773067
30783068   /* video extensions */
30793069   common_init(machine, galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
30803070
30813071   /* move the interrupt enable from $b000 to $b001 */
30823072   space->unmap_write(0xb000, 0xb000, 0, 0x7f8);
3083   space->install_legacy_write_handler(0xb001, 0xb001, 0, 0x7f8, FUNC(irq_enable_w));
3073   space->install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),state));
30843074
30853075   /* attach the sound command handler */
3086   iospace->install_legacy_write_handler(0x00, 0x00, 0, 0xffff, FUNC(checkman_sound_command_w));
3076   iospace->install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),state));
30873077
30883078   /* decrypt program code */
30893079   decode_checkman(machine);
r14896r14897
30923082
30933083static DRIVER_INIT( checkmaj )
30943084{
3085   galaxian_state *state = machine.driver_data<galaxian_state>();
30953086   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
30963087
30973088   /* video extensions */
30983089   common_init(machine, galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
30993090
31003091   /* attach the sound command handler */
3101   space->install_legacy_write_handler(0x7800, 0x7800, 0, 0x7ff, FUNC(checkman_sound_command_w));
3092   space->install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),state));
31023093
31033094   /* for the title screen */
3104   space->install_legacy_read_handler(0x3800, 0x3800, FUNC(checkmaj_protection_r));
3095   space->install_read_handler(0x3800, 0x3800, read8_delegate(FUNC(galaxian_state::checkmaj_protection_r),state));
31053096}
31063097
31073098
31083099static DRIVER_INIT( dingo )
31093100{
3101   galaxian_state *state = machine.driver_data<galaxian_state>();
31103102   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
31113103
31123104   /* video extensions */
31133105   common_init(machine, galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
31143106
31153107   /* attach the sound command handler */
3116   space->install_legacy_write_handler(0x7800, 0x7800, 0, 0x7ff, FUNC(checkman_sound_command_w));
3108   space->install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),state));
31173109
3118   space->install_legacy_read_handler(0x3000, 0x3000, FUNC(dingo_3000_r));
3119   space->install_legacy_read_handler(0x3035, 0x3035, FUNC(dingo_3035_r));
3110   space->install_read_handler(0x3000, 0x3000, read8_delegate(FUNC(galaxian_state::dingo_3000_r),state));
3111   space->install_read_handler(0x3035, 0x3035, read8_delegate(FUNC(galaxian_state::dingo_3035_r),state));
31203112}
31213113
31223114
31233115static DRIVER_INIT( dingoe )
31243116{
3117   galaxian_state *state = machine.driver_data<galaxian_state>();
31253118   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
31263119   address_space *iospace = machine.device("maincpu")->memory().space(AS_IO);
31273120
r14896r14897
31303123
31313124   /* move the interrupt enable from $b000 to $b001 */
31323125   space->unmap_write(0xb000, 0xb000, 0, 0x7f8);
3133   space->install_legacy_write_handler(0xb001, 0xb001, 0, 0x7f8, FUNC(irq_enable_w));
3126   space->install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),state));
31343127
31353128   /* attach the sound command handler */
3136   iospace->install_legacy_write_handler(0x00, 0x00, 0, 0xffff, FUNC(checkman_sound_command_w));
3129   iospace->install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),state));
31373130
3138   space->install_legacy_read_handler(0x3001, 0x3001, FUNC(dingoe_3001_r));   /* Protection check */
3131   space->install_read_handler(0x3001, 0x3001, read8_delegate(FUNC(galaxian_state::dingoe_3001_r),state));   /* Protection check */
31393132
31403133   /* decrypt program code */
31413134   decode_dingoe(machine);
r14896r14897
32993292   /* video extensions */
33003293   common_init(machine, galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
33013294
3302   space->install_legacy_write_handler(0xb000, 0xb000, 0, 0x7f8, FUNC(kingball_sound1_w));
3303   space->install_legacy_write_handler(0xb001, 0xb001, 0, 0x7f8, FUNC(irq_enable_w));
3304   space->install_legacy_write_handler(0xb002, 0xb002, 0, 0x7f8, FUNC(kingball_sound2_w));
3305   space->install_legacy_write_handler(0xb003, 0xb003, 0, 0x7f8, FUNC(kingball_speech_dip_w));
3295   space->install_write_handler(0xb000, 0xb000, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::kingball_sound1_w),state));
3296   space->install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),state));
3297   space->install_write_handler(0xb002, 0xb002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::kingball_sound2_w),state));
3298   space->install_write_handler(0xb003, 0xb003, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::kingball_speech_dip_w),state));
33063299
33073300   state_save_register_global(machine, state->m_kingball_speech_dip);
33083301   state_save_register_global(machine, state->m_kingball_sound);
r14896r14897
33113304
33123305static DRIVER_INIT( scorpnmc )
33133306{
3307   galaxian_state *state = machine.driver_data<galaxian_state>();
33143308   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
33153309
33163310   /* video extensions */
r14896r14897
33183312
33193313   /* move the interrupt enable from $b000 to $b001 */
33203314   space->unmap_write(0xb000, 0xb000, 0, 0x7f8);
3321   space->install_legacy_write_handler(0xb001, 0xb001, 0, 0x7f8, FUNC(irq_enable_w));
3315   space->install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),state));
33223316
33233317   /* extra ROM */
33243318   space->install_rom(0x5000, 0x67ff, machine.region("maincpu")->base() + 0x5000);
r14896r14897
33323326
33333327static DRIVER_INIT( thepitm )
33343328{
3329   galaxian_state *state = machine.driver_data<galaxian_state>();
33353330   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
33363331
33373332   /* video extensions */
r14896r14897
33393334
33403335   /* move the interrupt enable from $b000 to $b001 */
33413336   space->unmap_write(0xb000, 0xb000, 0, 0x7f8);
3342   space->install_legacy_write_handler(0xb001, 0xb001, 0, 0x7f8, FUNC(irq_enable_w));
3337   space->install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),state));
33433338
33443339   /* disable the stars */
33453340   space->unmap_write(0xb004, 0xb004, 0, 0x07f8);
r14896r14897
33903385   space->install_read_port(0x8001, 0x8001, 0, 0xffc, "IN1");
33913386   space->install_read_port(0x8002, 0x8002, 0, 0xffc, "IN2");
33923387   space->install_read_port(0x8003, 0x8003, 0, 0xffc, "IN3");
3393   space->install_write_handler(0x8000, 0x8000, 0, 0xfff, write8_delegate(FUNC(galaxian_state::soundlatch_w),state));
3394   space->install_legacy_write_handler(0x9000, 0x9000, 0, 0xfff, FUNC(explorer_sound_control_w));
3388   space->install_write_handler(0x8000, 0x8000, 0, 0xfff, write8_delegate(FUNC(galaxian_state::soundlatch_byte_w),state));
3389   space->install_write_handler(0x9000, 0x9000, 0, 0xfff, write8_delegate(FUNC(galaxian_state::explorer_sound_control_w),state));
33953390}
33963391
33973392
r14896r14897
34603455   /* video extensions */
34613456   common_init(machine, NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
34623457
3463   space->install_write_handler(0xa800, 0xa800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::soundlatch_w),state));
3464   space->install_legacy_write_handler(0xb001, 0xb001, 0, 0x7f8, FUNC(froggrmc_sound_control_w));
3458   space->install_write_handler(0xa800, 0xa800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::soundlatch_byte_w),state));
3459   space->install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::froggrmc_sound_control_w),state));
34653460
34663461   /* actually needs 2k of RAM */
34673462   space->install_ram(0x8000, 0x87ff);
r14896r14897
35003495
35013496static DRIVER_INIT( scorpion )
35023497{
3498   galaxian_state *state = machine.driver_data<galaxian_state>();
35033499   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
35043500
35053501   common_init(machine, scramble_draw_bullet, scramble_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
35063502
35073503   /* hook up AY8910 */
3508   machine.device("audiocpu")->memory().space(AS_IO)->install_legacy_readwrite_handler(0x00, 0xff, FUNC(scorpion_ay8910_r), FUNC(scorpion_ay8910_w));
3504   machine.device("audiocpu")->memory().space(AS_IO)->install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),state), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),state));
35093505
35103506   /* extra ROM */
35113507   space->install_read_bank(0x5800, 0x67ff, "bank1");
r14896r14897
35143510   /* no background related */
35153511//  space->nop_write(0x6803, 0x6803);
35163512
3517   machine.device("audiocpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3000, 0x3000, FUNC(scorpion_digitalker_intr_r));
3513   machine.device("audiocpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3000, 0x3000, read8_delegate(FUNC(galaxian_state::scorpion_digitalker_intr_r),state));
35183514/*
35193515{
35203516    const UINT8 *rom = machine.region("speech")->base();
src/mame/drivers/kickgoal.c
r14896r14897
493493   AM_RANGE(0xa0c000, 0xa0ffff) AM_RAM // more tilemap?
494494   AM_RANGE(0xa10000, 0xa1000f) AM_WRITEONLY AM_BASE(m_scrram) /* Scroll Registers */
495495   AM_RANGE(0xb00000, 0xb007ff) AM_WRITEONLY AM_BASE_SIZE(m_spriteram, m_spriteram_size) /* Sprites */
496   AM_RANGE(0xc00000, 0xc007ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram") /* Palette */ // actionhw reads this
496   AM_RANGE(0xc00000, 0xc007ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram") /* Palette */ // actionhw reads this
497497   AM_RANGE(0xff0000, 0xffffff) AM_RAM
498498ADDRESS_MAP_END
499499
src/mame/drivers/othldrby.c
r14896r14897
8989   AM_RANGE(0x300008, 0x300009) AM_WRITE(othldrby_vreg_addr_w)
9090   AM_RANGE(0x30000c, 0x30000d) AM_READ_PORT("VBLANK")
9191   AM_RANGE(0x30000c, 0x30000f) AM_WRITE(othldrby_vreg_w)
92   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
92   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
9393   AM_RANGE(0x600000, 0x600001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
9494   AM_RANGE(0x700000, 0x700001) AM_READ(othldrby_scanline_r)
9595   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("DSW1")
src/mame/drivers/bbusters.c
r14896r14897
253253{
254254   if (ACCESSING_BITS_0_7)
255255   {
256      soundlatch_w(space, 0, data&0xff);
256      soundlatch_byte_w(space, 0, data&0xff);
257257      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
258258   }
259259}
r14896r14897
335335   AM_RANGE(0x0b4000, 0x0b5fff) AM_RAM      /* service mode */
336336   AM_RANGE(0x0b8000, 0x0b8003) AM_WRITEONLY AM_BASE(m_pf1_scroll_data)
337337   AM_RANGE(0x0b8008, 0x0b800b) AM_WRITEONLY AM_BASE(m_pf2_scroll_data)
338   AM_RANGE(0x0d0000, 0x0d0fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
338   AM_RANGE(0x0d0000, 0x0d0fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
339339   AM_RANGE(0x0e0000, 0x0e0001) AM_READ_PORT("COINS")   /* Coins */
340340   AM_RANGE(0x0e0002, 0x0e0003) AM_READ_PORT("IN0")   /* Player 1 & 2 */
341341   AM_RANGE(0x0e0004, 0x0e0005) AM_READ_PORT("IN1")   /* Player 3 */
r14896r14897
362362   AM_RANGE(0x0b8000, 0x0b8003) AM_WRITEONLY AM_BASE(m_pf1_scroll_data)
363363   AM_RANGE(0x0c0000, 0x0c3fff) AM_RAM_WRITE(bbusters_pf2_w) AM_BASE(m_pf2_data)
364364   AM_RANGE(0x0c8000, 0x0c8003) AM_WRITEONLY AM_BASE(m_pf2_scroll_data)
365   AM_RANGE(0x0d0000, 0x0d07ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
365   AM_RANGE(0x0d0000, 0x0d07ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
366366   AM_RANGE(0x0e0000, 0x0e0001) AM_READ_PORT("IN0")
367367   AM_RANGE(0x0e0002, 0x0e0003) AM_READ_PORT("DSW1")
368368   AM_RANGE(0x0e0004, 0x0e0007) AM_READ(mechatt_gun_r)
r14896r14897
376376static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, bbusters_state )
377377   AM_RANGE(0x0000, 0xefff) AM_ROM
378378   AM_RANGE(0xf000, 0xf7ff) AM_RAM
379   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r) AM_WRITE(sound_status_w)
379   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) AM_WRITE(sound_status_w)
380380ADDRESS_MAP_END
381381
382382static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, bbusters_state )
src/mame/drivers/arcadecl.c
r14896r14897
127127 *
128128 *************************************/
129129
130static WRITE16_HANDLER( latch_w )
130WRITE16_MEMBER(arcadecl_state::latch_w)
131131{
132132   /* bit layout in this register:
133133
r14896r14897
138138   /* lower byte being modified? */
139139   if (ACCESSING_BITS_0_7)
140140   {
141      okim6295_device *oki = space->machine().device<okim6295_device>("oki");
141      okim6295_device *oki = machine().device<okim6295_device>("oki");
142142      oki->set_bank_base((data & 0x80) ? 0x40000 : 0x00000);
143      atarigen_set_oki6295_vol(space->machine(), (data & 0x001f) * 100 / 0x1f);
143      atarigen_set_oki6295_vol(machine(), (data & 0x001f) * 100 / 0x1f);
144144   }
145145}
146146
r14896r14897
167167   AM_RANGE(0x640022, 0x640023) AM_READ_PORT("TRACKY2")
168168   AM_RANGE(0x640024, 0x640025) AM_READ_PORT("TRACKX1")
169169   AM_RANGE(0x640026, 0x640027) AM_READ_PORT("TRACKY1")
170   AM_RANGE(0x640040, 0x64004f) AM_WRITE_LEGACY(latch_w)
170   AM_RANGE(0x640040, 0x64004f) AM_WRITE(latch_w)
171171   AM_RANGE(0x640060, 0x64006f) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
172172   AM_RANGE(0x641000, 0x641fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
173173   AM_RANGE(0x642000, 0x642001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0xff00)
src/mame/drivers/flstory.c
r14896r14897
4545
4646WRITE8_MEMBER(flstory_state::sound_command_w)
4747{
48   soundlatch_w(space, 0, data);
48   soundlatch_byte_w(space, 0, data);
4949   machine().scheduler().synchronize(FUNC(nmi_callback), data);
5050}
5151
r14896r14897
444444   AM_RANGE(0xca00, 0xca0d) AM_DEVWRITE_LEGACY("msm", msm5232_w)
445445   AM_RANGE(0xcc00, 0xcc00) AM_DEVWRITE_LEGACY("msm", sound_control_0_w)
446446   AM_RANGE(0xce00, 0xce00) AM_DEVWRITE_LEGACY("msm", sound_control_1_w)
447   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_r) AM_WRITE(to_main_w)
447   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r) AM_WRITE(to_main_w)
448448   AM_RANGE(0xda00, 0xda00) AM_READNOP AM_WRITE(nmi_enable_w)         /* unknown read*/
449449   AM_RANGE(0xdc00, 0xdc00) AM_WRITE(nmi_disable_w)
450450   AM_RANGE(0xde00, 0xde00) AM_READNOP AM_DEVWRITE_LEGACY("dac", dac_w)   /* signed 8-bit DAC &  unknown read */
src/mame/drivers/suprslam.c
r14896r14897
9595   if (ACCESSING_BITS_0_7)
9696   {
9797      m_pending_command = 1;
98      soundlatch_w(space, offset, data & 0xff);
98      soundlatch_byte_w(space, offset, data & 0xff);
9999      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
100100   }
101101}
r14896r14897
134134//  AM_RANGE(0xff3000, 0xff3001) AM_WRITENOP // sprite buffer trigger?
135135   AM_RANGE(0xff8000, 0xff8fff) AM_DEVREADWRITE_LEGACY("k053936", k053936_linectrl_r, k053936_linectrl_w)
136136   AM_RANGE(0xff9000, 0xff9001) AM_WRITE(sound_command_w)
137   AM_RANGE(0xffa000, 0xffafff) AM_RAM_WRITE(paletteram16_xGGGGGBBBBBRRRRR_word_w) AM_SHARE("paletteram")
137   AM_RANGE(0xffa000, 0xffafff) AM_RAM_WRITE(paletteram_xGGGGGBBBBBRRRRR_word_w) AM_SHARE("paletteram")
138138   AM_RANGE(0xffd000, 0xffd01f) AM_DEVWRITE_LEGACY("k053936", k053936_ctrl_w)
139139   AM_RANGE(0xffe000, 0xffe001) AM_WRITE(suprslam_bank_w)
140140   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("P1")
r14896r14897
154154static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, suprslam_state )
155155   ADDRESS_MAP_GLOBAL_MASK(0xff)
156156   AM_RANGE(0x00, 0x00) AM_WRITE(suprslam_sh_bankswitch_w)
157   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r) AM_WRITE(pending_command_clear_w)
157   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_byte_r) AM_WRITE(pending_command_clear_w)
158158   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
159159ADDRESS_MAP_END
160160
src/mame/drivers/sfkick.c
r14896r14897
332332static ADDRESS_MAP_START( sfkick_io_map, AS_IO, 8, sfkick_state )
333333   ADDRESS_MAP_UNMAP_HIGH
334334   ADDRESS_MAP_GLOBAL_MASK(0xff)
335   AM_RANGE( 0xa0, 0xa7) AM_WRITE(soundlatch_w )
335   AM_RANGE( 0xa0, 0xa7) AM_WRITE(soundlatch_byte_w )
336336   AM_RANGE( 0x98, 0x9b) AM_DEVREADWRITE( "v9938", v9938_device, read, write)
337337   AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE_LEGACY("ppi8255", ppi8255_r, ppi8255_w)
338338   AM_RANGE( 0xb4, 0xb5) AM_RAM /* loopback ? req by sfkicka (MSX Bios leftover)*/
r14896r14897
345345
346346static ADDRESS_MAP_START( sfkick_sound_io_map, AS_IO, 8, sfkick_state )
347347   ADDRESS_MAP_GLOBAL_MASK(0xff)
348   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
348   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)
349349   AM_RANGE(0x04, 0x05) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
350350ADDRESS_MAP_END
351351
src/mame/drivers/atetris.c
r14896r14897
201201static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, atetris_state )
202202   AM_RANGE(0x0000, 0x0fff) AM_RAM
203203   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(atetris_videoram_w) AM_BASE(m_videoram)
204   AM_RANGE(0x2000, 0x20ff) AM_MIRROR(0x0300) AM_RAM_WRITE(paletteram_RRRGGGBB_w) AM_SHARE("paletteram")
204   AM_RANGE(0x2000, 0x20ff) AM_MIRROR(0x0300) AM_RAM_WRITE(paletteram_RRRGGGBB_byte_w) AM_SHARE("paletteram")
205205   AM_RANGE(0x2400, 0x25ff) AM_MIRROR(0x0200) AM_RAM_WRITE(nvram_w) AM_SHARE("nvram")
206206   AM_RANGE(0x2800, 0x280f) AM_MIRROR(0x03e0) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
207207   AM_RANGE(0x2810, 0x281f) AM_MIRROR(0x03e0) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
r14896r14897
218218static ADDRESS_MAP_START( atetrisb2_map, AS_PROGRAM, 8, atetris_state )
219219   AM_RANGE(0x0000, 0x0fff) AM_RAM
220220   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(atetris_videoram_w) AM_BASE(m_videoram)
221   AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(paletteram_RRRGGGBB_w) AM_SHARE("paletteram")
221   AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(paletteram_RRRGGGBB_byte_w) AM_SHARE("paletteram")
222222   AM_RANGE(0x2400, 0x25ff) AM_RAM_WRITE(nvram_w) AM_SHARE("nvram")
223223   AM_RANGE(0x2802, 0x2802) AM_DEVWRITE_LEGACY("sn1", sn76496_w)
224224   AM_RANGE(0x2804, 0x2804) AM_DEVWRITE_LEGACY("sn2", sn76496_w)
src/mame/drivers/bmcbowl.c
r14896r14897
111111{
112112public:
113113   bmcbowl_state(const machine_config &mconfig, device_type type, const char *tag)
114      : driver_device(mconfig, type, tag) { }
114      : driver_device(mconfig, type, tag) ,
115      m_stats_ram(*this, "stats_ram"),
116      m_vid1(*this, "vid1"),
117      m_vid2(*this, "vid2"){ }
115118
116   UINT16 *m_vid1;
117   UINT16 *m_vid2;
119   required_shared_ptr<UINT8> m_stats_ram;
120   required_shared_ptr<UINT16> m_vid1;
121   required_shared_ptr<UINT16> m_vid2;
118122   UINT8 *m_bmc_colorram;
119   UINT8 *m_stats_ram;
120   size_t m_stats_ram_size;
121123   int m_clr_offset;
122124   int m_bmc_input;
123125   DECLARE_READ16_MEMBER(bmc_random_read);
r14896r14897
152154   {
153155      for (x=0;x<280;x+=2)
154156      {
155         pixdat = state->m_vid2[0x8000+z];
157         pixdat = state->m_vid2.target()[0x8000+z];
156158
157159         if(pixdat&0xff)
158160            bitmap.pix16(y, x+1) = (pixdat&0xff);
159161         if(pixdat>>8)
160162            bitmap.pix16(y, x) = (pixdat>>8);
161163
162         pixdat = state->m_vid2[z];
164         pixdat = state->m_vid2.target()[z];
163165
164166         if(pixdat&0xff)
165167            bitmap.pix16(y, x+1) = (pixdat&0xff);
166168         if(pixdat>>8)
167169            bitmap.pix16(y, x) = (pixdat>>8);
168170
169         pixdat = state->m_vid1[0x8000+z];
171         pixdat = state->m_vid1.target()[0x8000+z];
170172
171173         if(pixdat&0xff)
172174            bitmap.pix16(y, x+1) = (pixdat&0xff);
173175         if(pixdat>>8)
174176            bitmap.pix16(y, x) = (pixdat>>8);
175177
176         pixdat = state->m_vid1[z];
178         pixdat = state->m_vid1.target()[z];
177179
178180         if(pixdat&0xff)
179181            bitmap.pix16(y, x+1) = (pixdat&0xff);
r14896r14897
295297{
296298   int i;
297299   for (i=0; i<table_len; i++)
298      state->m_stats_ram[address+2*i]=table[i];
300      state->m_stats_ram.target()[address+2*i]=table[i];
299301}
300302#endif
301303
r14896r14897
305307   int i;
306308
307309   if (read_or_write)
308      file->write(state->m_stats_ram, state->m_stats_ram_size);
310      file->write(state->m_stats_ram, state->m_stats_ram.bytes());
309311   else
310312
311313#ifdef NVRAM_HACK
312   for (i = 0; i < state->m_stats_ram_size; i++)
313      state->m_stats_ram[i] = 0xff;
314   for (i = 0; i < state->m_stats_ram.bytes(); i++)
315      state->m_stats_ram.target()[i] = 0xff;
314316
315317   init_stats(state,bmc_nv1,ARRAY_LENGTH(bmc_nv1),0);
316318   init_stats(state,bmc_nv2,ARRAY_LENGTH(bmc_nv2),0x3b0);
317319   init_stats(state,bmc_nv3,ARRAY_LENGTH(bmc_nv3),0xfe2);
318320#else
319321   if (file)
320      file->read(state->m_stats_ram, state->m_stats_ram_size);
322      file->read(state->m_stats_ram, state->m_stats_ram.bytes());
321323   else
322324
323      for (i = 0; i < state->m_stats_ram_size; i++)
324         state->m_stats_ram[i] = 0xff;
325      for (i = 0; i < state->m_stats_ram.bytes(); i++)
326         state->m_stats_ram.target()[i] = 0xff;
325327#endif
326328
327329}
r14896r14897
343345   AM_RANGE(0x092800, 0x092803) AM_DEVWRITE8_LEGACY("aysnd", ay8910_data_address_w, 0xff00)
344346   AM_RANGE(0x092802, 0x092803) AM_DEVREAD8_LEGACY("aysnd", ay8910_r, 0xff00)
345347   AM_RANGE(0x093802, 0x093803) AM_READ_PORT("IN0")
346   AM_RANGE(0x095000, 0x095fff) AM_RAM AM_BASE(m_stats_ram) AM_SIZE(m_stats_ram_size) /* 8 bit */
348   AM_RANGE(0x095000, 0x095fff) AM_RAM AM_SHARE("stats_ram") /* 8 bit */
347349   AM_RANGE(0x097000, 0x097001) AM_READNOP
348350   AM_RANGE(0x140000, 0x1bffff) AM_ROM
349   AM_RANGE(0x1c0000, 0x1effff) AM_RAM AM_BASE(m_vid1)
351   AM_RANGE(0x1c0000, 0x1effff) AM_RAM AM_SHARE("vid1")
350352   AM_RANGE(0x1f0000, 0x1fffff) AM_RAM
351   AM_RANGE(0x200000, 0x21ffff) AM_RAM AM_BASE(m_vid2)
353   AM_RANGE(0x200000, 0x21ffff) AM_RAM AM_SHARE("vid2")
352354
353355   AM_RANGE(0x28c000, 0x28c001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0xff00)
354356
src/mame/drivers/pcat_nit.c
r14896r14897
107107
108108   DECLARE_WRITE_LINE_MEMBER(microtouch_out);
109109   DECLARE_WRITE_LINE_MEMBER(microtouch_in);
110   DECLARE_WRITE8_MEMBER(pcat_nit_rombank_w);
111   DECLARE_READ8_MEMBER(pcat_nit_io_r);
110112};
111113
112114WRITE_LINE_MEMBER(pcat_nit_state::microtouch_out)
r14896r14897
145147 *
146148 *************************************/
147149
148static WRITE8_HANDLER(pcat_nit_rombank_w)
150WRITE8_MEMBER(pcat_nit_state::pcat_nit_rombank_w)
149151{
150   pcat_nit_state *state = space->machine().driver_data<pcat_nit_state>();
151   logerror( "rom bank #%02x at PC=%08X\n", data, cpu_get_pc(&space->device()) );
152   logerror( "rom bank #%02x at PC=%08X\n", data, cpu_get_pc(&space.device()) );
152153   if ( data & 0x40 )
153154   {
154155      // rom bank
155      space->install_read_bank(0x000d8000, 0x000dffff, "rombank" );
156      space->unmap_write(0x000d8000, 0x000dffff);
156      space.install_read_bank(0x000d8000, 0x000dffff, "rombank" );
157      space.unmap_write(0x000d8000, 0x000dffff);
157158
158159      if ( data & 0x80 )
159160      {
160         memory_set_bank(space->machine(), "rombank", (data & 0x3f) | 0x40 );
161         memory_set_bank(machine(), "rombank", (data & 0x3f) | 0x40 );
161162      }
162163      else
163164      {
164         memory_set_bank(space->machine(), "rombank", data & 0x3f );
165         memory_set_bank(machine(), "rombank", data & 0x3f );
165166      }
166167   }
167168   else
168169   {
169170      // nvram bank
170      space->unmap_readwrite(0x000d8000, 0x000dffff);
171      space.unmap_readwrite(0x000d8000, 0x000dffff);
171172
172      space->install_readwrite_bank(0x000d8000, 0x000d9fff, "nvrambank" );
173      space.install_readwrite_bank(0x000d8000, 0x000d9fff, "nvrambank" );
173174
174      memory_set_bankptr(space->machine(), "nvrambank", state->m_banked_nvram);
175      memory_set_bankptr(machine(), "nvrambank", m_banked_nvram);
175176
176177   }
177178}
r14896r14897
181182   AM_RANGE(0x000a0000, 0x000bffff) AM_RAM
182183   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0) AM_WRITENOP
183184   AM_RANGE(0x000d0000, 0x000d3fff) AM_RAM AM_REGION("disk_bios", 0)
184   AM_RANGE(0x000d7000, 0x000d7003) AM_WRITE8_LEGACY(pcat_nit_rombank_w, 0xff)
185   AM_RANGE(0x000d7000, 0x000d7003) AM_WRITE8(pcat_nit_rombank_w, 0xff)
185186   AM_RANGE(0x000d8000, 0x000dffff) AM_ROMBANK("rombank")
186187   AM_RANGE(0x000f0000, 0x000fffff) AM_RAM AM_REGION("bios", 0 )
187188   AM_RANGE(0xffff0000, 0xffffffff) AM_ROM AM_REGION("bios", 0 )
188189ADDRESS_MAP_END
189190
190static READ8_HANDLER(pcat_nit_io_r)
191READ8_MEMBER(pcat_nit_state::pcat_nit_io_r)
191192{
192193   switch(offset)
193194   {
194195      case 0: /* 278 */
195196         return 0xff;
196197      case 1: /* 279 */
197         return input_port_read(space->machine(), "IN0");
198         return input_port_read(machine(), "IN0");
198199      case 7: /* 27f dips */
199200         return 0xff;
200201      default:
r14896r14897
204205
205206static ADDRESS_MAP_START( pcat_nit_io, AS_IO, 32, pcat_nit_state )
206207   AM_IMPORT_FROM(pcat32_io_common)
207   AM_RANGE(0x0278, 0x027f) AM_READ8_LEGACY(pcat_nit_io_r, 0xffffffff) AM_WRITENOP
208   AM_RANGE(0x0278, 0x027f) AM_READ8(pcat_nit_io_r, 0xffffffff) AM_WRITENOP
208209   AM_RANGE(0x0280, 0x0283) AM_READNOP
209210   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ns16450_device, ins8250_r, ins8250_w, 0xffffffff)
210211ADDRESS_MAP_END
src/mame/drivers/blockade.c
r14896r14897
129129    AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1")
130130    AM_RANGE(0x02, 0x02) AM_DEVWRITE_LEGACY("discrete", blockade_sound_freq_w)
131131    AM_RANGE(0x04, 0x04) AM_READ_PORT("IN2")
132    AM_RANGE(0x04, 0x04) AM_WRITE_LEGACY(blockade_env_on_w)
133    AM_RANGE(0x08, 0x08) AM_WRITE_LEGACY(blockade_env_off_w)
132    AM_RANGE(0x04, 0x04) AM_WRITE(blockade_env_on_w)
133    AM_RANGE(0x08, 0x08) AM_WRITE(blockade_env_off_w)
134134ADDRESS_MAP_END
135135
136136
src/mame/drivers/lordgun.c
r14896r14897
256256
257257WRITE16_MEMBER(lordgun_state::lordgun_soundlatch_w)
258258{
259   if (ACCESSING_BITS_0_7)      soundlatch_w (space, 0, (data >> 0) & 0xff);
260   if (ACCESSING_BITS_8_15)   soundlatch2_w(space, 0, (data >> 8) & 0xff);
259   if (ACCESSING_BITS_0_7)      soundlatch_byte_w (space, 0, (data >> 0) & 0xff);
260   if (ACCESSING_BITS_8_15)   soundlatch2_byte_w(space, 0, (data >> 8) & 0xff);
261261
262262   cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
263263}
r14896r14897
343343static ADDRESS_MAP_START( lordgun_soundio_map, AS_IO, 8, lordgun_state )
344344   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w )
345345   AM_RANGE(0x2000, 0x2000) AM_DEVREADWRITE("oki", okim6295_device, read, write)
346   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch2_r )
347   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r )
346   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch2_byte_r )
347   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r )
348348   AM_RANGE(0x5000, 0x5000) AM_READNOP
349349   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_LEGACY("oki", lordgun_okibank_w )
350350ADDRESS_MAP_END
351351
352352
353353static ADDRESS_MAP_START( aliencha_soundio_map, AS_IO, 8, lordgun_state )
354   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch2_r )
355   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r )
354   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch2_byte_r )
355   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r )
356356   AM_RANGE(0x5000, 0x5000) AM_WRITENOP   // writes 03 then 07 at end of NMI
357357   AM_RANGE(0x7000, 0x7000) AM_DEVREAD_LEGACY("ymf", ymf278b_r)
358358   AM_RANGE(0x7000, 0x7005) AM_DEVWRITE_LEGACY("ymf", ymf278b_w)
src/mame/drivers/zerozone.c
r14896r14897
3939{
4040   if (ACCESSING_BITS_8_15)
4141   {
42      soundlatch_w(space, offset, data >> 8);
42      soundlatch_byte_w(space, offset, data >> 8);
4343      device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0xff);
4444   }
4545}
r14896r14897
5252   AM_RANGE(0x080008, 0x080009) AM_READ_PORT("DSWB")
5353   AM_RANGE(0x08000a, 0x08000b) AM_READ_PORT("DSWA")
5454   AM_RANGE(0x084000, 0x084001) AM_WRITE(sound_w)
55   AM_RANGE(0x088000, 0x0881ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
55   AM_RANGE(0x088000, 0x0881ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
5656   AM_RANGE(0x098000, 0x098001) AM_RAM      /* Watchdog? */
5757   AM_RANGE(0x09ce00, 0x09ffff) AM_RAM_WRITE(tilemap_w) AM_SHARE("videoram")
5858   AM_RANGE(0x0b4000, 0x0b4001) AM_WRITE(tilebank_w)
r14896r14897
6464   AM_RANGE(0x0000, 0x7fff) AM_ROM
6565   AM_RANGE(0x8000, 0x87ff) AM_RAM
6666   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
67   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
67   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
6868ADDRESS_MAP_END
6969
7070
src/mame/drivers/lemmings.c
r14896r14897
7979
8080WRITE16_MEMBER(lemmings_state::lemmings_sound_w)
8181{
82   soundlatch_w(space, 0, data & 0xff);
82   soundlatch_byte_w(space, 0, data & 0xff);
8383   device_set_input_line(m_audiocpu, 1, HOLD_LINE);
8484}
8585
r14896r14897
114114   AM_RANGE(0x0000, 0x07ff) AM_RAM
115115   AM_RANGE(0x0800, 0x0801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)
116116   AM_RANGE(0x1000, 0x1000) AM_DEVREADWRITE("oki", okim6295_device, read, write)
117   AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r) AM_WRITE(lemmings_sound_ack_w)
117   AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_byte_r) AM_WRITE(lemmings_sound_ack_w)
118118   AM_RANGE(0x8000, 0xffff) AM_ROM
119119ADDRESS_MAP_END
120120
src/mame/drivers/espial.c
r14896r14897
101101
102102WRITE8_MEMBER(espial_state::espial_master_soundlatch_w)
103103{
104   soundlatch_w(space, offset, data);
104   soundlatch_byte_w(space, offset, data);
105105   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
106106}
107107
r14896r14897
113113   AM_RANGE(0x6082, 0x6082) AM_READ_PORT("DSW1")
114114   AM_RANGE(0x6083, 0x6083) AM_READ_PORT("IN1")
115115   AM_RANGE(0x6084, 0x6084) AM_READ_PORT("IN2")
116   AM_RANGE(0x6090, 0x6090) AM_READ(soundlatch2_r) AM_WRITE(espial_master_soundlatch_w)
116   AM_RANGE(0x6090, 0x6090) AM_READ(soundlatch2_byte_r) AM_WRITE(espial_master_soundlatch_w)
117117   AM_RANGE(0x7000, 0x7000) AM_READWRITE(watchdog_reset_r, watchdog_reset_w)
118118   AM_RANGE(0x7100, 0x7100) AM_WRITE(espial_master_interrupt_mask_w)
119119   AM_RANGE(0x7200, 0x7200) AM_WRITE(espial_flipscreen_w)
r14896r14897
138138   AM_RANGE(0x6082, 0x6082) AM_READ_PORT("DSW1")
139139   AM_RANGE(0x6083, 0x6083) AM_READ_PORT("IN1")
140140   AM_RANGE(0x6084, 0x6084) AM_READ_PORT("IN2")
141   AM_RANGE(0x6090, 0x6090) AM_READ(soundlatch2_r) AM_WRITE(espial_master_soundlatch_w)
141   AM_RANGE(0x6090, 0x6090) AM_READ(soundlatch2_byte_r) AM_WRITE(espial_master_soundlatch_w)
142142   AM_RANGE(0x7000, 0x7000) AM_READWRITE(watchdog_reset_r, watchdog_reset_w)
143143   AM_RANGE(0x7100, 0x7100) AM_WRITE(espial_master_interrupt_mask_w)
144144   AM_RANGE(0x7200, 0x7200) AM_WRITE(espial_flipscreen_w)
r14896r14897
156156   AM_RANGE(0x0000, 0x1fff) AM_ROM
157157   AM_RANGE(0x2000, 0x23ff) AM_RAM
158158   AM_RANGE(0x4000, 0x4000) AM_WRITE(espial_sound_nmi_mask_w)
159   AM_RANGE(0x6000, 0x6000) AM_READWRITE(soundlatch_r, soundlatch2_w)
159   AM_RANGE(0x6000, 0x6000) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w)
160160ADDRESS_MAP_END
161161
162162static ADDRESS_MAP_START( espial_sound_io_map, AS_IO, 8, espial_state )
src/mame/drivers/segag80r.c
r14896r14897
287287{
288288   segag80r_state *state = device->machine().driver_data<segag80r_state>();
289289   address_space *space = device->machine().device("maincpu")->memory().space(AS_PROGRAM);
290   state->soundlatch_w(*space, 0, data);
290   state->soundlatch_byte_w(*space, 0, data);
291291   cputag_set_input_line(device->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
292292   device->machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
293293}
r14896r14897
383383   AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x1800) AM_RAM
384384   AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x1ffc) AM_DEVWRITE_LEGACY("sn1", sindbadm_SN76496_w)
385385   AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x1ffc) AM_DEVWRITE_LEGACY("sn2", sindbadm_SN76496_w)
386   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1fff) AM_READ(soundlatch_r)
386   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1fff) AM_READ(soundlatch_byte_r)
387387ADDRESS_MAP_END
388388
389389
r14896r14897
14431443   iospace->install_legacy_write_handler(*speech, 0x3b, 0x3b, FUNC(sega_speech_control_w));
14441444
14451445   /* install Astro Blaster sound board */
1446   iospace->install_legacy_write_handler(0x3e, 0x3f, FUNC(astrob_sound_w));
1446   iospace->install_write_handler(0x3e, 0x3f, write8_delegate(FUNC(segag80r_state::astrob_sound_w),state));
14471447}
14481448
14491449
r14896r14897
14741474   iospace->install_readwrite_handler(0x08, 0x0f, read8_delegate(FUNC(segag80r_state::spaceod_back_port_r),state), write8_delegate(FUNC(segag80r_state::spaceod_back_port_w),state));
14751475
14761476   /* install Space Odyssey sound board */
1477   iospace->install_legacy_write_handler(0x0e, 0x0f, FUNC(spaceod_sound_w));
1477   iospace->install_write_handler(0x0e, 0x0f, write8_delegate(FUNC(segag80r_state::spaceod_sound_w),state));
14781478
14791479   /* install our wacky mangled ports */
14801480   iospace->install_read_handler(0xf8, 0xfb, read8_delegate(FUNC(segag80r_state::spaceod_mangled_ports_r),state));
src/mame/drivers/magic10.c
r14896r14897
8989{
9090public:
9191   magic10_state(const machine_config &mconfig, device_type type, const char *tag)
92      : driver_device(mconfig, type, tag) { }
92      : driver_device(mconfig, type, tag) ,
93      m_layer0_videoram(*this, "layer0_videoram"),
94      m_layer1_videoram(*this, "layer1_videoram"),
95      m_layer2_videoram(*this, "layer2_videoram"),
96      m_vregs(*this, "vregs"){ }
9397
9498   tilemap_t *m_layer0_tilemap;
9599   tilemap_t *m_layer1_tilemap;
96100   tilemap_t *m_layer2_tilemap;
97   UINT16 *m_layer0_videoram;
98   UINT16 *m_layer1_videoram;
99   UINT16 *m_layer2_videoram;
101   required_shared_ptr<UINT16> m_layer0_videoram;
102   required_shared_ptr<UINT16> m_layer1_videoram;
103   required_shared_ptr<UINT16> m_layer2_videoram;
100104   int m_layer2_offset[2];
101   UINT16 *m_vregs;
105   required_shared_ptr<UINT16> m_vregs;
102106   UINT16 m_magic102_ret;
103107   DECLARE_WRITE16_MEMBER(layer0_videoram_w);
104108   DECLARE_WRITE16_MEMBER(layer1_videoram_w);
r14896r14897
117121
118122WRITE16_MEMBER(magic10_state::layer0_videoram_w)
119123{
120   COMBINE_DATA(&m_layer0_videoram[offset]);
124   COMBINE_DATA(&m_layer0_videoram.target()[offset]);
121125   m_layer0_tilemap->mark_tile_dirty(offset >> 1);
122126}
123127
124128WRITE16_MEMBER(magic10_state::layer1_videoram_w)
125129{
126   COMBINE_DATA(&m_layer1_videoram[offset]);
130   COMBINE_DATA(&m_layer1_videoram.target()[offset]);
127131   m_layer1_tilemap->mark_tile_dirty(offset >> 1);
128132}
129133
130134WRITE16_MEMBER(magic10_state::layer2_videoram_w)
131135{
132   COMBINE_DATA(&m_layer2_videoram[offset]);
136   COMBINE_DATA(&m_layer2_videoram.target()[offset]);
133137   m_layer2_tilemap->mark_tile_dirty(offset >> 1);
134138}
135139
r14896r14897
146150   SET_TILE_INFO
147151   (
148152      1,
149      state->m_layer0_videoram[tile_index * 2],
150      state->m_layer0_videoram[tile_index * 2 + 1] & 0x0f,
151      TILE_FLIPYX((state->m_layer0_videoram[tile_index * 2 + 1] & 0xc0) >> 6)
153      state->m_layer0_videoram.target()[tile_index * 2],
154      state->m_layer0_videoram.target()[tile_index * 2 + 1] & 0x0f,
155      TILE_FLIPYX((state->m_layer0_videoram.target()[tile_index * 2 + 1] & 0xc0) >> 6)
152156   );
153157}
154158
r14896r14897
158162   SET_TILE_INFO
159163   (
160164      1,
161      state->m_layer1_videoram[tile_index * 2],
162      state->m_layer1_videoram[tile_index * 2 + 1] & 0x0f,
163      TILE_FLIPYX((state->m_layer1_videoram[tile_index * 2 + 1] & 0xc0) >> 6)
165      state->m_layer1_videoram.target()[tile_index * 2],
166      state->m_layer1_videoram.target()[tile_index * 2 + 1] & 0x0f,
167      TILE_FLIPYX((state->m_layer1_videoram.target()[tile_index * 2 + 1] & 0xc0) >> 6)
164168   );
165169}
166170
r14896r14897
170174   SET_TILE_INFO
171175   (
172176      0,
173      state->m_layer2_videoram[tile_index * 2],
174      state->m_layer2_videoram[tile_index * 2 + 1] & 0x0f,
177      state->m_layer2_videoram.target()[tile_index * 2],
178      state->m_layer2_videoram.target()[tile_index * 2 + 1] & 0x0f,
175179      0
176180   );
177181}
r14896r14897
199203    4 and 6 are y/x global register writes.
200204    0 and 2 are y/x writes for the scrolling layer.
201205    */
202   state->m_layer1_tilemap->set_scrolly(0, (state->m_vregs[0/2] - state->m_vregs[4/2])+0);
203   state->m_layer1_tilemap->set_scrollx(0, (state->m_vregs[2/2] - state->m_vregs[6/2])+4);
206   state->m_layer1_tilemap->set_scrolly(0, (state->m_vregs.target()[0/2] - state->m_vregs.target()[4/2])+0);
207   state->m_layer1_tilemap->set_scrollx(0, (state->m_vregs.target()[2/2] - state->m_vregs.target()[6/2])+4);
204208
205209   state->m_layer0_tilemap->draw(bitmap, cliprect, 0, 0);
206210   state->m_layer1_tilemap->draw(bitmap, cliprect, 0, 0);
r14896r14897
288292
289293static ADDRESS_MAP_START( magic10_map, AS_PROGRAM, 16, magic10_state )
290294   AM_RANGE(0x000000, 0x03ffff) AM_ROM
291   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(m_layer1_videoram)
292   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(m_layer0_videoram)
293   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(m_layer2_videoram)
295   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_SHARE("layer1_videoram")
296   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram")
297   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram")
294298   AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram")
295299   AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
296300   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("INPUTS")
r14896r14897
298302   AM_RANGE(0x400008, 0x400009) AM_WRITE(magic10_out_w)
299303   AM_RANGE(0x40000a, 0x40000b) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
300304   AM_RANGE(0x40000e, 0x40000f) AM_WRITENOP
301   AM_RANGE(0x400080, 0x400087) AM_RAM AM_BASE(m_vregs)
305   AM_RANGE(0x400080, 0x400087) AM_RAM AM_SHARE("vregs")
302306   AM_RANGE(0x600000, 0x603fff) AM_RAM
303307ADDRESS_MAP_END
304308
305309static ADDRESS_MAP_START( magic10a_map, AS_PROGRAM, 16, magic10_state )
306310   AM_RANGE(0x000000, 0x03ffff) AM_ROM
307   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(m_layer1_videoram)
308   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(m_layer0_videoram)
309   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(m_layer2_videoram)
311   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_SHARE("layer1_videoram")
312   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram")
313   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram")
310314   AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram")
311315   AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
312316   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("INPUTS")
r14896r14897
314318   AM_RANGE(0x500008, 0x500009) AM_WRITE(magic10_out_w)
315319   AM_RANGE(0x50000a, 0x50000b) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
316320   AM_RANGE(0x50000e, 0x50000f) AM_WRITENOP
317   AM_RANGE(0x500080, 0x500087) AM_RAM AM_BASE(m_vregs)   // video registers?
321   AM_RANGE(0x500080, 0x500087) AM_RAM AM_SHARE("vregs")   // video registers?
318322   AM_RANGE(0x600000, 0x603fff) AM_RAM
319323ADDRESS_MAP_END
320324
321325static ADDRESS_MAP_START( magic102_map, AS_PROGRAM, 16, magic10_state )
322326   AM_RANGE(0x000000, 0x03ffff) AM_ROM
323   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(m_layer1_videoram)
324   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(m_layer0_videoram)
325   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(m_layer2_videoram)
327   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_SHARE("layer1_videoram")
328   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram")
329   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram")
326330   AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram")
327331   AM_RANGE(0x400000, 0x4001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
328332   AM_RANGE(0x500000, 0x500001) AM_READ(magic102_r)
r14896r14897
334338   AM_RANGE(0x500002, 0x50001f) AM_WRITENOP
335339   AM_RANGE(0x600000, 0x603fff) AM_RAM
336340   AM_RANGE(0x700000, 0x700001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
337   AM_RANGE(0x700080, 0x700087) AM_RAM AM_BASE(m_vregs)   // video registers?
341   AM_RANGE(0x700080, 0x700087) AM_RAM AM_SHARE("vregs")   // video registers?
338342ADDRESS_MAP_END
339343
340344static ADDRESS_MAP_START( hotslot_map, AS_PROGRAM, 16, magic10_state )
341345   AM_RANGE(0x000000, 0x03ffff) AM_ROM
342   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(m_layer1_videoram)
343   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(m_layer0_videoram)
344   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(m_layer2_videoram)
346   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_SHARE("layer1_videoram")
347   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram")
348   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram")
345349   AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram")
346350   AM_RANGE(0x400000, 0x4001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
347351   AM_RANGE(0x500004, 0x500005) AM_READWRITE(hotslot_copro_r, hotslot_copro_w)   // copro comm
r14896r14897
353357   AM_RANGE(0x50001a, 0x50001d) AM_WRITENOP
354358   AM_RANGE(0x600000, 0x603fff) AM_RAM
355359   AM_RANGE(0x70000a, 0x70000b) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
356   AM_RANGE(0x700080, 0x700087) AM_RAM AM_BASE(m_vregs)
360   AM_RANGE(0x700080, 0x700087) AM_RAM AM_SHARE("vregs")
357361ADDRESS_MAP_END
358362
359363static ADDRESS_MAP_START( sgsafari_map, AS_PROGRAM, 16, magic10_state )
360364   AM_RANGE(0x000000, 0x03ffff) AM_ROM
361   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_BASE(m_layer1_videoram)
362   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_BASE(m_layer0_videoram)
363   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_BASE(m_layer2_videoram)
365   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(layer1_videoram_w) AM_SHARE("layer1_videoram")
366   AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram")
367   AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram")
364368   AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("nvram")
365369   AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
366370   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW1")
367371   AM_RANGE(0x500008, 0x500009) AM_WRITE(magic10_out_w)
368372   AM_RANGE(0x50000a, 0x50000b) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
369373   AM_RANGE(0x50000e, 0x50000f) AM_READ_PORT("IN0")
370   AM_RANGE(0x500080, 0x500087) AM_RAM AM_BASE(m_vregs)   // video registers?
374   AM_RANGE(0x500080, 0x500087) AM_RAM AM_SHARE("vregs")   // video registers?
371375   AM_RANGE(0x600000, 0x603fff) AM_RAM
372376ADDRESS_MAP_END
373377/*
src/mame/drivers/tmnt.c
r14896r14897
193193WRITE16_MEMBER(tmnt_state::tmnt_sound_command_w)
194194{
195195   if (ACCESSING_BITS_0_7)
196      soundlatch_w(space, 0, data & 0xff);
196      soundlatch_byte_w(space, 0, data & 0xff);
197197}
198198
199199static READ8_DEVICE_HANDLER( punkshot_sound_r )
r14896r14897
214214
215215READ16_MEMBER(tmnt_state::prmrsocr_sound_r)
216216{
217   return soundlatch3_r(space, 0);
217   return soundlatch3_byte_r(space, 0);
218218}
219219
220220WRITE16_MEMBER(tmnt_state::prmrsocr_sound_cmd_w)
r14896r14897
223223   {
224224      data &= 0xff;
225225      if (offset == 0)
226         soundlatch_w(space, 0, data);
226         soundlatch_byte_w(space, 0, data);
227227      else
228         soundlatch2_w(space, 0, data);
228         soundlatch2_byte_w(space, 0, data);
229229   }
230230}
231231
r14896r14897
621621static ADDRESS_MAP_START( punkshot_main_map, AS_PROGRAM, 16, tmnt_state )
622622   AM_RANGE(0x000000, 0x03ffff) AM_ROM
623623   AM_RANGE(0x080000, 0x083fff) AM_RAM /* main RAM */
624   AM_RANGE(0x090000, 0x090fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
624   AM_RANGE(0x090000, 0x090fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
625625   AM_RANGE(0x0a0000, 0x0a0001) AM_READ_PORT("DSW1/DSW2")
626626   AM_RANGE(0x0a0002, 0x0a0003) AM_READ_PORT("COINS/DSW3")
627627   AM_RANGE(0x0a0004, 0x0a0005) AM_READ_PORT("P3/P4")
r14896r14897
640640
641641static ADDRESS_MAP_START( lgtnfght_main_map, AS_PROGRAM, 16, tmnt_state )
642642   AM_RANGE(0x000000, 0x03ffff) AM_ROM
643   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
643   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
644644   AM_RANGE(0x090000, 0x093fff) AM_RAM   /*main RAM */
645645   AM_RANGE(0x0a0000, 0x0a0001) AM_READ_PORT("COINS")
646646   AM_RANGE(0x0a0002, 0x0a0003) AM_READ_PORT("P1")
r14896r14897
671671   AM_RANGE(0x180000, 0x183fff) AM_DEVREADWRITE_LEGACY("k052109", k052109_word_r, k052109_word_w)
672672   AM_RANGE(0x204000, 0x207fff) AM_RAM   /* main RAM */
673673   AM_RANGE(0x300000, 0x303fff) AM_READWRITE(k053245_scattered_word_r, k053245_scattered_word_w) AM_BASE(m_spriteram)
674   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
674   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
675675   AM_RANGE(0x500000, 0x50003f) AM_DEVREADWRITE_LEGACY("k054000", k054000_lsb_r, k054000_lsb_w)
676676   AM_RANGE(0x680000, 0x68001f) AM_READWRITE(k053244_word_noA1_r, k053244_word_noA1_w)
677677   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("P1")
r14896r14897
713713   AM_RANGE(0x000000, 0x03ffff) AM_ROM
714714   AM_RANGE(0x100000, 0x103fff) AM_RAM   /* main RAM */
715715   AM_RANGE(0x104000, 0x107fff) AM_READWRITE(k053245_scattered_word_r, k053245_scattered_word_w) AM_BASE(m_spriteram)
716   AM_RANGE(0x108000, 0x108fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
716   AM_RANGE(0x108000, 0x108fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
717717   AM_RANGE(0x10c000, 0x10cfff) AM_DEVREADWRITE_LEGACY("k053936", k053936_linectrl_r, k053936_linectrl_w)   /* 053936? */
718718   AM_RANGE(0x110000, 0x11001f) AM_WRITE(k053244_word_noA1_w)            /* duplicate! */
719719   AM_RANGE(0x114000, 0x11401f) AM_DEVREADWRITE_LEGACY("k053245", k053244_lsb_r, k053244_lsb_w)   /* duplicate! */
r14896r14897
737737   AM_RANGE(0x000000, 0x07ffff) AM_ROM
738738   AM_RANGE(0x100000, 0x103fff) AM_RAM   /* main RAM */
739739   AM_RANGE(0x104000, 0x107fff) AM_READWRITE(k053245_scattered_word_r, k053245_scattered_word_w) AM_BASE(m_spriteram)
740   AM_RANGE(0x108000, 0x108fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
740   AM_RANGE(0x108000, 0x108fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
741741   AM_RANGE(0x10c000, 0x10cfff) AM_DEVREADWRITE_LEGACY("k053936", k053936_linectrl_r, k053936_linectrl_w)
742742   AM_RANGE(0x110000, 0x11001f) AM_WRITE(k053244_word_noA1_w)            /* duplicate! */
743743   AM_RANGE(0x114000, 0x11401f) AM_DEVREADWRITE_LEGACY("k053245", k053244_lsb_r, k053244_lsb_w)   /* duplicate! */
r14896r14897
999999static ADDRESS_MAP_START( tmnt2_main_map, AS_PROGRAM, 16, tmnt_state )
10001000   AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_BASE(m_tmnt2_rom)
10011001   AM_RANGE(0x104000, 0x107fff) AM_RAM AM_BASE(m_sunset_104000)   /* main RAM */
1002   AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1002   AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
10031003   AM_RANGE(0x180000, 0x183fff) AM_RAM_WRITE(k053245_scattered_word_w) AM_BASE(m_spriteram)   // k053245_scattered_word_r
10041004   AM_RANGE(0x1c0000, 0x1c0001) AM_READ_PORT("P1")
10051005   AM_RANGE(0x1c0002, 0x1c0003) AM_READ_PORT("P2")
r14896r14897
10251025static ADDRESS_MAP_START( ssriders_main_map, AS_PROGRAM, 16, tmnt_state )
10261026   AM_RANGE(0x000000, 0x0bffff) AM_ROM
10271027   AM_RANGE(0x104000, 0x107fff) AM_RAM   /* main RAM */
1028   AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1028   AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
10291029   AM_RANGE(0x180000, 0x183fff) AM_READWRITE(k053245_scattered_word_r, k053245_scattered_word_w) AM_BASE(m_spriteram)
10301030   AM_RANGE(0x1c0000, 0x1c0001) AM_READ_PORT("P1")
10311031   AM_RANGE(0x1c0002, 0x1c0003) AM_READ_PORT("P2")
r14896r14897
10511051static ADDRESS_MAP_START( sunsetbl_main_map, AS_PROGRAM, 16, tmnt_state )
10521052   AM_RANGE(0x000000, 0x0bffff) AM_ROM
10531053   AM_RANGE(0x104000, 0x107fff) AM_RAM   /* main RAM */
1054   AM_RANGE(0x14c000, 0x14cfff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1054   AM_RANGE(0x14c000, 0x14cfff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
10551055   AM_RANGE(0x14e700, 0x14e71f) AM_DEVWRITE_LEGACY("k053251", k053251_lsb_w)
10561056   AM_RANGE(0x180000, 0x183fff) AM_READWRITE(k053245_scattered_word_r, k053245_scattered_word_w) AM_BASE(m_spriteram)
10571057   AM_RANGE(0x184000, 0x18ffff) AM_RAM
r14896r14897
10771077static ADDRESS_MAP_START( thndrx2_main_map, AS_PROGRAM, 16, tmnt_state )
10781078   AM_RANGE(0x000000, 0x03ffff) AM_ROM
10791079   AM_RANGE(0x100000, 0x103fff) AM_RAM   /* main RAM */
1080   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1080   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
10811081   AM_RANGE(0x300000, 0x30001f) AM_DEVWRITE_LEGACY("k053251", k053251_lsb_w)
10821082   AM_RANGE(0x400000, 0x400003) AM_DEVREAD8_LEGACY("k053260", punkshot_sound_r, 0x00ff)   /* K053260 */
10831083   AM_RANGE(0x400000, 0x400001) AM_DEVWRITE8_LEGACY("k053260", k053260_w, 0x00ff)
r14896r14897
10961096static ADDRESS_MAP_START( mia_audio_map, AS_PROGRAM, 8, tmnt_state )
10971097   AM_RANGE(0x0000, 0x7fff) AM_ROM
10981098   AM_RANGE(0x8000, 0x87ff) AM_RAM
1099   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
1099   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
11001100   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)
11011101   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
11021102ADDRESS_MAP_END
r14896r14897
11061106   AM_RANGE(0x0000, 0x7fff) AM_ROM
11071107   AM_RANGE(0x8000, 0x87ff) AM_RAM
11081108   AM_RANGE(0x9000, 0x9000) AM_READWRITE(tmnt_sres_r, tmnt_sres_w)   /* title music & UPD7759C reset */
1109   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
1109   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
11101110   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)
11111111   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
11121112   AM_RANGE(0xd000, 0xd000) AM_DEVWRITE_LEGACY("upd", upd7759_port_w)
r14896r14897
11741174   AM_RANGE(0xc000, 0xdfff) AM_RAM
11751175   AM_RANGE(0xe000, 0xe0ff) AM_DEVREADWRITE("k054539", k054539_device, read, write)
11761176   AM_RANGE(0xe100, 0xe12f) AM_READWRITE(k054539_ctrl_r, k054539_ctrl_w)
1177   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
1178   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
1179   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
1177   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_byte_w)
1178   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_byte_r)
1179   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_byte_r)
11801180   AM_RANGE(0xf800, 0xf800) AM_WRITE(prmrsocr_audio_bankswitch_w)
11811181ADDRESS_MAP_END
11821182
src/mame/drivers/zodiack.c
r14896r14897
126126
127127WRITE8_MEMBER( zodiack_state::master_soundlatch_w )
128128{
129   soundlatch_w(space, offset, data);
129   soundlatch_byte_w(space, offset, data);
130130   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
131131}
132132
r14896r14897
146146   AM_RANGE(0x6082, 0x6082) AM_READ_PORT("DSW1")
147147   AM_RANGE(0x6083, 0x6083) AM_READ_PORT("IN0")
148148   AM_RANGE(0x6084, 0x6084) AM_READ_PORT("IN1")
149   AM_RANGE(0x6090, 0x6090) AM_READWRITE(soundlatch_r, master_soundlatch_w)
149   AM_RANGE(0x6090, 0x6090) AM_READWRITE(soundlatch_byte_r, master_soundlatch_w)
150150   AM_RANGE(0x7000, 0x7000) AM_READNOP AM_WRITE(watchdog_reset_w)  /* NOP??? */
151151   AM_RANGE(0x7100, 0x7100) AM_WRITE(nmi_mask_w)
152152   AM_RANGE(0x7200, 0x7200) AM_WRITE(flipscreen_w)
r14896r14897
163163   AM_RANGE(0x0000, 0x1fff) AM_ROM
164164   AM_RANGE(0x2000, 0x23ff) AM_RAM
165165   AM_RANGE(0x4000, 0x4000) AM_WRITE(sound_nmi_enable_w)
166   AM_RANGE(0x6000, 0x6000) AM_READWRITE(soundlatch_r, soundlatch_w)
166   AM_RANGE(0x6000, 0x6000) AM_READWRITE(soundlatch_byte_r, soundlatch_byte_w)
167167ADDRESS_MAP_END
168168
169169static ADDRESS_MAP_START( io_map, AS_IO, 8, zodiack_state  )
src/mame/drivers/raiden2.c
r14896r14897
12711271   AM_RANGE(0x0f800, 0x0ffff) AM_RAM /* Stack area */
12721272
12731273   AM_RANGE(0x10000, 0x1efff) AM_RAM
1274   AM_RANGE(0x1f000, 0x1ffff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1274   AM_RANGE(0x1f000, 0x1ffff) AM_RAM AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
12751275
12761276   AM_RANGE(0x20000, 0x3ffff) AM_ROMBANK("mainbank")
12771277   AM_RANGE(0x40000, 0xfffff) AM_ROM AM_REGION("mainprg", 0x40000)
r14896r14897
13081308   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(raiden2_foreground_w) AM_BASE(fore_data)
13091309   AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(raiden2_midground_w) AM_BASE(mid_data)
13101310    AM_RANGE(0x0d000, 0x0dfff) AM_RAM_WRITE(raiden2_text_w) AM_BASE(text_data)
1311   AM_RANGE(0x0e000, 0x0efff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1311   AM_RANGE(0x0e000, 0x0efff) AM_RAM AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
13121312   AM_RANGE(0x0f000, 0x0ffff) AM_RAM AM_BASE(sprites)
13131313   AM_RANGE(0x10000, 0x1ffff) AM_RAM
13141314
r14896r14897
13381338   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(raiden2_foreground_w) AM_BASE(fore_data)
13391339   AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(raiden2_midground_w) AM_BASE(mid_data)
13401340    AM_RANGE(0x0d000, 0x0dfff) AM_RAM_WRITE(raiden2_text_w) AM_BASE(text_data)
1341   AM_RANGE(0x0e000, 0x0efff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1341   AM_RANGE(0x0e000, 0x0efff) AM_RAM AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
13421342   AM_RANGE(0x0f000, 0x0ffff) AM_RAM AM_BASE(sprites)
13431343
13441344   AM_RANGE(0x10000, 0x1ffff) AM_RAM
src/mame/drivers/mogura.c
r14896r14897
99{
1010public:
1111   mogura_state(const machine_config &mconfig, device_type type, const char *tag)
12      : driver_device(mconfig, type, tag) { }
12      : driver_device(mconfig, type, tag) ,
13      m_gfxram(*this, "gfxram"),
14      m_tileram(*this, "tileram"){ }
1315
1416   /* memory pointers */
15   UINT8 *   m_tileram;
16   UINT8 *   m_gfxram;
17   required_shared_ptr<UINT8> m_gfxram;
18   required_shared_ptr<UINT8> m_tileram;
1719
1820   /* video-related */
1921   tilemap_t *m_tilemap;
r14896r14897
6365static TILE_GET_INFO( get_mogura_tile_info )
6466{
6567   mogura_state *state = machine.driver_data<mogura_state>();
66   int code = state->m_tileram[tile_index];
67   int attr = state->m_tileram[tile_index + 0x800];
68   int code = state->m_tileram.target()[tile_index];
69   int attr = state->m_tileram.target()[tile_index + 0x800];
6870
6971   SET_TILE_INFO(
7072         0,
r14896r14897
7779static VIDEO_START( mogura )
7880{
7981   mogura_state *state = machine.driver_data<mogura_state>();
80   gfx_element_set_source(machine.gfx[0], state->m_gfxram);
82   gfx_element_set_source(machine.gfx[0], state->m_gfxram.target());
8183   state->m_tilemap = tilemap_create(machine, get_mogura_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
8284}
8385
r14896r14897
102104
103105WRITE8_MEMBER(mogura_state::mogura_tileram_w)
104106{
105   m_tileram[offset] = data;
107   m_tileram.target()[offset] = data;
106108   m_tilemap->mark_tile_dirty(offset & 0x7ff);
107109}
108110
r14896r14897
115117
116118WRITE8_MEMBER(mogura_state::mogura_gfxram_w)
117119{
118   m_gfxram[offset] = data ;
120   m_gfxram.target()[offset] = data ;
119121
120122   gfx_element_mark_dirty(machine().gfx[0], offset / 16);
121123}
r14896r14897
124126static ADDRESS_MAP_START( mogura_map, AS_PROGRAM, 8, mogura_state )
125127   AM_RANGE(0x0000, 0x7fff) AM_ROM
126128   AM_RANGE(0xc000, 0xdfff) AM_RAM // main ram
127   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(mogura_gfxram_w) AM_BASE(m_gfxram) // ram based characters
128   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(mogura_tileram_w) AM_BASE(m_tileram) // tilemap
129   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(mogura_gfxram_w) AM_SHARE("gfxram") // ram based characters
130   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(mogura_tileram_w) AM_SHARE("tileram") // tilemap
129131ADDRESS_MAP_END
130132
131133static ADDRESS_MAP_START( mogura_io_map, AS_IO, 8, mogura_state )
src/mame/drivers/ddealer.c
r14896r14897
117117{
118118public:
119119   ddealer_state(const machine_config &mconfig, device_type type, const char *tag)
120      : driver_device(mconfig, type, tag) { }
120      : driver_device(mconfig, type, tag) ,
121      m_vregs(*this, "vregs"),
122      m_left_fg_vram_top(*this, "left_fg_vratop"),
123      m_right_fg_vram_top(*this, "right_fg_vratop"),
124      m_left_fg_vram_bottom(*this, "left_fg_vrabottom"),
125      m_right_fg_vram_bottom(*this, "right_fg_vrabottom"),
126      m_back_vram(*this, "back_vram"),
127      m_work_ram(*this, "work_ram"),
128      m_mcu_shared_ram(*this, "mcu_shared_ram"){ }
121129
122130   /* memory pointers */
123   UINT16 *  m_mcu_shared_ram;
124   UINT16 *  m_work_ram;
125   UINT16 *  m_back_vram;
126   UINT16 *  m_left_fg_vram_top;
127   UINT16 *  m_right_fg_vram_top;
128   UINT16 *  m_left_fg_vram_bottom;
129   UINT16 *  m_right_fg_vram_bottom;
130   UINT16 *  m_vregs;
131   required_shared_ptr<UINT16> m_vregs;
132   required_shared_ptr<UINT16> m_left_fg_vram_top;
133   required_shared_ptr<UINT16> m_right_fg_vram_top;
134   required_shared_ptr<UINT16> m_left_fg_vram_bottom;
135   required_shared_ptr<UINT16> m_right_fg_vram_bottom;
136   required_shared_ptr<UINT16> m_back_vram;
137   required_shared_ptr<UINT16> m_work_ram;
138   required_shared_ptr<UINT16> m_mcu_shared_ram;
131139//  UINT16 *  m_paletteram16; // currently this uses generic palette handling
132140
133141   /* video-related */
r14896r14897
155163static TILE_GET_INFO( get_back_tile_info )
156164{
157165   ddealer_state *state = machine.driver_data<ddealer_state>();
158   int code = state->m_back_vram[tile_index];
166   int code = state->m_back_vram.target()[tile_index];
159167   SET_TILE_INFO(
160168         0,
161169         code & 0xfff,
r14896r14897
268276
269277   if (!state->m_flipscreen)
270278   {
271      if (state->m_vregs[0xcc / 2] & 0x80)
279      if (state->m_vregs.target()[0xcc / 2] & 0x80)
272280      {
273         ddealer_draw_video_layer(screen.machine(), &state->m_vregs[0x1e0 / 2], state->m_left_fg_vram_top, state->m_left_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
274         ddealer_draw_video_layer(screen.machine(), &state->m_vregs[0xcc / 2], state->m_right_fg_vram_top, state->m_right_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
281         ddealer_draw_video_layer(screen.machine(), &state->m_vregs.target()[0x1e0 / 2], state->m_left_fg_vram_top, state->m_left_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
282         ddealer_draw_video_layer(screen.machine(), &state->m_vregs.target()[0xcc / 2], state->m_right_fg_vram_top, state->m_right_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
275283      }
276284      else
277285      {
278         ddealer_draw_video_layer(screen.machine(), &state->m_vregs[0x1e0 / 2], state->m_left_fg_vram_top, state->m_left_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
286         ddealer_draw_video_layer(screen.machine(), &state->m_vregs.target()[0x1e0 / 2], state->m_left_fg_vram_top, state->m_left_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
279287      }
280288   }
281289   else
282290   {
283      if (state->m_vregs[0xcc / 2] & 0x80)
291      if (state->m_vregs.target()[0xcc / 2] & 0x80)
284292      {
285         ddealer_draw_video_layer(screen.machine(), &state->m_vregs[0xcc / 2], state->m_left_fg_vram_top, state->m_left_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
286         ddealer_draw_video_layer(screen.machine(), &state->m_vregs[0x1e0 / 2], state->m_right_fg_vram_top, state->m_right_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
293         ddealer_draw_video_layer(screen.machine(), &state->m_vregs.target()[0xcc / 2], state->m_left_fg_vram_top, state->m_left_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
294         ddealer_draw_video_layer(screen.machine(), &state->m_vregs.target()[0x1e0 / 2], state->m_right_fg_vram_top, state->m_right_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
287295      }
288296      else
289297      {
290         ddealer_draw_video_layer(screen.machine(), &state->m_vregs[0x1e0 / 2], state->m_left_fg_vram_top, state->m_left_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
298         ddealer_draw_video_layer(screen.machine(), &state->m_vregs.target()[0x1e0 / 2], state->m_left_fg_vram_top, state->m_left_fg_vram_bottom, bitmap, cliprect, state->m_flipscreen);
291299      }
292300
293301   }
r14896r14897
306314   if (state->m_coin_input & 0x01)//coin 1
307315   {
308316      if((state->m_input_pressed & 0x01) == 0)
309         state->m_mcu_shared_ram[0x000 / 2]++;
317         state->m_mcu_shared_ram.target()[0x000 / 2]++;
310318      state->m_input_pressed = (state->m_input_pressed & 0xfe) | 1;
311319   }
312320   else
r14896r14897
315323   if (state->m_coin_input & 0x02)//coin 2
316324   {
317325      if ((state->m_input_pressed & 0x02) == 0)
318         state->m_mcu_shared_ram[0x000 / 2]++;
326         state->m_mcu_shared_ram.target()[0x000 / 2]++;
319327      state->m_input_pressed = (state->m_input_pressed & 0xfd) | 2;
320328   }
321329   else
r14896r14897
324332   if (state->m_coin_input & 0x04)//service 1
325333   {
326334      if ((state->m_input_pressed & 0x04) == 0)
327         state->m_mcu_shared_ram[0x000 / 2]++;
335         state->m_mcu_shared_ram.target()[0x000 / 2]++;
328336      state->m_input_pressed = (state->m_input_pressed & 0xfb) | 4;
329337   }
330338   else
r14896r14897
332340
333341   /*0x104/2 is some sort of "start-lock",i.e. used on the girl selection.
334342      Without it,the game "steals" one credit if you press the start button on that.*/
335   if (state->m_mcu_shared_ram[0x000 / 2] > 0 && state->m_work_ram[0x104 / 2] & 1)
343   if (state->m_mcu_shared_ram.target()[0x000 / 2] > 0 && state->m_work_ram.target()[0x104 / 2] & 1)
336344   {
337345      if (state->m_coin_input & 0x08)//start 1
338346      {
339         if ((state->m_input_pressed & 0x08) == 0 && (~(state->m_work_ram[0x100 / 2] & 1)))
340            state->m_mcu_shared_ram[0x000 / 2]--;
347         if ((state->m_input_pressed & 0x08) == 0 && (~(state->m_work_ram.target()[0x100 / 2] & 1)))
348            state->m_mcu_shared_ram.target()[0x000 / 2]--;
341349         state->m_input_pressed = (state->m_input_pressed & 0xf7) | 8;
342350      }
343351      else
r14896r14897
345353
346354      if (state->m_coin_input & 0x10)//start 2
347355      {
348         if((state->m_input_pressed & 0x10) == 0 && (~(state->m_work_ram[0x100 / 2] & 2)))
349            state->m_mcu_shared_ram[0x000 / 2]--;
356         if((state->m_input_pressed & 0x10) == 0 && (~(state->m_work_ram.target()[0x100 / 2] & 2)))
357            state->m_mcu_shared_ram.target()[0x000 / 2]--;
350358         state->m_input_pressed = (state->m_input_pressed & 0xef) | 0x10;
351359      }
352360      else
r14896r14897
354362   }
355363
356364   /*random number generators,controls order of cards*/
357   state->m_mcu_shared_ram[0x10 / 2] = timer.machine().rand() & 0xffff;
358   state->m_mcu_shared_ram[0x12 / 2] = timer.machine().rand() & 0xffff;
359   state->m_mcu_shared_ram[0x14 / 2] = timer.machine().rand() & 0xffff;
360   state->m_mcu_shared_ram[0x16 / 2] = timer.machine().rand() & 0xffff;
365   state->m_mcu_shared_ram.target()[0x10 / 2] = timer.machine().rand() & 0xffff;
366   state->m_mcu_shared_ram.target()[0x12 / 2] = timer.machine().rand() & 0xffff;
367   state->m_mcu_shared_ram.target()[0x14 / 2] = timer.machine().rand() & 0xffff;
368   state->m_mcu_shared_ram.target()[0x16 / 2] = timer.machine().rand() & 0xffff;
361369}
362370
363371
364372
365373WRITE16_MEMBER(ddealer_state::back_vram_w)
366374{
367   COMBINE_DATA(&m_back_vram[offset]);
375   COMBINE_DATA(&m_back_vram.target()[offset]);
368376   m_back_tilemap->mark_tile_dirty(offset);
369377}
370378
371379
372380WRITE16_MEMBER(ddealer_state::ddealer_vregs_w)
373381{
374   COMBINE_DATA(&m_vregs[offset]);
382   COMBINE_DATA(&m_vregs.target()[offset]);
375383}
376384
377385/******************************************************************************************************
r14896r14897
381389******************************************************************************************************/
382390
383391#define PROT_JSR(_offs_,_protvalue_,_pc_) \
384   if(m_mcu_shared_ram[(_offs_)/2] == _protvalue_) \
392   if(m_mcu_shared_ram.target()[(_offs_)/2] == _protvalue_) \
385393   { \
386      m_mcu_shared_ram[(_offs_)/2] = 0xffff;  /*(MCU job done)*/ \
387      m_mcu_shared_ram[(_offs_+2-0x10)/2] = 0x4ef9;/*JMP*/\
388      m_mcu_shared_ram[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\
389      m_mcu_shared_ram[(_offs_+6-0x10)/2] = _pc_;  /*LO-DWORD*/\
394      m_mcu_shared_ram.target()[(_offs_)/2] = 0xffff;  /*(MCU job done)*/ \
395      m_mcu_shared_ram.target()[(_offs_+2-0x10)/2] = 0x4ef9;/*JMP*/\
396      m_mcu_shared_ram.target()[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\
397      m_mcu_shared_ram.target()[(_offs_+6-0x10)/2] = _pc_;  /*LO-DWORD*/\
390398   } \
391399
392400#define PROT_INPUT(_offs_,_protvalue_,_protinput_,_input_) \
393   if(m_mcu_shared_ram[_offs_] == _protvalue_) \
401   if(m_mcu_shared_ram.target()[_offs_] == _protvalue_) \
394402   {\
395      m_mcu_shared_ram[_protinput_] = ((_input_ & 0xffff0000)>>16);\
396      m_mcu_shared_ram[_protinput_+1] = (_input_ & 0x0000ffff);\
403      m_mcu_shared_ram.target()[_protinput_] = ((_input_ & 0xffff0000)>>16);\
404      m_mcu_shared_ram.target()[_protinput_+1] = (_input_ & 0x0000ffff);\
397405   }
398406
399407WRITE16_MEMBER(ddealer_state::ddealer_mcu_shared_w)
400408{
401   COMBINE_DATA(&m_mcu_shared_ram[offset]);
409   COMBINE_DATA(&m_mcu_shared_ram.target()[offset]);
402410
403411   switch(offset)
404412   {
r14896r14897
430438      case 0x4fe/2: PROT_JSR(0x4fe,0x8018,0x9818); break;
431439      /*Start-up vector,I think that only the first ram address can be written by the main CPU,or it is a whole sequence.*/
432440      case 0x000/2:
433         if (m_mcu_shared_ram[0x000 / 2] == 0x60fe)
441         if (m_mcu_shared_ram.target()[0x000 / 2] == 0x60fe)
434442         {
435            m_mcu_shared_ram[0x000 / 2] = 0x0000;//coin counter
436            m_mcu_shared_ram[0x002 / 2] = 0x0000;//coin counter "decimal point"
437            m_mcu_shared_ram[0x004 / 2] = 0x4ef9;
443            m_mcu_shared_ram.target()[0x000 / 2] = 0x0000;//coin counter
444            m_mcu_shared_ram.target()[0x002 / 2] = 0x0000;//coin counter "decimal point"
445            m_mcu_shared_ram.target()[0x004 / 2] = 0x4ef9;
438446         }
439447         break;
440448      case 0x002/2:
441449      case 0x004/2:
442         if (m_mcu_shared_ram[0x002 / 2] == 0x0000 && m_mcu_shared_ram[0x004 / 2] == 0x0214)
443            m_mcu_shared_ram[0x004 / 2] = 0x4ef9;
450         if (m_mcu_shared_ram.target()[0x002 / 2] == 0x0000 && m_mcu_shared_ram.target()[0x004 / 2] == 0x0214)
451            m_mcu_shared_ram.target()[0x004 / 2] = 0x4ef9;
444452         break;
445453      case 0x008/2:
446         if (m_mcu_shared_ram[0x008 / 2] == 0x000f)
447            m_mcu_shared_ram[0x008 / 2] = 0x0604;
454         if (m_mcu_shared_ram.target()[0x008 / 2] == 0x000f)
455            m_mcu_shared_ram.target()[0x008 / 2] = 0x0604;
448456         break;
449457      case 0x00c/2:
450         if (m_mcu_shared_ram[0x00c / 2] == 0x000f)
451            m_mcu_shared_ram[0x00c / 2] = 0x0000;
458         if (m_mcu_shared_ram.target()[0x00c / 2] == 0x000f)
459            m_mcu_shared_ram.target()[0x00c / 2] = 0x0000;
452460         break;
453461   }
454462}
r14896r14897
460468   AM_RANGE(0x080008, 0x080009) AM_READ_PORT("DSW1")
461469   AM_RANGE(0x08000a, 0x08000b) AM_READ_PORT("UNK")
462470   AM_RANGE(0x084000, 0x084003) AM_DEVWRITE8_LEGACY("ymsnd", ym2203_w, 0x00ff) // ym ?
463   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram") // palette ram
464   AM_RANGE(0x08c000, 0x08cfff) AM_RAM_WRITE(ddealer_vregs_w) AM_BASE(m_vregs) // palette ram
471   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram") // palette ram
472   AM_RANGE(0x08c000, 0x08cfff) AM_RAM_WRITE(ddealer_vregs_w) AM_SHARE("vregs") // palette ram
465473
466474   /* this might actually be 1 tilemap with some funky rowscroll / columnscroll enabled, I'm not sure */
467   AM_RANGE(0x090000, 0x090fff) AM_RAM AM_BASE(m_left_fg_vram_top)
468   AM_RANGE(0x091000, 0x091fff) AM_RAM AM_BASE(m_right_fg_vram_top)
469   AM_RANGE(0x092000, 0x092fff) AM_RAM AM_BASE(m_left_fg_vram_bottom)
470   AM_RANGE(0x093000, 0x093fff) AM_RAM AM_BASE(m_right_fg_vram_bottom)
475   AM_RANGE(0x090000, 0x090fff) AM_RAM AM_SHARE("left_fg_vratop")
476   AM_RANGE(0x091000, 0x091fff) AM_RAM AM_SHARE("right_fg_vratop")
477   AM_RANGE(0x092000, 0x092fff) AM_RAM AM_SHARE("left_fg_vrabottom")
478   AM_RANGE(0x093000, 0x093fff) AM_RAM AM_SHARE("right_fg_vrabottom")
471479   //AM_RANGE(0x094000, 0x094001) AM_NOP // always 0?
472480   AM_RANGE(0x098000, 0x098001) AM_WRITE(ddealer_flipscreen_w)
473   AM_RANGE(0x09c000, 0x09cfff) AM_RAM_WRITE(back_vram_w) AM_BASE(m_back_vram) // bg tilemap
474   AM_RANGE(0x0f0000, 0x0fdfff) AM_RAM AM_BASE(m_work_ram)
475   AM_RANGE(0x0fe000, 0x0fefff) AM_RAM_WRITE(ddealer_mcu_shared_w) AM_BASE(m_mcu_shared_ram)
481   AM_RANGE(0x09c000, 0x09cfff) AM_RAM_WRITE(back_vram_w) AM_SHARE("back_vram") // bg tilemap
482   AM_RANGE(0x0f0000, 0x0fdfff) AM_RAM AM_SHARE("work_ram")
483   AM_RANGE(0x0fe000, 0x0fefff) AM_RAM_WRITE(ddealer_mcu_shared_w) AM_SHARE("mcu_shared_ram")
476484   AM_RANGE(0x0ff000, 0x0fffff) AM_RAM
477485ADDRESS_MAP_END
478486
src/mame/drivers/berzerk.c
r14896r14897
2121{
2222public:
2323   berzerk_state(const machine_config &mconfig, device_type type, const char *tag)
24      : driver_device(mconfig, type, tag) { }
24      : driver_device(mconfig, type, tag) ,
25      m_videoram(*this, "videoram"),
26      m_colorram(*this, "colorram"){ }
2527
26   UINT8 *m_videoram;
27   size_t m_videoram_size;
28   UINT8 *m_colorram;
28   required_shared_ptr<UINT8> m_videoram;
29   required_shared_ptr<UINT8> m_colorram;
2930   UINT8 m_magicram_control;
3031   UINT8 m_last_shift_data;
3132   UINT8 m_intercept;
r14896r14897
362363{
363364   UINT8 alu_output;
364365
365   UINT8 current_video_data = m_videoram[offset];
366   UINT8 current_video_data = m_videoram.target()[offset];
366367
367368   /* shift data towards LSB.  MSB bits are filled by data from last_shift_data.
368369       The shifter consists of 5 74153 devices @ 7A, 8A, 9A, 10A and 11A,
r14896r14897
389390   alu_output = (TTL74181_read(LS181_10C, TTL74181_OUTPUT_F0, 4) << 4) |
390391             (TTL74181_read(LS181_12C, TTL74181_OUTPUT_F0, 4) << 0);
391392
392   m_videoram[offset] = alu_output ^ 0xff;
393   m_videoram.target()[offset] = alu_output ^ 0xff;
393394
394395   /* save data for next time */
395396   m_last_shift_data = data & 0x7f;
r14896r14897
460461
461462   get_pens(screen.machine(), pens);
462463
463   for (offs = 0; offs < state->m_videoram_size; offs++)
464   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
464465   {
465466      int i;
466467
467      UINT8 data = state->m_videoram[offs];
468      UINT8 color = state->m_colorram[((offs >> 2) & 0x07e0) | (offs & 0x001f)];
468      UINT8 data = state->m_videoram.target()[offs];
469      UINT8 color = state->m_colorram.target()[((offs >> 2) & 0x07e0) | (offs & 0x001f)];
469470
470471      UINT8 y = offs >> 5;
471472      UINT8 x = offs << 3;
r14896r14897
597598   AM_RANGE(0x0000, 0x07ff) AM_ROM
598599   AM_RANGE(0x0800, 0x0bff) AM_MIRROR(0x0400) AM_RAM AM_SHARE("nvram")
599600   AM_RANGE(0x1000, 0x3fff) AM_ROM
600   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(m_videoram) AM_SIZE(m_videoram_size) AM_SHARE("share1")
601   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videoram") AM_SHARE("share1")
601602   AM_RANGE(0x6000, 0x7fff) AM_RAM_WRITE(magicram_w) AM_SHARE("share1")
602   AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x3800) AM_RAM AM_BASE(m_colorram)
603   AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x3800) AM_RAM AM_SHARE("colorram")
603604   AM_RANGE(0xc000, 0xffff) AM_NOP
604605ADDRESS_MAP_END
605606
606607
607608static ADDRESS_MAP_START( frenzy_map, AS_PROGRAM, 8, berzerk_state )
608609   AM_RANGE(0x0000, 0x3fff) AM_ROM
609   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(m_videoram) AM_SIZE(m_videoram_size) AM_SHARE("share1")
610   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videoram") AM_SHARE("share1")
610611   AM_RANGE(0x6000, 0x7fff) AM_RAM_WRITE(magicram_w) AM_SHARE("share1")
611   AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x3800) AM_RAM AM_BASE(m_colorram)
612   AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x3800) AM_RAM AM_SHARE("colorram")
612613   AM_RANGE(0xc000, 0xcfff) AM_ROM
613614   AM_RANGE(0xf800, 0xfbff) AM_MIRROR(0x0400) AM_RAM AM_SHARE("nvram")
614615ADDRESS_MAP_END
src/mame/drivers/magtouch.c
r14896r14897
9595
9696   DECLARE_WRITE_LINE_MEMBER(microtouch_out);
9797   DECLARE_WRITE_LINE_MEMBER(microtouch_in);
98   DECLARE_READ8_MEMBER(magtouch_io_r);
99   DECLARE_WRITE8_MEMBER(magtouch_io_w);
98100};
99101
100102
r14896r14897
140142 *
141143 *************************************/
142144
143static READ8_HANDLER(magtouch_io_r)
145READ8_MEMBER(magtouch_state::magtouch_io_r)
144146{
145147   switch(offset)
146148   {
147149      case 1:
148         return input_port_read(space->machine(), "IN0");
150         return input_port_read(machine(), "IN0");
149151      default:
150152         return 0;
151153   }
152154}
153155
154static WRITE8_HANDLER(magtouch_io_w)
156WRITE8_MEMBER(magtouch_state::magtouch_io_w)
155157{
156158   switch(offset)
157159   {
158160      case 6:
159         memory_set_bank(space->machine(), "rombank", data & 0x7f );
161         memory_set_bank(machine(), "rombank", data & 0x7f );
160162         break;
161163   }
162164}
r14896r14897
173175
174176static ADDRESS_MAP_START( magtouch_io, AS_IO, 32, magtouch_state )
175177   AM_IMPORT_FROM(pcat32_io_common)
176   AM_RANGE(0x02e0, 0x02e7) AM_READWRITE8_LEGACY(magtouch_io_r, magtouch_io_w, 0xffffffff)
178   AM_RANGE(0x02e0, 0x02e7) AM_READWRITE8(magtouch_io_r, magtouch_io_w, 0xffffffff)
177179   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ns16450_device, ins8250_r, ins8250_w, 0xffffffff)
178180ADDRESS_MAP_END
179181
src/mame/drivers/igs009.c
r14896r14897
2727{
2828public:
2929   igs009_state(const machine_config &mconfig, device_type type, const char *tag)
30      : driver_device(mconfig, type, tag) { }
30      : driver_device(mconfig, type, tag) ,
31      m_bg_scroll(*this, "bg_scroll"),
32      m_gp98_reel1_ram(*this, "gp98_reel1_ram"),
33      m_gp98_reel2_ram(*this, "gp98_reel2_ram"),
34      m_gp98_reel3_ram(*this, "gp98_reel3_ram"),
35      m_gp98_reel4_ram(*this, "gp98_reel4_ram"),
36      m_bg_scroll2(*this, "bg_scroll2"),
37      m_fg_tile_ram(*this, "fg_tile_ram"),
38      m_fg_color_ram(*this, "fg_color_ram"){ }
3139
40   required_shared_ptr<UINT8> m_bg_scroll;
41   required_shared_ptr<UINT8> m_gp98_reel1_ram;
42   required_shared_ptr<UINT8> m_gp98_reel2_ram;
43   required_shared_ptr<UINT8> m_gp98_reel3_ram;
44   required_shared_ptr<UINT8> m_gp98_reel4_ram;
45   required_shared_ptr<UINT8> m_bg_scroll2;
46   required_shared_ptr<UINT8> m_fg_tile_ram;
47   required_shared_ptr<UINT8> m_fg_color_ram;
3248   tilemap_t *m_gp98_reel1_tilemap;
33   UINT8 *m_gp98_reel1_ram;
3449   tilemap_t *m_gp98_reel2_tilemap;
35   UINT8 *m_gp98_reel2_ram;
3650   tilemap_t *m_gp98_reel3_tilemap;
37   UINT8 *m_gp98_reel3_ram;
3851   tilemap_t *m_gp98_reel4_tilemap;
39   UINT8 *m_gp98_reel4_ram;
40   UINT8 *m_fg_tile_ram;
41   UINT8 *m_fg_color_ram;
42   UINT8 *m_bg_scroll;
43   UINT8 *m_bg_scroll2;
4452   tilemap_t *m_fg_tilemap;
4553   int m_video_enable;
4654   int m_nmi_enable;
r14896r14897
7280
7381WRITE8_MEMBER(igs009_state::gp98_reel1_ram_w)
7482{
75   m_gp98_reel1_ram[offset] = data;
83   m_gp98_reel1_ram.target()[offset] = data;
7684   m_gp98_reel1_tilemap->mark_tile_dirty(offset);
7785}
7886
7987static TILE_GET_INFO( get_jingbell_reel1_tile_info )
8088{
8189   igs009_state *state = machine.driver_data<igs009_state>();
82   int code = state->m_gp98_reel1_ram[tile_index];
90   int code = state->m_gp98_reel1_ram.target()[tile_index];
8391
8492   SET_TILE_INFO(
8593         0,
r14896r14897
92100static TILE_GET_INFO( get_gp98_reel1_tile_info )
93101{
94102   igs009_state *state = machine.driver_data<igs009_state>();
95   int code = state->m_gp98_reel1_ram[tile_index];
103   int code = state->m_gp98_reel1_ram.target()[tile_index];
96104
97105   SET_TILE_INFO(
98106         0,
r14896r14897
104112
105113WRITE8_MEMBER(igs009_state::gp98_reel2_ram_w)
106114{
107   m_gp98_reel2_ram[offset] = data;
115   m_gp98_reel2_ram.target()[offset] = data;
108116   m_gp98_reel2_tilemap->mark_tile_dirty(offset);
109117}
110118
111119static TILE_GET_INFO( get_jingbell_reel2_tile_info )
112120{
113121   igs009_state *state = machine.driver_data<igs009_state>();
114   int code = state->m_gp98_reel2_ram[tile_index];
122   int code = state->m_gp98_reel2_ram.target()[tile_index];
115123
116124   SET_TILE_INFO(
117125         0,
r14896r14897
123131static TILE_GET_INFO( get_gp98_reel2_tile_info )
124132{
125133   igs009_state *state = machine.driver_data<igs009_state>();
126   int code = state->m_gp98_reel2_ram[tile_index];
134   int code = state->m_gp98_reel2_ram.target()[tile_index];
127135
128136   SET_TILE_INFO(
129137         0,
r14896r14897
136144
137145WRITE8_MEMBER(igs009_state::gp98_reel3_ram_w)
138146{
139   m_gp98_reel3_ram[offset] = data;
147   m_gp98_reel3_ram.target()[offset] = data;
140148   m_gp98_reel3_tilemap->mark_tile_dirty(offset);
141149}
142150
143151static TILE_GET_INFO( get_jingbell_reel3_tile_info )
144152{
145153   igs009_state *state = machine.driver_data<igs009_state>();
146   int code = state->m_gp98_reel3_ram[tile_index];
154   int code = state->m_gp98_reel3_ram.target()[tile_index];
147155
148156   SET_TILE_INFO(
149157         0,
r14896r14897
155163static TILE_GET_INFO( get_gp98_reel3_tile_info )
156164{
157165   igs009_state *state = machine.driver_data<igs009_state>();
158   int code = state->m_gp98_reel3_ram[tile_index];
166   int code = state->m_gp98_reel3_ram.target()[tile_index];
159167
160168   SET_TILE_INFO(
161169         0,
r14896r14897
168176
169177WRITE8_MEMBER(igs009_state::gp98_reel4_ram_w)
170178{
171   m_gp98_reel4_ram[offset] = data;
179   m_gp98_reel4_ram.target()[offset] = data;
172180   m_gp98_reel4_tilemap->mark_tile_dirty(offset);
173181}
174182
175183static TILE_GET_INFO( get_jingbell_reel4_tile_info )
176184{
177185   igs009_state *state = machine.driver_data<igs009_state>();
178   int code = state->m_gp98_reel4_ram[tile_index];
186   int code = state->m_gp98_reel4_ram.target()[tile_index];
179187
180188   SET_TILE_INFO(
181189         0,
r14896r14897
187195static TILE_GET_INFO( get_gp98_reel4_tile_info )
188196{
189197   igs009_state *state = machine.driver_data<igs009_state>();
190   int code = state->m_gp98_reel4_ram[tile_index];
198   int code = state->m_gp98_reel4_ram.target()[tile_index];
191199
192200   SET_TILE_INFO(
193201         0,
r14896r14897
204212
205213WRITE8_MEMBER(igs009_state::bg_scroll_w)
206214{
207   m_bg_scroll[offset] = data;
215   m_bg_scroll.target()[offset] = data;
208216//  bg_tilemap->set_scrolly(offset,data);
209217}
210218
r14896r14897
212220static TILE_GET_INFO( get_fg_tile_info )
213221{
214222   igs009_state *state = machine.driver_data<igs009_state>();
215   int code = state->m_fg_tile_ram[tile_index] | (state->m_fg_color_ram[tile_index] << 8);
223   int code = state->m_fg_tile_ram.target()[tile_index] | (state->m_fg_color_ram.target()[tile_index] << 8);
216224   SET_TILE_INFO(1, code, (4*(code >> 14)+3), 0);
217225}
218226
219227WRITE8_MEMBER(igs009_state::fg_tile_w)
220228{
221   m_fg_tile_ram[offset] = data;
229   m_fg_tile_ram.target()[offset] = data;
222230   m_fg_tilemap->mark_tile_dirty(offset);
223231}
224232
225233WRITE8_MEMBER(igs009_state::fg_color_w)
226234{
227   m_fg_color_ram[offset] = data;
235   m_fg_color_ram.target()[offset] = data;
228236   m_fg_tilemap->mark_tile_dirty(offset);
229237}
230238
r14896r14897
290298
291299      for (i= 0;i < 0x80;i++)
292300      {
293         state->m_gp98_reel1_tilemap->set_scrolly(i, state->m_bg_scroll[i]*2);
294         state->m_gp98_reel2_tilemap->set_scrolly(i, state->m_bg_scroll[i+0x80]*2);
295         state->m_gp98_reel3_tilemap->set_scrolly(i, state->m_bg_scroll[i+0x100]*2);
296         state->m_gp98_reel4_tilemap->set_scrolly(i, state->m_bg_scroll[i+0x180]*2);
301         state->m_gp98_reel1_tilemap->set_scrolly(i, state->m_bg_scroll.target()[i]*2);
302         state->m_gp98_reel2_tilemap->set_scrolly(i, state->m_bg_scroll.target()[i+0x80]*2);
303         state->m_gp98_reel3_tilemap->set_scrolly(i, state->m_bg_scroll.target()[i+0x100]*2);
304         state->m_gp98_reel4_tilemap->set_scrolly(i, state->m_bg_scroll.target()[i+0x180]*2);
297305      }
298306
299307
r14896r14897
302310      for (zz=0;zz<0x80-8;zz++) // -8 because of visible area (2*8 = 16)
303311      {
304312         rectangle clip;
305         int rowenable = state->m_bg_scroll2[zz];
313         int rowenable = state->m_bg_scroll2.target()[zz];
306314
307315         /* draw top of screen */
308316         clip.set(visarea.min_x, visarea.max_x, startclipmin, startclipmin+2);
r14896r14897
454462
455463   AM_RANGE( 0x1000, 0x11ff ) AM_RAM_WRITE(bg_scroll_w ) AM_BASE(m_bg_scroll )
456464
457   AM_RANGE( 0x2000, 0x23ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_SHARE("paletteram")
458   AM_RANGE( 0x2400, 0x27ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_SHARE("paletteram2")
465   AM_RANGE( 0x2000, 0x23ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) AM_SHARE("paletteram")
466   AM_RANGE( 0x2400, 0x27ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) AM_SHARE("paletteram2")
459467
460468   AM_RANGE( 0x3000, 0x33ff ) AM_RAM_WRITE(gp98_reel1_ram_w )  AM_BASE(m_gp98_reel1_ram )
461469   AM_RANGE( 0x3400, 0x37ff ) AM_RAM_WRITE(gp98_reel2_ram_w )  AM_BASE(m_gp98_reel2_ram )
src/mame/drivers/spy.c
r14896r14897
6363
6464   if (m_rambank & 1)
6565   {
66      paletteram_xBBBBBGGGGGRRRRR_be_w(space,offset,data);
66      paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space,offset,data);
6767   }
6868   else if (m_rambank & 2)
6969   {
r14896r14897
383383   AM_RANGE(0x3f80, 0x3f80) AM_WRITE(bankswitch_w)
384384   AM_RANGE(0x3f90, 0x3f90) AM_WRITE(spy_3f90_w)
385385   AM_RANGE(0x3fa0, 0x3fa0) AM_WRITE(watchdog_reset_w)
386   AM_RANGE(0x3fb0, 0x3fb0) AM_WRITE(soundlatch_w)
386   AM_RANGE(0x3fb0, 0x3fb0) AM_WRITE(soundlatch_byte_w)
387387   AM_RANGE(0x3fc0, 0x3fc0) AM_WRITE(spy_sh_irqtrigger_w)
388388   AM_RANGE(0x3fd0, 0x3fd0) AM_READ_PORT("SYSTEM")
389389   AM_RANGE(0x3fd1, 0x3fd1) AM_READ_PORT("P1")
r14896r14897
402402   AM_RANGE(0xa000, 0xa00d) AM_DEVREADWRITE_LEGACY("k007232_1", k007232_r, k007232_w)
403403   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232_2", k007232_r, k007232_w)
404404   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r,ym3812_w)
405   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
405   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r)
406406ADDRESS_MAP_END
407407
408408
src/mame/drivers/psikyo.c
r14896r14897
305305
306306***************************************************************************/
307307
308READ32_MEMBER(psikyo_state::paletteram32_dword_r)
309{
310   return (m_generic_paletteram_16[offset * 2] << 16) | m_generic_paletteram_16[offset * 2 + 1];
311}
312
313WRITE32_MEMBER(psikyo_state::paletteram32_xRRRRRGGGGGBBBBB_dword_w)
314{
315   if (ACCESSING_BITS_16_31)
316      paletteram16_xRRRRRGGGGGBBBBB_word_w(space, offset * 2, data >> 16, mem_mask >> 16);
317   if (ACCESSING_BITS_0_15)
318      paletteram16_xRRRRRGGGGGBBBBB_word_w(space, offset * 2 + 1, data, mem_mask);
319}
320
321308static ADDRESS_MAP_START( psikyo_map, AS_PROGRAM, 32, psikyo_state )
322309   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                          // ROM (not all used)
323310   AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites, buffered by two frames (list buffered + fb buffered)
324   AM_RANGE(0x600000, 0x601fff) AM_READWRITE(paletteram32_dword_r, paletteram32_xRRRRRGGGGGBBBBB_dword_w)   // Palette
311   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_dword_be_w) AM_SHARE("paletteram")   // Palette
325312   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(psikyo_vram_0_w) AM_BASE(m_vram_0)      // Layer 0
326313   AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(psikyo_vram_1_w) AM_BASE(m_vram_1)      // Layer 1
327314   AM_RANGE(0x804000, 0x807fff) AM_RAM AM_BASE(m_vregs)                     // RAM + Vregs
r14896r14897
370357   AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE(m_bootleg_spritebuffer)            // RAM (it copies the spritelist here, the HW probably doesn't have automatic buffering like the originals?
371358
372359   AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites, buffered by two frames (list buffered + fb buffered)
373   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram32_xRRRRRGGGGGBBBBB_dword_w)   // Palette
360   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_dword_be_w) AM_SHARE("paletteram")   // Palette
374361   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(psikyo_vram_0_w) AM_BASE(m_vram_0)      // Layer 0
375362   AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(psikyo_vram_1_w) AM_BASE(m_vram_1)      // Layer 1
376363   AM_RANGE(0x804000, 0x807fff) AM_RAM AM_BASE(m_vregs)                        // RAM + Vregs
r14896r14897
10301017{
10311018   psikyo_state *state = machine.driver_data<psikyo_state>();
10321019   
1033   state->m_generic_paletteram_16.allocate(0x1000);
1034
10351020   state->m_audiocpu = machine.device("audiocpu");
10361021
10371022   state->save_item(NAME(state->m_soundlatch));
src/mame/drivers/tapatune.c
r14896r14897
3939{
4040public:
4141   tapatune_state(const machine_config &mconfig, device_type type, const char *tag)
42      : driver_device(mconfig, type, tag) {}
42      : driver_device(mconfig, type, tag),
43        m_videoram(*this, "videoram") {}
4344
4445   UINT8   m_paletteram[0x300];
4546   UINT16   m_palette_write_address;
4647   rgb_t   m_pens[0x100];
4748
48   UINT16   *m_videoram;
49   required_shared_ptr<UINT16> m_videoram;
4950
5051   UINT8   m_controls_mux;
5152   UINT8   m_z80_to_68k_index;
r14896r14897
128129
129130static ADDRESS_MAP_START( tapatune_map, AS_PROGRAM, 16, tapatune_state )
130131   AM_RANGE(0x000000, 0x2fffff) AM_ROM // program rom and graphics roms
131   AM_RANGE(0x300000, 0x31ffff) AM_RAM AM_BASE(m_videoram) // hardware video buffer
132   AM_RANGE(0x300000, 0x31ffff) AM_RAM AM_SHARE("videoram") // hardware video buffer
132133   AM_RANGE(0x320000, 0x327fff) AM_RAM // workram
133134   AM_RANGE(0x328000, 0x32ffff) AM_RAM
134135   AM_RANGE(0x330000, 0x337fff) AM_RAM // ram used as system video buffer
r14896r14897
285286   PORT_START("COINS")
286287   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
287288   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1)
288   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
289   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
289290   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
290291
291292   PORT_START("BUTTONS")
r14896r14897
343344
344345   for (x = 0; x < x_count*4; x++)
345346   {
346      UINT8 pix = ((UINT8*)state->m_videoram)[BYTE_XOR_BE(offs + x)];
347      UINT8 pix = ((UINT8*)state->m_videoram.target())[BYTE_XOR_BE(offs + x)];
347348      dest[2*x] = pens[((pix >> 4) & 0x0f)];
348349      dest[2*x + 1] = pens[(pix & 0x0f)];
349350   }
r14896r14897
397398
398399   MCFG_MC6845_ADD("crtc", H46505, 24000000/16, h46505_intf)   /* H46505 */
399400
400   MCFG_TICKET_DISPENSER_ADD("ticket", 100, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW)
401   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW)
401402
402403   /* sound hardware */
403404   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
src/mame/drivers/dacholer.c
r14896r14897
4343   dacholer_state(const machine_config &mconfig, device_type type, const char *tag)
4444      : driver_device(mconfig, type, tag),
4545      m_maincpu(*this,"maincpu"),
46      m_audiocpu(*this,"audiocpu")
47      { }
46      m_audiocpu(*this,"audiocpu"),
47      m_bgvideoram(*this, "bgvideoram"),
48      m_fgvideoram(*this, "fgvideoram"),
49      m_spriteram(*this, "spriteram"){ }
4850
51   /* devices */
52   required_device<cpu_device> m_maincpu;
53   required_device<cpu_device> m_audiocpu;
4954   /* memory pointers */
50   UINT8 *  m_bgvideoram;
51   UINT8 *  m_fgvideoram;
52   UINT8 *  m_spriteram;
53   size_t   m_spriteram_size;
55   required_shared_ptr<UINT8> m_bgvideoram;
56   required_shared_ptr<UINT8> m_fgvideoram;
57   required_shared_ptr<UINT8> m_spriteram;
5458
5559   /* video-related */
5660   tilemap_t  *m_bg_tilemap;
r14896r14897
6670   UINT8 m_music_interrupt_enable;
6771   UINT8 m_snd_ack;
6872
69   /* devices */
70   required_device<cpu_device> m_maincpu;
71   required_device<cpu_device> m_audiocpu;
7273   DECLARE_WRITE8_MEMBER(bg_scroll_x_w);
7374   DECLARE_WRITE8_MEMBER(bg_scroll_y_w);
7475   DECLARE_WRITE8_MEMBER(background_w);
r14896r14897
8788static TILE_GET_INFO( get_bg_tile_info )
8889{
8990   dacholer_state *state = machine.driver_data<dacholer_state>();
90   SET_TILE_INFO(1, state->m_bgvideoram[tile_index] + state->m_bg_bank * 0x100, 0, 0);
91   SET_TILE_INFO(1, state->m_bgvideoram.target()[tile_index] + state->m_bg_bank * 0x100, 0, 0);
9192}
9293
9394static TILE_GET_INFO( get_fg_tile_info )
9495{
9596   dacholer_state *state = machine.driver_data<dacholer_state>();
96   SET_TILE_INFO(0, state->m_fgvideoram[tile_index], 0, 0);
97   SET_TILE_INFO(0, state->m_fgvideoram.target()[tile_index], 0, 0);
9798}
9899
99100static VIDEO_START( dacholer )
r14896r14897
120121   dacholer_state *state = machine.driver_data<dacholer_state>();
121122   int offs, code, attr, sx, sy, flipx, flipy;
122123
123   for (offs = 0; offs < state->m_spriteram_size; offs += 4)
124   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
124125   {
125      code = state->m_spriteram[offs + 1];
126      attr = state->m_spriteram[offs + 2];
126      code = state->m_spriteram.target()[offs + 1];
127      attr = state->m_spriteram.target()[offs + 2];
127128
128129      flipx = attr & 0x10;
129130      flipy = attr & 0x20;
130131
131      sx = (state->m_spriteram[offs + 3] - 128) + 256 * (attr & 0x01);
132      sy = 255 - state->m_spriteram[offs];
132      sx = (state->m_spriteram.target()[offs + 3] - 128) + 256 * (attr & 0x01);
133      sy = 255 - state->m_spriteram.target()[offs];
133134
134      if (flip_screen_get(machine))
135      if (state->flip_screen())
135136      {
136137         sx = 240 - sx;
137138         sy = 240 - sy;
r14896r14897
151152{
152153   dacholer_state *state = screen.machine().driver_data<dacholer_state>();
153154
154   if (flip_screen_get(screen.machine()))
155   if (state->flip_screen())
155156   {
156157      state->m_bg_tilemap->set_scrollx(0, 256 - state->m_scroll_x);
157158      state->m_bg_tilemap->set_scrolly(0, 256 - state->m_scroll_y);
r14896r14897
170171
171172WRITE8_MEMBER(dacholer_state::background_w)
172173{
173   m_bgvideoram[offset] = data;
174   m_bgvideoram.target()[offset] = data;
174175   m_bg_tilemap->mark_tile_dirty(offset);
175176}
176177
177178WRITE8_MEMBER(dacholer_state::foreground_w)
178179{
179   m_fgvideoram[offset] = data;
180   m_fgvideoram.target()[offset] = data;
180181   m_fg_tilemap->mark_tile_dirty(offset);
181182}
182183
r14896r14897
188189      m_bg_tilemap->mark_all_dirty();
189190   }
190191
191   flip_screen_set(machine(), data & 0xc); // probably one bit for flipx and one for flipy
192   flip_screen_set(data & 0xc); // probably one bit for flipx and one for flipy
192193
193194}
194195
r14896r14897
203204
204205WRITE8_MEMBER(dacholer_state::snd_w)
205206{
206   soundlatch_w(space, offset, data);
207   soundlatch_byte_w(space, offset, data);
207208   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
208209}
209210
r14896r14897
216217static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, dacholer_state )
217218   AM_RANGE(0x0000, 0x7fff) AM_ROM
218219   AM_RANGE(0x8800, 0x97ff) AM_RAM
219   AM_RANGE(0xc000, 0xc3ff) AM_MIRROR(0x400) AM_RAM_WRITE(background_w) AM_BASE(m_bgvideoram)
220   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(foreground_w) AM_BASE(m_fgvideoram)
221   AM_RANGE(0xe000, 0xe0ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
220   AM_RANGE(0xc000, 0xc3ff) AM_MIRROR(0x400) AM_RAM_WRITE(background_w) AM_SHARE("bgvideoram")
221   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(foreground_w) AM_SHARE("fgvideoram")
222   AM_RANGE(0xe000, 0xe0ff) AM_RAM AM_SHARE("spriteram")
222223ADDRESS_MAP_END
223224
224225static ADDRESS_MAP_START( itaten_main_map, AS_PROGRAM, 8, dacholer_state )
r14896r14897
284285
285286static ADDRESS_MAP_START( snd_io_map, AS_IO, 8, dacholer_state )
286287   ADDRESS_MAP_GLOBAL_MASK(0xff)
287   AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_r, soundlatch_clear_w )
288   AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w )
288289   AM_RANGE(0x04, 0x04) AM_WRITE(music_irq_w)
289290   AM_RANGE(0x08, 0x08) AM_WRITE(snd_irq_w)
290291   AM_RANGE(0x0c, 0x0c) AM_WRITE(snd_ack_w)
r14896r14897
296297
297298static ADDRESS_MAP_START( itaten_snd_io_map, AS_IO, 8, dacholer_state )
298299   ADDRESS_MAP_GLOBAL_MASK(0xff)
299   AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_r, soundlatch_clear_w )
300   AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w )
300301   AM_RANGE(0x86, 0x87) AM_DEVWRITE_LEGACY("ay1", ay8910_data_address_w)
301302   AM_RANGE(0x8a, 0x8b) AM_DEVWRITE_LEGACY("ay2", ay8910_data_address_w)
302303   AM_RANGE(0x8e, 0x8f) AM_DEVWRITE_LEGACY("ay3", ay8910_data_address_w)
src/mame/drivers/esd16.c
r14896r14897
6767{
6868   if (ACCESSING_BITS_0_7)
6969   {
70      soundlatch_w(space, 0, data & 0xff);
70      soundlatch_byte_w(space, 0, data & 0xff);
7171      device_set_input_line(m_audio_cpu, 0, ASSERT_LINE);      // Generate an IRQ
7272      device_spin_until_time(&space.device(), attotime::from_usec(50));   // Allow the other CPU to reply
7373   }
r14896r14897
8282static ADDRESS_MAP_START( multchmp_map, AS_PROGRAM, 16, esd16_state )
8383   AM_RANGE(0x000000, 0x07ffff) AM_ROM                                                      // ROM
8484   AM_RANGE(0x100000, 0x10ffff) AM_RAM                                                      // RAM
85   AM_RANGE(0x200000, 0x2005ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
85   AM_RANGE(0x200000, 0x2005ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
8686/**/AM_RANGE(0x300000, 0x3007ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)            // Sprites
8787   AM_RANGE(0x300800, 0x300807) AM_WRITE(esd16_spriteram_w)                                    // Sprites (Mirrored)
8888/**/AM_RANGE(0x400000, 0x403fff) AM_RAM_WRITE(esd16_vram_0_w) AM_BASE(m_vram_0)                  // Layers
r14896r14897
133133static ADDRESS_MAP_START( hedpanic_map, AS_PROGRAM, 16, esd16_state )
134134   AM_RANGE(0x000000, 0x07ffff) AM_ROM                                                      // ROM
135135   AM_RANGE(0x100000, 0x10ffff) AM_RAM                                                      // RAM
136   AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
136   AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
137137   AM_RANGE(0x900000, 0x9007ff) AM_WRITEONLY AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites
138138   AM_RANGE(0x900800, 0x900807) AM_WRITE(esd16_spriteram_w)                                    // Sprites (Mirrored)
139139   AM_RANGE(0xa00000, 0xa03fff) AM_WRITE(esd16_vram_0_w) AM_BASE(m_vram_0)                     // Layers
r14896r14897
164164   AM_RANGE(0x300000, 0x303fff) AM_WRITE(esd16_vram_0_w) AM_BASE(m_vram_0)                     // Layers
165165   AM_RANGE(0x320000, 0x323fff) AM_WRITE(esd16_vram_1_w) AM_BASE(m_vram_1)                     //
166166   AM_RANGE(0x324000, 0x327fff) AM_WRITE(esd16_vram_1_w) AM_BASE(m_vram_1)                     // mirror?
167   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
167   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
168168   AM_RANGE(0x500000, 0x500001) AM_WRITENOP   // IRQ Ack
169169   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P1_P2")
170170   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
r14896r14897
188188
189189static ADDRESS_MAP_START( tangtang_map, AS_PROGRAM, 16, esd16_state )
190190   AM_RANGE(0x000000, 0x07ffff) AM_ROM                                                      // ROM
191   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // RAM
191   AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // RAM
192192   AM_RANGE(0x200000, 0x2007ff) AM_WRITEONLY AM_BASE_SIZE(m_spriteram, m_spriteram_size)      // Sprites
193193   AM_RANGE(0x200800, 0x200807) AM_WRITE(esd16_spriteram_w)                                    // Sprites (Mirrored)
194194   AM_RANGE(0x300000, 0x303fff) AM_WRITE(esd16_vram_0_w) AM_BASE(m_vram_0)                     // Layers
r14896r14897
240240
241241   /* Clear IRQ only after reading the command, or some get lost */
242242   device_set_input_line(m_audio_cpu, 0, CLEAR_LINE);
243   return soundlatch_r(space, 0);
243   return soundlatch_byte_r(space, 0);
244244}
245245
246246static ADDRESS_MAP_START( multchmp_sound_io_map, AS_IO, 8, esd16_state )
src/mame/drivers/model3.c
r14896r14897
689689/* Motorola MPC105 PCI Bridge/Memory Controller */
690690
691691
692static UINT32 pci_device_get_reg(model3_state *state)
692UINT32 model3_state::pci_device_get_reg()
693693{
694   int device = state->m_pci_device;
695   int reg = state->m_pci_reg;
694   int device = m_pci_device;
695   int reg = m_pci_reg;
696696
697697   switch(device)
698698   {
r14896r14897
708708      case 13:      /* Real3D Controller chip */
709709         switch(reg)
710710         {
711            case 0:      return state->m_real3d_device_id;   /* PCI Vendor ID & Device ID */
711            case 0:      return m_real3d_device_id;   /* PCI Vendor ID & Device ID */
712712            default:
713713               logerror("pci_device_get_reg: Real3D controller, unknown reg %02X", reg);
714714               break;
r14896r14897
742742   return 0;
743743}
744744
745static void pci_device_set_reg(model3_state *state, UINT32 value)
745void model3_state::pci_device_set_reg(UINT32 value)
746746{
747   int device = state->m_pci_device;
748   int reg = state->m_pci_reg;
747   int device = m_pci_device;
748   int reg = m_pci_reg;
749749
750750   switch(device)
751751   {
r14896r14897
815815   }
816816}
817817
818static READ64_HANDLER( mpc105_addr_r )
818READ64_MEMBER(model3_state::mpc105_addr_r)
819819{
820   model3_state *state = space->machine().driver_data<model3_state>();
821820   if (ACCESSING_BITS_32_63)
822821   {
823      return (UINT64)state->m_mpc105_addr << 32;
822      return (UINT64)m_mpc105_addr << 32;
824823   }
825824   return 0;
826825}
827826
828static WRITE64_HANDLER( mpc105_addr_w )
827WRITE64_MEMBER(model3_state::mpc105_addr_w)
829828{
830   model3_state *state = space->machine().driver_data<model3_state>();
831829   if (ACCESSING_BITS_32_63)
832830   {
833831      UINT32 d = FLIPENDIAN_INT32((UINT32)(data >> 32));
834      state->m_mpc105_addr = data >> 32;
832      m_mpc105_addr = data >> 32;
835833
836      state->m_pci_bus = (d >> 16) & 0xff;
837      state->m_pci_device = (d >> 11) & 0x1f;
838      state->m_pci_function = (d >> 8) & 0x7;
839      state->m_pci_reg = (d >> 2) & 0x3f;
834      m_pci_bus = (d >> 16) & 0xff;
835      m_pci_device = (d >> 11) & 0x1f;
836      m_pci_function = (d >> 8) & 0x7;
837      m_pci_reg = (d >> 2) & 0x3f;
840838   }
841839}
842840
843static READ64_HANDLER( mpc105_data_r )
841READ64_MEMBER(model3_state::mpc105_data_r)
844842{
845   model3_state *state = space->machine().driver_data<model3_state>();
846   if(state->m_pci_device == 0) {
847      return ((UINT64)(FLIPENDIAN_INT32(state->m_mpc105_regs[(state->m_pci_reg/2)+1])) << 32) |
848            ((UINT64)(FLIPENDIAN_INT32(state->m_mpc105_regs[(state->m_pci_reg/2)+0])));
843   if(m_pci_device == 0) {
844      return ((UINT64)(FLIPENDIAN_INT32(m_mpc105_regs[(m_pci_reg/2)+1])) << 32) |
845            ((UINT64)(FLIPENDIAN_INT32(m_mpc105_regs[(m_pci_reg/2)+0])));
849846   }
850   return FLIPENDIAN_INT32(pci_device_get_reg(state));
847   return FLIPENDIAN_INT32(pci_device_get_reg());
851848}
852849
853static WRITE64_HANDLER( mpc105_data_w )
850WRITE64_MEMBER(model3_state::mpc105_data_w)
854851{
855   model3_state *state = space->machine().driver_data<model3_state>();
856   if(state->m_pci_device == 0) {
857      state->m_mpc105_regs[(state->m_pci_reg/2)+1] = FLIPENDIAN_INT32((UINT32)(data >> 32));
858      state->m_mpc105_regs[(state->m_pci_reg/2)+0] = FLIPENDIAN_INT32((UINT32)(data));
852   if(m_pci_device == 0) {
853      m_mpc105_regs[(m_pci_reg/2)+1] = FLIPENDIAN_INT32((UINT32)(data >> 32));
854      m_mpc105_regs[(m_pci_reg/2)+0] = FLIPENDIAN_INT32((UINT32)(data));
859855      return;
860856   }
861857   if (ACCESSING_BITS_0_31)
862858   {
863      pci_device_set_reg(state, FLIPENDIAN_INT32((UINT32)data));
859      pci_device_set_reg(FLIPENDIAN_INT32((UINT32)data));
864860   }
865861}
866862
867static READ64_HANDLER( mpc105_reg_r )
863READ64_MEMBER(model3_state::mpc105_reg_r)
868864{
869   model3_state *state = space->machine().driver_data<model3_state>();
870   return ((UINT64)(state->m_mpc105_regs[(offset*2)+0]) << 32) |
871         (UINT64)(state->m_mpc105_regs[(offset*2)+1]);
865   return ((UINT64)(m_mpc105_regs[(offset*2)+0]) << 32) |
866         (UINT64)(m_mpc105_regs[(offset*2)+1]);
872867}
873868
874static WRITE64_HANDLER( mpc105_reg_w )
869WRITE64_MEMBER(model3_state::mpc105_reg_w)
875870{
876   model3_state *state = space->machine().driver_data<model3_state>();
877   state->m_mpc105_regs[(offset*2)+0] = (UINT32)(data >> 32);
878   state->m_mpc105_regs[(offset*2)+1] = (UINT32)data;
871   m_mpc105_regs[(offset*2)+0] = (UINT32)(data >> 32);
872   m_mpc105_regs[(offset*2)+1] = (UINT32)data;
879873}
880874
881875static void mpc105_init(running_machine &machine)
r14896r14897
898892/* Motorola MPC106 PCI Bridge/Memory Controller */
899893
900894
901static READ64_HANDLER( mpc106_addr_r )
895READ64_MEMBER(model3_state::mpc106_addr_r)
902896{
903   model3_state *state = space->machine().driver_data<model3_state>();
904897   if (ACCESSING_BITS_32_63)
905898   {
906      return (UINT64)state->m_mpc106_addr << 32;
899      return (UINT64)m_mpc106_addr << 32;
907900   }
908901   return 0;
909902}
910903
911static WRITE64_HANDLER( mpc106_addr_w )
904WRITE64_MEMBER(model3_state::mpc106_addr_w)
912905{
913   model3_state *state = space->machine().driver_data<model3_state>();
914906   if (ACCESSING_BITS_32_63)
915907   {
916908      UINT32 d = FLIPENDIAN_INT32((UINT32)(data >> 32));
917909
918910      if (((d >> 8) & 0xffffff) == 0x800000)
919911      {
920         state->m_mpc106_addr = d & 0xff;
912         m_mpc106_addr = d & 0xff;
921913      }
922914      else
923915      {
924         state->m_mpc106_addr = data >> 32;
916         m_mpc106_addr = data >> 32;
925917
926         state->m_pci_bus = (d >> 16) & 0xff;
927         state->m_pci_device = (d >> 11) & 0x1f;
928         state->m_pci_function = (d >> 8) & 0x7;
929         state->m_pci_reg = (d >> 2) & 0x3f;
918         m_pci_bus = (d >> 16) & 0xff;
919         m_pci_device = (d >> 11) & 0x1f;
920         m_pci_function = (d >> 8) & 0x7;
921         m_pci_reg = (d >> 2) & 0x3f;
930922      }
931923   }
932924}
933925
934static READ64_HANDLER( mpc106_data_r )
926READ64_MEMBER(model3_state::mpc106_data_r)
935927{
936   model3_state *state = space->machine().driver_data<model3_state>();
937   if(state->m_pci_device == 0) {
938      return ((UINT64)(FLIPENDIAN_INT32(state->m_mpc106_regs[(state->m_pci_reg/2)+1])) << 32) |
939            ((UINT64)(FLIPENDIAN_INT32(state->m_mpc106_regs[(state->m_pci_reg/2)+0])));
928   if(m_pci_device == 0) {
929      return ((UINT64)(FLIPENDIAN_INT32(m_mpc106_regs[(m_pci_reg/2)+1])) << 32) |
930            ((UINT64)(FLIPENDIAN_INT32(m_mpc106_regs[(m_pci_reg/2)+0])));
940931   }
941932   if (ACCESSING_BITS_32_63)
942933   {
943      return (UINT64)(FLIPENDIAN_INT32(pci_device_get_reg(state))) << 32;
934      return (UINT64)(FLIPENDIAN_INT32(pci_device_get_reg())) << 32;
944935   }
945936   else
946937   {
947      return (UINT64)(FLIPENDIAN_INT32(pci_device_get_reg(state)));
938      return (UINT64)(FLIPENDIAN_INT32(pci_device_get_reg()));
948939   }
949940}
950941
951static WRITE64_HANDLER( mpc106_data_w )
942WRITE64_MEMBER(model3_state::mpc106_data_w)
952943{
953   model3_state *state = space->machine().driver_data<model3_state>();
954   if(state->m_pci_device == 0) {
955      state->m_mpc106_regs[(state->m_pci_reg/2)+1] = FLIPENDIAN_INT32((UINT32)(data >> 32));
956      state->m_mpc106_regs[(state->m_pci_reg/2)+0] = FLIPENDIAN_INT32((UINT32)(data));
944   if(m_pci_device == 0) {
945      m_mpc106_regs[(m_pci_reg/2)+1] = FLIPENDIAN_INT32((UINT32)(data >> 32));
946      m_mpc106_regs[(m_pci_reg/2)+0] = FLIPENDIAN_INT32((UINT32)(data));
957947      return;
958948   }
959949   if (ACCESSING_BITS_0_31)
960950   {
961      pci_device_set_reg(state, FLIPENDIAN_INT32((UINT32)data));
951      pci_device_set_reg(FLIPENDIAN_INT32((UINT32)data));
962952   }
963953}
964954
965static READ64_HANDLER( mpc106_reg_r )
955READ64_MEMBER(model3_state::mpc106_reg_r)
966956{
967   model3_state *state = space->machine().driver_data<model3_state>();
968   return ((UINT64)(state->m_mpc106_regs[(offset*2)+0]) << 32) |
969         (UINT64)(state->m_mpc106_regs[(offset*2)+1]);
957   return ((UINT64)(m_mpc106_regs[(offset*2)+0]) << 32) |
958         (UINT64)(m_mpc106_regs[(offset*2)+1]);
970959}
971960
972static WRITE64_HANDLER( mpc106_reg_w )
961WRITE64_MEMBER(model3_state::mpc106_reg_w)
973962{
974   model3_state *state = space->machine().driver_data<model3_state>();
975   state->m_mpc106_regs[(offset*2)+0] = (UINT32)(data >> 32);
976   state->m_mpc106_regs[(offset*2)+1] = (UINT32)data;
963   m_mpc106_regs[(offset*2)+0] = (UINT32)(data >> 32);
964   m_mpc106_regs[(offset*2)+1] = (UINT32)data;
977965}
978966
979967static void mpc106_init(running_machine &machine)
r14896r14897
999987
1000988/*****************************************************************************/
1001989
1002static READ64_HANDLER(scsi_r)
990READ64_MEMBER(model3_state::scsi_r)
1003991{
1004992   int reg = offset*8;
1005993   UINT64 r = 0;
1006994   if (ACCESSING_BITS_56_63) {
1007      r |= (UINT64)lsi53c810_reg_r(space, reg+0) << 56;
995      r |= (UINT64)lsi53c810_reg_r(&space, reg+0) << 56;
1008996   }
1009997   if (ACCESSING_BITS_48_55) {
1010      r |= (UINT64)lsi53c810_reg_r(space, reg+1) << 48;
998      r |= (UINT64)lsi53c810_reg_r(&space, reg+1) << 48;
1011999   }
10121000   if (ACCESSING_BITS_40_47) {
1013      r |= (UINT64)lsi53c810_reg_r(space, reg+2) << 40;
1001      r |= (UINT64)lsi53c810_reg_r(&space, reg+2) << 40;
10141002   }
10151003   if (ACCESSING_BITS_32_39) {
1016      r |= (UINT64)lsi53c810_reg_r(space, reg+3) << 32;
1004      r |= (UINT64)lsi53c810_reg_r(&space, reg+3) << 32;
10171005   }
10181006   if (ACCESSING_BITS_24_31) {
1019      r |= (UINT64)lsi53c810_reg_r(space, reg+4) << 24;
1007      r |= (UINT64)lsi53c810_reg_r(&space, reg+4) << 24;
10201008   }
10211009   if (ACCESSING_BITS_16_23) {
1022      r |= (UINT64)lsi53c810_reg_r(space, reg+5) << 16;
1010      r |= (UINT64)lsi53c810_reg_r(&space, reg+5) << 16;
10231011   }
10241012   if (ACCESSING_BITS_8_15) {
1025      r |= (UINT64)lsi53c810_reg_r(space, reg+6) << 8;
1013      r |= (UINT64)lsi53c810_reg_r(&space, reg+6) << 8;
10261014   }
10271015   if (ACCESSING_BITS_0_7) {
1028      r |= (UINT64)lsi53c810_reg_r(space, reg+7) << 0;
1016      r |= (UINT64)lsi53c810_reg_r(&space, reg+7) << 0;
10291017   }
10301018
10311019   return r;
10321020}
10331021
1034static WRITE64_HANDLER(scsi_w)
1022WRITE64_MEMBER(model3_state::scsi_w)
10351023{
10361024   int reg = offset*8;
10371025   if (ACCESSING_BITS_56_63) {
1038      lsi53c810_reg_w(space, reg+0, data >> 56);
1026      lsi53c810_reg_w(&space, reg+0, data >> 56);
10391027   }
10401028   if (ACCESSING_BITS_48_55) {
1041      lsi53c810_reg_w(space, reg+1, data >> 48);
1029      lsi53c810_reg_w(&space, reg+1, data >> 48);
10421030   }
10431031   if (ACCESSING_BITS_40_47) {
1044      lsi53c810_reg_w(space, reg+2, data >> 40);
1032      lsi53c810_reg_w(&space, reg+2, data >> 40);
10451033   }
10461034   if (ACCESSING_BITS_32_39) {
1047      lsi53c810_reg_w(space, reg+3, data >> 32);
1035      lsi53c810_reg_w(&space, reg+3, data >> 32);
10481036   }
10491037   if (ACCESSING_BITS_24_31) {
1050      lsi53c810_reg_w(space, reg+4, data >> 24);
1038      lsi53c810_reg_w(&space, reg+4, data >> 24);
10511039   }
10521040   if (ACCESSING_BITS_16_23) {
1053      lsi53c810_reg_w(space, reg+5, data >> 16);
1041      lsi53c810_reg_w(&space, reg+5, data >> 16);
10541042   }
10551043   if (ACCESSING_BITS_8_15) {
1056      lsi53c810_reg_w(space, reg+6, data >> 8);
1044      lsi53c810_reg_w(&space, reg+6, data >> 8);
10571045   }
10581046   if (ACCESSING_BITS_0_7) {
1059      lsi53c810_reg_w(space, reg+7, data >> 0);
1047      lsi53c810_reg_w(&space, reg+7, data >> 0);
10601048   }
10611049}
10621050
r14896r14897
10791067/* Real3D DMA */
10801068
10811069
1082static READ64_HANDLER( real3d_dma_r )
1070READ64_MEMBER(model3_state::real3d_dma_r)
10831071{
1084   model3_state *state = space->machine().driver_data<model3_state>();
10851072   switch(offset)
10861073   {
10871074      case 1:
1088         return (state->m_dma_irq << 24) | (state->m_dma_endian << 8);
1075         return (m_dma_irq << 24) | (m_dma_endian << 8);
10891076      case 2:
10901077         if(ACCESSING_BITS_0_31) {
1091            return state->m_dma_data;
1078            return m_dma_data;
10921079         }
10931080         break;
10941081   }
r14896r14897
10961083   return 0;
10971084}
10981085
1099static WRITE64_HANDLER( real3d_dma_w )
1086WRITE64_MEMBER(model3_state::real3d_dma_w)
11001087{
1101   model3_state *state = space->machine().driver_data<model3_state>();
11021088   switch(offset)
11031089   {
11041090      case 0:
11051091         if(ACCESSING_BITS_32_63) {      /* DMA source address */
1106            state->m_dma_source = FLIPENDIAN_INT32((UINT32)(data >> 32));
1092            m_dma_source = FLIPENDIAN_INT32((UINT32)(data >> 32));
11071093            return;
11081094         }
11091095         if(ACCESSING_BITS_0_31) {      /* DMA destination address */
1110            state->m_dma_dest = FLIPENDIAN_INT32((UINT32)(data));
1096            m_dma_dest = FLIPENDIAN_INT32((UINT32)(data));
11111097            return;
11121098         }
11131099         break;
r14896r14897
11151101         if(ACCESSING_BITS_32_63)      /* DMA length */
11161102         {
11171103            int length = FLIPENDIAN_INT32((UINT32)(data >> 32)) * 4;
1118            if (state->m_dma_endian & 0x80)
1104            if (m_dma_endian & 0x80)
11191105            {
1120               real3d_dma_callback(space->machine(), state->m_dma_source, state->m_dma_dest, length, 0);
1106               real3d_dma_callback(machine(), m_dma_source, m_dma_dest, length, 0);
11211107            }
11221108            else
11231109            {
1124               real3d_dma_callback(space->machine(), state->m_dma_source, state->m_dma_dest, length, 1);
1110               real3d_dma_callback(machine(), m_dma_source, m_dma_dest, length, 1);
11251111            }
1126            state->m_dma_irq |= 0x01;
1127            scsi_irq_callback(space->machine(), 1);
1112            m_dma_irq |= 0x01;
1113            scsi_irq_callback(machine(), 1);
11281114            return;
11291115         }
11301116         else if(ACCESSING_BITS_16_23)
11311117         {
11321118            if(data & 0x10000) {
1133               state->m_dma_irq &= ~0x1;
1134               scsi_irq_callback(space->machine(), 0);
1119               m_dma_irq &= ~0x1;
1120               scsi_irq_callback(machine(), 0);
11351121            }
11361122            return;
11371123         }
11381124         else if(ACCESSING_BITS_8_15)
11391125         {
1140            state->m_dma_endian = (data >> 8) & 0xff;
1126            m_dma_endian = (data >> 8) & 0xff;
11411127            return;
11421128         }
11431129         break;
r14896r14897
11451131         if(ACCESSING_BITS_32_63) {      /* DMA command */
11461132            UINT32 cmd = FLIPENDIAN_INT32((UINT32)(data >> 32));
11471133            if(cmd & 0x20000000) {
1148               state->m_dma_data = FLIPENDIAN_INT32(state->m_real3d_device_id);   /* (PCI Vendor & Device ID) */
1134               m_dma_data = FLIPENDIAN_INT32(m_real3d_device_id);   /* (PCI Vendor & Device ID) */
11491135            }
11501136            else if(cmd & 0x80000000) {
1151               state->m_dma_status ^= 0xffffffff;
1152               state->m_dma_data = state->m_dma_status;
1137               m_dma_status ^= 0xffffffff;
1138               m_dma_data = m_dma_status;
11531139            }
11541140            return;
11551141         }
11561142         if(ACCESSING_BITS_0_31) {      /* ??? */
1157            state->m_dma_data = 0xffffffff;
1143            m_dma_data = 0xffffffff;
11581144            return;
11591145         }
11601146         return;
r14896r14897
13381324static MACHINE_RESET(model3_21) { model3_init(machine, 0x21); }
13391325
13401326
1341static READ64_HANDLER( model3_ctrl_r )
1327READ64_MEMBER(model3_state::model3_ctrl_r)
13421328{
1343   model3_state *state = space->machine().driver_data<model3_state>();
13441329   switch( offset )
13451330   {
13461331      case 0:
13471332         if (ACCESSING_BITS_56_63)
13481333         {
1349            return (UINT64)state->m_controls_bank << 56;
1334            return (UINT64)m_controls_bank << 56;
13501335         }
13511336         else if (ACCESSING_BITS_24_31)
13521337         {
1353            if(state->m_controls_bank & 0x1)
1338            if(m_controls_bank & 0x1)
13541339            {
1355               return (input_port_read(space->machine(), "IN1")) << 24;
1340               return (input_port_read(machine(), "IN1")) << 24;
13561341            }
13571342            else
13581343            {
1359               return (input_port_read(space->machine(), "IN0")) << 24;
1344               return (input_port_read(machine(), "IN0")) << 24;
13601345            }
13611346         }
13621347         break;
r14896r14897
13641349      case 1:
13651350         if (ACCESSING_BITS_56_63)
13661351         {
1367            return (UINT64)input_port_read(space->machine(), "IN2") << 56;
1352            return (UINT64)input_port_read(machine(), "IN2") << 56;
13681353         }
13691354         else if (ACCESSING_BITS_24_31)
13701355         {
1371            return input_port_read(space->machine(), "IN3") << 24;
1356            return input_port_read(machine(), "IN3") << 24;
13721357         }
13731358         break;
13741359
r14896r14897
13841369      case 5:
13851370         if (ACCESSING_BITS_24_31)               /* Serial comm RX FIFO 1 */
13861371         {
1387            return (UINT64)state->m_serial_fifo1 << 24;
1372            return (UINT64)m_serial_fifo1 << 24;
13881373         }
13891374         break;
13901375
13911376      case 6:
13921377         if (ACCESSING_BITS_56_63)      /* Serial comm RX FIFO 2 */
13931378         {
1394            return (UINT64)state->m_serial_fifo2 << 56;
1379            return (UINT64)m_serial_fifo2 << 56;
13951380         }
13961381         else if (ACCESSING_BITS_24_31)            /* Serial comm full/empty flags */
13971382         {
r14896r14897
14031388         if (ACCESSING_BITS_24_31)      /* ADC Data read */
14041389         {
14051390            static const char *const adcnames[] = { "AN0", "AN1", "AN2", "AN3", "AN4", "AN5", "AN6", "AN7" };
1406            UINT8 adc_data = input_port_read_safe(space->machine(), adcnames[state->m_adc_channel], 0);
1407            state->m_adc_channel++;
1408            state->m_adc_channel &= 0x7;
1391            UINT8 adc_data = input_port_read_safe(machine(), adcnames[m_adc_channel], 0);
1392            m_adc_channel++;
1393            m_adc_channel &= 0x7;
14091394            return (UINT64)adc_data << 24;
14101395         }
14111396         break;
r14896r14897
14151400   return 0;
14161401}
14171402
1418static WRITE64_HANDLER( model3_ctrl_w )
1403WRITE64_MEMBER(model3_state::model3_ctrl_w)
14191404{
1420   model3_state *state = space->machine().driver_data<model3_state>();
14211405   switch(offset)
14221406   {
14231407      case 0:
14241408         if (ACCESSING_BITS_56_63)
14251409         {
1426            eeprom_device *eeprom = space->machine().device<eeprom_device>("eeprom");
1410            eeprom_device *eeprom = machine().device<eeprom_device>("eeprom");
14271411            int reg = (data >> 56) & 0xff;
14281412            eeprom->write_bit((reg & 0x20) ? 1 : 0);
14291413            eeprom->set_clock_line((reg & 0x80) ? ASSERT_LINE : CLEAR_LINE);
14301414            eeprom->set_cs_line((reg & 0x40) ? CLEAR_LINE : ASSERT_LINE);
1431            state->m_controls_bank = reg & 0xff;
1415            m_controls_bank = reg & 0xff;
14321416         }
14331417         return;
14341418
14351419      case 2:
1436         COMBINE_DATA(&state->m_controls_2);
1420         COMBINE_DATA(&m_controls_2);
14371421         return;
14381422
14391423      case 3:
1440         COMBINE_DATA(&state->m_controls_3);
1424         COMBINE_DATA(&m_controls_3);
14411425         return;
14421426
14431427      case 4:
r14896r14897
14501434            switch(data >> 24)
14511435            {
14521436               case 0x00:
1453                  state->m_lightgun_reg_sel = state->m_serial_fifo2;
1437                  m_lightgun_reg_sel = m_serial_fifo2;
14541438                  break;
14551439               case 0x87:
1456                  state->m_serial_fifo1 = 0;
1457                  switch(state->m_lightgun_reg_sel)      /* read lightrun register */
1440                  m_serial_fifo1 = 0;
1441                  switch(m_lightgun_reg_sel)      /* read lightrun register */
14581442                  {
14591443                     case 0:      /* player 1 gun X-position, lower 8-bits */
1460                        state->m_serial_fifo2 = input_port_read(space->machine(), "LIGHT0_Y") & 0xff;
1444                        m_serial_fifo2 = input_port_read(machine(), "LIGHT0_Y") & 0xff;
14611445                        break;
14621446                     case 1:      /* player 1 gun X-position, upper 2-bits */
1463                        state->m_serial_fifo2 = (input_port_read(space->machine(), "LIGHT0_Y") >> 8) & 0x3;
1447                        m_serial_fifo2 = (input_port_read(machine(), "LIGHT0_Y") >> 8) & 0x3;
14641448                        break;
14651449                     case 2:      /* player 1 gun Y-position, lower 8-bits */
1466                        state->m_serial_fifo2 = input_port_read(space->machine(), "LIGHT0_X") & 0xff;
1450                        m_serial_fifo2 = input_port_read(machine(), "LIGHT0_X") & 0xff;
14671451                        break;
14681452                     case 3:      /* player 1 gun Y-position, upper 2-bits */
1469                        state->m_serial_fifo2 = (input_port_read(space->machine(), "LIGHT0_X") >> 8) & 0x3;
1453                        m_serial_fifo2 = (input_port_read(machine(), "LIGHT0_X") >> 8) & 0x3;
14701454                        break;
14711455                     case 4:      /* player 2 gun X-position, lower 8-bits */
1472                        state->m_serial_fifo2 = input_port_read(space->machine(), "LIGHT1_Y") & 0xff;
1456                        m_serial_fifo2 = input_port_read(machine(), "LIGHT1_Y") & 0xff;
14731457                        break;
14741458                     case 5:      /* player 2 gun X-position, upper 2-bits */
1475                        state->m_serial_fifo2 = (input_port_read(space->machine(), "LIGHT1_Y") >> 8) & 0x3;
1459                        m_serial_fifo2 = (input_port_read(machine(), "LIGHT1_Y") >> 8) & 0x3;
14761460                        break;
14771461                     case 6:      /* player 2 gun Y-position, lower 8-bits */
1478                        state->m_serial_fifo2 = input_port_read(space->machine(), "LIGHT1_X") & 0xff;
1462                        m_serial_fifo2 = input_port_read(machine(), "LIGHT1_X") & 0xff;
14791463                        break;
14801464                     case 7:      /* player 2 gun Y-position, upper 2-bits */
1481                        state->m_serial_fifo2 = (input_port_read(space->machine(), "LIGHT1_X") >> 8) & 0x3;
1465                        m_serial_fifo2 = (input_port_read(machine(), "LIGHT1_X") >> 8) & 0x3;
14821466                        break;
14831467                     case 8:      /* gun offscreen (bit set = gun offscreen, bit clear = gun on screen) */
1484                        state->m_serial_fifo2 = 0;   /* bit 0 = player 1, bit 1 = player 2 */
1485                        if(input_port_read(space->machine(), "OFFSCREEN") & 0x1) {
1486                           state->m_serial_fifo2 |= 0x01;
1468                        m_serial_fifo2 = 0;   /* bit 0 = player 1, bit 1 = player 2 */
1469                        if(input_port_read(machine(), "OFFSCREEN") & 0x1) {
1470                           m_serial_fifo2 |= 0x01;
14871471                        }
14881472                        break;
14891473                  }
14901474                  break;
14911475               default:
1492                  //mame_printf_debug("Lightgun: Unknown command %02X at %08X\n", (UINT32)(data >> 24), cpu_get_pc(&space->device()));
1476                  //mame_printf_debug("Lightgun: Unknown command %02X at %08X\n", (UINT32)(data >> 24), cpu_get_pc(&space.device()));
14931477                  break;
14941478            }
14951479         }
r14896r14897
14981482      case 5:
14991483         if (ACCESSING_BITS_56_63)   /* Serial comm TX FIFO 2 */
15001484         {
1501            state->m_serial_fifo2 = data >> 56;
1485            m_serial_fifo2 = data >> 56;
15021486            return;
15031487         }
15041488         break;
r14896r14897
15061490      case 7:
15071491         if (ACCESSING_BITS_24_31)   /* ADC Channel selection */
15081492         {
1509            state->m_adc_channel = (data >> 24) & 0xf;
1493            m_adc_channel = (data >> 24) & 0xf;
15101494         }
15111495         return;
15121496   }
r14896r14897
15141498   logerror("ctrl_w: %02X, %08X%08X, %08X%08X", offset, (UINT32)(data >> 32), (UINT32)(data), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask));
15151499}
15161500
1517static READ64_HANDLER( model3_sys_r )
1501READ64_MEMBER(model3_state::model3_sys_r)
15181502{
1519   model3_state *state = space->machine().driver_data<model3_state>();
1520//  printf("model3_sys_r: mask %llx @ %x (PC %x)\n", mem_mask, offset, cpu_get_pc(&space->device()));
1503//  printf("model3_sys_r: mask %llx @ %x (PC %x)\n", mem_mask, offset, cpu_get_pc(&space.device()));
15211504
15221505   switch (offset)
15231506   {
15241507      case 0x08/8:
15251508         if (ACCESSING_BITS_56_63)
15261509         {
1527            return ((UINT64)state->m_crom_bank << 56);
1510            return ((UINT64)m_crom_bank << 56);
15281511         }
15291512         break;
15301513
15311514      case 0x10/8:
15321515         if (ACCESSING_BITS_56_63)
15331516         {
1534            UINT64 res = model3_tap_read(space->machine());
1517            UINT64 res = model3_tap_read(machine());
15351518
15361519            return res<<61;
15371520         }
15381521         else if (ACCESSING_BITS_24_31)
15391522         {
1540            return (state->m_irq_enable<<24);
1523            return (m_irq_enable<<24);
15411524         }
15421525         else logerror("m3_sys: Unk sys_r @ 0x10: mask = %x\n", (UINT32)mem_mask);
15431526         break;
15441527      case 0x18/8:
1545//          printf("read irq_state %x (PC %x)\n", state->m_irq_state, cpu_get_pc(&space->device()));
1546         return (UINT64)state->m_irq_state<<56 | 0xff000000;
1528//          printf("read irq_state %x (PC %x)\n", m_irq_state, cpu_get_pc(&space.device()));
1529         return (UINT64)m_irq_state<<56 | 0xff000000;
15471530         break;
15481531   }
15491532
r14896r14897
15511534   return 0;
15521535}
15531536
1554static WRITE64_HANDLER( model3_sys_w )
1537WRITE64_MEMBER(model3_state::model3_sys_w)
15551538{
1556   model3_state *state = space->machine().driver_data<model3_state>();
15571539//  printf("model3_sys_w: %llx to %x mask %llx\n", data, offset, mem_mask);
15581540
15591541   switch (offset)
r14896r14897
15611543      case 0x10/8:
15621544         if (ACCESSING_BITS_24_31)
15631545         {
1564            state->m_irq_enable = (data>>24)&0xff;
1546            m_irq_enable = (data>>24)&0xff;
15651547         }
15661548         else logerror("m3_sys: unknown mask on IRQen write\n");
15671549         break;
15681550      case 0x18/8:
15691551         if ((mem_mask & 0xff000000) == 0xff000000)   // int ACK with bits in REVERSE ORDER from the other registers (Seeeee-gaaaa!)
15701552         {                  // may also be a secondary enable based on behavior of e.g. magtruck VBL handler
1571//              UINT32 old_irq = state->m_irq_state;
1553//              UINT32 old_irq = m_irq_state;
15721554            UINT8 ack = (data>>24)&0xff, realack;
15731555            int i;
15741556
r14896r14897
15901572
15911573//                      printf("%x to ack (realack %x)\n", ack, realack);
15921574
1593                  state->m_irq_state &= realack;
1575                  m_irq_state &= realack;
15941576                  break;
15951577            }
15961578         }
r14896r14897
16021584      case 0x08/8:
16031585         if (ACCESSING_BITS_56_63)
16041586         {
1605            state->m_crom_bank = data >> 56;
1587            m_crom_bank = data >> 56;
16061588
16071589            data >>= 56;
16081590            data = (~data) & 0x7;
16091591
1610            memory_set_bankptr(space->machine(),  "bank1", space->machine().region( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1592            memory_set_bankptr(machine(),  "bank1", machine().region( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
16111593         }
16121594         if (ACCESSING_BITS_24_31)
16131595         {
16141596            data >>= 24;
1615            model3_tap_write(space->machine(),
1597            model3_tap_write(machine(),
16161598               (data >> 6) & 1,// TCK
16171599               (data >> 2) & 1,// TMS
16181600               (data >> 5) & 1,// TDI
r14896r14897
16231605   }
16241606}
16251607
1626static READ64_HANDLER( model3_rtc_r )
1608READ64_MEMBER(model3_state::model3_rtc_r)
16271609{
1628   model3_state *state = space->machine().driver_data<model3_state>();
16291610   UINT64 r = 0;
16301611   if(ACCESSING_BITS_56_63) {
1631      r |= (UINT64)state->rtc72421_r(*space, (offset*2)+0, (UINT32)(mem_mask >> 32)) << 32;
1612      r |= (UINT64)rtc72421_r(*&space, (offset*2)+0, (UINT32)(mem_mask >> 32)) << 32;
16321613   }
16331614   if(ACCESSING_BITS_24_31) {
1634      r |= (UINT64)state->rtc72421_r(*space, (offset*2)+1, (UINT32)(mem_mask));
1615      r |= (UINT64)rtc72421_r(*&space, (offset*2)+1, (UINT32)(mem_mask));
16351616   }
16361617   return r;
16371618}
16381619
1639static WRITE64_HANDLER( model3_rtc_w )
1620WRITE64_MEMBER(model3_state::model3_rtc_w)
16401621{
1641   model3_state *state = space->machine().driver_data<model3_state>();
16421622   if(ACCESSING_BITS_56_63) {
1643      state->rtc72421_w(*space, (offset*2)+0, (UINT32)(data >> 32), (UINT32)(mem_mask >> 32));
1623      rtc72421_w(*&space, (offset*2)+0, (UINT32)(data >> 32), (UINT32)(mem_mask >> 32));
16441624   }
16451625   if(ACCESSING_BITS_24_31) {
1646      state->rtc72421_w(*space, (offset*2)+1, (UINT32)(data), (UINT32)(mem_mask));
1626      rtc72421_w(*&space, (offset*2)+1, (UINT32)(data), (UINT32)(mem_mask));
16471627   }
16481628}
16491629
1650static READ64_HANDLER(real3d_status_r)
1630READ64_MEMBER(model3_state::real3d_status_r)
16511631{
1652   model3_state *state = space->machine().driver_data<model3_state>();
1653   state->m_real3d_status ^= U64(0xffffffffffffffff);
1632   m_real3d_status ^= U64(0xffffffffffffffff);
16541633   if (offset == 0)
16551634   {
16561635      /* pretty sure this is VBLANK */
1657      state->m_real3d_status &= ~U64(0x0000000200000000);
1658      if (space->machine().primary_screen->vblank())
1659         state->m_real3d_status |= U64(0x0000000200000000);
1660      return state->m_real3d_status;
1636      m_real3d_status &= ~U64(0x0000000200000000);
1637      if (machine().primary_screen->vblank())
1638         m_real3d_status |= U64(0x0000000200000000);
1639      return m_real3d_status;
16611640   }
1662   return state->m_real3d_status;
1641   return m_real3d_status;
16631642}
16641643
16651644/* SCSP interface */
1666static WRITE8_HANDLER(model3_sound_w)
1645WRITE8_MEMBER(model3_state::model3_sound_w)
16671646{
1668   model3_state *state = space->machine().driver_data<model3_state>();
16691647
16701648   switch (offset)
16711649   {
16721650      case 0:
16731651         // clear the interrupt
1674         model3_set_irq_line(space->machine(), 0x40, CLEAR_LINE);
1652         model3_set_irq_line(machine(), 0x40, CLEAR_LINE);
16751653
16761654         // send to the sound board
1677         scsp_midi_in(space->machine().device("scsp1"), 0, data, 0);
1655         scsp_midi_in(machine().device("scsp1"), 0, data, 0);
16781656
1679         if (state->m_sound_irq_enable)
1657         if (m_sound_irq_enable)
16801658         {
1681            state->m_sound_timer->adjust(attotime::from_msec(1));
1659            m_sound_timer->adjust(attotime::from_msec(1));
16821660         }
16831661         break;
16841662
16851663      case 4:
16861664         if (data == 0x27)
16871665         {
1688            state->m_sound_irq_enable = 1;
1689            state->m_sound_timer->adjust(attotime::from_msec(1));
1666            m_sound_irq_enable = 1;
1667            m_sound_timer->adjust(attotime::from_msec(1));
16901668         }
16911669         else if (data == 0x06)
16921670         {
1693            state->m_sound_irq_enable = 0;
1671            m_sound_irq_enable = 0;
16941672         }
16951673         break;
16961674   }
r14896r14897
16981676
16991677
17001678
1701static READ64_HANDLER(network_r)
1679READ64_MEMBER(model3_state::network_r)
17021680{
1703   model3_state *state = space->machine().driver_data<model3_state>();
1704   mame_printf_debug("network_r: %02X at %08X\n", offset, cpu_get_pc(&space->device()));
1705   return state->m_network_ram[offset];
1681   mame_printf_debug("network_r: %02X at %08X\n", offset, cpu_get_pc(&space.device()));
1682   return m_network_ram[offset];
17061683}
17071684
1708static WRITE64_HANDLER(network_w)
1685WRITE64_MEMBER(model3_state::network_w)
17091686{
1710   model3_state *state = space->machine().driver_data<model3_state>();
1711   COMBINE_DATA(state->m_network_ram + offset);
1712   mame_printf_debug("network_w: %02X, %08X%08X at %08X\n", offset, (UINT32)(data >> 32), (UINT32)(data), cpu_get_pc(&space->device()));
1687   COMBINE_DATA(m_network_ram + offset);
1688   mame_printf_debug("network_w: %02X, %08X%08X at %08X\n", offset, (UINT32)(data >> 32), (UINT32)(data), cpu_get_pc(&space.device()));
17131689}
17141690
17151691
r14896r14897
17941770   discarded).
17951771*/
17961772
1797static READ64_HANDLER(model3_security_r)
1773READ64_MEMBER(model3_state::model3_security_r)
17981774{
1799   model3_state *state = space->machine().driver_data<model3_state>();
18001775   switch(offset)
18011776   {
18021777      case 0x00/8:   return 0;      /* status */
18031778      case 0x1c/8:               /* security board data read */
18041779      {
1805         if (mame_stricmp(space->machine().system().name, "vs299") == 0 ||
1806            mame_stricmp(space->machine().system().name, "vs2v991") == 0)
1780         if (mame_stricmp(machine().system().name, "vs299") == 0 ||
1781            mame_stricmp(machine().system().name, "vs2v991") == 0)
18071782         {
1808            return (UINT64)vs299_prot_data[state->m_prot_data_ptr++] << 48;
1783            return (UINT64)vs299_prot_data[m_prot_data_ptr++] << 48;
18091784         }
1810         else if (mame_stricmp(space->machine().system().name, "swtrilgy") == 0 ||
1811                mame_stricmp(space->machine().system().name, "swtrilgya") == 0)
1785         else if (mame_stricmp(machine().system().name, "swtrilgy") == 0 ||
1786                mame_stricmp(machine().system().name, "swtrilgya") == 0)
18121787         {
1813            UINT64 data = (UINT64)swt_prot_data[state->m_prot_data_ptr++] << 16;
1814            if (state->m_prot_data_ptr > 0x38)
1788            UINT64 data = (UINT64)swt_prot_data[m_prot_data_ptr++] << 16;
1789            if (m_prot_data_ptr > 0x38)
18151790            {
1816               state->m_prot_data_ptr = 0;
1791               m_prot_data_ptr = 0;
18171792            }
18181793            return data;
18191794         }
1820         else if (mame_stricmp(space->machine().system().name, "fvipers2") == 0)
1795         else if (mame_stricmp(machine().system().name, "fvipers2") == 0)
18211796         {
1822            UINT64 data = (UINT64)fvipers2_prot_data[state->m_prot_data_ptr++] << 16;
1823            if (state->m_prot_data_ptr >= 0x41)
1797            UINT64 data = (UINT64)fvipers2_prot_data[m_prot_data_ptr++] << 16;
1798            if (m_prot_data_ptr >= 0x41)
18241799            {
1825               state->m_prot_data_ptr = 0;
1800               m_prot_data_ptr = 0;
18261801            }
18271802            return data;
18281803         }
1829         else if (mame_stricmp(space->machine().system().name, "spikeout") == 0 ||
1830                mame_stricmp(space->machine().system().name, "spikeofe") == 0)
1804         else if (mame_stricmp(machine().system().name, "spikeout") == 0 ||
1805                mame_stricmp(machine().system().name, "spikeofe") == 0)
18311806         {
1832            UINT64 data = (UINT64)spikeout_prot_data[state->m_prot_data_ptr++] << 16;
1833            if (state->m_prot_data_ptr >= 0x55)
1807            UINT64 data = (UINT64)spikeout_prot_data[m_prot_data_ptr++] << 16;
1808            if (m_prot_data_ptr >= 0x55)
18341809            {
1835               state->m_prot_data_ptr = 0;
1810               m_prot_data_ptr = 0;
18361811            }
18371812            return data;
18381813         }
1839         else if (mame_stricmp(space->machine().system().name, "eca") == 0 ||
1840                mame_stricmp(space->machine().system().name, "ecax") == 0)
1814         else if (mame_stricmp(machine().system().name, "eca") == 0 ||
1815                mame_stricmp(machine().system().name, "ecax") == 0)
18411816         {
1842            UINT64 data = (UINT64)eca_prot_data[state->m_prot_data_ptr++] << 16;
1843            if (state->m_prot_data_ptr >= 0x31)
1817            UINT64 data = (UINT64)eca_prot_data[m_prot_data_ptr++] << 16;
1818            if (m_prot_data_ptr >= 0x31)
18441819            {
1845               state->m_prot_data_ptr = 0;
1820               m_prot_data_ptr = 0;
18461821            }
18471822            return data;
18481823         }
1849         else if (mame_stricmp(space->machine().system().name, "oceanhun") == 0)
1824         else if (mame_stricmp(machine().system().name, "oceanhun") == 0)
18501825         {
1851            UINT64 data = (UINT64)oceanhun_prot_data[state->m_prot_data_ptr++] << 16;
1852            if (state->m_prot_data_ptr >= 58)
1826            UINT64 data = (UINT64)oceanhun_prot_data[m_prot_data_ptr++] << 16;
1827            if (m_prot_data_ptr >= 58)
18531828            {
1854               state->m_prot_data_ptr = 0;
1829               m_prot_data_ptr = 0;
18551830            }
18561831            return data;
18571832         }
r14896r14897
18641839   return U64(0xffffffffffffffff);
18651840}
18661841
1867static WRITE64_HANDLER(daytona2_rombank_w)
1842WRITE64_MEMBER(model3_state::daytona2_rombank_w)
18681843{
18691844   if (ACCESSING_BITS_56_63)
18701845   {
18711846      data >>= 56;
18721847      data = (~data) & 0xf;
1873      memory_set_bankptr(space->machine(),  "bank1", space->machine().region( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1874      memory_set_bankptr(space->machine(),  "bank2", space->machine().region( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1848      memory_set_bankptr(machine(),  "bank1", machine().region( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1849      memory_set_bankptr(machine(),  "bank2", machine().region( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
18751850   }
18761851}
18771852
18781853static ADDRESS_MAP_START( model3_mem, AS_PROGRAM, 64, model3_state )
18791854   AM_RANGE(0x00000000, 0x007fffff) AM_RAM   AM_BASE(m_work_ram)   /* work RAM */
18801855
1881   AM_RANGE(0x84000000, 0x8400003f) AM_READ_LEGACY(real3d_status_r )
1856   AM_RANGE(0x84000000, 0x8400003f) AM_READ(real3d_status_r )
18821857   AM_RANGE(0x88000000, 0x88000007) AM_WRITE(real3d_cmd_w )
18831858   AM_RANGE(0x8e000000, 0x8e0fffff) AM_WRITE(real3d_display_list_w )
18841859   AM_RANGE(0x98000000, 0x980fffff) AM_WRITE(real3d_polygon_ram_w )
18851860
1886   AM_RANGE(0xf0040000, 0xf004003f) AM_MIRROR(0x0e000000) AM_READWRITE_LEGACY(model3_ctrl_r, model3_ctrl_w )
1887   AM_RANGE(0xf0080000, 0xf008ffff) AM_MIRROR(0x0e000000) AM_WRITE8_LEGACY(model3_sound_w, U64(0xffffffffffffffff) )
1861   AM_RANGE(0xf0040000, 0xf004003f) AM_MIRROR(0x0e000000) AM_READWRITE(model3_ctrl_r, model3_ctrl_w )
1862   AM_RANGE(0xf0080000, 0xf008ffff) AM_MIRROR(0x0e000000) AM_WRITE8(model3_sound_w, U64(0xffffffffffffffff) )
18881863   AM_RANGE(0xf00c0000, 0xf00dffff) AM_MIRROR(0x0e000000) AM_RAM AM_SHARE("backup")   /* backup SRAM */
1889   AM_RANGE(0xf0100000, 0xf010003f) AM_MIRROR(0x0e000000) AM_READWRITE_LEGACY(model3_sys_r, model3_sys_w )
1890   AM_RANGE(0xf0140000, 0xf014003f) AM_MIRROR(0x0e000000) AM_READWRITE_LEGACY(model3_rtc_r, model3_rtc_w )
1864   AM_RANGE(0xf0100000, 0xf010003f) AM_MIRROR(0x0e000000) AM_READWRITE(model3_sys_r, model3_sys_w )
1865   AM_RANGE(0xf0140000, 0xf014003f) AM_MIRROR(0x0e000000) AM_READWRITE(model3_rtc_r, model3_rtc_w )
18911866   AM_RANGE(0xf0180000, 0xf019ffff) AM_MIRROR(0x0e000000) AM_RAM                     /* Security Board RAM */
1892   AM_RANGE(0xf01a0000, 0xf01a003f) AM_MIRROR(0x0e000000) AM_READ_LEGACY(model3_security_r )   /* Security board */
1867   AM_RANGE(0xf01a0000, 0xf01a003f) AM_MIRROR(0x0e000000) AM_READ(model3_security_r )   /* Security board */
18931868
18941869   AM_RANGE(0xf1000000, 0xf10f7fff) AM_READWRITE(model3_char_r, model3_char_w )   /* character RAM */
18951870   AM_RANGE(0xf10f8000, 0xf10fffff) AM_READWRITE(model3_tile_r, model3_tile_w )   /* tilemaps */
r14896r14897
50665041
50675042/* Model 3 sound board emulation */
50685043
5069static WRITE16_HANDLER( model3snd_ctrl )
5044WRITE16_MEMBER(model3_state::model3snd_ctrl)
50705045{
50715046   // handle sample banking
5072   if (space->machine().region("scsp2")->bytes() > 0x800000)
5047   if (machine().region("scsp2")->bytes() > 0x800000)
50735048   {
5074      UINT8 *snd = space->machine().region("scsp2")->base();
5049      UINT8 *snd = machine().region("scsp2")->base();
50755050      if (data & 0x20)
50765051      {
5077         memory_set_bankptr(space->machine(), "bank4", snd + 0x200000);
5078         memory_set_bankptr(space->machine(), "bank5", snd + 0x600000);
5052         memory_set_bankptr(machine(), "bank4", snd + 0x200000);
5053         memory_set_bankptr(machine(), "bank5", snd + 0x600000);
50795054      }
50805055      else
50815056      {
5082         memory_set_bankptr(space->machine(), "bank4", snd + 0x800000);
5083         memory_set_bankptr(space->machine(), "bank5", snd + 0xa00000);
5057         memory_set_bankptr(machine(), "bank4", snd + 0x800000);
5058         memory_set_bankptr(machine(), "bank5", snd + 0xa00000);
50845059      }
50855060   }
50865061}
r14896r14897
50905065   AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE_LEGACY("scsp1", scsp_r, scsp_w)
50915066   AM_RANGE(0x200000, 0x27ffff) AM_RAM AM_REGION("scsp2", 0)
50925067   AM_RANGE(0x300000, 0x300fff) AM_DEVREADWRITE_LEGACY("scsp2", scsp_r, scsp_w)
5093   AM_RANGE(0x400000, 0x400001) AM_WRITE_LEGACY(model3snd_ctrl)
5068   AM_RANGE(0x400000, 0x400001) AM_WRITE(model3snd_ctrl)
50945069   AM_RANGE(0x600000, 0x67ffff) AM_ROM AM_REGION("audiocpu", 0x80000)
50955070   AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("samples", 0)
50965071   AM_RANGE(0xa00000, 0xdfffff) AM_ROMBANK("bank4")
r14896r14897
53555330
53565331static DRIVER_INIT( model3_10 )
53575332{
5333   model3_state *state = machine.driver_data<model3_state>();
53585334   interleave_vroms(machine);
53595335
5360   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xc0000000, 0xc00000ff, FUNC(scsi_r), FUNC(scsi_w) );
5336   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc0000000, 0xc00000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
53615337
53625338   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
53635339
5364   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0800cf8, 0xf0800cff, FUNC(mpc105_addr_r), FUNC(mpc105_addr_w) );
5365   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0c00cf8, 0xf0c00cff, FUNC(mpc105_data_r), FUNC(mpc105_data_w) );
5366   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf8fff000, 0xf8fff0ff, FUNC(mpc105_reg_r), FUNC(mpc105_reg_w) );
5340   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc105_addr_r),state), write64_delegate(FUNC(model3_state::mpc105_addr_w),state));
5341   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc105_data_r),state), write64_delegate(FUNC(model3_state::mpc105_data_w),state));
5342   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc105_reg_r),state), write64_delegate(FUNC(model3_state::mpc105_reg_w),state));
53675343}
53685344
53695345static DRIVER_INIT( model3_15 )
53705346{
5347   model3_state *state = machine.driver_data<model3_state>();
53715348   interleave_vroms(machine);
53725349   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
53735350
5374   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0800cf8, 0xf0800cff, FUNC(mpc105_addr_r), FUNC(mpc105_addr_w) );
5375   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0c00cf8, 0xf0c00cff, FUNC(mpc105_data_r), FUNC(mpc105_data_w) );
5376   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf8fff000, 0xf8fff0ff, FUNC(mpc105_reg_r), FUNC(mpc105_reg_w) );
5351   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc105_addr_r),state), write64_delegate(FUNC(model3_state::mpc105_addr_w),state));
5352   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc105_data_r),state), write64_delegate(FUNC(model3_state::mpc105_data_w),state));
5353   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc105_reg_r),state), write64_delegate(FUNC(model3_state::mpc105_reg_w),state));
53775354}
53785355
53795356static DRIVER_INIT( model3_20 )
53805357{
5358   model3_state *state = machine.driver_data<model3_state>();
53815359   interleave_vroms(machine);
53825360   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
53835361
5384   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xc2000000, 0xc20000ff, FUNC(real3d_dma_r), FUNC(real3d_dma_w) );
5362   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc2000000, 0xc20000ff, read64_delegate(FUNC(model3_state::real3d_dma_r),state), write64_delegate(FUNC(model3_state::real3d_dma_w),state));
53855363
5386   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xfec00000, 0xfedfffff, FUNC(mpc106_addr_r), FUNC(mpc106_addr_w) );
5387   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xfee00000, 0xfeffffff, FUNC(mpc106_data_r), FUNC(mpc106_data_w) );
5388   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf8fff000, 0xf8fff0ff, FUNC(mpc106_reg_r), FUNC(mpc106_reg_w) );
5364   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),state), write64_delegate(FUNC(model3_state::mpc106_addr_w),state));
5365   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),state), write64_delegate(FUNC(model3_state::mpc106_data_w),state));
5366   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),state), write64_delegate(FUNC(model3_state::mpc106_reg_w),state));
53895367}
53905368
53915369static DRIVER_INIT( lostwsga )
53925370{
5371   model3_state *state = machine.driver_data<model3_state>();
53935372   UINT32 *rom = (UINT32*)machine.region("user1")->base();
53945373
53955374   DRIVER_INIT_CALL(model3_15);
53965375   /* TODO: there's an M68K device at 0xC0000000 - FF, maybe lightgun controls ? */
5397   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xc1000000, 0xc10000ff, FUNC(scsi_r), FUNC(scsi_w) );
5376   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
53985377
53995378   rom[0x7374f0/4] = 0x38840004;      /* This seems to be an actual bug in the original code */
54005379}
54015380
54025381static DRIVER_INIT( scud )
54035382{
5383   model3_state *state = machine.driver_data<model3_state>();
54045384   UINT32 *rom = (UINT32*)machine.region("user1")->base();
54055385
54065386   DRIVER_INIT_CALL(model3_15);
54075387   /* TODO: network device at 0xC0000000 - FF */
5408   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf9000000, 0xf90000ff, FUNC(scsi_r), FUNC(scsi_w) );
5388   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
54095389
54105390   rom[(0x71275c^4)/4] = 0x60000000;
54115391   rom[(0x71277c^4)/4] = 0x60000000;
r14896r14897
54135393
54145394static DRIVER_INIT( scudp )
54155395{
5396   model3_state *state = machine.driver_data<model3_state>();
54165397   UINT32 *rom = (UINT32*)machine.region("user1")->base();
54175398
54185399   DRIVER_INIT_CALL(model3_15);
54195400   /* TODO: network device at 0xC0000000 - FF */
5420   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xc1000000, 0xc10000ff, FUNC(scsi_r), FUNC(scsi_w) );
5401   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
54215402
54225403   rom[(0x713724^4)/4] = 0x60000000;
54235404   rom[(0x713744^4)/4] = 0x60000000;
r14896r14897
54305411
54315412static DRIVER_INIT( lemans24 )
54325413{
5414   model3_state *state = machine.driver_data<model3_state>();
54335415   UINT32 *rom = (UINT32*)machine.region("user1")->base();
54345416   DRIVER_INIT_CALL(model3_15);
54355417
5436   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xc1000000, 0xc10000ff, FUNC(scsi_r), FUNC(scsi_w) );
5418   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
54375419
54385420   rom[(0x73fe38^4)/4] = 0x38840004;      /* This seems to be an actual bug in the original code */
54395421
r14896r14897
54575439
54585440static DRIVER_INIT( vs215 )
54595441{
5442   model3_state *state = machine.driver_data<model3_state>();
54605443   UINT32 *rom = (UINT32*)machine.region("user1")->base();
54615444
54625445   rom[(0x70dde0^4)/4] = 0x60000000;
r14896r14897
54665449   interleave_vroms(machine);
54675450   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
54685451
5469   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf9000000, 0xf90000ff, FUNC(scsi_r), FUNC(scsi_w) );
5452   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
54705453
5471   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0800cf8, 0xf0800cff, FUNC(mpc106_addr_r), FUNC(mpc106_addr_w) );
5472   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xfec00000, 0xfedfffff, FUNC(mpc106_addr_r), FUNC(mpc106_addr_w) );
5473   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0c00cf8, 0xf0c00cff, FUNC(mpc106_data_r), FUNC(mpc106_data_w) );
5474   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xfee00000, 0xfeffffff, FUNC(mpc106_data_r), FUNC(mpc106_data_w) );
5475   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf8fff000, 0xf8fff0ff, FUNC(mpc106_reg_r), FUNC(mpc106_reg_w) );
5454   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc106_addr_r),state), write64_delegate(FUNC(model3_state::mpc106_addr_w),state));
5455   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),state), write64_delegate(FUNC(model3_state::mpc106_addr_w),state));
5456   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc106_data_r),state), write64_delegate(FUNC(model3_state::mpc106_data_w),state));
5457   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),state), write64_delegate(FUNC(model3_state::mpc106_data_w),state));
5458   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),state), write64_delegate(FUNC(model3_state::mpc106_reg_w),state));
54765459}
54775460
54785461static DRIVER_INIT( vs29815 )
54795462{
5463   model3_state *state = machine.driver_data<model3_state>();
54805464   UINT32 *rom = (UINT32*)machine.region("user1")->base();
54815465
54825466   rom[(0x6028ec^4)/4] = 0x60000000;
r14896r14897
54855469   interleave_vroms(machine);
54865470   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
54875471
5488   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf9000000, 0xf90000ff, FUNC(scsi_r), FUNC(scsi_w) );
5472   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
54895473
5490   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0800cf8, 0xf0800cff, FUNC(mpc106_addr_r), FUNC(mpc106_addr_w) );
5491   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xfec00000, 0xfedfffff, FUNC(mpc106_addr_r), FUNC(mpc106_addr_w) );
5492   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0c00cf8, 0xf0c00cff, FUNC(mpc106_data_r), FUNC(mpc106_data_w) );
5493   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xfee00000, 0xfeffffff, FUNC(mpc106_data_r), FUNC(mpc106_data_w) );
5494   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf8fff000, 0xf8fff0ff, FUNC(mpc106_reg_r), FUNC(mpc106_reg_w) );
5474   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc106_addr_r),state), write64_delegate(FUNC(model3_state::mpc106_addr_w),state));
5475   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),state), write64_delegate(FUNC(model3_state::mpc106_addr_w),state));
5476   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc106_data_r),state), write64_delegate(FUNC(model3_state::mpc106_data_w),state));
5477   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),state), write64_delegate(FUNC(model3_state::mpc106_data_w),state));
5478   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),state), write64_delegate(FUNC(model3_state::mpc106_reg_w),state));
54955479}
54965480
54975481static DRIVER_INIT( bass )
54985482{
5483   model3_state *state = machine.driver_data<model3_state>();
54995484   UINT32 *rom = (UINT32*)machine.region("user1")->base();
55005485
55015486   rom[(0x7999a8^4)/4] = 0x60000000;
r14896r14897
55045489   interleave_vroms(machine);
55055490   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
55065491
5507   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf9000000, 0xf90000ff, FUNC(scsi_r), FUNC(scsi_w) );
5492   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
55085493
5509   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0800cf8, 0xf0800cff, FUNC(mpc106_addr_r), FUNC(mpc106_addr_w) );
5510   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xfec00000, 0xfedfffff, FUNC(mpc106_addr_r), FUNC(mpc106_addr_w) );
5511   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0c00cf8, 0xf0c00cff, FUNC(mpc106_data_r), FUNC(mpc106_data_w) );
5512   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xfee00000, 0xfeffffff, FUNC(mpc106_data_r), FUNC(mpc106_data_w) );
5513   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf8fff000, 0xf8fff0ff, FUNC(mpc106_reg_r), FUNC(mpc106_reg_w) );
5494   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc106_addr_r),state), write64_delegate(FUNC(model3_state::mpc106_addr_w),state));
5495   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),state), write64_delegate(FUNC(model3_state::mpc106_addr_w),state));
5496   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc106_data_r),state), write64_delegate(FUNC(model3_state::mpc106_data_w),state));
5497   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),state), write64_delegate(FUNC(model3_state::mpc106_data_w),state));
5498   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),state), write64_delegate(FUNC(model3_state::mpc106_reg_w),state));
55145499}
55155500
55165501static DRIVER_INIT( getbass )
55175502{
5503   model3_state *state = machine.driver_data<model3_state>();
55185504   interleave_vroms(machine);
55195505   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
55205506
5521   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf9000000, 0xf90000ff, FUNC(scsi_r), FUNC(scsi_w) );
5507   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
55225508
5523   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0800cf8, 0xf0800cff, FUNC(mpc105_addr_r), FUNC(mpc105_addr_w) );
5524   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0c00cf8, 0xf0c00cff, FUNC(mpc105_data_r), FUNC(mpc105_data_w) );
5525   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf8fff000, 0xf8fff0ff, FUNC(mpc105_reg_r), FUNC(mpc105_reg_w) );
5509   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc105_addr_r),state), write64_delegate(FUNC(model3_state::mpc105_addr_w),state));
5510   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc105_data_r),state), write64_delegate(FUNC(model3_state::mpc105_data_w),state));
5511   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc105_reg_r),state), write64_delegate(FUNC(model3_state::mpc105_reg_w),state));
55265512}
55275513
55285514static DRIVER_INIT( vs2 )
r14896r14897
55935579   DRIVER_INIT_CALL(model3_20);
55945580
55955581   state->m_network_ram = auto_alloc_array_clear(machine, UINT64, 0x10000);
5596   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xc0000000, 0xc00fffff, FUNC(network_r), FUNC(network_w) );
5582   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),state), write64_delegate(FUNC(model3_state::network_w),state));
55975583
55985584   rom[(0x50e8d4^4)/4] = 0x60000000;
55995585   rom[(0x50e8f4^4)/4] = 0x60000000;
r14896r14897
56095595   DRIVER_INIT_CALL(model3_20);
56105596
56115597   state->m_network_ram = auto_alloc_array_clear(machine, UINT64, 0x10000);
5612   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xc0000000, 0xc00fffff, FUNC(network_r), FUNC(network_w) );
5598   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),state), write64_delegate(FUNC(model3_state::network_w),state));
56135599
56145600   //rom[(0x50e8d4^4)/4] = 0x60000000;
56155601   //rom[(0x50e8f4^4)/4] = 0x60000000;
r14896r14897
56755661
56765662static DRIVER_INIT( daytona2 )
56775663{
5664   model3_state *state = machine.driver_data<model3_state>();
56785665   UINT32 *rom = (UINT32*)machine.region("user1")->base();
56795666   DRIVER_INIT_CALL(model3_20);
56805667
5681   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xc3800000, 0xc3800007, FUNC(daytona2_rombank_w) );
5668   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),state));
56825669   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
56835670
56845671   //rom[(0x68468c^4)/4] = 0x60000000;
r14896r14897
56895676
56905677static DRIVER_INIT( dayto2pe )
56915678{
5679   model3_state *state = machine.driver_data<model3_state>();
56925680   UINT32 *rom = (UINT32*)machine.region("user1")->base();
56935681   DRIVER_INIT_CALL(model3_20);
56945682
5695   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xc3800000, 0xc3800007, FUNC(daytona2_rombank_w) );
5683   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),state));
56965684   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
56975685
56985686   rom[(0x606784^4)/4] = 0x60000000;
src/mame/drivers/iqblock.c
r14896r14897
131131
132132
133133static ADDRESS_MAP_START( main_portmap, AS_IO, 8, iqblock_state )
134   AM_RANGE(0x2000, 0x23ff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w)
135   AM_RANGE(0x2800, 0x2bff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w)
134   AM_RANGE(0x2000, 0x23ff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w)
135   AM_RANGE(0x2800, 0x2bff) AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w)
136136   AM_RANGE(0x6000, 0x603f) AM_WRITE(iqblock_fgscroll_w)
137137   AM_RANGE(0x6800, 0x69ff) AM_WRITE(iqblock_fgvideoram_w)   /* initialized up to 6fff... bug or larger tilemap? */
138138   AM_RANGE(0x7000, 0x7fff) AM_WRITE(iqblock_bgvideoram_w)
src/mame/drivers/cb2001.c
r14896r14897
5050{
5151public:
5252   cb2001_state(const machine_config &mconfig, device_type type, const char *tag)
53      : driver_device(mconfig, type, tag) { }
53      : driver_device(mconfig, type, tag) ,
54      m_vram_fg(*this, "vrafg"),
55      m_vram_bg(*this, "vrabg"){ }
5456
55   UINT16 *m_vram_fg;
56   UINT16* m_vram_bg;
57   required_shared_ptr<UINT16> m_vram_fg;
58   required_shared_ptr<UINT16> m_vram_bg;
5759   int m_videobank;
5860   int m_videomode;
5961   tilemap_t *m_reel1_tilemap;
r14896r14897
6163   tilemap_t *m_reel3_tilemap;
6264   int m_other1;
6365   int m_other2;
66   DECLARE_WRITE16_MEMBER(cb2001_vidctrl_w);
67   DECLARE_WRITE16_MEMBER(cb2001_vidctrl2_w);
68   DECLARE_WRITE16_MEMBER(cb2001_bg_w);
6469};
6570
6671
r14896r14897
341346               int tile;
342347               int colour;
343348
344               tile = (state->m_vram_bg[count] & 0x0fff);
345               colour = (state->m_vram_bg[count] & 0xf000)>>12;
349               tile = (state->m_vram_bg.target()[count] & 0x0fff);
350               colour = (state->m_vram_bg.target()[count] & 0xf000)>>12;
346351               tile += state->m_videobank*0x2000;
347352
348353
r14896r14897
360365         {
361366            UINT16 scroll;
362367
363            scroll = state->m_vram_bg[0xa00/2 + i/2];
368            scroll = state->m_vram_bg.target()[0xa00/2 + i/2];
364369            if (i&1)
365370               scroll >>=8;
366371            scroll &=0xff;
367372
368373            state->m_reel2_tilemap->set_scrolly(i, scroll);
369374
370            scroll = state->m_vram_bg[0x800/2 + i/2];
375            scroll = state->m_vram_bg.target()[0x800/2 + i/2];
371376            if (i&1)
372377               scroll >>=8;
373378            scroll &=0xff;
374379
375380            state->m_reel1_tilemap->set_scrolly(i, scroll);
376381
377            scroll = state->m_vram_bg[0xc00/2 + i/2];
382            scroll = state->m_vram_bg.target()[0xc00/2 + i/2];
378383            if (i&1)
379384               scroll >>=8;
380385            scroll &=0xff;
r14896r14897
403408         int tile;
404409         int colour;
405410
406         tile = (state->m_vram_fg[count] & 0x0fff);
407         colour = (state->m_vram_fg[count] & 0xf000)>>12;
411         tile = (state->m_vram_fg.target()[count] & 0x0fff);
412         colour = (state->m_vram_fg.target()[count] & 0xf000)>>12;
408413         tile += state->m_videobank*0x2000;
409414
410415         if (state->m_other2 & 0x4)
r14896r14897
426431/* these ports sometimes get written with similar values
427432 - they could be hooked up wrong, or subject to change it the code
428433   is being executed incorrectly */
429WRITE16_HANDLER( cb2001_vidctrl_w )
434WRITE16_MEMBER(cb2001_state::cb2001_vidctrl_w)
430435{
431   cb2001_state *state = space->machine().driver_data<cb2001_state>();
432436   if (mem_mask&0xff00) // video control?
433437   {
434438      printf("cb2001_vidctrl_w %04x %04x\n", data, mem_mask);
435      state->m_videobank = (data & 0x0800)>>11;
439      m_videobank = (data & 0x0800)>>11;
436440   }
437441   else // something else
438      state->m_other1 = data & 0x00ff;
442      m_other1 = data & 0x00ff;
439443}
440444
441WRITE16_HANDLER( cb2001_vidctrl2_w )
445WRITE16_MEMBER(cb2001_state::cb2001_vidctrl2_w)
442446{
443   cb2001_state *state = space->machine().driver_data<cb2001_state>();
444447   if (mem_mask&0xff00) // video control?
445448   {
446449      printf("cb2001_vidctrl2_w %04x %04x\n", data, mem_mask); // i think this switches to 'reels' mode
447      state->m_videomode = (data>>8) & 0x03; // which bit??
450      m_videomode = (data>>8) & 0x03; // which bit??
448451   }
449452   else // something else
450      state->m_other2 = data & 0x00ff;
453      m_other2 = data & 0x00ff;
451454
452455//      printf("cb2001_vidctrl2_w %04x %04x\n", data, mem_mask); // bank could be here instead
453456}
r14896r14897
456459static TILE_GET_INFO( get_cb2001_reel1_tile_info )
457460{
458461   cb2001_state *state = machine.driver_data<cb2001_state>();
459   int code = state->m_vram_bg[(0x0000/2) + tile_index/2];
462   int code = state->m_vram_bg.target()[(0x0000/2) + tile_index/2];
460463
461464   if (tile_index&1)
462465      code >>=8;
r14896r14897
475478static TILE_GET_INFO( get_cb2001_reel2_tile_info )
476479{
477480   cb2001_state *state = machine.driver_data<cb2001_state>();
478   int code = state->m_vram_bg[(0x0200/2) + tile_index/2];
481   int code = state->m_vram_bg.target()[(0x0200/2) + tile_index/2];
479482
480483   if (tile_index&1)
481484      code >>=8;
r14896r14897
495498static TILE_GET_INFO( get_cb2001_reel3_tile_info )
496499{
497500   cb2001_state *state = machine.driver_data<cb2001_state>();
498   int code = state->m_vram_bg[(0x0400/2) + tile_index/2];
501   int code = state->m_vram_bg.target()[(0x0400/2) + tile_index/2];
499502   int colour = 0;//(cb2001_out_c&0x7) + 8;
500503
501504   if (tile_index&1)
r14896r14897
523526   state->m_reel3_tilemap->set_scroll_cols(64);
524527}
525528
526WRITE16_HANDLER( cb2001_bg_w )
529WRITE16_MEMBER(cb2001_state::cb2001_bg_w)
527530{
528   cb2001_state *state = space->machine().driver_data<cb2001_state>();
529   COMBINE_DATA(&state->m_vram_bg[offset]);
531   COMBINE_DATA(&m_vram_bg.target()[offset]);
530532
531533   // also used for the reel tilemaps in a different mode
532534/*
533535    if (offset<0x200/2)
534536    {
535        state->m_reel1_tilemap->mark_tile_dirty((offset&0xff)/2);
537        m_reel1_tilemap->mark_tile_dirty((offset&0xff)/2);
536538    }
537539    else if (offset<0x400/2)
538540    {
539        state->m_reel2_tilemap->mark_tile_dirty((offset&0xff)/2);
541        m_reel2_tilemap->mark_tile_dirty((offset&0xff)/2);
540542    }
541543    else if (offset<0x600/2)
542544    {
543        state->m_reel3_tilemap->mark_tile_dirty((offset&0xff)/2);
545        m_reel3_tilemap->mark_tile_dirty((offset&0xff)/2);
544546    }
545547    else if (offset<0x800/2)
546548    {
547549    //  reel4_tilemap->mark_tile_dirty((offset&0xff)/2);
548550    }
549551*/
550   state->m_reel1_tilemap->mark_all_dirty();
551   state->m_reel2_tilemap->mark_all_dirty();
552   state->m_reel3_tilemap->mark_all_dirty();
552   m_reel1_tilemap->mark_all_dirty();
553   m_reel2_tilemap->mark_all_dirty();
554   m_reel3_tilemap->mark_all_dirty();
553555
554556
555557}
556558
557559static ADDRESS_MAP_START( cb2001_map, AS_PROGRAM, 16, cb2001_state )
558560   AM_RANGE(0x00000, 0x1ffff) AM_RAM
559   AM_RANGE(0x20000, 0x20fff) AM_RAM AM_BASE(m_vram_fg)
560   AM_RANGE(0x21000, 0x21fff) AM_RAM_WRITE_LEGACY(&cb2001_bg_w) AM_BASE(m_vram_bg)
561   AM_RANGE(0x20000, 0x20fff) AM_RAM AM_SHARE("vrafg")
562   AM_RANGE(0x21000, 0x21fff) AM_RAM_WRITE(cb2001_bg_w) AM_SHARE("vrabg")
561563   AM_RANGE(0xc0000, 0xfffff) AM_ROM AM_REGION("boot_prg",0)
562564ADDRESS_MAP_END
563565
r14896r14897
567569   AM_RANGE(0x20, 0x21) AM_DEVREAD8_LEGACY("aysnd", ay8910_r, 0xff00)
568570   AM_RANGE(0x22, 0x23) AM_DEVWRITE8_LEGACY("aysnd", ay8910_data_address_w, 0xffff)
569571
570   AM_RANGE(0x30, 0x31) AM_WRITE_LEGACY(cb2001_vidctrl_w)
571   AM_RANGE(0x32, 0x33) AM_WRITE_LEGACY(cb2001_vidctrl2_w)
572   AM_RANGE(0x30, 0x31) AM_WRITE(cb2001_vidctrl_w)
573   AM_RANGE(0x32, 0x33) AM_WRITE(cb2001_vidctrl2_w)
572574ADDRESS_MAP_END
573575
574576static INPUT_PORTS_START( cb2001 )
src/mame/drivers/funkyjet.c
r14896r14897
102102
103103static ADDRESS_MAP_START( funkyjet_map, AS_PROGRAM, 16, funkyjet_state )
104104   AM_RANGE(0x000000, 0x07ffff) AM_ROM
105   AM_RANGE(0x120000, 0x1207ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
105   AM_RANGE(0x120000, 0x1207ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
106106   AM_RANGE(0x140000, 0x143fff) AM_RAM
107107   AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
108108   AM_RANGE(0x180000, 0x1807ff) AM_READWRITE_LEGACY(deco16_146_funkyjet_prot_r, deco16_146_funkyjet_prot_w) AM_BASE_LEGACY(&deco16_prot_ram)
r14896r14897
124124   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
125125   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki", okim6295_device, read, write)
126126   AM_RANGE(0x130000, 0x130001) AM_NOP /* This board only has 1 oki chip */
127   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
127   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
128128   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
129129   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
130130   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/xexex.c
r14896r14897
211211   {
212212      // anyone knows why 0x1a keeps lurking the sound queue in the world version???
213213      if (m_strip_0x1a)
214         if (soundlatch2_r(space, 0) == 1 && data == 0x1a)
214         if (soundlatch2_byte_r(space, 0) == 1 && data == 0x1a)
215215            return;
216216
217      soundlatch_w(space, 0, data & 0xff);
217      soundlatch_byte_w(space, 0, data & 0xff);
218218   }
219219}
220220
221221WRITE16_MEMBER(xexex_state::sound_cmd2_w)
222222{
223223   if (ACCESSING_BITS_0_7)
224      soundlatch2_w(space, 0, data & 0xff);
224      soundlatch2_byte_w(space, 0, data & 0xff);
225225}
226226
227227WRITE16_MEMBER(xexex_state::sound_irq_w)
r14896r14897
231231
232232READ16_MEMBER(xexex_state::sound_status_r)
233233{
234   return soundlatch3_r(space, 0);
234   return soundlatch3_byte_r(space, 0);
235235}
236236
237237static void reset_sound_region(running_machine &machine)
r14896r14897
346346   AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE_LEGACY("k056832", k056832_ram_word_r, k056832_ram_word_w)
347347   AM_RANGE(0x190000, 0x191fff) AM_DEVREAD_LEGACY("k056832", k056832_rom_word_r)      // Passthrough to tile roms
348348   AM_RANGE(0x1a0000, 0x1a1fff) AM_DEVREAD("k053250", k053250_t, rom_r)
349   AM_RANGE(0x1b0000, 0x1b1fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")
349   AM_RANGE(0x1b0000, 0x1b1fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")
350350
351351#if XE_DEBUG
352352   AM_RANGE(0x0c0000, 0x0c003f) AM_DEVREAD_LEGACY("k056832", k056832_word_r)
r14896r14897
365365   AM_RANGE(0xc000, 0xdfff) AM_RAM
366366   AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("k054539", k054539_device, read, write)
367367   AM_RANGE(0xec00, 0xec01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
368   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
369   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
370   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
368   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_byte_w)
369   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_byte_r)
370   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_byte_r)
371371   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
372372ADDRESS_MAP_END
373373
src/mame/drivers/wallc.c
r14896r14897
5757{
5858public:
5959   wallc_state(const machine_config &mconfig, device_type type, const char *tag)
60      : driver_device(mconfig, type, tag) { }
60      : driver_device(mconfig, type, tag) ,
61      m_videoram(*this, "videoram"){ }
6162
62   UINT8 *m_videoram;
63   required_shared_ptr<UINT8> m_videoram;
6364   tilemap_t *m_bg_tilemap;
6465   DECLARE_WRITE8_MEMBER(wallc_videoram_w);
6566   DECLARE_WRITE8_MEMBER(wallc_coin_counter_w);
r14896r14897
130131
131132WRITE8_MEMBER(wallc_state::wallc_videoram_w)
132133{
133   UINT8 *videoram = m_videoram;
134   UINT8 *videoram = m_videoram.target();
134135   videoram[offset] = data;
135136   m_bg_tilemap->mark_tile_dirty(offset);
136137}
r14896r14897
138139static TILE_GET_INFO( get_bg_tile_info )
139140{
140141   wallc_state *state = machine.driver_data<wallc_state>();
141   UINT8 *videoram = state->m_videoram;
142   UINT8 *videoram = state->m_videoram.target();
142143   SET_TILE_INFO(0, videoram[tile_index] + 0x100, 1, 0);
143144}
144145
r14896r14897
162163
163164static ADDRESS_MAP_START( wallc_map, AS_PROGRAM, 8, wallc_state )
164165   AM_RANGE(0x0000, 0x7fff) AM_ROM
165   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(wallc_videoram_w) AM_MIRROR(0xc00) AM_BASE(m_videoram)   /* 2114, 2114 */
166   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(wallc_videoram_w) AM_MIRROR(0xc00) AM_SHARE("videoram")   /* 2114, 2114 */
166167   AM_RANGE(0xa000, 0xa3ff) AM_RAM      /* 2114, 2114 */
167168
168169   AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW1")
src/mame/drivers/ironhors.c
r14896r14897
6464   AM_RANGE(0x0020, 0x003f) AM_RAM AM_BASE(m_scroll)
6565   AM_RANGE(0x0040, 0x005f) AM_RAM
6666   AM_RANGE(0x0060, 0x00df) AM_RAM
67   AM_RANGE(0x0800, 0x0800) AM_WRITE(soundlatch_w)
67   AM_RANGE(0x0800, 0x0800) AM_WRITE(soundlatch_byte_w)
6868   AM_RANGE(0x0900, 0x0900) AM_READ_PORT("DSW3") AM_WRITE(ironhors_sh_irqtrigger_w)
6969   AM_RANGE(0x0a00, 0x0a00) AM_READ_PORT("DSW2") AM_WRITE(ironhors_palettebank_w)
7070   AM_RANGE(0x0b00, 0x0b00) AM_READ_PORT("DSW1") AM_WRITE(ironhors_flipscreen_w)
r14896r14897
8787static ADDRESS_MAP_START( slave_map, AS_PROGRAM, 8, ironhors_state )
8888   AM_RANGE(0x0000, 0x3fff) AM_ROM
8989   AM_RANGE(0x4000, 0x43ff) AM_RAM
90   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r)
90   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_byte_r)
9191ADDRESS_MAP_END
9292
9393static ADDRESS_MAP_START( slave_io_map, AS_IO, 8, ironhors_state )
r14896r14897
103103   AM_RANGE(0x31db, 0x31fa) AM_RAM AM_BASE(m_scroll)
104104   AM_RANGE(0x0040, 0x005f) AM_RAM
105105   AM_RANGE(0x0060, 0x00ff) AM_RAM
106   AM_RANGE(0x0800, 0x0800) AM_WRITE(soundlatch_w)
106   AM_RANGE(0x0800, 0x0800) AM_WRITE(soundlatch_byte_w)
107107   AM_RANGE(0x0900, 0x0900) /*AM_READ_PORT("DSW3") */AM_WRITE(ironhors_sh_irqtrigger_w)
108108   AM_RANGE(0x0a00, 0x0a00) AM_READ_PORT("DSW2") //AM_WRITE(ironhors_palettebank_w)
109109   AM_RANGE(0x0b00, 0x0b00) AM_READ_PORT("DSW1") AM_WRITE(ironhors_flipscreen_w)
r14896r14897
442442{
443443   ironhors_state *state = device->machine().driver_data<ironhors_state>();
444444
445   return state->soundlatch_r(*state->m_soundcpu->memory().space(AS_PROGRAM), 0);
445   return state->soundlatch_byte_r(*state->m_soundcpu->memory().space(AS_PROGRAM), 0);
446446}
447447
448448static const ym2203_interface farwest_ym2203_config =
src/mame/drivers/marinedt.c
r14896r14897
101101{
102102public:
103103   marinedt_state(const machine_config &mconfig, device_type type, const char *tag)
104      : driver_device(mconfig, type, tag) { }
104      : driver_device(mconfig, type, tag) ,
105      m_tx_tileram(*this, "tx_tileram"){ }
105106
106107   /* memory pointers */
107   UINT8 *    m_tx_tileram;
108   required_shared_ptr<UINT8> m_tx_tileram;
108109
109110   /* video-related */
110111   bitmap_ind16 *m_tile;
r14896r14897
152153WRITE8_MEMBER(marinedt_state::tx_tileram_w)
153154{
154155
155   m_tx_tileram[offset] = data;
156   m_tx_tileram.target()[offset] = data;
156157   m_tx_tilemap->mark_tile_dirty(offset);
157158}
158159
r14896r14897
311312   AM_RANGE(0x0000, 0x37ff) AM_ROM
312313   AM_RANGE(0x4000, 0x43ff) AM_RAM
313314   AM_RANGE(0x4400, 0x47ff) AM_RAM            //unused, vram mirror?
314   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(tx_tileram_w) AM_BASE(m_tx_tileram)
315   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(tx_tileram_w) AM_SHARE("tx_tileram")
315316   AM_RANGE(0x4c00, 0x4c00) AM_WRITENOP   //?? maybe off by one error
316317ADDRESS_MAP_END
317318
r14896r14897
478479static TILE_GET_INFO( get_tile_info )
479480{
480481   marinedt_state *state = machine.driver_data<marinedt_state>();
481   int code = state->m_tx_tileram[tile_index];
482   int code = state->m_tx_tileram.target()[tile_index];
482483   int color = 0;
483484   int flags = TILE_FLIPX;
484485
src/mame/drivers/skullxbo.c
r14896r14897
6565}
6666
6767
68static WRITE16_HANDLER( skullxbo_halt_until_hblank_0_w )
68WRITE16_MEMBER(skullxbo_state::skullxbo_halt_until_hblank_0_w)
6969{
70   atarigen_halt_until_hblank_0(*space->machine().primary_screen);
70   atarigen_halt_until_hblank_0(*machine().primary_screen);
7171}
7272
7373
r14896r14897
9595 *
9696 *************************************/
9797
98static READ16_HANDLER( special_port1_r )
98READ16_MEMBER(skullxbo_state::special_port1_r)
9999{
100   skullxbo_state *state = space->machine().driver_data<skullxbo_state>();
101   int temp = input_port_read(space->machine(), "FF5802");
102   if (state->m_cpu_to_sound_ready) temp ^= 0x0040;
103   if (atarigen_get_hblank(*space->machine().primary_screen)) temp ^= 0x0010;
100   int temp = input_port_read(machine(), "FF5802");
101   if (m_cpu_to_sound_ready) temp ^= 0x0040;
102   if (atarigen_get_hblank(*machine().primary_screen)) temp ^= 0x0010;
104103   return temp;
105104}
106105
r14896r14897
112111 *
113112 *************************************/
114113
115static WRITE16_HANDLER( skullxbo_mobwr_w )
114WRITE16_MEMBER(skullxbo_state::skullxbo_mobwr_w)
116115{
117116   logerror("MOBWR[%02X] = %04X\n", offset, data);
118117}
r14896r14897
128127static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, skullxbo_state )
129128   AM_RANGE(0x000000, 0x07ffff) AM_ROM
130129   AM_RANGE(0xff0000, 0xff07ff) AM_WRITE_LEGACY(skullxbo_mobmsb_w)
131   AM_RANGE(0xff0800, 0xff0bff) AM_WRITE_LEGACY(skullxbo_halt_until_hblank_0_w)
130   AM_RANGE(0xff0800, 0xff0bff) AM_WRITE(skullxbo_halt_until_hblank_0_w)
132131   AM_RANGE(0xff0c00, 0xff0fff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
133132   AM_RANGE(0xff1000, 0xff13ff) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
134133   AM_RANGE(0xff1400, 0xff17ff) AM_WRITE_LEGACY(atarigen_sound_w)
r14896r14897
143142   AM_RANGE(0xff1f80, 0xff1fff) AM_WRITE(watchdog_reset16_w)
144143   AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram_w) AM_SHARE("paletteram")
145144   AM_RANGE(0xff4000, 0xff47ff) AM_WRITE_LEGACY(skullxbo_yscroll_w) AM_BASE(m_yscroll)
146   AM_RANGE(0xff4800, 0xff4fff) AM_WRITE_LEGACY(skullxbo_mobwr_w)
145   AM_RANGE(0xff4800, 0xff4fff) AM_WRITE(skullxbo_mobwr_w)
147146   AM_RANGE(0xff6000, 0xff6fff) AM_WRITE_LEGACY(atarigen_eeprom_w) AM_SHARE("eeprom")
148147   AM_RANGE(0xff5000, 0xff5001) AM_READ_LEGACY(atarigen_sound_r)
149148   AM_RANGE(0xff5800, 0xff5801) AM_READ_PORT("FF5800")
150   AM_RANGE(0xff5802, 0xff5803) AM_READ_LEGACY(special_port1_r)
149   AM_RANGE(0xff5802, 0xff5803) AM_READ(special_port1_r)
151150   AM_RANGE(0xff6000, 0xff6fff) AM_READ_LEGACY(atarigen_eeprom_r)
152151   AM_RANGE(0xff8000, 0xff9fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_latched_lsb_w) AM_BASE(m_playfield)
153152   AM_RANGE(0xffa000, 0xffbfff) AM_RAM_WRITE_LEGACY(atarigen_playfield_upper_w) AM_BASE(m_playfield_upper)
src/mame/drivers/sliver.c
r14896r14897
8181public:
8282   sliver_state(const machine_config &mconfig, device_type type, const char *tag)
8383      : driver_device(mconfig, type, tag),
84      m_maincpu(*this, "maincpu")
85      { }
84      m_maincpu(*this, "maincpu"),
85      m_colorram(*this, "colorram"){ }
8686
8787   UINT16 m_io_offset;
8888   UINT16 m_io_reg[IO_SIZE];
r14896r14897
9696   int m_tmp_counter;
9797   int m_clr_offset;
9898
99   UINT8 *m_colorram;
99   required_device<cpu_device> m_maincpu;
100   required_shared_ptr<UINT8> m_colorram;
100101   bitmap_rgb32 m_bitmap_fg;
101102   bitmap_rgb32 m_bitmap_bg;
102103
103104   UINT16 m_tempbuf[8];
104105
105   required_device<cpu_device> m_maincpu;
106106   DECLARE_WRITE16_MEMBER(fifo_data_w);
107107   DECLARE_WRITE16_MEMBER(fifo_clear_w);
108108   DECLARE_WRITE16_MEMBER(fifo_flush_w);
r14896r14897
132132   if (y < 0 || x < 0 || x > 383 || y > 255)
133133      return;
134134
135   b=(state->m_colorram[addr] << 2) | (state->m_colorram[addr] & 0x3);
136   g=(state->m_colorram[addr+0x100] << 2) | (state->m_colorram[addr+0x100] & 3);
137   r=(state->m_colorram[addr+0x200] << 2) | (state->m_colorram[addr+0x200] & 3);
135   b=(state->m_colorram.target()[addr] << 2) | (state->m_colorram.target()[addr] & 0x3);
136   g=(state->m_colorram.target()[addr+0x100] << 2) | (state->m_colorram.target()[addr+0x100] & 3);
137   r=(state->m_colorram.target()[addr+0x200] << 2) | (state->m_colorram.target()[addr+0x200] & 3);
138138
139139   state->m_bitmap_fg.pix32(y, x) = r | (g<<8) | (b<<16);
140140}
r14896r14897
313313
314314WRITE16_MEMBER(sliver_state::sound_w)
315315{
316   soundlatch_w(space, 0, data & 0xff);
316   soundlatch_byte_w(space, 0, data & 0xff);
317317   cputag_set_input_line(machine(), "audiocpu", MCS51_INT0_LINE, HOLD_LINE);
318318}
319319
r14896r14897
360360
361361static ADDRESS_MAP_START( soundmem_io, AS_IO, 8, sliver_state )
362362   AM_RANGE(0x0100, 0x0100) AM_DEVREADWRITE("oki", okim6295_device, read, write)
363   AM_RANGE(0x0101, 0x0101) AM_READ(soundlatch_r)
363   AM_RANGE(0x0101, 0x0101) AM_READ(soundlatch_byte_r)
364364   /* ports */
365365   AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_WRITE(oki_setbank )
366366ADDRESS_MAP_END
r14896r14897
453453INPUT_PORTS_END
454454
455455static ADDRESS_MAP_START( ramdac_map, AS_0, 8, sliver_state )
456   AM_RANGE(0x000, 0x3ff) AM_RAM AM_BASE(m_colorram)
456   AM_RANGE(0x000, 0x3ff) AM_RAM AM_SHARE("colorram")
457457ADDRESS_MAP_END
458458
459459static RAMDAC_INTERFACE( ramdac_intf )
src/mame/drivers/mrflea.c
r14896r14897
162162   AM_RANGE(0x0000, 0xbfff) AM_ROM
163163   AM_RANGE(0xc000, 0xcfff) AM_RAM
164164   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(mrflea_videoram_w) AM_BASE(m_videoram)
165   AM_RANGE(0xe800, 0xe83f) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_le_w) AM_SHARE("paletteram")
165   AM_RANGE(0xe800, 0xe83f) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_le_w) AM_SHARE("paletteram")
166166   AM_RANGE(0xec00, 0xecff) AM_RAM_WRITE(mrflea_spriteram_w) AM_BASE(m_spriteram)
167167ADDRESS_MAP_END
168168
src/mame/drivers/glass.c
r14896r14897
8383   AM_RANGE(0x102000, 0x102fff) AM_RAM                                                      /* Extra Video RAM */
8484   AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE(m_vregs)                           /* Video Registers */
8585   AM_RANGE(0x108008, 0x108009) AM_WRITE(clr_int_w)                                          /* CLR INT Video */
86   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
86   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")   /* Palette */
8787   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(m_spriteram)                                 /* Sprite RAM */
8888   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2")
8989   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
src/mame/drivers/subsino.c
r14896r14897
232232{
233233public:
234234   subsino_state(const machine_config &mconfig, device_type type, const char *tag)
235      : driver_device(mconfig, type, tag) { }
235      : driver_device(mconfig, type, tag) ,
236      m_colorram(*this, "colorram"),
237      m_videoram(*this, "videoram"),
238      m_reel3_scroll(*this, "reel3_scroll"),
239      m_reel2_scroll(*this, "reel2_scroll"),
240      m_reel1_scroll(*this, "reel1_scroll"),
241      m_reel1_ram(*this, "reel1_ram"),
242      m_reel2_ram(*this, "reel2_ram"),
243      m_reel3_ram(*this, "reel3_ram"){ }
236244
237   UINT8 *m_videoram;
238   UINT8 *m_colorram;
245   required_shared_ptr<UINT8> m_colorram;
246   required_shared_ptr<UINT8> m_videoram;
247   required_shared_ptr<UINT8> m_reel3_scroll;
248   required_shared_ptr<UINT8> m_reel2_scroll;
249   required_shared_ptr<UINT8> m_reel1_scroll;
250   required_shared_ptr<UINT8> m_reel1_ram;
251   required_shared_ptr<UINT8> m_reel2_ram;
252   required_shared_ptr<UINT8> m_reel3_ram;
253
239254   tilemap_t *m_tmap;
240255   tilemap_t *m_reel1_tilemap;
241256   tilemap_t *m_reel2_tilemap;
242257   tilemap_t *m_reel3_tilemap;
243258   int m_tiles_offset;
244   UINT8* m_reel1_ram;
245   UINT8* m_reel2_ram;
246   UINT8* m_reel3_ram;
247   UINT8* m_reel1_scroll;
248   UINT8* m_reel2_scroll;
249   UINT8* m_reel3_scroll;
250259   UINT8 m_out_c;
251260   UINT8* m_reel1_attr;
252261   UINT8* m_reel2_attr;
r14896r14897
291300
292301WRITE8_MEMBER(subsino_state::subsino_videoram_w)
293302{
294   m_videoram[offset] = data;
303   m_videoram.target()[offset] = data;
295304   m_tmap->mark_tile_dirty(offset);
296305}
297306
298307WRITE8_MEMBER(subsino_state::subsino_colorram_w)
299308{
300   m_colorram[offset] = data;
309   m_colorram.target()[offset] = data;
301310   m_tmap->mark_tile_dirty(offset);
302311}
303312
304313static TILE_GET_INFO( get_tile_info )
305314{
306315   subsino_state *state = machine.driver_data<subsino_state>();
307   UINT16 code = state->m_videoram[ tile_index ] + (state->m_colorram[ tile_index ] << 8);
316   UINT16 code = state->m_videoram.target()[ tile_index ] + (state->m_colorram.target()[ tile_index ] << 8);
308317   UINT16 color = (code >> 8) & 0x0f;
309318   code = ((code & 0xf000) >> 4) + ((code & 0xff) >> 0);
310319   code += state->m_tiles_offset;
r14896r14897
314323static TILE_GET_INFO( get_stisub_tile_info )
315324{
316325   subsino_state *state = machine.driver_data<subsino_state>();
317   UINT16 code = state->m_videoram[ tile_index ] + (state->m_colorram[ tile_index ] << 8);
326   UINT16 code = state->m_videoram.target()[ tile_index ] + (state->m_colorram.target()[ tile_index ] << 8);
318327   code&= 0x3fff;
319328   SET_TILE_INFO(0, code, 0, 0);
320329}
r14896r14897
332341
333342WRITE8_MEMBER(subsino_state::subsino_reel1_ram_w)
334343{
335   m_reel1_ram[offset] = data;
344   m_reel1_ram.target()[offset] = data;
336345   m_reel1_tilemap->mark_tile_dirty(offset);
337346}
338347
339348static TILE_GET_INFO( get_subsino_reel1_tile_info )
340349{
341350   subsino_state *state = machine.driver_data<subsino_state>();
342   int code = state->m_reel1_ram[tile_index];
351   int code = state->m_reel1_ram.target()[tile_index];
343352   int colour = (state->m_out_c&0x7) + 8;
344353
345354   SET_TILE_INFO(
r14896r14897
352361static TILE_GET_INFO( get_stisub_reel1_tile_info )
353362{
354363   subsino_state *state = machine.driver_data<subsino_state>();
355   int code = state->m_reel1_ram[tile_index];
364   int code = state->m_reel1_ram.target()[tile_index];
356365   int attr = state->m_reel1_attr[tile_index];
357366
358367   SET_TILE_INFO(
r14896r14897
365374
366375WRITE8_MEMBER(subsino_state::subsino_reel2_ram_w)
367376{
368   m_reel2_ram[offset] = data;
377   m_reel2_ram.target()[offset] = data;
369378   m_reel2_tilemap->mark_tile_dirty(offset);
370379}
371380
372381static TILE_GET_INFO( get_subsino_reel2_tile_info )
373382{
374383   subsino_state *state = machine.driver_data<subsino_state>();
375   int code = state->m_reel2_ram[tile_index];
384   int code = state->m_reel2_ram.target()[tile_index];
376385   int colour = (state->m_out_c&0x7) + 8;
377386
378387   SET_TILE_INFO(
r14896r14897
385394static TILE_GET_INFO( get_stisub_reel2_tile_info )
386395{
387396   subsino_state *state = machine.driver_data<subsino_state>();
388   int code = state->m_reel2_ram[tile_index];
397   int code = state->m_reel2_ram.target()[tile_index];
389398   int attr = state->m_reel2_attr[tile_index];
390399
391400   SET_TILE_INFO(
r14896r14897
397406
398407WRITE8_MEMBER(subsino_state::subsino_reel3_ram_w)
399408{
400   m_reel3_ram[offset] = data;
409   m_reel3_ram.target()[offset] = data;
401410   m_reel3_tilemap->mark_tile_dirty(offset);
402411}
403412
404413static TILE_GET_INFO( get_subsino_reel3_tile_info )
405414{
406415   subsino_state *state = machine.driver_data<subsino_state>();
407   int code = state->m_reel3_ram[tile_index];
416   int code = state->m_reel3_ram.target()[tile_index];
408417   int colour = (state->m_out_c&0x7) + 8;
409418
410419   SET_TILE_INFO(
r14896r14897
417426static TILE_GET_INFO( get_stisub_reel3_tile_info )
418427{
419428   subsino_state *state = machine.driver_data<subsino_state>();
420   int code = state->m_reel3_ram[tile_index];
429   int code = state->m_reel3_ram.target()[tile_index];
421430   int attr = state->m_reel3_attr[tile_index];
422431
423432   SET_TILE_INFO(
r14896r14897
477486
478487   for (i= 0;i < 64;i++)
479488   {
480      state->m_reel1_tilemap->set_scrolly(i, state->m_reel1_scroll[i]);
481      state->m_reel2_tilemap->set_scrolly(i, state->m_reel2_scroll[i]);
482      state->m_reel3_tilemap->set_scrolly(i, state->m_reel3_scroll[i]);
489      state->m_reel1_tilemap->set_scrolly(i, state->m_reel1_scroll.target()[i]);
490      state->m_reel2_tilemap->set_scrolly(i, state->m_reel2_scroll.target()[i]);
491      state->m_reel3_tilemap->set_scrolly(i, state->m_reel3_scroll.target()[i]);
483492   }
484493
485494   if (state->m_out_c&0x08)
r14896r14897
514523
515524   for (i= 0;i < 64;i++)
516525   {
517      state->m_reel1_tilemap->set_scrolly(i, state->m_reel1_scroll[i]);
518      state->m_reel2_tilemap->set_scrolly(i, state->m_reel2_scroll[i]);
519      state->m_reel3_tilemap->set_scrolly(i, state->m_reel3_scroll[i]);
526      state->m_reel1_tilemap->set_scrolly(i, state->m_reel1_scroll.target()[i]);
527      state->m_reel2_tilemap->set_scrolly(i, state->m_reel2_scroll.target()[i]);
528      state->m_reel3_tilemap->set_scrolly(i, state->m_reel3_scroll.target()[i]);
520529   }
521530
522531   if (state->m_out_c&0x08)
r14896r14897
10211030   AM_RANGE( 0x10000, 0x13fff ) AM_ROM
10221031   AM_RANGE( 0x14000, 0x14fff ) AM_ROM // reads the card face data here (see rom copy in rom loading)
10231032
1024   AM_RANGE( 0x150c0, 0x150ff ) AM_RAM AM_BASE(m_reel3_scroll)
1025   AM_RANGE( 0x15140, 0x1517f ) AM_RAM AM_BASE(m_reel2_scroll)
1026   AM_RANGE( 0x15180, 0x151bf ) AM_RAM AM_BASE(m_reel1_scroll)
1033   AM_RANGE( 0x150c0, 0x150ff ) AM_RAM AM_SHARE("reel3_scroll")
1034   AM_RANGE( 0x15140, 0x1517f ) AM_RAM AM_SHARE("reel2_scroll")
1035   AM_RANGE( 0x15180, 0x151bf ) AM_RAM AM_SHARE("reel1_scroll")
10271036
1028   AM_RANGE( 0x15800, 0x159ff ) AM_RAM_WRITE(subsino_reel1_ram_w) AM_BASE(m_reel1_ram)
1029   AM_RANGE( 0x15a00, 0x15bff ) AM_RAM_WRITE(subsino_reel2_ram_w) AM_BASE(m_reel2_ram)
1030   AM_RANGE( 0x15c00, 0x15dff ) AM_RAM_WRITE(subsino_reel3_ram_w) AM_BASE(m_reel3_ram)
1037   AM_RANGE( 0x15800, 0x159ff ) AM_RAM_WRITE(subsino_reel1_ram_w) AM_SHARE("reel1_ram")
1038   AM_RANGE( 0x15a00, 0x15bff ) AM_RAM_WRITE(subsino_reel2_ram_w) AM_SHARE("reel2_ram")
1039   AM_RANGE( 0x15c00, 0x15dff ) AM_RAM_WRITE(subsino_reel3_ram_w) AM_SHARE("reel3_ram")
10311040ADDRESS_MAP_END
10321041
10331042
r14896r14897
10981107      }
10991108      else if (offset<0x80)
11001109      {
1101         m_reel2_scroll[offset&0x3f] = data;
1110         m_reel2_scroll.target()[offset&0x3f] = data;
11021111      }
11031112      else if (offset<0xc0)
11041113      {
1105         m_reel1_scroll[offset&0x3f] = data;
1114         m_reel1_scroll.target()[offset&0x3f] = data;
11061115      }
11071116      else
11081117      {
1109         m_reel3_scroll[offset&0x3f] = data;
1118         m_reel3_scroll.target()[offset&0x3f] = data;
11101119      }
11111120   }
11121121}
r14896r14897
11471156
11481157   AM_RANGE( 0xf000, 0xf7ff ) AM_READWRITE(reel_scrollattr_r, reel_scrollattr_w)
11491158
1150   AM_RANGE( 0xf800, 0xf9ff ) AM_RAM_WRITE(subsino_reel1_ram_w) AM_BASE(m_reel1_ram)
1151   AM_RANGE( 0xfa00, 0xfbff ) AM_RAM_WRITE(subsino_reel2_ram_w) AM_BASE(m_reel2_ram)
1152   AM_RANGE( 0xfc00, 0xfdff ) AM_RAM_WRITE(subsino_reel3_ram_w) AM_BASE(m_reel3_ram)
1159   AM_RANGE( 0xf800, 0xf9ff ) AM_RAM_WRITE(subsino_reel1_ram_w) AM_SHARE("reel1_ram")
1160   AM_RANGE( 0xfa00, 0xfbff ) AM_RAM_WRITE(subsino_reel2_ram_w) AM_SHARE("reel2_ram")
1161   AM_RANGE( 0xfc00, 0xfdff ) AM_RAM_WRITE(subsino_reel3_ram_w) AM_SHARE("reel3_ram")
11531162ADDRESS_MAP_END
11541163
11551164
r14896r14897
11881197
11891198   AM_RANGE( 0xf000, 0xf7ff ) AM_READWRITE(reel_scrollattr_r, reel_scrollattr_w)
11901199
1191   AM_RANGE( 0xf800, 0xf9ff ) AM_RAM_WRITE(subsino_reel1_ram_w) AM_BASE(m_reel1_ram)
1192   AM_RANGE( 0xfa00, 0xfbff ) AM_RAM_WRITE(subsino_reel2_ram_w) AM_BASE(m_reel2_ram)
1193   AM_RANGE( 0xfc00, 0xfdff ) AM_RAM_WRITE(subsino_reel3_ram_w) AM_BASE(m_reel3_ram)
1200   AM_RANGE( 0xf800, 0xf9ff ) AM_RAM_WRITE(subsino_reel1_ram_w) AM_SHARE("reel1_ram")
1201   AM_RANGE( 0xfa00, 0xfbff ) AM_RAM_WRITE(subsino_reel2_ram_w) AM_SHARE("reel2_ram")
1202   AM_RANGE( 0xfc00, 0xfdff ) AM_RAM_WRITE(subsino_reel3_ram_w) AM_SHARE("reel3_ram")
11941203ADDRESS_MAP_END
11951204
11961205
r14896r14897
35443553   rom[0x957] = 0x18; //patch "losing protection" check
35453554   state->m_stisub_colorram = auto_alloc_array(machine, UINT8, 256*3);
35463555
3547   state->m_reel1_scroll = auto_alloc_array(machine, UINT8, 0x40);
3548   state->m_reel2_scroll = auto_alloc_array(machine, UINT8, 0x40);
3549   state->m_reel3_scroll = auto_alloc_array(machine, UINT8, 0x40);
3556   //state->m_reel1_scroll = auto_alloc_array(machine, UINT8, 0x40);
3557   //state->m_reel2_scroll = auto_alloc_array(machine, UINT8, 0x40);
3558   //state->m_reel3_scroll = auto_alloc_array(machine, UINT8, 0x40);
35503559
35513560   state->m_reel1_attr = auto_alloc_array(machine, UINT8, 0x200);
35523561   state->m_reel2_attr = auto_alloc_array(machine, UINT8, 0x200);
r14896r14897
35583567   subsino_state *state = machine.driver_data<subsino_state>();
35593568   state->m_stisub_colorram = auto_alloc_array(machine, UINT8, 256*3);
35603569
3561   state->m_reel1_scroll = auto_alloc_array(machine, UINT8, 0x40);
3562   state->m_reel2_scroll = auto_alloc_array(machine, UINT8, 0x40);
3563   state->m_reel3_scroll = auto_alloc_array(machine, UINT8, 0x40);
3570   //state->m_reel1_scroll = auto_alloc_array(machine, UINT8, 0x40);
3571   //state->m_reel2_scroll = auto_alloc_array(machine, UINT8, 0x40);
3572   //state->m_reel3_scroll = auto_alloc_array(machine, UINT8, 0x40);
35643573
35653574   state->m_reel1_attr = auto_alloc_array(machine, UINT8, 0x200);
35663575   state->m_reel2_attr = auto_alloc_array(machine, UINT8, 0x200);
src/mame/drivers/jchan.c
r14896r14897
522522   AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(jchan_suprnova_sprite32_1_w) AM_BASE(m_spriteram_1)
523523   AM_RANGE(0x600000, 0x60003f) AM_RAM_WRITE(jchan_suprnova_sprite32regs_1_w) AM_BASE(m_sprregs_1)
524524
525   AM_RANGE(0x700000, 0x70ffff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram") // palette for sprites?
525   AM_RANGE(0x700000, 0x70ffff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram") // palette for sprites?
526526
527527   AM_RANGE(0xf00000, 0xf00007) AM_READWRITE(jchan_ctrl_r, jchan_ctrl_w) AM_BASE(m_ctrl)
528528
src/mame/drivers/mlanding.c
r14896r14897
3131{
3232public:
3333   mlanding_state(const machine_config &mconfig, device_type type, const char *tag)
34      : driver_device(mconfig, type, tag) { }
34      : driver_device(mconfig, type, tag) ,
35      m_g_ram(*this, "g_ram"),
36      m_ml_tileram(*this, "ml_tileram"),
37      m_dma_ram(*this, "dma_ram"),
38      m_ml_dotram(*this, "ml_dotram"),
39      m_mecha_ram(*this, "mecha_ram"){ }
3540
36   UINT16 * m_ml_tileram;
37   UINT16 *m_g_ram;
38   UINT16 * m_ml_dotram;
39   UINT16 *m_dma_ram;
41   required_shared_ptr<UINT16> m_g_ram;
42   required_shared_ptr<UINT16> m_ml_tileram;
43   required_shared_ptr<UINT16> m_dma_ram;
44   required_shared_ptr<UINT16> m_ml_dotram;
45   required_shared_ptr<UINT8> m_mecha_ram;
4046   UINT32 m_adpcm_pos;
4147   UINT32 m_adpcm_end;
4248   int m_adpcm_data;
r14896r14897
4450   UINT8 m_pal_fg_bank;
4551   int m_dma_active;
4652   UINT16 m_dsp_HOLD_signal;
47   UINT8 *m_mecha_ram;
4853   UINT8 m_trigger;
4954   DECLARE_WRITE16_MEMBER(ml_tileram_w);
5055   DECLARE_READ16_MEMBER(ml_tileram_r);
r14896r14897
8691
8792   for (y = cliprect.min_y; y <= cliprect.max_y; ++y)
8893   {
89      UINT16 *src = &state->m_g_ram[y * 512/2 + cliprect.min_x];
94      UINT16 *src = &state->m_g_ram.target()[y * 512/2 + cliprect.min_x];
9095      UINT16 *dst = &bitmap.pix16(y, cliprect.min_x);
9196
9297      for (x = cliprect.min_x; x <= cliprect.max_x; x += 2)
r14896r14897
119124
120125      int j, k;
121126
122      UINT16 attr = state->m_dma_ram[offs];
127      UINT16 attr = state->m_dma_ram.target()[offs];
123128
124129      if (attr == 0)
125130         continue;
126131
127      x = state->m_dma_ram[offs + 1];
128      y = state->m_dma_ram[offs + 2];
129      colour = state->m_dma_ram[offs + 3];
132      x = state->m_dma_ram.target()[offs + 1];
133      y = state->m_dma_ram.target()[offs + 2];
134      colour = state->m_dma_ram.target()[offs + 3];
130135
131136      dx = x >> 11;
132137      dy = y >> 11;
r14896r14897
161166               // Draw the 8x8 chunk
162167               for (y1 = 0; y1 < 8; ++y1)
163168               {
164                  UINT16 *src = &state->m_ml_tileram[(code * 2 * 8) + y1*2];
165                  UINT16 *dst = &state->m_g_ram[(y + k*8+y1)*512/2 + (j*8+x)/2];
169                  UINT16 *src = &state->m_ml_tileram.target()[(code * 2 * 8) + y1*2];
170                  UINT16 *dst = &state->m_g_ram.target()[(y + k*8+y1)*512/2 + (j*8+x)/2];
166171
167172                  UINT8 p2 = *src & 0xff;
168173                  UINT8 p1 = *src++ >> 8;
r14896r14897
209214         for(y1 = 0; y1 < dy*8; y1++)
210215         {
211216            int x1;
212            UINT16 *dst = &state->m_g_ram[((y + y1) * 512/2) + x/2];
217            UINT16 *dst = &state->m_g_ram.target()[((y + y1) * 512/2) + x/2];
213218
214219            for(x1 = 0; x1 < dx*8; x1+=2)
215220            {
r14896r14897
223228
224229WRITE16_MEMBER(mlanding_state::ml_tileram_w)
225230{
226   COMBINE_DATA(&m_ml_tileram[offset]);
231   COMBINE_DATA(&m_ml_tileram.target()[offset]);
227232}
228233
229234READ16_MEMBER(mlanding_state::ml_tileram_r)
230235{
231   return m_ml_tileram[offset];
236   return m_ml_tileram.target()[offset];
232237}
233238
234239
r14896r14897
454459
455460READ16_MEMBER(mlanding_state::ml_mecha_ram_r)
456461{
457   return (m_mecha_ram[offset*2]<<8)|m_mecha_ram[offset*2+1];
462   return (m_mecha_ram.target()[offset*2]<<8)|m_mecha_ram.target()[offset*2+1];
458463}
459464
460465WRITE16_MEMBER(mlanding_state::ml_mecha_ram_w)
r14896r14897
469474   AM_RANGE(0x000000, 0x05ffff) AM_ROM
470475   AM_RANGE(0x080000, 0x08ffff) AM_RAM
471476
472   AM_RANGE(0x100000, 0x17ffff) AM_RAM AM_BASE(m_g_ram)// 512kB G RAM - enough here for double buffered 512x400x8 frame
473   AM_RANGE(0x180000, 0x1bffff) AM_READWRITE(ml_tileram_r, ml_tileram_w) AM_BASE(m_ml_tileram)
474   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("share2") AM_BASE(m_dma_ram)
477   AM_RANGE(0x100000, 0x17ffff) AM_RAM AM_SHARE("g_ram")// 512kB G RAM - enough here for double buffered 512x400x8 frame
478   AM_RANGE(0x180000, 0x1bffff) AM_READWRITE(ml_tileram_r, ml_tileram_w) AM_SHARE("ml_tileram")
479   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("share2") AM_SHARE("dma_ram")
475480   AM_RANGE(0x1c4000, 0x1cffff) AM_RAM AM_SHARE("share1")
476481
477482   AM_RANGE(0x1d0000, 0x1d0001) AM_WRITE(ml_sub_reset_w)
r14896r14897
481486   AM_RANGE(0x2d0000, 0x2d0001) AM_READNOP
482487   AM_RANGE(0x2d0002, 0x2d0003) AM_DEVREAD8_LEGACY("tc0140syt", tc0140syt_comm_r, 0x00ff)
483488
484   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
489   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
485490   AM_RANGE(0x280000, 0x2807ff) AM_READWRITE(ml_mecha_ram_r,ml_mecha_ram_w)
486491
487492   AM_RANGE(0x290000, 0x290001) AM_READ_PORT("IN1")
r14896r14897
509514   AM_RANGE(0x050000, 0x0503ff) AM_RAM AM_SHARE("share3")
510515   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("share2")
511516   AM_RANGE(0x1c4000, 0x1cffff) AM_RAM AM_SHARE("share1")
512   AM_RANGE(0x200000, 0x203fff) AM_RAM AM_BASE(m_ml_dotram)
517   AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("ml_dotram")
513518ADDRESS_MAP_END
514519
515520static WRITE8_DEVICE_HANDLER( ml_msm_start_lsb_w )
r14896r14897
544549
545550READ16_MEMBER(mlanding_state::ml_dotram_r)
546551{
547   return m_ml_dotram[offset];
552   return m_ml_dotram.target()[offset];
548553}
549554
550555WRITE16_MEMBER(mlanding_state::ml_dotram_w)
551556{
552   m_ml_dotram[offset] = data;
557   m_ml_dotram.target()[offset] = data;
553558}
554559
555560READ16_MEMBER(mlanding_state::dsp_HOLD_signal_r)
r14896r14897
566571//mecha driver ?
567572static ADDRESS_MAP_START( mlanding_z80_sub_mem, AS_PROGRAM, 8, mlanding_state )
568573   AM_RANGE(0x0000, 0x7fff) AM_ROM
569   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(m_mecha_ram)
574   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("mecha_ram")
570575   AM_RANGE(0x8800, 0x8fff) AM_RAM
571576
572577   AM_RANGE(0x9000, 0x9001) AM_READ(test_r)
src/mame/drivers/tankbust.c
r14896r14897
8080      m_irq_mask = data & 1;
8181      break;
8282
83   case 1:   /* 0xe001 (value 0 then 1) written right after the soundlatch_w */
83   case 1:   /* 0xe001 (value 0 then 1) written right after the soundlatch_byte_w */
8484      machine().scheduler().synchronize(FUNC(soundirqline_callback), data);
8585      break;
8686
src/mame/drivers/neoprint.c
r14896r14897
3030{
3131public:
3232   neoprint_state(const machine_config &mconfig, device_type type, const char *tag)
33      : driver_device(mconfig, type, tag) { }
33      : driver_device(mconfig, type, tag) ,
34      m_npvidram(*this, "npvidram"),
35      m_npvidregs(*this, "npvidregs"){ }
3436
35   UINT16* m_npvidram;
36   UINT16* m_npvidregs;
37   required_shared_ptr<UINT16> m_npvidram;
38   required_shared_ptr<UINT16> m_npvidregs;
3739   UINT8 m_audio_result;
3840   UINT8 m_bank_val;
3941   UINT8 m_vblank;
r14896r14897
7173   const gfx_element *gfx = machine.gfx[0];
7274   INT16 scrollx, scrolly;
7375
74   i = (state->m_npvidregs[((layer*8)+0x06)/2] & 7) * 0x1000/4;
75   scrollx = ((state->m_npvidregs[((layer*8)+0x00)/2] - (0xd8 + layer*4)) & 0x03ff);
76   scrolly = ((state->m_npvidregs[((layer*8)+0x02)/2] - 0xffeb) & 0x03ff);
76   i = (state->m_npvidregs.target()[((layer*8)+0x06)/2] & 7) * 0x1000/4;
77   scrollx = ((state->m_npvidregs.target()[((layer*8)+0x00)/2] - (0xd8 + layer*4)) & 0x03ff);
78   scrolly = ((state->m_npvidregs.target()[((layer*8)+0x02)/2] - 0xffeb) & 0x03ff);
7779
7880   scrollx/=2;
7981   scrolly/=2;
r14896r14897
8284   {
8385      for (x=0;x<32;x++)
8486      {
85         UINT16 dat = state->m_npvidram[i*2] >> data_shift; // a video register?
87         UINT16 dat = state->m_npvidram.target()[i*2] >> data_shift; // a video register?
8688         UINT16 color;
87         if(state->m_npvidram[i*2+1] & 0x0020) // TODO: 8bpp switch?
88            color = ((state->m_npvidram[i*2+1] & 0x8000) << 1) | 0x200 | ((state->m_npvidram[i*2+1] & 0xff00) >> 7);
89         if(state->m_npvidram.target()[i*2+1] & 0x0020) // TODO: 8bpp switch?
90            color = ((state->m_npvidram.target()[i*2+1] & 0x8000) << 1) | 0x200 | ((state->m_npvidram.target()[i*2+1] & 0xff00) >> 7);
8991         else
90            color = ((state->m_npvidram[i*2+1] & 0xff00) >> 8) | ((state->m_npvidram[i*2+1] & 0x0010) << 4);
91         UINT8 fx = (state->m_npvidram[i*2+1] & 0x0040);
92         UINT8 fy = (state->m_npvidram[i*2+1] & 0x0080);
92            color = ((state->m_npvidram.target()[i*2+1] & 0xff00) >> 8) | ((state->m_npvidram.target()[i*2+1] & 0x0010) << 4);
93         UINT8 fx = (state->m_npvidram.target()[i*2+1] & 0x0040);
94         UINT8 fy = (state->m_npvidram.target()[i*2+1] & 0x0080);
9395
9496         drawgfx_transpen(bitmap,cliprect,gfx,dat,color,fx,fy,x*16+scrollx,y*16-scrolly,0);
9597         drawgfx_transpen(bitmap,cliprect,gfx,dat,color,fx,fy,x*16+scrollx-512,y*16-scrolly,0);
r14896r14897
173175   /* accessing the LSB only is not mapped */
174176   if (mem_mask != 0x00ff)
175177   {
176      soundlatch_w(space, 0, data >> 8);
178      soundlatch_byte_w(space, 0, data >> 8);
177179
178180      audio_cpu_assert_nmi(machine());
179181
r14896r14897
187189
188190READ8_MEMBER(neoprint_state::audio_command_r)
189191{
190   UINT8 ret = soundlatch_r(space, 0);
192   UINT8 ret = soundlatch_byte_r(space, 0);
191193
192194   //if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", cpu_get_pc(&space.device()), ret);
193195
r14896r14897
213215/*  AM_RANGE(0x100000, 0x17ffff) multi-cart or banking, some writes points here if anything lies there too */
214216   AM_RANGE(0x200000, 0x20ffff) AM_RAM
215217   AM_RANGE(0x300000, 0x30ffff) AM_RAM AM_SHARE("nvram")
216   AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE(m_npvidram)
217   AM_RANGE(0x500000, 0x51ffff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
218   AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_SHARE("npvidram")
219   AM_RANGE(0x500000, 0x51ffff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
218220   AM_RANGE(0x600000, 0x600001) AM_READWRITE(neoprint_audio_result_r,audio_command_w)
219221   AM_RANGE(0x600002, 0x600003) AM_READWRITE(neoprint_calendar_r,neoprint_calendar_w)
220222   AM_RANGE(0x600004, 0x600005) AM_READ_PORT("SYSTEM") AM_WRITENOP
r14896r14897
224226   AM_RANGE(0x60000c, 0x60000d) AM_READ_PORT("DSW2")
225227   AM_RANGE(0x60000e, 0x60000f) AM_WRITENOP
226228
227   AM_RANGE(0x700000, 0x70001b) AM_RAM AM_BASE(m_npvidregs)
229   AM_RANGE(0x700000, 0x70001b) AM_RAM AM_SHARE("npvidregs")
228230
229231   AM_RANGE(0x70001e, 0x70001f) AM_WRITENOP //watchdog
230232ADDRESS_MAP_END
r14896r14897
288290   AM_RANGE(0x20000c, 0x20000d) AM_READ_PORT("DSW2")
289291   AM_RANGE(0x20000e, 0x20000f) AM_WRITENOP
290292
291   AM_RANGE(0x240000, 0x24001b) AM_RAM AM_BASE(m_npvidregs)
293   AM_RANGE(0x240000, 0x24001b) AM_RAM AM_SHARE("npvidregs")
292294   AM_RANGE(0x24001e, 0x24001f) AM_WRITENOP //watchdog
293295
294296   AM_RANGE(0x300000, 0x33ffff) AM_RAM AM_SHARE("nvram")
295297   AM_RANGE(0x380000, 0x38ffff) AM_RAM
296   AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE(m_npvidram)
298   AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_SHARE("npvidram")
297299   AM_RANGE(0x500000, 0x57ffff) AM_RAM_WRITE(nprsp_palette_w) AM_SHARE("paletteram")
298300ADDRESS_MAP_END
299301
src/mame/drivers/seattle.c
r14896r14897
426426public:
427427   seattle_state(const machine_config &mconfig, device_type type, const char *tag)
428428      : driver_device(mconfig, type, tag),
429        m_nvram(*this, "nvram") { }
429        m_nvram(*this, "nvram") ,
430      m_rambase(*this, "rambase"),
431      m_interrupt_enable(*this, "interrupt_enable"),
432      m_interrupt_config(*this, "interrupt_config"),
433      m_asic_reset(*this, "asic_reset"),
434      m_rombase(*this, "rombase"){ }
430435
431436   required_shared_ptr<UINT32>   m_nvram;
432   UINT32 *m_rambase;
433   UINT32 *m_rombase;
437   required_shared_ptr<UINT32> m_rambase;
438   required_shared_ptr<UINT32> m_interrupt_enable;
439   required_shared_ptr<UINT32> m_interrupt_config;
440   required_shared_ptr<UINT32> m_asic_reset;
441   required_shared_ptr<UINT32> m_rombase;
434442   galileo_data m_galileo;
435443   widget_data m_widget;
436444   device_t *m_voodoo;
r14896r14897
445453   UINT8 m_vblank_irq_num;
446454   UINT8 m_vblank_latch;
447455   UINT8 m_vblank_state;
448   UINT32 *m_interrupt_config;
449   UINT32 *m_interrupt_enable;
450   UINT32 *m_asic_reset;
451456   UINT8 m_pending_analog_read;
452457   UINT8 m_status_leds;
453458   UINT32 m_cmos_write_enabled;
459   DECLARE_READ32_MEMBER(interrupt_state_r);
460   DECLARE_READ32_MEMBER(interrupt_state2_r);
461   DECLARE_WRITE32_MEMBER(interrupt_config_w);
462   DECLARE_WRITE32_MEMBER(seattle_interrupt_enable_w);
463   DECLARE_WRITE32_MEMBER(vblank_clear_w);
464   DECLARE_READ32_MEMBER(galileo_r);
465   DECLARE_WRITE32_MEMBER(galileo_w);
466   DECLARE_WRITE32_MEMBER(seattle_voodoo_w);
467   DECLARE_READ32_MEMBER(analog_port_r);
468   DECLARE_WRITE32_MEMBER(analog_port_w);
469   DECLARE_READ32_MEMBER(carnevil_gun_r);
470   DECLARE_WRITE32_MEMBER(carnevil_gun_w);
471   DECLARE_WRITE32_MEMBER(cmos_w);
472   DECLARE_READ32_MEMBER(cmos_r);
473   DECLARE_WRITE32_MEMBER(cmos_protect_w);
474   DECLARE_READ32_MEMBER(cmos_protect_r);
475   DECLARE_WRITE32_MEMBER(seattle_watchdog_w);
476   DECLARE_WRITE32_MEMBER(asic_reset_w);
477   DECLARE_WRITE32_MEMBER(asic_fifo_w);
478   DECLARE_READ32_MEMBER(status_leds_r);
479   DECLARE_WRITE32_MEMBER(status_leds_w);
454480};
455481
456482
r14896r14897
508534   mips3drc_set_options(machine.device("maincpu"), MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY);
509535
510536   /* configure fast RAM regions for DRC */
511   mips3drc_add_fastram(machine.device("maincpu"), 0x00000000, 0x007fffff, FALSE, state->m_rambase);
512   mips3drc_add_fastram(machine.device("maincpu"), 0x1fc00000, 0x1fc7ffff, TRUE,  state->m_rombase);
537   mips3drc_add_fastram(machine.device("maincpu"), 0x00000000, 0x007fffff, FALSE, state->m_rambase.target());
538   mips3drc_add_fastram(machine.device("maincpu"), 0x1fc00000, 0x1fc7ffff, TRUE,  state->m_rombase.target());
513539
514540   /* register for save states */
515541   state_save_register_global_array(machine, state->m_galileo.reg);
r14896r14897
631657 *
632658 *************************************/
633659
634static READ32_HANDLER( interrupt_state_r )
660READ32_MEMBER(seattle_state::interrupt_state_r)
635661{
636   seattle_state *state = space->machine().driver_data<seattle_state>();
637662   UINT32 result = 0;
638   result |= state->m_ethernet_irq_state << ETHERNET_IRQ_SHIFT;
639   result |= state->m_vblank_latch << VBLANK_IRQ_SHIFT;
663   result |= m_ethernet_irq_state << ETHERNET_IRQ_SHIFT;
664   result |= m_vblank_latch << VBLANK_IRQ_SHIFT;
640665   return result;
641666}
642667
643668
644static READ32_HANDLER( interrupt_state2_r )
669READ32_MEMBER(seattle_state::interrupt_state2_r)
645670{
646   seattle_state *state = space->machine().driver_data<seattle_state>();
647671   UINT32 result = interrupt_state_r(space, offset, mem_mask);
648   result |= state->m_vblank_state << 8;
672   result |= m_vblank_state << 8;
649673   return result;
650674}
651675
652676
653static WRITE32_HANDLER( interrupt_config_w )
677WRITE32_MEMBER(seattle_state::interrupt_config_w)
654678{
655   seattle_state *state = space->machine().driver_data<seattle_state>();
656679   int irq;
657   COMBINE_DATA(state->m_interrupt_config);
680   COMBINE_DATA(m_interrupt_config.target());
658681
659682   /* VBLANK: clear anything pending on the old IRQ */
660   if (state->m_vblank_irq_num != 0)
661      cputag_set_input_line(space->machine(), "maincpu", state->m_vblank_irq_num, CLEAR_LINE);
683   if (m_vblank_irq_num != 0)
684      cputag_set_input_line(machine(), "maincpu", m_vblank_irq_num, CLEAR_LINE);
662685
663686   /* VBLANK: compute the new IRQ vector */
664   irq = (*state->m_interrupt_config >> (2*VBLANK_IRQ_SHIFT)) & 3;
665   state->m_vblank_irq_num = (irq != 0) ? (2 + irq) : 0;
687   irq = (*m_interrupt_config >> (2*VBLANK_IRQ_SHIFT)) & 3;
688   m_vblank_irq_num = (irq != 0) ? (2 + irq) : 0;
666689
667690   /* Widget board case */
668   if (state->m_board_config == SEATTLE_WIDGET_CONFIG)
691   if (m_board_config == SEATTLE_WIDGET_CONFIG)
669692   {
670693      /* Widget: clear anything pending on the old IRQ */
671      if (state->m_widget.irq_num != 0)
672         cputag_set_input_line(space->machine(), "maincpu", state->m_widget.irq_num, CLEAR_LINE);
694      if (m_widget.irq_num != 0)
695         cputag_set_input_line(machine(), "maincpu", m_widget.irq_num, CLEAR_LINE);
673696
674697      /* Widget: compute the new IRQ vector */
675      irq = (*state->m_interrupt_config >> (2*WIDGET_IRQ_SHIFT)) & 3;
676      state->m_widget.irq_num = (irq != 0) ? (2 + irq) : 0;
698      irq = (*m_interrupt_config >> (2*WIDGET_IRQ_SHIFT)) & 3;
699      m_widget.irq_num = (irq != 0) ? (2 + irq) : 0;
677700   }
678701
679702   /* Flagstaff board case */
680   if (state->m_board_config == FLAGSTAFF_CONFIG)
703   if (m_board_config == FLAGSTAFF_CONFIG)
681704   {
682705      /* Ethernet: clear anything pending on the old IRQ */
683      if (state->m_ethernet_irq_num != 0)
684         cputag_set_input_line(space->machine(), "maincpu", state->m_ethernet_irq_num, CLEAR_LINE);
706      if (m_ethernet_irq_num != 0)
707         cputag_set_input_line(machine(), "maincpu", m_ethernet_irq_num, CLEAR_LINE);
685708
686709      /* Ethernet: compute the new IRQ vector */
687      irq = (*state->m_interrupt_config >> (2*ETHERNET_IRQ_SHIFT)) & 3;
688      state->m_ethernet_irq_num = (irq != 0) ? (2 + irq) : 0;
710      irq = (*m_interrupt_config >> (2*ETHERNET_IRQ_SHIFT)) & 3;
711      m_ethernet_irq_num = (irq != 0) ? (2 + irq) : 0;
689712   }
690713
691714   /* update the states */
692   update_vblank_irq(space->machine());
693   ethernet_interrupt_machine(space->machine(), state->m_ethernet_irq_state);
715   update_vblank_irq(machine());
716   ethernet_interrupt_machine(machine(), m_ethernet_irq_state);
694717}
695718
696719
697static WRITE32_HANDLER( seattle_interrupt_enable_w )
720WRITE32_MEMBER(seattle_state::seattle_interrupt_enable_w)
698721{
699   seattle_state *state = space->machine().driver_data<seattle_state>();
700   UINT32 old = *state->m_interrupt_enable;
701   COMBINE_DATA(state->m_interrupt_enable);
702   if (old != *state->m_interrupt_enable)
722   UINT32 old = *m_interrupt_enable.target();
723   COMBINE_DATA(m_interrupt_enable.target());
724   if (old != *m_interrupt_enable.target())
703725   {
704      if (state->m_vblank_latch)
705         update_vblank_irq(space->machine());
706      if (state->m_ethernet_irq_state)
707         ethernet_interrupt_machine(space->machine(), state->m_ethernet_irq_state);
726      if (m_vblank_latch)
727         update_vblank_irq(machine());
728      if (m_ethernet_irq_state)
729         ethernet_interrupt_machine(machine(), m_ethernet_irq_state);
708730   }
709731}
710732
r14896r14897
732754}
733755
734756
735static WRITE32_HANDLER( vblank_clear_w )
757WRITE32_MEMBER(seattle_state::vblank_clear_w)
736758{
737   seattle_state *state = space->machine().driver_data<seattle_state>();
738759   /* clear the latch and update the IRQ */
739   state->m_vblank_latch = 0;
740   update_vblank_irq(space->machine());
760   m_vblank_latch = 0;
761   update_vblank_irq(machine());
741762}
742763
743764
r14896r14897
10881109}
10891110
10901111
1091static READ32_HANDLER( galileo_r )
1112READ32_MEMBER(seattle_state::galileo_r)
10921113{
1093   seattle_state *state = space->machine().driver_data<seattle_state>();
1094   galileo_data &galileo = state->m_galileo;
1114   galileo_data &galileo = m_galileo;
10951115   UINT32 result = galileo.reg[offset];
10961116
10971117   /* switch off the offset for special cases */
r14896r14897
11131133         }
11141134
11151135         /* eat some time for those which poll this register */
1116         device_eat_cycles(&space->device(), 100);
1136         device_eat_cycles(&space.device(), 100);
11171137
11181138         if (LOG_TIMERS)
1119            logerror("%08X:hires_timer_r = %08X\n", cpu_get_pc(&space->device()), result);
1139            logerror("%08X:hires_timer_r = %08X\n", cpu_get_pc(&space.device()), result);
11201140         break;
11211141      }
11221142
r14896r14897
11351155
11361156         /* unit 0 is the PCI bridge */
11371157         if (unit == 0 && func == 0)
1138            result = pci_bridge_r(space, reg, type);
1158            result = pci_bridge_r(&space, reg, type);
11391159
11401160         /* unit 8 is the 3dfx card */
11411161         else if (unit == 8 && func == 0)
1142            result = pci_3dfx_r(space, reg, type);
1162            result = pci_3dfx_r(&space, reg, type);
11431163
11441164         /* unit 9 is the IDE controller */
11451165         else if (unit == 9 && func == 0)
1146            result = pci_ide_r(space, reg, type);
1166            result = pci_ide_r(&space, reg, type);
11471167
11481168         /* anything else, just log */
11491169         else
11501170         {
11511171            result = ~0;
1152            logerror("%08X:PCIBus read: bus %d unit %d func %d reg %d type %d = %08X\n", cpu_get_pc(&space->device()), bus, unit, func, reg, type, result);
1172            logerror("%08X:PCIBus read: bus %d unit %d func %d reg %d type %d = %08X\n", cpu_get_pc(&space.device()), bus, unit, func, reg, type, result);
11531173         }
11541174         break;
11551175      }
r14896r14897
11591179      case GREG_INT_MASK:
11601180      case GREG_TIMER_CONTROL:
11611181//          if (LOG_GALILEO)
1162//              logerror("%08X:Galileo read from offset %03X = %08X\n", cpu_get_pc(&space->device()), offset*4, result);
1182//              logerror("%08X:Galileo read from offset %03X = %08X\n", cpu_get_pc(&space.device()), offset*4, result);
11631183         break;
11641184
11651185      default:
1166         logerror("%08X:Galileo read from offset %03X = %08X\n", cpu_get_pc(&space->device()), offset*4, result);
1186         logerror("%08X:Galileo read from offset %03X = %08X\n", cpu_get_pc(&space.device()), offset*4, result);
11671187         break;
11681188   }
11691189
r14896r14897
11711191}
11721192
11731193
1174static WRITE32_HANDLER( galileo_w )
1194WRITE32_MEMBER(seattle_state::galileo_w)
11751195{
1176   seattle_state *state = space->machine().driver_data<seattle_state>();
1177   galileo_data &galileo = state->m_galileo;
1196   galileo_data &galileo = m_galileo;
11781197   UINT32 oldata = galileo.reg[offset];
11791198   COMBINE_DATA(&galileo.reg[offset]);
11801199
r14896r14897
11891208         int which = offset % 4;
11901209
11911210         if (LOG_DMA)
1192            logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
1211            logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space.device()), offset*4, data, mem_mask);
11931212
11941213         /* keep the read only activity bit */
11951214         galileo.reg[offset] &= ~0x4000;
r14896r14897
11971216
11981217         /* fetch next record */
11991218         if (data & 0x2000)
1200            galileo_dma_fetch_next(space, which);
1219            galileo_dma_fetch_next(&space, which);
12011220         galileo.reg[offset] &= ~0x2000;
12021221
12031222         /* if enabling, start the DMA */
12041223         if (!(oldata & 0x1000) && (data & 0x1000))
1205            galileo_perform_dma(space, which);
1224            galileo_perform_dma(&space, which);
12061225         break;
12071226      }
12081227
r14896r14897
12191238         if (!timer->active)
12201239            timer->count = data;
12211240         if (LOG_TIMERS)
1222            logerror("%08X:timer/counter %d count = %08X [start=%08X]\n", cpu_get_pc(&space->device()), offset % 4, data, timer->count);
1241            logerror("%08X:timer/counter %d count = %08X [start=%08X]\n", cpu_get_pc(&space.device()), offset % 4, data, timer->count);
12231242         break;
12241243      }
12251244
r14896r14897
12281247         int which, mask;
12291248
12301249         if (LOG_TIMERS)
1231            logerror("%08X:timer/counter control = %08X\n", cpu_get_pc(&space->device()), data);
1250            logerror("%08X:timer/counter control = %08X\n", cpu_get_pc(&space.device()), data);
12321251         for (which = 0, mask = 0x01; which < 4; which++, mask <<= 2)
12331252         {
12341253            galileo_timer *timer = &galileo.timer[which];
r14896r14897
12621281         if (LOG_GALILEO)
12631282            logerror("%08X:Galileo write to IRQ clear = %08X & %08X\n", offset*4, data, mem_mask);
12641283         galileo.reg[offset] = oldata & data;
1265         update_galileo_irqs(space->machine());
1284         update_galileo_irqs(machine());
12661285         break;
12671286
12681287      case GREG_CONFIG_DATA:
r14896r14897
12751294
12761295         /* unit 0 is the PCI bridge */
12771296         if (unit == 0 && func == 0)
1278            pci_bridge_w(space, reg, type, data);
1297            pci_bridge_w(&space, reg, type, data);
12791298
12801299         /* unit 8 is the 3dfx card */
12811300         else if (unit == 8 && func == 0)
1282            pci_3dfx_w(space, reg, type, data);
1301            pci_3dfx_w(&space, reg, type, data);
12831302
12841303         /* unit 9 is the IDE controller */
12851304         else if (unit == 9 && func == 0)
1286            pci_ide_w(space, reg, type, data);
1305            pci_ide_w(&space, reg, type, data);
12871306
12881307         /* anything else, just log */
12891308         else
1290            logerror("%08X:PCIBus write: bus %d unit %d func %d reg %d type %d = %08X\n", cpu_get_pc(&space->device()), bus, unit, func, reg, type, data);
1309            logerror("%08X:PCIBus write: bus %d unit %d func %d reg %d type %d = %08X\n", cpu_get_pc(&space.device()), bus, unit, func, reg, type, data);
12911310         break;
12921311      }
12931312
r14896r14897
12981317      case GREG_CONFIG_ADDRESS:
12991318      case GREG_INT_MASK:
13001319         if (LOG_GALILEO)
1301            logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
1320            logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space.device()), offset*4, data, mem_mask);
13021321         break;
13031322
13041323      default:
1305         logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
1324         logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space.device()), offset*4, data, mem_mask);
13061325         break;
13071326   }
13081327}
r14896r14897
13151334 *
13161335 *************************************/
13171336
1318static WRITE32_HANDLER( seattle_voodoo_w )
1337WRITE32_MEMBER(seattle_state::seattle_voodoo_w)
13191338{
1320   seattle_state *state = space->machine().driver_data<seattle_state>();
13211339   /* if we're not stalled, just write and get out */
1322   if (!state->m_voodoo_stalled)
1340   if (!m_voodoo_stalled)
13231341   {
1324      voodoo_w(state->m_voodoo, offset, data, mem_mask);
1342      voodoo_w(m_voodoo, offset, data, mem_mask);
13251343      return;
13261344   }
13271345
13281346   /* shouldn't get here if the CPU is already stalled */
1329   if (state->m_cpu_stalled_on_voodoo)
1347   if (m_cpu_stalled_on_voodoo)
13301348      fatalerror("seattle_voodoo_w while CPU is stalled");
13311349
13321350   /* remember all the info about this access for later */
1333   state->m_cpu_stalled_on_voodoo = TRUE;
1334   state->m_cpu_stalled_offset = offset;
1335   state->m_cpu_stalled_data = data;
1336   state->m_cpu_stalled_mem_mask = mem_mask;
1351   m_cpu_stalled_on_voodoo = TRUE;
1352   m_cpu_stalled_offset = offset;
1353   m_cpu_stalled_data = data;
1354   m_cpu_stalled_mem_mask = mem_mask;
13371355
13381356   /* spin until we send the magic trigger */
1339   device_spin_until_trigger(&space->device(), 45678);
1340   if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo (already stalled)\n", cpu_get_pc(&space->device()));
1357   device_spin_until_trigger(&space.device(), 45678);
1358   if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo (already stalled)\n", cpu_get_pc(&space.device()));
13411359}
13421360
13431361
r14896r14897
14051423 *
14061424 *************************************/
14071425
1408static READ32_HANDLER( analog_port_r )
1426READ32_MEMBER(seattle_state::analog_port_r)
14091427{
1410   seattle_state *state = space->machine().driver_data<seattle_state>();
1411   return state->m_pending_analog_read;
1428   return m_pending_analog_read;
14121429}
14131430
14141431
1415static WRITE32_HANDLER( analog_port_w )
1432WRITE32_MEMBER(seattle_state::analog_port_w)
14161433{
1417   seattle_state *state = space->machine().driver_data<seattle_state>();
14181434   static const char *const portnames[] = { "AN0", "AN1", "AN2", "AN3", "AN4", "AN5", "AN6", "AN7" };
14191435
14201436   if (data < 8 || data > 15)
1421      logerror("%08X:Unexpected analog port select = %08X\n", cpu_get_pc(&space->device()), data);
1422   state->m_pending_analog_read = input_port_read(space->machine(), portnames[data & 7]);
1437      logerror("%08X:Unexpected analog port select = %08X\n", cpu_get_pc(&space.device()), data);
1438   m_pending_analog_read = input_port_read(machine(), portnames[data & 7]);
14231439}
14241440
14251441
r14896r14897
14301446 *
14311447 *************************************/
14321448
1433static READ32_HANDLER( carnevil_gun_r )
1449READ32_MEMBER(seattle_state::carnevil_gun_r)
14341450{
14351451   UINT32 result = 0;
14361452
14371453   switch (offset)
14381454   {
14391455      case 0:      /* low 8 bits of X */
1440         result = (input_port_read(space->machine(), "LIGHT0_X") << 4) & 0xff;
1456         result = (input_port_read(machine(), "LIGHT0_X") << 4) & 0xff;
14411457         break;
14421458
14431459      case 1:      /* upper 4 bits of X */
1444         result = (input_port_read(space->machine(), "LIGHT0_X") >> 4) & 0x0f;
1445         result |= (input_port_read(space->machine(), "FAKE") & 0x03) << 4;
1460         result = (input_port_read(machine(), "LIGHT0_X") >> 4) & 0x0f;
1461         result |= (input_port_read(machine(), "FAKE") & 0x03) << 4;
14461462         result |= 0x40;
14471463         break;
14481464
14491465      case 2:      /* low 8 bits of Y */
1450         result = (input_port_read(space->machine(), "LIGHT0_Y") << 2) & 0xff;
1466         result = (input_port_read(machine(), "LIGHT0_Y") << 2) & 0xff;
14511467         break;
14521468
14531469      case 3:      /* upper 4 bits of Y */
1454         result = (input_port_read(space->machine(), "LIGHT0_Y") >> 6) & 0x03;
1470         result = (input_port_read(machine(), "LIGHT0_Y") >> 6) & 0x03;
14551471         break;
14561472
14571473      case 4:      /* low 8 bits of X */
1458         result = (input_port_read(space->machine(), "LIGHT1_X") << 4) & 0xff;
1474         result = (input_port_read(machine(), "LIGHT1_X") << 4) & 0xff;
14591475         break;
14601476
14611477      case 5:      /* upper 4 bits of X */
1462         result = (input_port_read(space->machine(), "LIGHT1_X") >> 4) & 0x0f;
1463         result |= (input_port_read(space->machine(), "FAKE") & 0x30);
1478         result = (input_port_read(machine(), "LIGHT1_X") >> 4) & 0x0f;
1479         result |= (input_port_read(machine(), "FAKE") & 0x30);
14641480         result |= 0x40;
14651481         break;
14661482
14671483      case 6:      /* low 8 bits of Y */
1468         result = (input_port_read(space->machine(), "LIGHT1_Y") << 2) & 0xff;
1484         result = (input_port_read(machine(), "LIGHT1_Y") << 2) & 0xff;
14691485         break;
14701486
14711487      case 7:      /* upper 4 bits of Y */
1472         result = (input_port_read(space->machine(), "LIGHT1_Y") >> 6) & 0x03;
1488         result = (input_port_read(machine(), "LIGHT1_Y") >> 6) & 0x03;
14731489         break;
14741490   }
14751491   return result;
14761492}
14771493
14781494
1479static WRITE32_HANDLER( carnevil_gun_w )
1495WRITE32_MEMBER(seattle_state::carnevil_gun_w)
14801496{
14811497   logerror("carnevil_gun_w(%d) = %02X\n", offset, data);
14821498}
r14896r14897
15531569         break;
15541570
15551571      case WREG_ANALOG:
1556         result = analog_port_r(device->machine().device("maincpu")->memory().space(AS_PROGRAM), 0, mem_mask);
1572         result = state->analog_port_r(*device->machine().device("maincpu")->memory().space(AS_PROGRAM), 0, mem_mask);
15571573         break;
15581574
15591575      case WREG_ETHER_DATA:
r14896r14897
15851601         break;
15861602
15871603      case WREG_ANALOG:
1588         analog_port_w(device->machine().device("maincpu")->memory().space(AS_PROGRAM), 0, data, mem_mask);
1604         state->analog_port_w(*device->machine().device("maincpu")->memory().space(AS_PROGRAM), 0, data, mem_mask);
15891605         break;
15901606
15911607      case WREG_ETHER_DATA:
r14896r14897
16021618 *
16031619 *************************************/
16041620
1605static WRITE32_HANDLER( cmos_w )
1621WRITE32_MEMBER(seattle_state::cmos_w)
16061622{
1607   seattle_state *state = space->machine().driver_data<seattle_state>();
1608   if (state->m_cmos_write_enabled)
1609      COMBINE_DATA(state->m_nvram + offset);
1610   state->m_cmos_write_enabled = FALSE;
1623   if (m_cmos_write_enabled)
1624      COMBINE_DATA(m_nvram + offset);
1625   m_cmos_write_enabled = FALSE;
16111626}
16121627
16131628
1614static READ32_HANDLER( cmos_r )
1629READ32_MEMBER(seattle_state::cmos_r)
16151630{
1616   seattle_state *state = space->machine().driver_data<seattle_state>();
1617   return state->m_nvram[offset];
1631   return m_nvram.target()[offset];
16181632}
16191633
16201634
1621static WRITE32_HANDLER( cmos_protect_w )
1635WRITE32_MEMBER(seattle_state::cmos_protect_w)
16221636{
1623   seattle_state *state = space->machine().driver_data<seattle_state>();
1624   state->m_cmos_write_enabled = TRUE;
1637   m_cmos_write_enabled = TRUE;
16251638}
16261639
16271640
1628static READ32_HANDLER( cmos_protect_r )
1641READ32_MEMBER(seattle_state::cmos_protect_r)
16291642{
1630   seattle_state *state = space->machine().driver_data<seattle_state>();
1631   return state->m_cmos_write_enabled;
1643   return m_cmos_write_enabled;
16321644}
16331645
16341646
r14896r14897
16391651 *
16401652 *************************************/
16411653
1642static WRITE32_HANDLER( seattle_watchdog_w )
1654WRITE32_MEMBER(seattle_state::seattle_watchdog_w)
16431655{
1644   device_eat_cycles(&space->device(), 100);
1656   device_eat_cycles(&space.device(), 100);
16451657}
16461658
16471659
1648static WRITE32_HANDLER( asic_reset_w )
1660WRITE32_MEMBER(seattle_state::asic_reset_w)
16491661{
1650   seattle_state *state = space->machine().driver_data<seattle_state>();
1651   COMBINE_DATA(state->m_asic_reset);
1652   if (!(*state->m_asic_reset & 0x0002))
1653      midway_ioasic_reset(space->machine());
1662   COMBINE_DATA(m_asic_reset.target());
1663   if (!(*m_asic_reset & 0x0002))
1664      midway_ioasic_reset(machine());
16541665}
16551666
16561667
1657static WRITE32_HANDLER( asic_fifo_w )
1668WRITE32_MEMBER(seattle_state::asic_fifo_w)
16581669{
1659   midway_ioasic_fifo_w(space->machine(), data);
1670   midway_ioasic_fifo_w(machine(), data);
16601671}
16611672
16621673
1663static READ32_HANDLER( status_leds_r )
1674READ32_MEMBER(seattle_state::status_leds_r)
16641675{
1665   seattle_state *state = space->machine().driver_data<seattle_state>();
1666   return state->m_status_leds | 0xffffff00;
1676   return m_status_leds | 0xffffff00;
16671677}
16681678
16691679
1670static WRITE32_HANDLER( status_leds_w )
1680WRITE32_MEMBER(seattle_state::status_leds_w)
16711681{
1672   seattle_state *state = space->machine().driver_data<seattle_state>();
16731682   if (ACCESSING_BITS_0_7)
1674      state->m_status_leds = data;
1683      m_status_leds = data;
16751684}
16761685
16771686
r14896r14897
17631772
17641773static ADDRESS_MAP_START( seattle_map, AS_PROGRAM, 32, seattle_state )
17651774   ADDRESS_MAP_UNMAP_HIGH
1766   AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_BASE(m_rambase)   // wg3dh only has 4MB; sfrush, blitz99 8MB
1767   AM_RANGE(0x08000000, 0x08ffffff) AM_DEVREAD_LEGACY("voodoo", voodoo_r) AM_WRITE_LEGACY(seattle_voodoo_w)
1775   AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("rambase")   // wg3dh only has 4MB; sfrush, blitz99 8MB
1776   AM_RANGE(0x08000000, 0x08ffffff) AM_DEVREAD_LEGACY("voodoo", voodoo_r) AM_WRITE(seattle_voodoo_w)
17681777   AM_RANGE(0x0a000000, 0x0a0003ff) AM_DEVREADWRITE_LEGACY("ide", seattle_ide_r, ide_controller32_w)
17691778   AM_RANGE(0x0a00040c, 0x0a00040f) AM_NOP                  // IDE-related, but annoying
17701779   AM_RANGE(0x0a000f00, 0x0a000f07) AM_DEVREADWRITE_LEGACY("ide", ide_bus_master32_r, ide_bus_master32_w)
1771   AM_RANGE(0x0c000000, 0x0c000fff) AM_READWRITE_LEGACY(galileo_r, galileo_w)
1772   AM_RANGE(0x13000000, 0x13000003) AM_WRITE_LEGACY(asic_fifo_w)
1780   AM_RANGE(0x0c000000, 0x0c000fff) AM_READWRITE(galileo_r, galileo_w)
1781   AM_RANGE(0x13000000, 0x13000003) AM_WRITE(asic_fifo_w)
17731782   AM_RANGE(0x16000000, 0x1600003f) AM_READWRITE_LEGACY(midway_ioasic_r, midway_ioasic_w)
1774   AM_RANGE(0x16100000, 0x1611ffff) AM_READWRITE_LEGACY(cmos_r, cmos_w) AM_SHARE("nvram")
1775   AM_RANGE(0x17000000, 0x17000003) AM_READWRITE_LEGACY(cmos_protect_r, cmos_protect_w)
1776   AM_RANGE(0x17100000, 0x17100003) AM_WRITE_LEGACY(seattle_watchdog_w)
1777   AM_RANGE(0x17300000, 0x17300003) AM_RAM_WRITE_LEGACY(seattle_interrupt_enable_w) AM_BASE(m_interrupt_enable)
1778   AM_RANGE(0x17400000, 0x17400003) AM_RAM_WRITE_LEGACY(interrupt_config_w) AM_BASE(m_interrupt_config)
1779   AM_RANGE(0x17500000, 0x17500003) AM_READ_LEGACY(interrupt_state_r)
1780   AM_RANGE(0x17600000, 0x17600003) AM_READ_LEGACY(interrupt_state2_r)
1781   AM_RANGE(0x17700000, 0x17700003) AM_WRITE_LEGACY(vblank_clear_w)
1783   AM_RANGE(0x16100000, 0x1611ffff) AM_READWRITE(cmos_r, cmos_w) AM_SHARE("nvram")
1784   AM_RANGE(0x17000000, 0x17000003) AM_READWRITE(cmos_protect_r, cmos_protect_w)
1785   AM_RANGE(0x17100000, 0x17100003) AM_WRITE(seattle_watchdog_w)
1786   AM_RANGE(0x17300000, 0x17300003) AM_RAM_WRITE(seattle_interrupt_enable_w) AM_SHARE("interrupt_enable")
1787   AM_RANGE(0x17400000, 0x17400003) AM_RAM_WRITE(interrupt_config_w) AM_SHARE("interrupt_config")
1788   AM_RANGE(0x17500000, 0x17500003) AM_READ(interrupt_state_r)
1789   AM_RANGE(0x17600000, 0x17600003) AM_READ(interrupt_state2_r)
1790   AM_RANGE(0x17700000, 0x17700003) AM_WRITE(vblank_clear_w)
17821791   AM_RANGE(0x17800000, 0x17800003) AM_NOP
1783   AM_RANGE(0x17900000, 0x17900003) AM_READWRITE_LEGACY(status_leds_r, status_leds_w)
1784   AM_RANGE(0x17f00000, 0x17f00003) AM_RAM_WRITE_LEGACY(asic_reset_w) AM_BASE(m_asic_reset)
1785   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_BASE(m_rombase)
1792   AM_RANGE(0x17900000, 0x17900003) AM_READWRITE(status_leds_r, status_leds_w)
1793   AM_RANGE(0x17f00000, 0x17f00003) AM_RAM_WRITE(asic_reset_w) AM_SHARE("asic_reset")
1794   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("rombase")
17861795ADDRESS_MAP_END
17871796
17881797
r14896r14897
28312840
28322841      case FLAGSTAFF_CONFIG:
28332842         /* set up the analog inputs */
2834         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x14000000, 0x14000003, FUNC(analog_port_r), FUNC(analog_port_w));
2843         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x14000000, 0x14000003, read32_delegate(FUNC(seattle_state::analog_port_r),state), write32_delegate(FUNC(seattle_state::analog_port_w),state));
28352844
28362845         /* set up the ethernet controller */
28372846         device = machine.device("ethernet");
r14896r14897
29282937   init_common(machine, MIDWAY_IOASIC_BLITZ99, 444/* or 528 */, 80, SEATTLE_CONFIG);
29292938
29302939   /* for some reason, the code in the ROM appears buggy; this is a small patch to fix it */
2931   state->m_rombase[0x934/4] += 4;
2940   state->m_rombase.target()[0x934/4] += 4;
29322941
29332942   /* main CPU speedups */
29342943   mips3drc_add_hotspot(machine.device("maincpu"), 0x80135510, 0x3C028024, 250);      /* confirmed */
r14896r14897
29642973   init_common(machine, MIDWAY_IOASIC_CARNEVIL, 469/* 469 or 486 or 528 */, 80, SEATTLE_CONFIG);
29652974
29662975   /* set up the gun */
2967   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x16800000, 0x1680001f, FUNC(carnevil_gun_r), FUNC(carnevil_gun_w));
2976   seattle_state *state = machine.driver_data<seattle_state>();
2977   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16800000, 0x1680001f, read32_delegate(FUNC(seattle_state::carnevil_gun_r),state), write32_delegate(FUNC(seattle_state::carnevil_gun_w),state));
29682978
29692979   /* speedups */
29702980   mips3drc_add_hotspot(machine.device("maincpu"), 0x8015176C, 0x3C03801A, 250);      /* confirmed */
src/mame/drivers/alpha68k.c
r14896r14897
296296WRITE16_MEMBER(alpha68k_state::kyros_sound_w)
297297{
298298   if(ACCESSING_BITS_8_15)
299      soundlatch_w(space, 0, (data >> 8) & 0xff);
299      soundlatch_byte_w(space, 0, (data >> 8) & 0xff);
300300}
301301
302302WRITE16_MEMBER(alpha68k_state::alpha68k_II_sound_w)
303303{
304304   if(ACCESSING_BITS_0_7)
305      soundlatch_w(space, 0, data & 0xff);
305      soundlatch_byte_w(space, 0, data & 0xff);
306306}
307307
308308WRITE16_MEMBER(alpha68k_state::alpha68k_V_sound_w)
309309{
310310   /* Sound & fix bank select are in the same word */
311311   if(ACCESSING_BITS_0_7)
312      soundlatch_w(space, 0, data & 0xff);
312      soundlatch_byte_w(space, 0, data & 0xff);
313313   if(ACCESSING_BITS_8_15)
314314      alpha68k_V_video_bank_w(machine(), (data >> 8) & 0xff);
315315}
r14896r14897
319319
320320   if (ACCESSING_BITS_0_7)
321321   {
322      soundlatch_w(space, 0, data);
322      soundlatch_byte_w(space, 0, data);
323323      device_set_input_line(m_audiocpu, 0, HOLD_LINE);
324324   }
325325}
r14896r14897
329329
330330   if (ACCESSING_BITS_0_7)
331331   {
332      soundlatch_w(space, 0, data);
332      soundlatch_byte_w(space, 0, data);
333333      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
334334   }
335335}
r14896r14897
750750static ADDRESS_MAP_START( kyros_sound_map, AS_PROGRAM, 8, alpha68k_state )
751751   AM_RANGE(0x0000, 0xbfff) AM_ROM
752752   AM_RANGE(0xc000, 0xc7ff) AM_RAM
753   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
754   AM_RANGE(0xe002, 0xe002) AM_WRITE(soundlatch_clear_w)
753   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
754   AM_RANGE(0xe002, 0xe002) AM_WRITE(soundlatch_clear_byte_w)
755755   AM_RANGE(0xe004, 0xe004) AM_DEVWRITE_LEGACY("dac", dac_signed_w)
756756   AM_RANGE(0xe006, 0xe00e) AM_WRITENOP // soundboard I/O's, ignored
757757/* reference only
r14896r14897
766766static ADDRESS_MAP_START( sstingry_sound_map, AS_PROGRAM, 8, alpha68k_state )
767767   AM_RANGE(0x0000, 0x7fff) AM_ROM
768768   AM_RANGE(0x8000, 0x87ff) AM_RAM
769   AM_RANGE(0xc100, 0xc100) AM_READ(soundlatch_r)
770   AM_RANGE(0xc102, 0xc102) AM_WRITE(soundlatch_clear_w)
769   AM_RANGE(0xc100, 0xc100) AM_READ(soundlatch_byte_r)
770   AM_RANGE(0xc102, 0xc102) AM_WRITE(soundlatch_clear_byte_w)
771771   AM_RANGE(0xc104, 0xc104) AM_DEVWRITE_LEGACY("dac", dac_signed_w)
772772   AM_RANGE(0xc106, 0xc10e) AM_WRITENOP // soundboard I/O's, ignored
773773ADDRESS_MAP_END
r14896r14897
779779
780780static ADDRESS_MAP_START( alpha68k_I_s_map, AS_PROGRAM, 8, alpha68k_state )
781781   AM_RANGE(0x0000, 0x9fff) AM_ROM
782   AM_RANGE(0xe000, 0xe000) AM_READWRITE(soundlatch_r, soundlatch_clear_w)
782   AM_RANGE(0xe000, 0xe000) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w)
783783   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_status_port_r, ym3812_control_port_w)
784784   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE_LEGACY("ymsnd", ym3812_write_port_w)
785785   AM_RANGE(0xf000, 0xf7ff) AM_RAM
r14896r14897
790790static ADDRESS_MAP_START( tnextspc_sound_map, AS_PROGRAM, 8, alpha68k_state )
791791   AM_RANGE(0x0000, 0xefff) AM_ROM
792792   AM_RANGE(0xf000, 0xf7ff) AM_RAM
793   AM_RANGE(0xf800, 0xf800) AM_READWRITE(soundlatch_r, soundlatch_clear_w)
793   AM_RANGE(0xf800, 0xf800) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w)
794794ADDRESS_MAP_END
795795
796796static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, alpha68k_state )
797797   ADDRESS_MAP_GLOBAL_MASK(0xff)
798   AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_r, soundlatch_clear_w)
798   AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w)
799799   AM_RANGE(0x08, 0x08) AM_DEVWRITE_LEGACY("dac", dac_signed_w)
800800   AM_RANGE(0x0a, 0x0b) AM_DEVWRITE_LEGACY("ym2", ym2413_w)
801801   AM_RANGE(0x0c, 0x0d) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
r14896r14897
815815   ADDRESS_MAP_GLOBAL_MASK(0xff)
816816   AM_RANGE(0x00, 0x00) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
817817   AM_RANGE(0x01, 0x01) AM_DEVREADWRITE_LEGACY("aysnd", ay8910_r, ay8910_data_w)
818   AM_RANGE(0x02, 0x02) AM_WRITE(soundlatch_clear_w)
818   AM_RANGE(0x02, 0x02) AM_WRITE(soundlatch_clear_byte_w)
819819   AM_RANGE(0x06, 0x06) AM_WRITENOP
820820ADDRESS_MAP_END
821821
r14896r14897
18231823{
18241824   AY8910_LEGACY_OUTPUT,
18251825   AY8910_DEFAULT_LOADS,
1826   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r)
1826   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r)
18271827};
18281828
18291829WRITE8_MEMBER(alpha68k_state::porta_w)
r14896r14897
18471847   {
18481848      AY8910_LEGACY_OUTPUT,
18491849      AY8910_DEFAULT_LOADS,
1850      DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
1850      DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
18511851      DEVCB_NULL,
18521852      DEVCB_DRIVER_MEMBER(alpha68k_state, porta_w),
18531853      DEVCB_NULL
src/mame/drivers/tmaster.c
r14896r14897
123123      : driver_device(mconfig, type, tag),
124124      m_maincpu(*this,"maincpu"),
125125      m_microtouch(*this,"microtouch")
126      { }
126      ,
127      m_regs(*this, "regs"),
128      m_galgames_ram(*this, "galgames_ram"){ }
127129
128   DECLARE_WRITE8_MEMBER(microtouch_tx);
130   required_device<cpu_device> m_maincpu;
131   optional_device<microtouch_device> m_microtouch;
132   required_shared_ptr<UINT16> m_regs;
133   required_shared_ptr<UINT16> m_galgames_ram;
129134
130135   int m_okibank;
131136   UINT8 m_rtc_ram[8];
132137   bitmap_ind16 m_bitmap[2][2];
133   UINT16 *m_regs;
134138   UINT16 m_color;
135139   UINT16 m_addr;
136140   UINT32 m_gfx_offs;
137141   UINT32 m_gfx_size;
138142   int (*m_compute_addr) (UINT16 reg_low, UINT16 reg_mid, UINT16 reg_high);
139   UINT16 *m_galgames_ram;
140143   UINT16 m_galgames_cart;
141144   UINT32 m_palette_offset;
142145   UINT8 m_palette_index;
143146   UINT8 m_palette_data[3];
144147   device_t *m_duart68681;
145148
146   required_device<cpu_device> m_maincpu;
147   optional_device<microtouch_device> m_microtouch;
149   DECLARE_WRITE8_MEMBER(microtouch_tx);
148150   DECLARE_READ16_MEMBER(rtc_r);
149151   DECLARE_WRITE16_MEMBER(rtc_w);
150152   DECLARE_WRITE16_MEMBER(tmaster_color_w);
r14896r14897
358360
359361   bitmap.fill(get_black_pen(screen.machine()), cliprect);
360362
361   if (layers_ctrl & 1)   copybitmap_trans(bitmap, state->m_bitmap[0][(state->m_regs[0x02/2]>>8)&1], 0,0,0,0, cliprect, 0xff);
362   if (layers_ctrl & 2)   copybitmap_trans(bitmap, state->m_bitmap[1][(state->m_regs[0x02/2]>>9)&1], 0,0,0,0, cliprect, 0xff);
363   if (layers_ctrl & 1)   copybitmap_trans(bitmap, state->m_bitmap[0][(state->m_regs.target()[0x02/2]>>8)&1], 0,0,0,0, cliprect, 0xff);
364   if (layers_ctrl & 2)   copybitmap_trans(bitmap, state->m_bitmap[1][(state->m_regs.target()[0x02/2]>>9)&1], 0,0,0,0, cliprect, 0xff);
363365
364366   return 0;
365367}
r14896r14897
383385
384386   UINT16 pen;
385387
386   buffer   =   (state->m_regs[0x02/2] >> 8) & 3;   // 1 bit per layer, selects the currently displayed buffer
387   sw      =    state->m_regs[0x04/2];
388   sx      =    state->m_regs[0x06/2];
389   sh      =    state->m_regs[0x08/2] + 1;
390   sy      =    state->m_regs[0x0a/2];
388   buffer   =   (state->m_regs.target()[0x02/2] >> 8) & 3;   // 1 bit per layer, selects the currently displayed buffer
389   sw      =    state->m_regs.target()[0x04/2];
390   sx      =    state->m_regs.target()[0x06/2];
391   sh      =    state->m_regs.target()[0x08/2] + 1;
392   sy      =    state->m_regs.target()[0x0a/2];
391393   addr   =   (*state->m_compute_addr)(
392             state->m_regs[0x0c/2],
393             state->m_regs[0x0e/2], state->m_addr);
394   mode   =    state->m_regs[0x10/2];
394             state->m_regs.target()[0x0c/2],
395             state->m_regs.target()[0x0e/2], state->m_addr);
396   mode   =    state->m_regs.target()[0x10/2];
395397
396398   layer   =   (mode >> 7) & 1;   // layer to draw to
397399   buffer   =   ((mode >> 6) & 1) ^ ((buffer >> layer) & 1);   // bit 6 selects whether to use the opposite buffer to that displayed
r14896r14897
538540
539541   AM_RANGE( 0x580000, 0x580001 ) AM_WRITENOP // often
540542
541   AM_RANGE( 0x600000, 0x601fff ) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w ) AM_SHARE("paletteram")
543   AM_RANGE( 0x600000, 0x601fff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w ) AM_SHARE("paletteram")
542544
543545   AM_RANGE( 0x800000, 0x800001 ) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
544546
src/mame/drivers/namcos22.c
r14896r14897
13601360   cputag_set_input_line(machine, "mcu",INPUT_LINE_RESET,ASSERT_LINE); /* MCU */
13611361} /* InitDSP */
13621362
1363static READ16_HANDLER( pdp_status_r )
1363READ16_MEMBER(namcos22_state::pdp_status_r)
13641364{
1365   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1366   return state->m_mMasterBIOZ;
1365   return m_mMasterBIOZ;
13671366} /* pdp_status_r */
13681367
1369static void
1370WriteToPointRAM( namcos22_state *state, offs_t offs, UINT32 data )
1368void namcos22_state::WriteToPointRAM(offs_t offs, UINT32 data )
13711369{
13721370   offs &= 0xffffff; /* 24 bit addressing */
1373   if( state->m_mbSuperSystem22 )
1371   if( m_mbSuperSystem22 )
13741372   {
13751373      if( offs>=0xf80000 && offs<=0xf9ffff )
1376         state->m_mpPointRAM[offs-0xf80000] = data & 0x00ffffff;
1374         m_mpPointRAM[offs-0xf80000] = data & 0x00ffffff;
13771375   }
13781376   else
13791377   {
13801378      if( offs>=0xf00000 && offs<=0xf1ffff )
1381         state->m_mpPointRAM[offs-0xf00000] = data & 0x00ffffff;
1379         m_mpPointRAM[offs-0xf00000] = data & 0x00ffffff;
13821380   }
13831381} /* WriteToPointRAM */
13841382
1385static UINT32
1386ReadFromCommRAM( namcos22_state *state, offs_t offs )
1383UINT32 namcos22_state::ReadFromCommRAM(offs_t offs )
13871384{
1388   return state->m_polygonram[offs&0x7fff];
1385   return m_polygonram[offs&0x7fff];
13891386} /* ReadFromCommRAM */
13901387
1391static void
1392WriteToCommRAM( namcos22_state *state, offs_t offs, UINT32 data )
1388void namcos22_state::WriteToCommRAM(offs_t offs, UINT32 data )
13931389{
1394   if (data & 0x00800000) state->m_polygonram[offs&0x7fff] = data | 0xff000000;
1395   else state->m_polygonram[offs&0x7fff] = data & 0x00ffffff;
1390   if (data & 0x00800000) m_polygonram[offs&0x7fff] = data | 0xff000000;
1391   else m_polygonram[offs&0x7fff] = data & 0x00ffffff;
13961392} /* WriteToCommRAM */
13971393
1398static READ16_HANDLER( pdp_begin_r )
1394READ16_MEMBER(namcos22_state::pdp_begin_r)
13991395{
1400   namcos22_state *state = space->machine().driver_data<namcos22_state>();
14011396   /* this feature appears to be only used on Super System22 hardware */
1402   if( state->m_mbSuperSystem22 )
1397   if( m_mbSuperSystem22 )
14031398   {
1404      UINT16 offs = state->m_polygonram[0x20000/4-1];
1405      state->m_mMasterBIOZ = 1;
1399      UINT16 offs = m_polygonram[0x20000/4-1];
1400      m_mMasterBIOZ = 1;
14061401      for(;;)
14071402      {
14081403         UINT16 start = offs;
1409         UINT16 cmd = ReadFromCommRAM(state, offs++);
1404         UINT16 cmd = ReadFromCommRAM(offs++);
14101405         UINT32 srcAddr;
14111406         UINT32 dstAddr;
14121407         UINT32 numWords;
r14896r14897
14181413            break;
14191414
14201415         case 0xfff5: /* write to point ram */
1421            dstAddr = ReadFromCommRAM(state, offs++); /* 32 bit PointRAM address */
1422            data    = ReadFromCommRAM(state, offs++); /* 24 bit data */
1423            WriteToPointRAM( state, dstAddr, data );
1416            dstAddr = ReadFromCommRAM(offs++); /* 32 bit PointRAM address */
1417            data    = ReadFromCommRAM(offs++); /* 24 bit data */
1418            WriteToPointRAM(dstAddr, data );
14241419            break;
14251420
14261421         case 0xfff6: /* read word from point ram */
1427            srcAddr = ReadFromCommRAM(state, offs++); /* 32 bit PointRAM address */
1428            dstAddr = ReadFromCommRAM(state, offs++); /* CommRAM address; receives 24 bit PointRAM data */
1429            data    = namcos22_point_rom_r( space->machine(), srcAddr );
1430            WriteToCommRAM( state, dstAddr, data );
1422            srcAddr = ReadFromCommRAM(offs++); /* 32 bit PointRAM address */
1423            dstAddr = ReadFromCommRAM(offs++); /* CommRAM address; receives 24 bit PointRAM data */
1424            data    = namcos22_point_rom_r( machine(), srcAddr );
1425            WriteToCommRAM(dstAddr, data );
14311426            break;
14321427
14331428         case 0xfff7: /* block move (CommRAM to CommRAM) */
1434            srcAddr  = ReadFromCommRAM(state, offs++);
1435            dstAddr  = ReadFromCommRAM(state, offs++);
1436            numWords = ReadFromCommRAM(state, offs++);
1429            srcAddr  = ReadFromCommRAM(offs++);
1430            dstAddr  = ReadFromCommRAM(offs++);
1431            numWords = ReadFromCommRAM(offs++);
14371432            while( numWords-- )
14381433            {
1439               data = ReadFromCommRAM(state, srcAddr++);
1440               WriteToCommRAM( state, dstAddr++, data );
1434               data = ReadFromCommRAM(srcAddr++);
1435               WriteToCommRAM(dstAddr++, data );
14411436            }
14421437            break;
14431438
14441439         case 0xfffa: /* read block from point ram */
1445            srcAddr  = ReadFromCommRAM(state, offs++); /* 32 bit PointRAM address */
1446            dstAddr  = ReadFromCommRAM(state, offs++); /* CommRAM address; receives data */
1447            numWords = ReadFromCommRAM(state, offs++); /* block size */
1440            srcAddr  = ReadFromCommRAM(offs++); /* 32 bit PointRAM address */
1441            dstAddr  = ReadFromCommRAM(offs++); /* CommRAM address; receives data */
1442            numWords = ReadFromCommRAM(offs++); /* block size */
14481443            while( numWords-- )
14491444            {
1450               data = namcos22_point_rom_r( space->machine(), srcAddr++ );
1451               WriteToCommRAM( state, dstAddr++, data );
1445               data = namcos22_point_rom_r( machine(), srcAddr++ );
1446               WriteToCommRAM(dstAddr++, data );
14521447            }
14531448            break;
14541449
14551450         case 0xfffb: /* write block to point ram */
1456            dstAddr  = ReadFromCommRAM(state, offs++); /* 32 bit PointRAM address */
1457            numWords = ReadFromCommRAM(state, offs++); /* block size */
1451            dstAddr  = ReadFromCommRAM(offs++); /* 32 bit PointRAM address */
1452            numWords = ReadFromCommRAM(offs++); /* block size */
14581453            while( numWords-- )
14591454            {
1460               data = ReadFromCommRAM( state, offs++ ); /* 24 bit source data */
1461               WriteToPointRAM( state, dstAddr++, data );
1455               data = ReadFromCommRAM(offs++ ); /* 24 bit source data */
1456               WriteToPointRAM(dstAddr++, data );
14621457            }
14631458            break;
14641459
14651460         case 0xfffc: /* point ram to point ram */
1466            srcAddr  = ReadFromCommRAM(state, offs++);
1467            dstAddr  = ReadFromCommRAM(state, offs++);
1468            numWords = ReadFromCommRAM(state, offs++);
1461            srcAddr  = ReadFromCommRAM(offs++);
1462            dstAddr  = ReadFromCommRAM(offs++);
1463            numWords = ReadFromCommRAM(offs++);
14691464            while( numWords-- )
14701465            {
1471               data = namcos22_point_rom_r( space->machine(), srcAddr++ );
1472               WriteToPointRAM( state, dstAddr++, data );
1466               data = namcos22_point_rom_r( machine(), srcAddr++ );
1467               WriteToPointRAM(dstAddr++, data );
14731468            }
14741469            break;
14751470
14761471         case 0xfffd: /* direct command to render device */
14771472            // len -> command (eg. BB0003) -> data
1478            numWords = ReadFromCommRAM(state, offs++);
1473            numWords = ReadFromCommRAM(offs++);
14791474            while( numWords-- )
14801475            {
1481               data = ReadFromCommRAM(state, offs++);
1476               data = ReadFromCommRAM(offs++);
14821477               //namcos22_WriteDataToRenderDevice( data );
14831478            }
14841479            break;
14851480
14861481         case 0xfffe: /* unknown */
1487            data = ReadFromCommRAM(state, offs++); /* ??? (usually 0x400 or 0) */
1482            data = ReadFromCommRAM(offs++); /* ??? (usually 0x400 or 0) */
14881483            break;
14891484
14901485         case 0xffff: /* "goto" command */
1491            offs = ReadFromCommRAM(state, offs);
1486            offs = ReadFromCommRAM(offs);
14921487            if( offs == start )
14931488            { /* most commands end with a "goto self" */
14941489               return 0;
r14896r14897
15001495            return 0;
15011496         }
15021497      } /* for(;;) */
1503   } /* state->m_mbSuperSystem22 */
1498   } /* m_mbSuperSystem22 */
15041499   return 0;
15051500} /* pdp_begin_r */
15061501
1507static READ16_HANDLER( slave_external_ram_r )
1502READ16_MEMBER(namcos22_state::slave_external_ram_r)
15081503{
1509   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1510   return state->m_mpSlaveExternalRAM[offset];
1504   return m_mpSlaveExternalRAM[offset];
15111505}
15121506
1513static WRITE16_HANDLER( slave_external_ram_w )
1507WRITE16_MEMBER(namcos22_state::slave_external_ram_w)
15141508{
1515   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1516   COMBINE_DATA( &state->m_mpSlaveExternalRAM[offset] );
1509   COMBINE_DATA( &m_mpSlaveExternalRAM[offset] );
15171510}
15181511
15191512static void HaltSlaveDSP( running_machine &machine )
r14896r14897
15281521   namcos22_enable_slave_simulation(machine, 1);
15291522}
15301523
1531static READ16_HANDLER( dsp_HOLD_signal_r )
1524READ16_MEMBER(namcos22_state::dsp_HOLD_signal_r)
15321525{ /* STUB */
15331526   return 0;
15341527}
15351528
1536static WRITE16_HANDLER( dsp_HOLD_ACK_w )
1529WRITE16_MEMBER(namcos22_state::dsp_HOLD_ACK_w)
15371530{ /* STUB */
15381531}
15391532
1540static WRITE16_HANDLER( dsp_XF_output_w )
1533WRITE16_MEMBER(namcos22_state::dsp_XF_output_w)
15411534{ /* STUB */
15421535}
15431536
15441537/************************************************************/
15451538
1546static WRITE16_HANDLER( point_ram_idx_w )
1539WRITE16_MEMBER(namcos22_state::point_ram_idx_w)
15471540{
1548   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1549   state->m_mPointAddr<<=16;
1550   state->m_mPointAddr |= data;
1541   m_mPointAddr<<=16;
1542   m_mPointAddr |= data;
15511543}
15521544
1553static WRITE16_HANDLER( point_ram_loword_iw )
1545WRITE16_MEMBER(namcos22_state::point_ram_loword_iw)
15541546{
1555   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1556   state->m_mPointData |= data;
1557   WriteToPointRAM( state, state->m_mPointAddr++, state->m_mPointData );
1547   m_mPointData |= data;
1548   WriteToPointRAM(m_mPointAddr++, m_mPointData );
15581549}
15591550
1560static WRITE16_HANDLER( point_ram_hiword_w )
1551WRITE16_MEMBER(namcos22_state::point_ram_hiword_w)
15611552{
1562   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1563   state->m_mPointData = (data<<16);
1553   m_mPointData = (data<<16);
15641554}
15651555
1566static READ16_HANDLER( point_ram_loword_r )
1556READ16_MEMBER(namcos22_state::point_ram_loword_r)
15671557{
1568   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1569   return namcos22_point_rom_r(space->machine(), state->m_mPointAddr)&0xffff;
1558   return namcos22_point_rom_r(machine(), m_mPointAddr)&0xffff;
15701559}
15711560
1572static READ16_HANDLER( point_ram_hiword_ir )
1561READ16_MEMBER(namcos22_state::point_ram_hiword_ir)
15731562{
1574   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1575   return namcos22_point_rom_r(space->machine(), state->m_mPointAddr++)>>16;
1563   return namcos22_point_rom_r(machine(), m_mPointAddr++)>>16;
15761564}
15771565
1578static WRITE16_HANDLER( dsp_unk2_w )
1566WRITE16_MEMBER(namcos22_state::dsp_unk2_w)
15791567{
15801568   /**
15811569     * Used by Ridge Racer (Japan) to specify baseaddr
r14896r14897
15931581   eDSP_UPLOAD_DATA
15941582};
15951583
1596static READ16_HANDLER( dsp_unk_port3_r )
1584READ16_MEMBER(namcos22_state::dsp_unk_port3_r)
15971585{
1598   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1599   state->m_mMasterBIOZ = 0;
1600   state->m_mDspUploadState = eDSP_UPLOAD_READY;
1586   m_mMasterBIOZ = 0;
1587   m_mDspUploadState = eDSP_UPLOAD_READY;
16011588   return 0;
16021589}
16031590
1604static WRITE16_HANDLER( upload_code_to_slave_dsp_w )
1591WRITE16_MEMBER(namcos22_state::upload_code_to_slave_dsp_w)
16051592{
1606   namcos22_state *state = space->machine().driver_data<namcos22_state>();
16071593
1608   switch( state->m_mDspUploadState )
1594   switch( m_mDspUploadState )
16091595   {
16101596   case eDSP_UPLOAD_READY:
16111597      logerror( "UPLOAD_READY; cmd = 0x%x\n", data );
16121598      switch (data)
16131599      {
16141600         case 0:
1615            HaltSlaveDSP(space->machine());
1601            HaltSlaveDSP(machine());
16161602            break;
16171603         case 1:
1618            state->m_mDspUploadState = eDSP_UPLOAD_DEST;
1604            m_mDspUploadState = eDSP_UPLOAD_DEST;
16191605            break;
16201606         case 2:
16211607            /* custom IC poke */
16221608            break;
16231609         case 3:
1624            EnableSlaveDSP(space->machine());
1610            EnableSlaveDSP(machine());
16251611            break;
16261612         case 4:
16271613            break;
16281614         case 0x10:
16291615            /* serial i/o related? */
1630            EnableSlaveDSP(space->machine());
1616            EnableSlaveDSP(machine());
16311617            break;
16321618
16331619         default:
1634            logerror( "%08x: master port#7: 0x%04x\n", cpu_get_previouspc(&space->device()), data );
1620            logerror( "%08x: master port#7: 0x%04x\n", cpu_get_previouspc(&space.device()), data );
16351621            break;
16361622      }
16371623      break;
16381624
16391625   case eDSP_UPLOAD_DEST:
1640      state->m_mUploadDestIdx = data;
1641      state->m_mDspUploadState = eDSP_UPLOAD_DATA;
1626      m_mUploadDestIdx = data;
1627      m_mDspUploadState = eDSP_UPLOAD_DATA;
16421628      break;
16431629
16441630   case eDSP_UPLOAD_DATA:
1645      state->m_mpSlaveExternalRAM[state->m_mUploadDestIdx&0x1fff] = data;
1646      state->m_mUploadDestIdx++;
1631      m_mpSlaveExternalRAM[m_mUploadDestIdx&0x1fff] = data;
1632      m_mUploadDestIdx++;
16471633      break;
16481634
16491635   default:
r14896r14897
16511637   }
16521638}
16531639
1654static READ16_HANDLER( dsp_unk8_r )
1640READ16_MEMBER(namcos22_state::dsp_unk8_r)
16551641{
16561642   /* bit 0x0001 is busy signal */
16571643   return 0;
16581644}
16591645
1660static READ16_HANDLER( custom_ic_status_r )
1646READ16_MEMBER(namcos22_state::custom_ic_status_r)
16611647{
16621648   /* bit 0x0001 signals completion */
16631649   return 0x0063;
16641650}
16651651
1666static READ16_HANDLER( dsp_upload_status_r )
1652READ16_MEMBER(namcos22_state::dsp_upload_status_r)
16671653{
16681654   /**
16691655     * bit 0x0001 is polled to confirm that code/data has been
r14896r14897
16721658   return 0x0000;
16731659}
16741660
1675static READ16_HANDLER( master_external_ram_r )
1661READ16_MEMBER(namcos22_state::master_external_ram_r)
16761662{
1677   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1678   return state->m_mpMasterExternalRAM[offset];
1663   return m_mpMasterExternalRAM[offset];
16791664}
16801665
1681static WRITE16_HANDLER( master_external_ram_w )
1666WRITE16_MEMBER(namcos22_state::master_external_ram_w)
16821667{
1683   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1684   COMBINE_DATA( &state->m_mpMasterExternalRAM[offset] );
1668   COMBINE_DATA( &m_mpMasterExternalRAM[offset] );
16851669}
16861670
1687static WRITE16_HANDLER( slave_serial_io_w )
1671WRITE16_MEMBER(namcos22_state::slave_serial_io_w)
16881672{
1689   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1690   state->m_mSerialDataSlaveToMasterNext = data;
1673   m_mSerialDataSlaveToMasterNext = data;
16911674   logerror( "slave_serial_io_w(%04x)\n", data );
16921675}
16931676
1694static READ16_HANDLER( master_serial_io_r )
1677READ16_MEMBER(namcos22_state::master_serial_io_r)
16951678{
1696   namcos22_state *state = space->machine().driver_data<namcos22_state>();
16971679   logerror( "master_serial_io_r() == %04x\n",
1698      state->m_mSerialDataSlaveToMasterCurrent );
1699   return state->m_mSerialDataSlaveToMasterCurrent;
1680      m_mSerialDataSlaveToMasterCurrent );
1681   return m_mSerialDataSlaveToMasterCurrent;
17001682}
17011683
17021684static TIMER_DEVICE_CALLBACK( dsp_master_serial_irq )
r14896r14897
17331715   }
17341716}
17351717
1736static WRITE16_HANDLER( dsp_unk_porta_w )
1718WRITE16_MEMBER(namcos22_state::dsp_unk_porta_w)
17371719{
17381720}
17391721
1740static WRITE16_HANDLER( dsp_led_w )
1722WRITE16_MEMBER(namcos22_state::dsp_led_w)
17411723{
17421724   /* I believe this port controls diagnostic LEDs on the DSP PCB. */
17431725}
r14896r14897
17781760 * 0x0075 0xf205 // sx,sy
17791761 * 0x602b 0x93e8 // i,zpos
17801762 */
1781static WRITE16_HANDLER( dsp_unk8_w )
1763WRITE16_MEMBER(namcos22_state::dsp_unk8_w)
17821764{
1783   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1784   state->m_mRenderBufSize = 0;
1765   m_mRenderBufSize = 0;
17851766}
17861767
1787static WRITE16_HANDLER( master_render_device_w )
1768WRITE16_MEMBER(namcos22_state::master_render_device_w)
17881769{
1789   namcos22_state *state = space->machine().driver_data<namcos22_state>();
1790   if( state->m_mRenderBufSize<MAX_RENDER_CMD_SEQ )
1770   if( m_mRenderBufSize<MAX_RENDER_CMD_SEQ )
17911771   {
1792      state->m_mRenderBufData[state->m_mRenderBufSize++] = data;
1793      if( state->m_mRenderBufSize == MAX_RENDER_CMD_SEQ )
1772      m_mRenderBufData[m_mRenderBufSize++] = data;
1773      if( m_mRenderBufSize == MAX_RENDER_CMD_SEQ )
17941774      {
1795         namcos22_draw_direct_poly( space->machine(), state->m_mRenderBufData );
1775         namcos22_draw_direct_poly( machine(), m_mRenderBufData );
17961776      }
17971777   }
17981778}
r14896r14897
18041784
18051785static ADDRESS_MAP_START( master_dsp_data, AS_DATA, 16, namcos22_state )
18061786   AM_RANGE(0x1000, 0x3fff) AM_RAM
1807   AM_RANGE(0x4000, 0x7fff) AM_READ_LEGACY(master_external_ram_r) AM_WRITE_LEGACY(master_external_ram_w)
1787   AM_RANGE(0x4000, 0x7fff) AM_READ(master_external_ram_r) AM_WRITE(master_external_ram_w)
18081788   AM_RANGE(0x8000, 0xffff) AM_READ(namcos22_dspram16_r) AM_WRITE(namcos22_dspram16_w)
18091789ADDRESS_MAP_END
18101790
18111791static ADDRESS_MAP_START( master_dsp_io, AS_IO, 16, namcos22_state )
1812   AM_RANGE(0x0,0x0) AM_WRITE_LEGACY(point_ram_loword_iw) AM_READ_LEGACY(point_ram_loword_r)
1813   AM_RANGE(0x1,0x1) AM_WRITE_LEGACY(point_ram_hiword_w) AM_READ_LEGACY(point_ram_hiword_ir)
1814   AM_RANGE(0x2,0x2) AM_WRITE_LEGACY(dsp_unk2_w) AM_READ_LEGACY(pdp_begin_r)
1815   AM_RANGE(0x3,0x3) AM_WRITE_LEGACY(point_ram_idx_w) AM_READ_LEGACY(dsp_unk_port3_r)
1792   AM_RANGE(0x0,0x0) AM_WRITE(point_ram_loword_iw) AM_READ(point_ram_loword_r)
1793   AM_RANGE(0x1,0x1) AM_WRITE(point_ram_hiword_w) AM_READ(point_ram_hiword_ir)
1794   AM_RANGE(0x2,0x2) AM_WRITE(dsp_unk2_w) AM_READ(pdp_begin_r)
1795   AM_RANGE(0x3,0x3) AM_WRITE(point_ram_idx_w) AM_READ(dsp_unk_port3_r)
18161796   AM_RANGE(0x4,0x4) AM_WRITENOP /* unknown */
1817   AM_RANGE(0x7,0x7) AM_WRITE_LEGACY(upload_code_to_slave_dsp_w)
1818   AM_RANGE(0x8,0x8) AM_WRITE_LEGACY(dsp_unk8_w) AM_READ_LEGACY(dsp_unk8_r)         /* trigger irq? */
1819   AM_RANGE(0x9,0x9) AM_WRITENOP AM_READ_LEGACY(custom_ic_status_r) /* trigger irq? */
1820   AM_RANGE(0xa,0xa) AM_WRITE_LEGACY(dsp_unk_porta_w)
1797   AM_RANGE(0x7,0x7) AM_WRITE(upload_code_to_slave_dsp_w)
1798   AM_RANGE(0x8,0x8) AM_WRITE(dsp_unk8_w) AM_READ(dsp_unk8_r)         /* trigger irq? */
1799   AM_RANGE(0x9,0x9) AM_WRITENOP AM_READ(custom_ic_status_r) /* trigger irq? */
1800   AM_RANGE(0xa,0xa) AM_WRITE(dsp_unk_porta_w)
18211801   AM_RANGE(0xb,0xb) AM_WRITENOP /* RINT-related? */
1822   AM_RANGE(0xc,0xc) AM_WRITE_LEGACY(master_render_device_w)
1802   AM_RANGE(0xc,0xc) AM_WRITE(master_render_device_w)
18231803   AM_RANGE(0xd,0xd) AM_WRITE(namcos22_dspram16_bank_w)
1824   AM_RANGE(0xe,0xe) AM_WRITE_LEGACY(dsp_led_w)
1825   AM_RANGE(0xf,0xf) AM_WRITENOP AM_READ_LEGACY(dsp_upload_status_r)
1826   AM_RANGE(TMS32025_HOLD,  TMS32025_HOLD)  AM_READ_LEGACY(dsp_HOLD_signal_r)
1827   AM_RANGE(TMS32025_HOLDA, TMS32025_HOLDA) AM_WRITE_LEGACY(dsp_HOLD_ACK_w)
1828   AM_RANGE(TMS32025_XF,    TMS32025_XF)    AM_WRITE_LEGACY(dsp_XF_output_w)
1829   AM_RANGE(TMS32025_BIO,   TMS32025_BIO)   AM_READ_LEGACY(pdp_status_r)
1830   AM_RANGE(TMS32025_DR,    TMS32025_DR)    AM_READ_LEGACY(master_serial_io_r)
1804   AM_RANGE(0xe,0xe) AM_WRITE(dsp_led_w)
1805   AM_RANGE(0xf,0xf) AM_WRITENOP AM_READ(dsp_upload_status_r)
1806   AM_RANGE(TMS32025_HOLD,  TMS32025_HOLD)  AM_READ(dsp_HOLD_signal_r)
1807   AM_RANGE(TMS32025_HOLDA, TMS32025_HOLDA) AM_WRITE(dsp_HOLD_ACK_w)
1808   AM_RANGE(TMS32025_XF,    TMS32025_XF)    AM_WRITE(dsp_XF_output_w)
1809   AM_RANGE(TMS32025_BIO,   TMS32025_BIO)   AM_READ(pdp_status_r)
1810   AM_RANGE(TMS32025_DR,    TMS32025_DR)    AM_READ(master_serial_io_r)
18311811ADDRESS_MAP_END
18321812
1833static READ16_HANDLER( dsp_BIOZ_r )
1813READ16_MEMBER(namcos22_state::dsp_BIOZ_r)
18341814{ /* STUB */
18351815   return 1;
18361816}
18371817
1838static READ16_HANDLER( dsp_slave_port3_r )
1818READ16_MEMBER(namcos22_state::dsp_slave_port3_r)
18391819{
18401820   return 0x0010; /* ? */
18411821}
18421822
1843static READ16_HANDLER( dsp_slave_port4_r )
1823READ16_MEMBER(namcos22_state::dsp_slave_port4_r)
18441824{
18451825   return 0;
18461826//  return ReadDataFromSlaveBuf();
18471827}
18481828
1849static READ16_HANDLER( dsp_slave_port5_r )
1829READ16_MEMBER(namcos22_state::dsp_slave_port5_r)
18501830{
18511831#if 0
18521832   int numWords = SlaveBufSize();
r14896r14897
18561836   return 0;
18571837}
18581838
1859static READ16_HANDLER( dsp_slave_port6_r )
1839READ16_MEMBER(namcos22_state::dsp_slave_port6_r)
18601840{
18611841   /**
18621842     * bit 0x9 indicates whether device at port2 is ready to receive data
r14896r14897
18651845   return 0;
18661846}
18671847
1868static WRITE16_HANDLER( dsp_slave_portc_w )
1848WRITE16_MEMBER(namcos22_state::dsp_slave_portc_w)
18691849{
18701850   /* Unknown; used before transmitting a command sequence. */
18711851}
18721852
1873static READ16_HANDLER( dsp_slave_port8_r )
1853READ16_MEMBER(namcos22_state::dsp_slave_port8_r)
18741854{
18751855   /* This reports  status of the device mapped at port 0xb.
18761856     *
r14896r14897
18801860   return 0; /* status */
18811861}
18821862
1883static READ16_HANDLER( dsp_slave_portb_r )
1863READ16_MEMBER(namcos22_state::dsp_slave_portb_r)
18841864{
18851865   /* The slave DSP reads before transmitting a command sequence. */
18861866   return 0;
18871867}
18881868
1889static WRITE16_HANDLER( dsp_slave_portb_w )
1869WRITE16_MEMBER(namcos22_state::dsp_slave_portb_w)
18901870{
18911871   /* The slave dsp uses this to transmit a command sequence to an external device. */
18921872}
r14896r14897
18971877ADDRESS_MAP_END
18981878
18991879static ADDRESS_MAP_START( slave_dsp_data, AS_DATA, 16, namcos22_state )
1900   AM_RANGE(0x8000, 0x9fff) AM_READ_LEGACY(slave_external_ram_r) AM_WRITE_LEGACY(slave_external_ram_w)
1880   AM_RANGE(0x8000, 0x9fff) AM_READ(slave_external_ram_r) AM_WRITE(slave_external_ram_w)
19011881ADDRESS_MAP_END
19021882
19031883static ADDRESS_MAP_START( slave_dsp_io, AS_IO, 16, namcos22_state )
19041884   /* unknown signal */
1905   AM_RANGE(0x3,0x3) AM_READ_LEGACY(dsp_slave_port3_r)
1885   AM_RANGE(0x3,0x3) AM_READ(dsp_slave_port3_r)
19061886
1907   AM_RANGE(0x4,0x4) AM_READ_LEGACY(dsp_slave_port4_r)
1908   AM_RANGE(0x5,0x5) AM_READ_LEGACY(dsp_slave_port5_r)
1909   AM_RANGE(0x6,0x6) AM_WRITENOP AM_READ_LEGACY(dsp_slave_port6_r)
1887   AM_RANGE(0x4,0x4) AM_READ(dsp_slave_port4_r)
1888   AM_RANGE(0x5,0x5) AM_READ(dsp_slave_port5_r)
1889   AM_RANGE(0x6,0x6) AM_WRITENOP AM_READ(dsp_slave_port6_r)
19101890
19111891   /* render device state */
1912   AM_RANGE(0x8,0x8) AM_WRITENOP AM_READ_LEGACY(dsp_slave_port8_r)
1892   AM_RANGE(0x8,0x8) AM_WRITENOP AM_READ(dsp_slave_port8_r)
19131893
19141894   /* render device */
1915   AM_RANGE(0xb,0xb) AM_WRITE_LEGACY(dsp_slave_portb_w) AM_READ_LEGACY(dsp_slave_portb_r)
1895   AM_RANGE(0xb,0xb) AM_WRITE(dsp_slave_portb_w) AM_READ(dsp_slave_portb_r)
19161896
1917   AM_RANGE(0xc,0xc) AM_WRITE_LEGACY(dsp_slave_portc_w)
1897   AM_RANGE(0xc,0xc) AM_WRITE(dsp_slave_portc_w)
19181898
1919   AM_RANGE(TMS32025_HOLD,  TMS32025_HOLD)  AM_READ_LEGACY(dsp_HOLD_signal_r)
1920   AM_RANGE(TMS32025_HOLDA, TMS32025_HOLDA) AM_WRITE_LEGACY(dsp_HOLD_ACK_w)
1921   AM_RANGE(TMS32025_XF,    TMS32025_XF)    AM_WRITE_LEGACY(dsp_XF_output_w)
1922   AM_RANGE(TMS32025_BIO,   TMS32025_BIO)   AM_READ_LEGACY(dsp_BIOZ_r)
1923   AM_RANGE(TMS32025_DX,    TMS32025_DX)    AM_WRITE_LEGACY(slave_serial_io_w)
1899   AM_RANGE(TMS32025_HOLD,  TMS32025_HOLD)  AM_READ(dsp_HOLD_signal_r)
1900   AM_RANGE(TMS32025_HOLDA, TMS32025_HOLDA) AM_WRITE(dsp_HOLD_ACK_w)
1901   AM_RANGE(TMS32025_XF,    TMS32025_XF)    AM_WRITE(dsp_XF_output_w)
1902   AM_RANGE(TMS32025_BIO,   TMS32025_BIO)   AM_READ(dsp_BIOZ_r)
1903   AM_RANGE(TMS32025_DX,    TMS32025_DX)    AM_WRITE(slave_serial_io_w)
19241904ADDRESS_MAP_END
19251905
19261906static NVRAM_HANDLER( namcos22 )
r14896r14897
20322012GFXDECODE_END
20332013
20342014/* prelim! */
2035static READ32_HANDLER( namcos22_C139_SCI_r )
2015READ32_MEMBER(namcos22_state::namcos22_C139_SCI_r)
20362016{
20372017   switch( offset )
20382018   {
r14896r14897
20422022}
20432023
20442024#if 0
2045static WRITE32_HANDLER( namcos22_C139_SCI_w )
2025WRITE32_MEMBER(namcos22_state::namcos22_C139_SCI_w)
20462026{
20472027   COMBINE_DATA( &namcos22_C139_SCI[offset] );
20482028   /*
r14896r14897
20742054}
20752055#endif
20762056
2077static READ32_HANDLER( namcos22_system_controller_r )
2057READ32_MEMBER(namcos22_state::namcos22_system_controller_r)
20782058{
2079   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2080   return state->m_system_controller[offset];
2059   return m_system_controller[offset];
20812060}
20822061
20832062/* system controller (super system22)
r14896r14897
21192098
212020990x1c: dsp control
21212100*/
2122static WRITE32_HANDLER( namcos22s_system_controller_w )
2101WRITE32_MEMBER(namcos22_state::namcos22s_system_controller_w)
21232102{
2124   namcos22_state *state = space->machine().driver_data<namcos22_state>();
21252103   int oldreg, newreg;
21262104
21272105   // acknowledge irqs
21282106   if (offset == 0x04/4 && mem_mask & 0xff000000)
21292107   {
21302108      // vblank
2131      state->m_irq_state &= ~1;
2132      cputag_set_input_line(space->machine(), "maincpu", nthbyte(state->m_system_controller, 0x00) & 7, CLEAR_LINE);
2109      m_irq_state &= ~1;
2110      cputag_set_input_line(machine(), "maincpu", nthbyte(m_system_controller, 0x00) & 7, CLEAR_LINE);
21332111   }
21342112
21352113   // irq level / enable irqs
21362114   if (offset == 0x00/4 && mem_mask & 0xff000000)
21372115   {
21382116      // vblank
2139      oldreg = nthbyte(state->m_system_controller, 0x00) & 7;
2117      oldreg = nthbyte(m_system_controller, 0x00) & 7;
21402118      newreg = data >> 24 & 7;
2141      if (state->m_irq_state & 1 && oldreg != newreg)
2119      if (m_irq_state & 1 && oldreg != newreg)
21422120      {
2143         cputag_set_input_line(space->machine(), "maincpu", oldreg, CLEAR_LINE);
2121         cputag_set_input_line(machine(), "maincpu", oldreg, CLEAR_LINE);
21442122         if (newreg)
2145            cputag_set_input_line(space->machine(), "maincpu", newreg, ASSERT_LINE);
2123            cputag_set_input_line(machine(), "maincpu", newreg, ASSERT_LINE);
21462124         else
2147            state->m_irq_state &= ~1;
2125            m_irq_state &= ~1;
21482126      }
21492127   }
21502128
r14896r14897
21522130   if (offset == 0x16/4 && mem_mask & 0x0000ff00)
21532131   {
21542132      if (data & 0x0000ff00)
2155         cputag_set_input_line(space->machine(), "mcu", INPUT_LINE_RESET, CLEAR_LINE);
2133         cputag_set_input_line(machine(), "mcu", INPUT_LINE_RESET, CLEAR_LINE);
21562134      else
2157         cputag_set_input_line(space->machine(), "mcu", INPUT_LINE_RESET, ASSERT_LINE);
2135         cputag_set_input_line(machine(), "mcu", INPUT_LINE_RESET, ASSERT_LINE);
21582136   }
21592137
21602138   // dsp control
21612139   if (offset == 0x1c/4 && mem_mask & 0xff000000)
21622140   {
2163      oldreg = nthbyte(state->m_system_controller, 0x1c);
2141      oldreg = nthbyte(m_system_controller, 0x1c);
21642142      newreg = data >> 24 & 0xff;
21652143      if (newreg != oldreg)
21662144      {
21672145         if( newreg == 0 )
21682146         { /* disable DSPs */
2169            cputag_set_input_line(space->machine(), "master", INPUT_LINE_RESET, ASSERT_LINE); /* master DSP */
2170            cputag_set_input_line(space->machine(), "slave", INPUT_LINE_RESET, ASSERT_LINE); /* slave DSP */
2171            namcos22_enable_slave_simulation(space->machine(), 0);
2172            state->m_mbEnableDspIrqs = 0;
2147            cputag_set_input_line(machine(), "master", INPUT_LINE_RESET, ASSERT_LINE); /* master DSP */
2148            cputag_set_input_line(machine(), "slave", INPUT_LINE_RESET, ASSERT_LINE); /* slave DSP */
2149            namcos22_enable_slave_simulation(machine(), 0);
2150            m_mbEnableDspIrqs = 0;
21732151         }
21742152         else if( newreg == 1 )
21752153         { /* enable dsp and rendering subsystem */
2176            cputag_set_input_line(space->machine(), "master", INPUT_LINE_RESET, CLEAR_LINE);
2177            namcos22_enable_slave_simulation(space->machine(), 1);
2178            state->m_mbEnableDspIrqs = 1;
2154            cputag_set_input_line(machine(), "master", INPUT_LINE_RESET, CLEAR_LINE);
2155            namcos22_enable_slave_simulation(machine(), 1);
2156            m_mbEnableDspIrqs = 1;
21792157         }
21802158         else if( newreg == 0xff )
21812159         { /* used to upload game-specific code to master/slave dsps */
2182            cputag_set_input_line(space->machine(), "master", INPUT_LINE_RESET, CLEAR_LINE);
2183            state->m_mbEnableDspIrqs = 0;
2160            cputag_set_input_line(machine(), "master", INPUT_LINE_RESET, CLEAR_LINE);
2161            m_mbEnableDspIrqs = 0;
21842162         }
21852163      }
21862164   }
21872165
2188   COMBINE_DATA( &state->m_system_controller[offset] );
2166   COMBINE_DATA( &m_system_controller[offset] );
21892167
21902168} /* namcos22s_system_controller_w */
21912169
r14896r14897
225022280x1a: 0 or 1 or 0xff -> DSP control
225122290x1b: ?
22522230*/
2253static WRITE32_HANDLER( namcos22_system_controller_w )
2231WRITE32_MEMBER(namcos22_state::namcos22_system_controller_w)
22542232{
2255   namcos22_state *state = space->machine().driver_data<namcos22_state>();
22562233   int oldreg, newreg;
22572234
22582235   // acknowledge irqs
22592236   if (offset == 0x09/4 && mem_mask & 0x00ff0000)
22602237   {
22612238      // vblank
2262      state->m_irq_state &= ~1;
2263      cputag_set_input_line(space->machine(), "maincpu", nthbyte(state->m_system_controller, 0x04) & 7, CLEAR_LINE);
2239      m_irq_state &= ~1;
2240      cputag_set_input_line(machine(), "maincpu", nthbyte(m_system_controller, 0x04) & 7, CLEAR_LINE);
22642241   }
22652242
22662243   // irq level / enable irqs
22672244   if (offset == 0x04/4 && mem_mask & 0xff000000)
22682245   {
22692246      // vblank
2270      oldreg = nthbyte(state->m_system_controller, 0x04) & 7;
2247      oldreg = nthbyte(m_system_controller, 0x04) & 7;
22712248      newreg = data >> 24 & 7;
2272      if (state->m_irq_state & 1 && oldreg != newreg)
2249      if (m_irq_state & 1 && oldreg != newreg)
22732250      {
2274         cputag_set_input_line(space->machine(), "maincpu", oldreg, CLEAR_LINE);
2251         cputag_set_input_line(machine(), "maincpu", oldreg, CLEAR_LINE);
22752252         if (newreg)
2276            cputag_set_input_line(space->machine(), "maincpu", newreg, ASSERT_LINE);
2253            cputag_set_input_line(machine(), "maincpu", newreg, ASSERT_LINE);
22772254         else
2278            state->m_irq_state &= ~1;
2255            m_irq_state &= ~1;
22792256      }
22802257   }
22812258
r14896r14897
22832260   if (offset == 0x1a/4 && mem_mask & 0xff000000)
22842261   {
22852262      if (data & 0xff000000)
2286         cputag_set_input_line(space->machine(), "mcu", INPUT_LINE_RESET, CLEAR_LINE);
2263         cputag_set_input_line(machine(), "mcu", INPUT_LINE_RESET, CLEAR_LINE);
22872264      else
2288         cputag_set_input_line(space->machine(), "mcu", INPUT_LINE_RESET, ASSERT_LINE);
2265         cputag_set_input_line(machine(), "mcu", INPUT_LINE_RESET, ASSERT_LINE);
22892266   }
22902267
22912268   // dsp control
22922269   if (offset == 0x1a/4 && mem_mask & 0x0000ff00)
22932270   {
2294      oldreg = nthbyte(state->m_system_controller, 0x1a);
2271      oldreg = nthbyte(m_system_controller, 0x1a);
22952272      newreg = data >> 8 & 0xff;
22962273      if (newreg != oldreg)
22972274      {
22982275         if( newreg == 0 )
22992276         { /* disable DSPs */
2300            cputag_set_input_line(space->machine(), "master", INPUT_LINE_RESET, ASSERT_LINE); /* master DSP */
2301            cputag_set_input_line(space->machine(), "slave", INPUT_LINE_RESET, ASSERT_LINE); /* slave DSP */
2302            namcos22_enable_slave_simulation(space->machine(), 0);
2303            state->m_mbEnableDspIrqs = 0;
2277            cputag_set_input_line(machine(), "master", INPUT_LINE_RESET, ASSERT_LINE); /* master DSP */
2278            cputag_set_input_line(machine(), "slave", INPUT_LINE_RESET, ASSERT_LINE); /* slave DSP */
2279            namcos22_enable_slave_simulation(machine(), 0);
2280            m_mbEnableDspIrqs = 0;
23042281         }
23052282         else if( newreg == 1 )
23062283         { /* enable dsp and rendering subsystem */
2307            cputag_set_input_line(space->machine(), "master", INPUT_LINE_RESET, CLEAR_LINE);
2308            namcos22_enable_slave_simulation(space->machine(), 1);
2309            state->m_mbEnableDspIrqs = 1;
2284            cputag_set_input_line(machine(), "master", INPUT_LINE_RESET, CLEAR_LINE);
2285            namcos22_enable_slave_simulation(machine(), 1);
2286            m_mbEnableDspIrqs = 1;
23102287         }
23112288         else if( newreg == 0xff )
23122289         { /* used to upload game-specific code to master/slave dsps */
2313            cputag_set_input_line(space->machine(), "master", INPUT_LINE_RESET, CLEAR_LINE);
2314            state->m_mbEnableDspIrqs = 0;
2290            cputag_set_input_line(machine(), "master", INPUT_LINE_RESET, CLEAR_LINE);
2291            m_mbEnableDspIrqs = 0;
23152292         }
23162293      }
23172294   }
23182295
2319   COMBINE_DATA( &state->m_system_controller[offset] );
2296   COMBINE_DATA( &m_system_controller[offset] );
23202297
23212298} /* namcos22_system_controller_w */
23222299
r14896r14897
23942371   }
23952372}
23962373
2397static READ32_HANDLER( namcos22_keycus_r )
2374READ32_MEMBER(namcos22_state::namcos22_keycus_r)
23982375{
23992376   // this chip is also used for reading random values in some games
24002377   // for example in timecris to determine where certain enemies will emerge
24012378   // but it is not yet understood how this works
2402   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2403//  printf("Hit keycus mask %x PC=%x\n", mem_mask, cpu_get_pc(&space->device()));
2379//  printf("Hit keycus mask %x PC=%x\n", mem_mask, cpu_get_pc(&space.device()));
24042380
24052381   if (ACCESSING_BITS_0_15)
2406      return state->m_keycus_id;
2382      return m_keycus_id;
24072383   if (ACCESSING_BITS_16_31)
2408      return state->m_keycus_id << 16;
2384      return m_keycus_id << 16;
24092385
24102386   return 0;
24112387}
24122388
2413static WRITE32_HANDLER( namcos22_keycus_w )
2389WRITE32_MEMBER(namcos22_state::namcos22_keycus_w)
24142390{
24152391   // for obfuscating keycus and/or random seed?
24162392}
r14896r14897
24302406 * Other values seem to be digital versions of analog ports, for example "the gas pedal is
24312407 * pressed" as a boolean flag.  IO RAM supplies it as an analog value.
24322408 */
2433static READ32_HANDLER( namcos22_portbit_r )
2409READ32_MEMBER(namcos22_state::namcos22_portbit_r)
24342410{
2435   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2436   UINT32 data = state->m_mSys22PortBits;
2437   state->m_mSys22PortBits>>=1;
2411   UINT32 data = m_mSys22PortBits;
2412   m_mSys22PortBits>>=1;
24382413   return data&0x10001;
24392414}
2440static WRITE32_HANDLER( namcos22_portbit_w )
2415WRITE32_MEMBER(namcos22_state::namcos22_portbit_w)
24412416{
2442   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2443   unsigned dat50000008 = AnalogAsDigital(space->machine());
2417   unsigned dat50000008 = AnalogAsDigital(machine());
24442418   unsigned dat5000000a = 0xffff;
2445   state->m_mSys22PortBits = (dat50000008<<16)|dat5000000a;
2419   m_mSys22PortBits = (dat50000008<<16)|dat5000000a;
24462420}
24472421
2448static READ32_HANDLER( namcos22_dipswitch_r )
2422READ32_MEMBER(namcos22_state::namcos22_dipswitch_r)
24492423{
2450   return input_port_read(space->machine(), "DSW0")<<16;
2424   return input_port_read(machine(), "DSW0")<<16;
24512425}
24522426
2453static READ32_HANDLER( namcos22_mcuram_r )
2427READ32_MEMBER(namcos22_state::namcos22_mcuram_r)
24542428{
2455   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2456   return state->m_shareram[offset];
2429   return m_shareram[offset];
24572430}
24582431
2459static WRITE32_HANDLER( namcos22_mcuram_w )
2432WRITE32_MEMBER(namcos22_state::namcos22_mcuram_w)
24602433{
2461   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2462   COMBINE_DATA(&state->m_shareram[offset]);
2434   COMBINE_DATA(&m_shareram[offset]);
24632435}
24642436
2465static READ32_HANDLER( namcos22_gun_r )
2437READ32_MEMBER(namcos22_state::namcos22_gun_r)
24662438{
2467   int xpos = input_port_read_safe(space->machine(), "LIGHTX", 0) * 640 / 0xff;
2468   int ypos = input_port_read_safe(space->machine(), "LIGHTY", 0) * 240 / 0xff + 0x10;
2439   int xpos = input_port_read_safe(machine(), "LIGHTX", 0) * 640 / 0xff;
2440   int ypos = input_port_read_safe(machine(), "LIGHTY", 0) * 240 / 0xff + 0x10;
24692441   switch( offset )
24702442   {
24712443   case 0: /* 430000 */
r14896r14897
24812453   }
24822454} /* namcos22_gun_r */
24832455
2484static WRITE32_HANDLER( namcos22_cpuleds_w )
2456WRITE32_MEMBER(namcos22_state::namcos22_cpuleds_w)
24852457{
24862458   // 8 leds on cpu board, left to right:
24872459   // GYRGYRGY green/yellow/red, 0=on 1=off
r14896r14897
24982470   output_set_lamp_value(7, data>>0 & 1);
24992471}
25002472
2501static READ32_HANDLER( alpinesa_prot_r )
2473READ32_MEMBER(namcos22_state::alpinesa_prot_r)
25022474{
2503   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2504   return state->m_mAlpineSurferProtData;
2475   return m_mAlpineSurferProtData;
25052476} /* alpinesa_prot_r */
25062477
2507static WRITE32_HANDLER( alpinesa_prot_w )
2478WRITE32_MEMBER(namcos22_state::alpinesa_prot_w)
25082479{
2509   namcos22_state *state = space->machine().driver_data<namcos22_state>();
25102480   switch( data )
25112481   {
25122482   case 0:
2513      state->m_mAlpineSurferProtData = 0;
2483      m_mAlpineSurferProtData = 0;
25142484      break;
25152485   case 1:
2516      state->m_mAlpineSurferProtData = 1;
2486      m_mAlpineSurferProtData = 1;
25172487      break;
25182488   case 3:
2519      state->m_mAlpineSurferProtData = 2;
2489      m_mAlpineSurferProtData = 2;
25202490      break;
25212491   default:
25222492      break;
25232493   }
25242494} /* alpinesa_prot_w */
25252495
2526static WRITE32_HANDLER( namcos22s_nvmem_w )
2496WRITE32_MEMBER(namcos22_state::namcos22s_nvmem_w)
25272497{
2528   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2529   mem_mask &= 0xff00ff00; // 8KB RAM over 16KB address space
2530   COMBINE_DATA(&state->m_nvmem[offset]);
2498   mem_mask &= 0xff00ff00; // 8KB RAM over 16KB address &space
2499   COMBINE_DATA(&m_nvmem[offset]);
25312500}
25322501
2533static WRITE32_HANDLER( namcos22s_chipselect_w )
2502WRITE32_MEMBER(namcos22_state::namcos22s_chipselect_w)
25342503{
25352504   // assume that this register is for chip enable/disable
25362505   // it's written many times during boot-up, and most games don't touch it afterwards (last value usually 0038 or 0838)
r14896r14897
25382507   // 4000: spot related (set in dirtdash and testmode)
25392508   // 0800: fade related?
25402509   // other bits: no clue
2541   namcos22_state *state = space->machine().driver_data<namcos22_state>();
25422510   if (ACCESSING_BITS_16_23)
2543      state->m_chipselect = data >> 16;
2511      m_chipselect = data >> 16;
25442512   else if (ACCESSING_BITS_24_31)
2545      state->m_chipselect = data >> 24;
2513      m_chipselect = data >> 24;
25462514}
25472515
25482516/* Namco Super System 22 */
25492517static ADDRESS_MAP_START( namcos22s_am, AS_PROGRAM, 32, namcos22_state )
25502518   AM_RANGE(0x000000, 0x3fffff) AM_ROM
2551   AM_RANGE(0x400000, 0x40001f) AM_READWRITE_LEGACY(namcos22_keycus_r, namcos22_keycus_w)
2519   AM_RANGE(0x400000, 0x40001f) AM_READWRITE(namcos22_keycus_r, namcos22_keycus_w)
25522520   AM_RANGE(0x410000, 0x413fff) AM_RAM /* C139 SCI buffer */
2553   AM_RANGE(0x420000, 0x42000f) AM_READ_LEGACY(namcos22_C139_SCI_r) AM_WRITEONLY /* C139 SCI registers */
2554   AM_RANGE(0x430000, 0x43000f) AM_READ_LEGACY(namcos22_gun_r)
2555   AM_RANGE(0x430000, 0x430003) AM_WRITE_LEGACY(namcos22_cpuleds_w)
2556   AM_RANGE(0x440000, 0x440003) AM_READ_LEGACY(namcos22_dipswitch_r)
2557   AM_RANGE(0x450008, 0x45000b) AM_READWRITE_LEGACY(namcos22_portbit_r, namcos22_portbit_w)
2558   AM_RANGE(0x460000, 0x463fff) AM_RAM_WRITE_LEGACY(namcos22s_nvmem_w) AM_BASE_SIZE(m_nvmem, m_nvmem_size)
2559   AM_RANGE(0x700000, 0x70001f) AM_READWRITE_LEGACY(namcos22_system_controller_r, namcos22s_system_controller_w) AM_BASE(m_system_controller)
2560   AM_RANGE(0x800000, 0x800003) AM_WRITE_LEGACY(namcos22s_chipselect_w)
2521   AM_RANGE(0x420000, 0x42000f) AM_READ(namcos22_C139_SCI_r) AM_WRITEONLY /* C139 SCI registers */
2522   AM_RANGE(0x430000, 0x43000f) AM_READ(namcos22_gun_r)
2523   AM_RANGE(0x430000, 0x430003) AM_WRITE(namcos22_cpuleds_w)
2524   AM_RANGE(0x440000, 0x440003) AM_READ(namcos22_dipswitch_r)
2525   AM_RANGE(0x450008, 0x45000b) AM_READWRITE(namcos22_portbit_r, namcos22_portbit_w)
2526   AM_RANGE(0x460000, 0x463fff) AM_RAM_WRITE(namcos22s_nvmem_w) AM_BASE_SIZE(m_nvmem, m_nvmem_size)
2527   AM_RANGE(0x700000, 0x70001f) AM_READWRITE(namcos22_system_controller_r, namcos22s_system_controller_w) AM_BASE(m_system_controller)
2528   AM_RANGE(0x800000, 0x800003) AM_WRITE(namcos22s_chipselect_w)
25612529   AM_RANGE(0x810000, 0x81000f) AM_RAM AM_BASE(m_czattr)
25622530   AM_RANGE(0x810200, 0x8103ff) AM_READWRITE(namcos22s_czram_r, namcos22s_czram_w)
25632531   AM_RANGE(0x820000, 0x8202ff) AM_WRITENOP /* leftover of old (non-super) video mixer device */
r14896r14897
25702538   AM_RANGE(0x900000, 0x90ffff) AM_RAM AM_BASE(m_vics_data)
25712539   AM_RANGE(0x940000, 0x94007f) AM_READWRITE(namcos22s_vics_control_r, namcos22s_vics_control_w) AM_BASE(m_vics_control)
25722540   AM_RANGE(0x980000, 0x9affff) AM_RAM AM_BASE(m_spriteram) /* C374 */
2573   AM_RANGE(0xa04000, 0xa0bfff) AM_READWRITE_LEGACY(namcos22_mcuram_r, namcos22_mcuram_w) AM_BASE(m_shareram) /* COM RAM */
2541   AM_RANGE(0xa04000, 0xa0bfff) AM_READWRITE(namcos22_mcuram_r, namcos22_mcuram_w) AM_BASE(m_shareram) /* COM RAM */
25742542   AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(namcos22_dspram_r, namcos22_dspram_w) AM_BASE(m_polygonram)
25752543   AM_RANGE(0xe00000, 0xe3ffff) AM_RAM /* workram */
25762544ADDRESS_MAP_END
25772545
2578static READ16_HANDLER( s22mcu_shared_r )
2546READ16_MEMBER(namcos22_state::s22mcu_shared_r)
25792547{
2580   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2581   UINT16 *share16 = (UINT16 *)state->m_shareram;
2548   UINT16 *share16 = (UINT16 *)m_shareram;
25822549
25832550   return share16[BYTE_XOR_BE(offset)];
25842551}
25852552
2586static WRITE16_HANDLER( s22mcu_shared_w )
2553WRITE16_MEMBER(namcos22_state::s22mcu_shared_w)
25872554{
2588   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2589   UINT16 *share16 = (UINT16 *)state->m_shareram;
2555   UINT16 *share16 = (UINT16 *)m_shareram;
25902556
25912557   COMBINE_DATA(&share16[BYTE_XOR_BE(offset)]);
25922558}
r14896r14897
26192585// Super System 22 M37710
26202586static ADDRESS_MAP_START( mcu_program, AS_PROGRAM, 16, namcos22_state )
26212587   AM_RANGE(0x002000, 0x002fff) AM_DEVREADWRITE("c352", c352_device, read, write)
2622   AM_RANGE(0x004000, 0x00bfff) AM_READWRITE_LEGACY(s22mcu_shared_r, s22mcu_shared_w )
2588   AM_RANGE(0x004000, 0x00bfff) AM_READWRITE(s22mcu_shared_r, s22mcu_shared_w )
26232589   AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("user4", 0xc000)
26242590   AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("user4", 0)
26252591   AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("user4", 0)
r14896r14897
26312597// System 22 37702
26322598static ADDRESS_MAP_START( mcu_s22_program, AS_PROGRAM, 16, namcos22_state )
26332599   AM_RANGE(0x002000, 0x002fff) AM_DEVREADWRITE("c352", c352_device, read, write)
2634   AM_RANGE(0x004000, 0x00bfff) AM_READWRITE_LEGACY(s22mcu_shared_r, s22mcu_shared_w )
2600   AM_RANGE(0x004000, 0x00bfff) AM_READWRITE(s22mcu_shared_r, s22mcu_shared_w )
26352601   AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("mcu", 0)
26362602   AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("user4", 0)
26372603   AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("user4", 0)
r14896r14897
26412607ADDRESS_MAP_END
26422608
26432609
2644static WRITE8_HANDLER( mcu_port4_w )
2610WRITE8_MEMBER(namcos22_state::mcu_port4_w)
26452611{
2646   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2647   state->m_p4 = data;
2612   m_p4 = data;
26482613}
26492614
2650static READ8_HANDLER( mcu_port4_r )
2615READ8_MEMBER(namcos22_state::mcu_port4_r)
26512616{
2652   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2653   return state->m_p4;
2617   return m_p4;
26542618}
26552619
2656static WRITE8_HANDLER( mcu_port5_w )
2620WRITE8_MEMBER(namcos22_state::mcu_port5_w)
26572621{
26582622   ;
26592623}
26602624
2661static READ8_HANDLER( mcu_port5_r )
2625READ8_MEMBER(namcos22_state::mcu_port5_r)
26622626{
2663   namcos22_state *state = space->machine().driver_data<namcos22_state>();
26642627
2665   if (state->m_p4 & 8)
2666      return input_port_read_safe(space->machine(), "MCUP5A", 0xff);
2628   if (m_p4 & 8)
2629      return input_port_read_safe(machine(), "MCUP5A", 0xff);
26672630   else
2668      return input_port_read_safe(space->machine(), "MCUP5B", 0xff);
2631      return input_port_read_safe(machine(), "MCUP5B", 0xff);
26692632}
26702633
2671static WRITE8_HANDLER( mcu_port6_w )
2634WRITE8_MEMBER(namcos22_state::mcu_port6_w)
26722635{
26732636   ;
26742637}
26752638
2676static READ8_HANDLER( mcu_port6_r )
2639READ8_MEMBER(namcos22_state::mcu_port6_r)
26772640{
26782641   return 0;
26792642}
26802643
2681static WRITE8_HANDLER( mcu_port7_w )
2644WRITE8_MEMBER(namcos22_state::mcu_port7_w)
26822645{
26832646   ;
26842647}
26852648
2686static READ8_HANDLER( mcu_port7_r )
2649READ8_MEMBER(namcos22_state::mcu_port7_r)
26872650{
26882651   return 0;
26892652}
26902653
2691static WRITE8_HANDLER( propcycle_mcu_port5_w )
2654WRITE8_MEMBER(namcos22_state::propcycle_mcu_port5_w)
26922655{
26932656   // prop cycle outputs:
26942657   // bit 1 = fan
26952658   // bit 2 = button light
26962659
26972660   output_set_value("fan0", data & 1);
2698   set_led_status(space->machine(), 0, data & 2);
2661   set_led_status(machine(), 0, data & 2);
26992662}
27002663
2701static READ8_HANDLER( propcycle_mcu_adc_r )
2664READ8_MEMBER(namcos22_state::propcycle_mcu_adc_r)
27022665{
27032666   // H+L = horizontal, 1 H+L = vertical
27042667   UINT16 ddx, ddy;
27052668
2706   ddx = input_port_read(space->machine(), "STICKX");
2669   ddx = input_port_read(machine(), "STICKX");
27072670   if (ddx > 0) ddx -= 1;
2708   ddy = input_port_read(space->machine(), "STICKY");
2671   ddy = input_port_read(machine(), "STICKY");
27092672   if (ddy > 0) ddy -= 1;
27102673
27112674   ddx <<= 2;
r14896r14897
27222685         // and timer A3 is configured by the MCU program to cause an interrupt each time
27232686         // it's clocked.  by counting the number of interrupts in a frame, we can determine
27242687         // how fast the user is pedaling.
2725         if( input_port_read(space->machine(), "JOY") & 0x10 )
2688         if( input_port_read(machine(), "JOY") & 0x10 )
27262689         {
27272690            int i;
27282691            for (i = 0; i < 16; i++)
27292692            {
2730               generic_pulse_irq_line(space->machine().device("mcu"), M37710_LINE_TIMERA3TICK, 1);
2693               generic_pulse_irq_line(machine().device("mcu")->execute(), M37710_LINE_TIMERA3TICK, 1);
27312694            }
27322695         }
27332696
r14896r14897
27492712   state->m_motor_status = param;
27502713}
27512714
2752static WRITE8_HANDLER( alpine_mcu_port5_w )
2715WRITE8_MEMBER(namcos22_state::alpine_mcu_port5_w)
27532716{
2754   namcos22_state *state = space->machine().driver_data<namcos22_state>();
27552717
27562718   // bits 1+2 are steplock motor outputs
27572719   if ((data & 6) == 6)
27582720   {
2759      if (state->m_motor_status == 2)
2721      if (m_motor_status == 2)
27602722      {
27612723         // free steps
2762         state->m_motor_status = 0;
2763         state->m_motor_timer->adjust(attotime::from_msec(500), 1);
2724         m_motor_status = 0;
2725         m_motor_timer->adjust(attotime::from_msec(500), 1);
27642726      }
27652727   }
27662728   else if (data & 4)
27672729   {
2768      if (state->m_motor_status == 1)
2730      if (m_motor_status == 1)
27692731      {
27702732         // lock steps
2771         state->m_motor_status = 0;
2772         state->m_motor_timer->adjust(attotime::from_msec(500), 2);
2733         m_motor_status = 0;
2734         m_motor_timer->adjust(attotime::from_msec(500), 2);
27732735      }
27742736   }
27752737}
27762738
2777static READ8_HANDLER( alpineracer_mcu_adc_r )
2739READ8_MEMBER(namcos22_state::alpineracer_mcu_adc_r)
27782740{
27792741   // 0 H+L = swing, 1 H+L = edge
2780   UINT16 swing = input_port_read(space->machine(), "SWING")<<2;
2781   UINT16 edge  = input_port_read(space->machine(), "EDGE" )<<2;
2742   UINT16 swing = input_port_read(machine(), "SWING")<<2;
2743   UINT16 edge  = input_port_read(machine(), "EDGE" )<<2;
27822744
27832745   switch (offset)
27842746   {
r14896r14897
27992761   }
28002762}
28012763
2802static READ8_HANDLER( cybrcycc_mcu_adc_r )
2764READ8_MEMBER(namcos22_state::cybrcycc_mcu_adc_r)
28032765{
28042766   UINT16 gas,brake,steer;
2805   ReadAnalogDrivingPorts( space->machine(), &gas, &brake, &steer );
2767   ReadAnalogDrivingPorts( machine(), &gas, &brake, &steer );
28062768
28072769   gas <<= 2;
28082770   brake <<= 2;
r14896r14897
28332795   }
28342796}
28352797
2836static READ8_HANDLER( tokyowar_mcu_adc_r )
2798READ8_MEMBER(namcos22_state::tokyowar_mcu_adc_r)
28372799{
28382800   UINT16 gas,brake,steer;
2839   ReadAnalogDrivingPorts( space->machine(), &gas, &brake, &steer );
2801   ReadAnalogDrivingPorts( machine(), &gas, &brake, &steer );
28402802
28412803   gas <<= 2;
28422804   brake <<= 2;
r14896r14897
28672829   }
28682830}
28692831
2870static READ8_HANDLER( aquajet_mcu_adc_r )
2832READ8_MEMBER(namcos22_state::aquajet_mcu_adc_r)
28712833{
28722834   UINT16 gas, steer, ddy;
28732835
2874   gas   = input_port_read(space->machine(), "GAS") ^ 0x7f;
2875   steer = input_port_read(space->machine(), "STEER") ^ 0xff;
2876   ddy = input_port_read(space->machine(), "STICKY");
2836   gas   = input_port_read(machine(), "GAS") ^ 0x7f;
2837   steer = input_port_read(machine(), "STEER") ^ 0xff;
2838   ddy = input_port_read(machine(), "STICKY");
28772839   if (ddy > 0) ddy -= 1;
28782840
28792841   gas <<= 2;
r14896r14897
29112873   }
29122874}
29132875
2914static READ8_HANDLER( airco22_mcu_adc_r )
2876READ8_MEMBER(namcos22_state::airco22_mcu_adc_r)
29152877{
29162878   UINT16 pedal, x, y;
29172879
2918   pedal = input_port_read(space->machine(), "PEDAL")<<2;
2919   x = input_port_read(space->machine(), "STICKX")<<2;
2920   y = input_port_read(space->machine(), "STICKY")<<2;
2880   pedal = input_port_read(machine(), "PEDAL")<<2;
2881   x = input_port_read(machine(), "STICKX")<<2;
2882   y = input_port_read(machine(), "STICKY")<<2;
29212883
29222884
29232885   switch (offset)
r14896r14897
29462908}
29472909
29482910static ADDRESS_MAP_START( mcu_io, AS_IO, 8, namcos22_state )
2949   AM_RANGE(M37710_PORT4, M37710_PORT4) AM_READ_LEGACY(mcu_port4_r ) AM_WRITE_LEGACY(mcu_port4_w )
2950   AM_RANGE(M37710_PORT5, M37710_PORT5) AM_READ_LEGACY(mcu_port5_r ) AM_WRITE_LEGACY(mcu_port5_w )
2951   AM_RANGE(M37710_PORT6, M37710_PORT6) AM_READ_LEGACY(mcu_port6_r ) AM_WRITE_LEGACY(mcu_port6_w )
2952   AM_RANGE(M37710_PORT7, M37710_PORT7) AM_READ_LEGACY(mcu_port7_r ) AM_WRITE_LEGACY(mcu_port7_w )
2911   AM_RANGE(M37710_PORT4, M37710_PORT4) AM_READ(mcu_port4_r ) AM_WRITE(mcu_port4_w )
2912   AM_RANGE(M37710_PORT5, M37710_PORT5) AM_READ(mcu_port5_r ) AM_WRITE(mcu_port5_w )
2913   AM_RANGE(M37710_PORT6, M37710_PORT6) AM_READ(mcu_port6_r ) AM_WRITE(mcu_port6_w )
2914   AM_RANGE(M37710_PORT7, M37710_PORT7) AM_READ(mcu_port7_r ) AM_WRITE(mcu_port7_w )
29532915ADDRESS_MAP_END
29542916
2955static READ8_HANDLER( mcu_port4_s22_r )
2917READ8_MEMBER(namcos22_state::mcu_port4_s22_r)
29562918{
2957   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2958   return state->m_p4 | 0x10;   // for C74, 0x10 selects sound MCU role, 0x00 selects control-reading role
2919   return m_p4 | 0x10;   // for C74, 0x10 selects sound MCU role, 0x00 selects control-reading role
29592920}
29602921
29612922static ADDRESS_MAP_START( mcu_s22_io, AS_IO, 8, namcos22_state )
2962   AM_RANGE(M37710_PORT4, M37710_PORT4) AM_READ_LEGACY(mcu_port4_s22_r )
2923   AM_RANGE(M37710_PORT4, M37710_PORT4) AM_READ(mcu_port4_s22_r )
29632924ADDRESS_MAP_END
29642925
29652926static TIMER_DEVICE_CALLBACK( mcu_irq )
r14896r14897
30553016     *     C389? (Cyber Cycles)
30563017     *     C392? (Ace Driver Victory Lap)
30573018     */
3058   AM_RANGE(0x20000000, 0x2000000f) AM_READWRITE_LEGACY(namcos22_keycus_r, namcos22_keycus_w)
3019   AM_RANGE(0x20000000, 0x2000000f) AM_READWRITE(namcos22_keycus_r, namcos22_keycus_w)
30593020
30603021   /**
30613022     * C139 SCI Buffer
r14896r14897
30983059     *     2002000c  2  R/W RX FIFO Pointer (0x0000 - 0x0fff)
30993060     *     2002000e  2  W   TX FIFO Pointer (0x0000 - 0x1fff)
31003061     */
3101   AM_RANGE(0x20020000, 0x2002000f) AM_READ_LEGACY(namcos22_C139_SCI_r) AM_WRITEONLY
3062   AM_RANGE(0x20020000, 0x2002000f) AM_READ(namcos22_C139_SCI_r) AM_WRITEONLY
31023063
31033064   /**
31043065     * System Controller: Interrupt Control, Peripheral Control
31053066     *
31063067     */
3107   AM_RANGE(0x40000000, 0x4000001f) AM_READWRITE_LEGACY(namcos22_system_controller_r, namcos22_system_controller_w) AM_BASE(m_system_controller)
3068   AM_RANGE(0x40000000, 0x4000001f) AM_READWRITE(namcos22_system_controller_r, namcos22_system_controller_w) AM_BASE(m_system_controller)
31083069
31093070   /**
31103071     * Unknown Device (optional for diagnostics?)
r14896r14897
31193080     *     0x50000000 - DIPSW3
31203081     *     0x50000001 - DIPSW2
31213082     */
3122   AM_RANGE(0x50000000, 0x50000003) AM_READ_LEGACY(namcos22_dipswitch_r) AM_WRITENOP
3123   AM_RANGE(0x50000008, 0x5000000b) AM_READWRITE_LEGACY(namcos22_portbit_r, namcos22_portbit_w)
3083   AM_RANGE(0x50000000, 0x50000003) AM_READ(namcos22_dipswitch_r) AM_WRITENOP
3084   AM_RANGE(0x50000008, 0x5000000b) AM_READWRITE(namcos22_portbit_r, namcos22_portbit_w)
31243085
31253086   /**
31263087     * EEPROM
r14896r14897
31693130     * +0x0300 - 0x03ff?    Song Title (put messages here from Sound CPU)
31703131     */
31713132   AM_RANGE(0x60000000, 0x60003fff) AM_WRITENOP
3172   AM_RANGE(0x60004000, 0x6000bfff) AM_READWRITE_LEGACY(namcos22_mcuram_r, namcos22_mcuram_w) AM_BASE(m_shareram)
3133   AM_RANGE(0x60004000, 0x6000bfff) AM_READWRITE(namcos22_mcuram_r, namcos22_mcuram_w) AM_BASE(m_shareram)
31733134
31743135   /**
31753136     * C71 (TI TMS320C25 DSP) Shared RAM (0x70000000 - 0x70020000)
r14896r14897
54465407// MCU speed cheats (every bit helps with these games)
54475408
54485409// for MCU BIOS v1.41
5449static READ16_HANDLER( mcu141_speedup_r )
5410READ16_MEMBER(namcos22_state::mcu141_speedup_r)
54505411{
5451   namcos22_state *state = space->machine().driver_data<namcos22_state>();
5452   if ((cpu_get_pc(&space->device()) == 0xc12d) && (!(state->m_su_82 & 0xff00)))
5412   if ((cpu_get_pc(&space.device()) == 0xc12d) && (!(m_su_82 & 0xff00)))
54535413   {
5454      device_spin_until_interrupt(&space->device());
5414      device_spin_until_interrupt(&space.device());
54555415   }
54565416
5457   return state->m_su_82;
5417   return m_su_82;
54585418}
54595419
5460static WRITE16_HANDLER( mcu_speedup_w )
5420WRITE16_MEMBER(namcos22_state::mcu_speedup_w)
54615421{
5462   namcos22_state *state = space->machine().driver_data<namcos22_state>();
5463   COMBINE_DATA(&state->m_su_82);
5422   COMBINE_DATA(&m_su_82);
54645423}
54655424
54665425// for MCU BIOS v1.30
5467static READ16_HANDLER( mcu130_speedup_r )
5426READ16_MEMBER(namcos22_state::mcu130_speedup_r)
54685427{
5469   namcos22_state *state = space->machine().driver_data<namcos22_state>();
5470   if ((cpu_get_pc(&space->device()) == 0xc12a) && (!(state->m_su_82 & 0xff00)))
5428   if ((cpu_get_pc(&space.device()) == 0xc12a) && (!(m_su_82 & 0xff00)))
54715429   {
5472      device_spin_until_interrupt(&space->device());
5430      device_spin_until_interrupt(&space.device());
54735431   }
54745432
5475   return state->m_su_82;
5433   return m_su_82;
54765434}
54775435
54785436// for NSTX7702 v1.00 (C74)
5479static READ16_HANDLER( mcuc74_speedup_r )
5437READ16_MEMBER(namcos22_state::mcuc74_speedup_r)
54805438{
5481   namcos22_state *state = space->machine().driver_data<namcos22_state>();
5482   if (((cpu_get_pc(&space->device()) == 0xc0df) || (cpu_get_pc(&space->device()) == 0xc101)) && (!(state->m_su_82 & 0xff00)))
5439   if (((cpu_get_pc(&space.device()) == 0xc0df) || (cpu_get_pc(&space.device()) == 0xc101)) && (!(m_su_82 & 0xff00)))
54835440   {
5484      device_spin_until_interrupt(&space->device());
5441      device_spin_until_interrupt(&space.device());
54855442   }
54865443
5487   return state->m_su_82;
5444   return m_su_82;
54885445}
54895446
54905447static void install_c74_speedup(running_machine &machine)
54915448{
5449   namcos22_state *state = machine.driver_data<namcos22_state>();
54925450   if (MCU_SPEEDUP)
5493      machine.device("mcu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x80, 0x81, FUNC(mcuc74_speedup_r), FUNC(mcu_speedup_w));
5451      machine.device("mcu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x80, 0x81, read16_delegate(FUNC(namcos22_state::mcuc74_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state));
54945452}
54955453
54965454static void install_130_speedup(running_machine &machine)
54975455{
5456   namcos22_state *state = machine.driver_data<namcos22_state>();
54985457   // install speedup cheat for 1.30 MCU BIOS
54995458   if (MCU_SPEEDUP)
5500      machine.device("mcu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x82, 0x83, FUNC(mcu130_speedup_r), FUNC(mcu_speedup_w));
5459      machine.device("mcu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos22_state::mcu130_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state));
55015460}
55025461
55035462static void install_141_speedup(running_machine &machine)
55045463{
5464   namcos22_state *state = machine.driver_data<namcos22_state>();
55055465   // install speedup cheat for 1.41 MCU BIOS
55065466   if (MCU_SPEEDUP)
5507      machine.device("mcu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x82, 0x83, FUNC(mcu141_speedup_r), FUNC(mcu_speedup_w));
5467      machine.device("mcu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos22_state::mcu141_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state));
55085468}
55095469
55105470static void namcos22_init( running_machine &machine, int game_type )
r14896r14897
55275487   namcos22_state *state = machine.driver_data<namcos22_state>();
55285488   namcos22_init(machine, game_type);
55295489
5530   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(alpineracer_mcu_adc_r));
5531   machine.device("mcu")->memory().space(AS_IO)->install_legacy_write_handler(M37710_PORT5, M37710_PORT5, FUNC(alpine_mcu_port5_w));
5490   machine.device("mcu")->memory().space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::alpineracer_mcu_adc_r),state));
5491   machine.device("mcu")->memory().space(AS_IO)->install_write_handler(M37710_PORT5, M37710_PORT5, write8_delegate(FUNC(namcos22_state::alpine_mcu_port5_w),state));
55325492
55335493   state->m_motor_timer = machine.scheduler().timer_alloc(FUNC(alpine_steplock_callback));
55345494   state->m_motor_timer->reset();
r14896r14897
55605520   namcos22_state *state = machine.driver_data<namcos22_state>();
55615521   alpine_init_common(machine, NAMCOS22_ALPINE_SURFER);
55625522
5563   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x200000, 0x200003, FUNC(alpinesa_prot_r));
5564   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x300000, 0x300003, FUNC(alpinesa_prot_w));
5523   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler (0x200000, 0x200003, read32_delegate(FUNC(namcos22_state::alpinesa_prot_r),state));
5524   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(namcos22_state::alpinesa_prot_w),state));
55655525   install_141_speedup(machine);
55665526
55675527   state->m_keycus_id = 0x01a9;
r14896r14897
55695529
55705530static DRIVER_INIT( airco22 )
55715531{
5532   namcos22_state *state = machine.driver_data<namcos22_state>();
55725533   namcos22_init(machine, NAMCOS22_AIR_COMBAT22);
55735534
55745535   // S22-BIOS ver1.20 namco all rights reserved 94/12/21
5575   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(airco22_mcu_adc_r));
5536   machine.device("mcu")->memory().space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::airco22_mcu_adc_r),state));
55765537}
55775538
55785539static DRIVER_INIT( propcycl )
r14896r14897
55955556//   pROM[0x22296/4] |= 0x00004e75;
55965557
55975558   namcos22_init(machine, NAMCOS22_PROP_CYCLE);
5598
5599   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(propcycle_mcu_adc_r));
5600   machine.device("mcu")->memory().space(AS_IO)->install_legacy_write_handler(M37710_PORT5, M37710_PORT5, FUNC(propcycle_mcu_port5_w));
5559   namcos22_state *state = machine.driver_data<namcos22_state>();
5560   machine.device("mcu")->memory().space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::propcycle_mcu_adc_r),state));
5561   machine.device("mcu")->memory().space(AS_IO)->install_write_handler(M37710_PORT5, M37710_PORT5, write8_delegate(FUNC(namcos22_state::propcycle_mcu_port5_w),state));
56015562   install_141_speedup(machine);
56025563}
56035564
r14896r14897
56635624   namcos22_state *state = machine.driver_data<namcos22_state>();
56645625   namcos22_init(machine, NAMCOS22_CYBER_CYCLES);
56655626
5666   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(cybrcycc_mcu_adc_r));
5627   machine.device("mcu")->memory().space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::cybrcycc_mcu_adc_r),state));
56675628   install_130_speedup(machine);
56685629
56695630   state->m_keycus_id = 0x0387;
r14896r14897
56815642   namcos22_state *state = machine.driver_data<namcos22_state>();
56825643   namcos22_init(machine, NAMCOS22_TOKYO_WARS);
56835644
5684   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(tokyowar_mcu_adc_r));
5645   machine.device("mcu")->memory().space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::tokyowar_mcu_adc_r),state));
56855646   install_141_speedup(machine);
56865647
56875648   state->m_keycus_id = 0x01a8;
r14896r14897
56905651static DRIVER_INIT( aquajet )
56915652{
56925653   namcos22_init(machine, NAMCOS22_AQUA_JET);
5693
5694   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(aquajet_mcu_adc_r));
5654   namcos22_state *state = machine.driver_data<namcos22_state>();
5655   machine.device("mcu")->memory().space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::aquajet_mcu_adc_r),state));
56955656   install_141_speedup(machine);
56965657}
56975658
r14896r14897
57005661   namcos22_state *state = machine.driver_data<namcos22_state>();
57015662   namcos22_init(machine, NAMCOS22_DIRT_DASH);
57025663
5703   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(cybrcycc_mcu_adc_r));
5664   machine.device("mcu")->memory().space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::cybrcycc_mcu_adc_r),state));
57045665   install_141_speedup(machine);
57055666
57065667   state->m_keycus_id = 0x01a2;
src/mame/drivers/flyball.c
r14896r14897
2222{
2323public:
2424   flyball_state(const machine_config &mconfig, device_type type, const char *tag)
25      : driver_device(mconfig, type, tag) { }
25      : driver_device(mconfig, type, tag) ,
26      m_playfield_ram(*this, "playfield_ram"),
27      m_rombase(*this, "rombase"){ }
2628
2729   /* memory pointers */
28   UINT8 *  m_rombase;
29   UINT8 *  m_playfield_ram;
30   required_shared_ptr<UINT8> m_playfield_ram;
31   required_shared_ptr<UINT8> m_rombase;
3032
3133   /* video-related */
3234   tilemap_t  *m_tmap;
r14896r14897
7375static TILE_GET_INFO( flyball_get_tile_info )
7476{
7577   flyball_state *state = machine.driver_data<flyball_state>();
76   UINT8 data = state->m_playfield_ram[tile_index];
78   UINT8 data = state->m_playfield_ram.target()[tile_index];
7779   int flags = ((data & 0x40) ? TILE_FLIPX : 0) | ((data & 0x80) ? TILE_FLIPY : 0);
7880   int code = data & 63;
7981
r14896r14897
262264   AM_RANGE(0x0900, 0x0900) AM_WRITE(flyball_potmask_w)
263265   AM_RANGE(0x0a00, 0x0a07) AM_WRITE(flyball_misc_w)
264266   AM_RANGE(0x0b00, 0x0b00) AM_READ(flyball_input_r)
265   AM_RANGE(0x0d00, 0x0eff) AM_WRITEONLY AM_BASE(m_playfield_ram)
266   AM_RANGE(0x1000, 0x1fff) AM_ROM AM_BASE(m_rombase) /* program */
267   AM_RANGE(0x0d00, 0x0eff) AM_WRITEONLY AM_SHARE("playfield_ram")
268   AM_RANGE(0x1000, 0x1fff) AM_ROM AM_SHARE("rombase") /* program */
267269ADDRESS_MAP_END
268270
269271
r14896r14897
390392   UINT8* ROM = machine.region("maincpu")->base() + 0x2000;
391393
392394   for (i = 0; i < 0x1000; i++)
393      state->m_rombase[i] = ROM[i ^ 0x1ff];
395      state->m_rombase.target()[i] = ROM[i ^ 0x1ff];
394396
395397   machine.device("maincpu")->reset();
396398
src/mame/drivers/galaxold.c
r14896r14897
413413   AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
414414   AM_RANGE(0x5400, 0x57ff) AM_READ(galaxold_videoram_r)
415415   AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
416   AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
417   AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
416   AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
417   AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
418418   AM_RANGE(0x5880, 0x58ff) AM_RAM
419419   AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0")
420420   AM_RANGE(0x6000, 0x6001) AM_WRITE(galaxold_leds_w)
r14896r14897
443443   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
444444   AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r)
445445   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
446   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
447   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
446   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
447   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
448448   AM_RANGE(0x9880, 0x98ff) AM_RAM
449449   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
450450   AM_RANGE(0xa003, 0xa003) AM_WRITE(galaxold_coin_counter_w)
r14896r14897
475475   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
476476   AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r)
477477   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
478   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
479   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
478   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
479   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
480480   AM_RANGE(0x9880, 0x98ff) AM_RAM
481481   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
482482   AM_RANGE(0xa000, 0xa002) AM_WRITE(galaxold_gfxbank_w)// a002 - sprite bank
r14896r14897
500500   AM_RANGE(0x6000, 0x6fff) AM_RAM
501501   AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(m_videoram)
502502   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
503   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
504   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
503   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
504   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
505505   AM_RANGE(0x9880, 0x98ff) AM_RAM
506506   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0")
507507   AM_RANGE(0xc000, 0xc001) AM_WRITE(galaxold_leds_w)
r14896r14897
527527   AM_RANGE(0x6000, 0x6fff) AM_RAM
528528   AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(m_videoram)
529529   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
530   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
531   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
530   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
531   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
532532   AM_RANGE(0x9880, 0x98ff) AM_RAM
533533   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
534534   AM_RANGE(0xa001, 0xa002) AM_WRITE(galaxold_leds_w)                                              /* GUESS */
r14896r14897
554554   AM_RANGE(0x4000, 0x47ff) AM_RAM
555555   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
556556   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
557   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
558   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
557   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
558   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
559559   AM_RANGE(0x5080, 0x50ff) AM_RAM
560560   AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0")
561561   AM_RANGE(0x6000, 0x6001) AM_WRITENOP  /* sound triggers */
r14896r14897
590590   AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
591591   AM_RANGE(0x4c00, 0x4fff) AM_WRITE(galaxold_videoram_w) // mirror
592592   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
593   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
594   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
593   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
594   AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
595595   AM_RANGE(0x5080, 0x50ff) AM_RAM
596596   AM_RANGE(0x5800, 0x5fff) AM_READ(scramb2_protection_r) // must return 0x25
597597   AM_RANGE(0x6000, 0x6007) AM_READ(scramb2_port0_r) // reads from 8 addresses, 1 bit per address
r14896r14897
615615   AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
616616   AM_RANGE(0x5400, 0x57ff) AM_READ(galaxold_videoram_r)
617617   AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
618   AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
619   AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
618   AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
619   AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
620620   AM_RANGE(0x5880, 0x58ff) AM_RAM
621621   AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0")
622622   AM_RANGE(0x6000, 0x6001) AM_WRITE(galaxold_leds_w)
r14896r14897
646646   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
647647   AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r)
648648   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
649   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
650   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
649   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
650   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
651651   AM_RANGE(0x9880, 0x98ff) AM_RAM
652652   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
653653   AM_RANGE(0xa003, 0xa003) AM_WRITE(galaxold_coin_counter_w)
r14896r14897
667667   AM_RANGE(0x7000, 0x7fff) AM_ROM
668668   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
669669   AM_RANGE(0x9800, 0x983f) AM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
670   AM_RANGE(0x9840, 0x987f) AM_WRITEONLY AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
671   AM_RANGE(0x98c0, 0x98ff) AM_WRITEONLY AM_BASE(m_spriteram2) AM_SIZE(m_spriteram2_size)
670   AM_RANGE(0x9840, 0x987f) AM_WRITEONLY AM_BASE_SIZE(m_spriteram,m_spriteram_size)
671   AM_RANGE(0x98c0, 0x98ff) AM_WRITEONLY AM_BASE_SIZE(m_spriteram2,m_spriteram2_size)
672672   AM_RANGE(0xa000, 0xa0ff) AM_READ_PORT("IN0")
673673   AM_RANGE(0xa003, 0xa003) AM_WRITE(galaxold_coin_counter_w)
674674  //AM_RANGE(0xa004, 0xa007) AM_WRITE_LEGACY(galaxian_lfo_freq_w)
r14896r14897
692692   AM_RANGE(0x7000, 0x7000) AM_READ_PORT("DSW0") /* mirror */
693693   AM_RANGE(0x8000, 0x87ff) AM_RAM
694694   AM_RANGE(0x8800, 0x883f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
695   AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
696   AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
695   AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
696   AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
697697   AM_RANGE(0x8880, 0x8bff) AM_WRITENOP
698698   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
699699   AM_RANGE(0x9800, 0x9800) AM_READ(watchdog_reset_r)
r14896r14897
719719   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(m_videoram)
720720   AM_RANGE(0x9400, 0x97ff) AM_WRITENOP // not used
721721   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
722   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
723   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
722   AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
723   AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
724724   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
725725   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN1")
726726   AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW0")
r14896r14897
745745   AM_RANGE(0x4800, 0x4bff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(m_videoram)
746746   AM_RANGE(0x4c00, 0x4fff) AM_WRITE(galaxold_videoram_w)
747747   AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
748   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
748   AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
749749   AM_RANGE(0x6801, 0x6801) AM_WRITENOP //continuosly 0 and 1
750750   AM_RANGE(0x6802, 0x6802) AM_WRITE(galaxold_coin_counter_w)
751751   AM_RANGE(0x6806, 0x6806) AM_WRITE(galaxold_flip_screen_x_w)
r14896r14897
781781   AM_RANGE(0x6103, 0x6103) AM_WRITENOP
782782   AM_RANGE(0x6200, 0x6203) AM_WRITENOP AM_BASE(m_attributesram)
783783   AM_RANGE(0x8000, 0x9fff) AM_ROM
784   AM_RANGE(0xffe6, 0xffff) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
784   AM_RANGE(0xffe6, 0xffff) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
785785ADDRESS_MAP_END
786786
787787static ADDRESS_MAP_START( harem_cpu2, AS_PROGRAM, 8, galaxold_state )
r14896r14897
798798   AM_RANGE(0x20, 0x20) AM_DEVWRITE_LEGACY("ay2", ay8910_data_w)
799799   AM_RANGE(0x40, 0x40) AM_DEVWRITE_LEGACY("ay3", ay8910_address_w)
800800   AM_RANGE(0x80, 0x80) AM_DEVWRITE_LEGACY("ay3", ay8910_data_w)
801   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
801   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_byte_r)
802802ADDRESS_MAP_END
803803
804804static ADDRESS_MAP_START( hunchbkg, AS_PROGRAM, 8, galaxold_state )
805805   AM_RANGE(0x0000, 0x0fff) AM_ROM
806806   AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
807   AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
807   AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE_SIZE(m_spriteram,m_spriteram_size)
808808   AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0")
809809   AM_RANGE(0x1500, 0x1501) AM_MIRROR(0x6000) AM_WRITE(galaxold_leds_w)         /* not connected ... */
810810   AM_RANGE(0x1502, 0x1502) AM_MIRROR(0x6000) AM_WRITE(galaxold_coin_lockout_w)   /* not connected ... */
r14896r14897
839839static ADDRESS_MAP_START( drivfrcg, AS_PROGRAM, 8, galaxold_state )
840840   AM_RANGE(0x0000, 0x0fff) AM_ROM
841841   AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
842   AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
842   AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE_SIZE(m_spriteram,m_spriteram_size)
843843   AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0")
844844   AM_RANGE(0x1503, 0x1503) AM_MIRROR(0x6000) AM_WRITE(galaxold_coin_counter_w)
845845   AM_RANGE(0x1580, 0x1580) AM_MIRROR(0x6000) AM_READ_PORT("IN1")
r14896r14897
867867static ADDRESS_MAP_START( racknrol, AS_PROGRAM, 8, galaxold_state )
868868   AM_RANGE(0x0000, 0x0fff) AM_ROM
869869   AM_RANGE(0x1400, 0x143f) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(m_attributesram)
870   AM_RANGE(0x1440, 0x14bf) AM_MIRROR(0x6000) AM_RAM AM_BASE(m_spriteram) AM_SIZE(m_spriteram_size)
870   AM_RANGE(0x1440, 0x14bf) AM_MIRROR(0x6000) AM_RAM AM_BASE_SIZE(m_spriteram,m_spriteram_size)
871871   AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_RAM
872872   AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0")
873873   AM_RANGE(0x1580, 0x1580) AM_MIRROR(0x6000) AM_READ_PORT("IN1")
src/mame/drivers/atarisy1.c
r14896r14897
261261}
262262
263263
264static READ16_HANDLER( joystick_r )
264READ16_MEMBER(atarisy1_state::joystick_r)
265265{
266   atarisy1_state *state = space->machine().driver_data<atarisy1_state>();
267266   int newval = 0xff;
268267   static const char *const portnames[] = { "IN0", "IN1" };
269268
270269   /* digital joystick type */
271   if (state->m_joystick_type == 1)
272      newval = (input_port_read(space->machine(), "IN0") & (0x80 >> offset)) ? 0xf0 : 0x00;
270   if (m_joystick_type == 1)
271      newval = (input_port_read(machine(), "IN0") & (0x80 >> offset)) ? 0xf0 : 0x00;
273272
274273   /* Hall-effect analog joystick */
275   else if (state->m_joystick_type == 2)
276      newval = input_port_read(space->machine(), portnames[offset & 1]);
274   else if (m_joystick_type == 2)
275      newval = input_port_read(machine(), portnames[offset & 1]);
277276
278277   /* Road Blasters gas pedal */
279   else if (state->m_joystick_type == 3)
280      newval = input_port_read(space->machine(), "IN1");
278   else if (m_joystick_type == 3)
279      newval = input_port_read(machine(), "IN1");
281280
282281   /* the A4 bit enables/disables joystick IRQs */
283   state->m_joystick_int_enable = ((offset >> 3) & 1) ^ 1;
282   m_joystick_int_enable = ((offset >> 3) & 1) ^ 1;
284283
285284   /* clear any existing interrupt and set a timer for a new one */
286   state->m_joystick_int = 0;
287   state->m_joystick_timer->adjust(attotime::from_usec(50), newval);
288   atarigen_update_interrupts(space->machine());
285   m_joystick_int = 0;
286   m_joystick_timer->adjust(attotime::from_usec(50), newval);
287   atarigen_update_interrupts(machine());
289288
290   return state->m_joystick_value;
289   return m_joystick_value;
291290}
292291
293292
294static WRITE16_HANDLER( joystick_w )
293WRITE16_MEMBER(atarisy1_state::joystick_w)
295294{
296295   /* the A4 bit enables/disables joystick IRQs */
297   atarisy1_state *state = space->machine().driver_data<atarisy1_state>();
298   state->m_joystick_int_enable = ((offset >> 3) & 1) ^ 1;
296   m_joystick_int_enable = ((offset >> 3) & 1) ^ 1;
299297}
300298
301299
r14896r14897
306304 *
307305 *************************************/
308306
309static READ16_HANDLER( trakball_r )
307READ16_MEMBER(atarisy1_state::trakball_r)
310308{
311   atarisy1_state *state = space->machine().driver_data<atarisy1_state>();
312309   int result = 0xff;
313310
314311   /* Marble Madness trackball type -- rotated 45 degrees! */
315   if (state->m_trackball_type == 1)
312   if (m_trackball_type == 1)
316313   {
317314      int player = (offset >> 1) & 1;
318315      int which = offset & 1;
r14896r14897
324321
325322         if (player == 0)
326323         {
327            posx = (INT8)input_port_read(space->machine(), "IN0");
328            posy = (INT8)input_port_read(space->machine(), "IN1");
324            posx = (INT8)input_port_read(machine(), "IN0");
325            posy = (INT8)input_port_read(machine(), "IN1");
329326         }
330327         else
331328         {
332            posx = (INT8)input_port_read(space->machine(), "IN2");
333            posy = (INT8)input_port_read(space->machine(), "IN3");
329            posx = (INT8)input_port_read(machine(), "IN2");
330            posy = (INT8)input_port_read(machine(), "IN3");
334331         }
335332
336         state->m_cur[player][0] = posx + posy;
337         state->m_cur[player][1] = posx - posy;
333         m_cur[player][0] = posx + posy;
334         m_cur[player][1] = posx - posy;
338335      }
339336
340      result = state->m_cur[player][which];
337      result = m_cur[player][which];
341338   }
342339
343340   /* Road Blasters steering wheel */
344   else if (state->m_trackball_type == 2)
345      result = input_port_read(space->machine(), "IN0");
341   else if (m_trackball_type == 2)
342      result = input_port_read(machine(), "IN0");
346343
347344   return result;
348345}
r14896r14897
355352 *
356353 *************************************/
357354
358static READ16_HANDLER( port4_r )
355READ16_MEMBER(atarisy1_state::port4_r)
359356{
360   atarisy1_state *state = space->machine().driver_data<atarisy1_state>();
361   int temp = input_port_read(space->machine(), "F60000");
362   if (state->m_cpu_to_sound_ready) temp ^= 0x0080;
357   int temp = input_port_read(machine(), "F60000");
358   if (m_cpu_to_sound_ready) temp ^= 0x0080;
363359   return temp;
364360}
365361
r14896r14897
371367 *
372368 *************************************/
373369
374static READ8_HANDLER( switch_6502_r )
370READ8_MEMBER(atarisy1_state::switch_6502_r)
375371{
376   atarisy1_state *state = space->machine().driver_data<atarisy1_state>();
377   int temp = input_port_read(space->machine(), "1820");
372   int temp = input_port_read(machine(), "1820");
378373
379   if (state->m_cpu_to_sound_ready) temp ^= 0x08;
380   if (state->m_sound_to_cpu_ready) temp ^= 0x10;
381   if (!(input_port_read(space->machine(), "F60000") & 0x0040)) temp ^= 0x80;
374   if (m_cpu_to_sound_ready) temp ^= 0x08;
375   if (m_sound_to_cpu_ready) temp ^= 0x10;
376   if (!(input_port_read(machine(), "F60000") & 0x0040)) temp ^= 0x80;
382377
383378   return temp;
384379}
r14896r14897
455450 *
456451 *************************************/
457452
458static WRITE8_HANDLER( led_w )
453WRITE8_MEMBER(atarisy1_state::led_w)
459454{
460   set_led_status(space->machine(), offset, ~data & 1);
455   set_led_status(machine(), offset, ~data & 1);
461456}
462457
463458
r14896r14897
484479   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_BASE(m_playfield)
485480   AM_RANGE(0xa02000, 0xa02fff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarisy1_spriteram_w)
486481   AM_RANGE(0xa03000, 0xa03fff) AM_RAM_WRITE_LEGACY(atarigen_alpha_w) AM_BASE(m_alpha)
487   AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram16_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
482   AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
488483   AM_RANGE(0xf00000, 0xf00fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
489   AM_RANGE(0xf20000, 0xf20007) AM_READ_LEGACY(trakball_r)
490   AM_RANGE(0xf40000, 0xf4001f) AM_READWRITE_LEGACY(joystick_r, joystick_w)
491   AM_RANGE(0xf60000, 0xf60003) AM_READ_LEGACY(port4_r)
484   AM_RANGE(0xf20000, 0xf20007) AM_READ(trakball_r)
485   AM_RANGE(0xf40000, 0xf4001f) AM_READWRITE(joystick_r, joystick_w)
486   AM_RANGE(0xf60000, 0xf60003) AM_READ(port4_r)
492487   AM_RANGE(0xf80000, 0xf80001) AM_WRITE_LEGACY(atarigen_sound_w)   /* used by roadbls2 */
493488   AM_RANGE(0xfc0000, 0xfc0001) AM_READ_LEGACY(atarigen_sound_r)
494489   AM_RANGE(0xfe0000, 0xfe0001) AM_WRITE_LEGACY(atarigen_sound_w)
r14896r14897
507502   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("via6522_0", via6522_device, read, write)
508503   AM_RANGE(0x1800, 0x1801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
509504   AM_RANGE(0x1810, 0x1810) AM_READWRITE_LEGACY(atarigen_6502_sound_r, atarigen_6502_sound_w)
510   AM_RANGE(0x1820, 0x1820) AM_READ_LEGACY(switch_6502_r)
511   AM_RANGE(0x1824, 0x1825) AM_WRITE_LEGACY(led_w)
505   AM_RANGE(0x1820, 0x1820) AM_READ(switch_6502_r)
506   AM_RANGE(0x1824, 0x1825) AM_WRITE(led_w)
512507   AM_RANGE(0x1870, 0x187f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
513508   AM_RANGE(0x4000, 0xffff) AM_ROM
514509ADDRESS_MAP_END
src/mame/drivers/unkhorse.c
r14896r14897
2727{
2828public:
2929   horse_state(const machine_config &mconfig, device_type type, const char *tag)
30      : driver_device(mconfig, type, tag) { }
30      : driver_device(mconfig, type, tag) ,
31      m_video_ram(*this, "video_ram"),
32      m_color_ram(*this, "color_ram"){ }
3133 
32   UINT8 *m_video_ram;
33   UINT8 *m_color_ram;
34   required_shared_ptr<UINT8> m_video_ram;
35   required_shared_ptr<UINT8> m_color_ram;
3436   UINT8 m_output;
3537};
3638 
r14896r14897
5658   {
5759      for (int x = 0; x < 32; x++)
5860      {
59         UINT8 data = state->m_video_ram[y << 5 | x];
60         UINT8 color = state->m_color_ram[(y << 3 & 0x780) | x] >> 4;
61         UINT8 data = state->m_video_ram.target()[y << 5 | x];
62         UINT8 color = state->m_color_ram.target()[(y << 3 & 0x780) | x] >> 4;
6163 
6264         for (int i = 0; i < 8; i++)
6365            bitmap.pix16(y, x << 3 | i) = (data >> i & 1) ? color : 0;
r14896r14897
7779static ADDRESS_MAP_START( horse_map, AS_PROGRAM, 8, horse_state )
7880   AM_RANGE(0x0000, 0x37ff) AM_ROM
7981   AM_RANGE(0x4000, 0x40ff) AM_DEVREADWRITE("i8155", i8155_device, memory_r, memory_w)
80   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_BASE(m_video_ram)
81   AM_RANGE(0x8000, 0x879f) AM_RAM AM_BASE(m_color_ram) AM_MIRROR(0x0860)
82   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE("video_ram")
83   AM_RANGE(0x8000, 0x879f) AM_RAM AM_SHARE("color_ram") AM_MIRROR(0x0860)
8284 
8385ADDRESS_MAP_END
8486 
src/mame/drivers/pturn.c
r14896r14897
8383{
8484public:
8585   pturn_state(const machine_config &mconfig, device_type type, const char *tag)
86      : driver_device(mconfig, type, tag) { }
86      : driver_device(mconfig, type, tag) ,
87      m_videoram(*this, "videoram"),
88      m_spriteram(*this, "spriteram"){ }
8789
88   UINT8 *m_videoram;
90   required_shared_ptr<UINT8> m_videoram;
8991   tilemap_t *m_fgmap;
9092   tilemap_t *m_bgmap;
9193   int m_bgbank;
r14896r14897
9597   int m_bgcolor;
9698   int m_nmi_main;
9799   int m_nmi_sub;
98   UINT8 *m_spriteram;
99   size_t m_spriteram_size;
100   required_shared_ptr<UINT8> m_spriteram;
100101   DECLARE_WRITE8_MEMBER(pturn_videoram_w);
101102   DECLARE_WRITE8_MEMBER(nmi_main_enable_w);
102103   DECLARE_WRITE8_MEMBER(nmi_sub_enable_w);
r14896r14897
127128static TILE_GET_INFO( get_pturn_tile_info )
128129{
129130   pturn_state *state = machine.driver_data<pturn_state>();
130   UINT8 *videoram = state->m_videoram;
131   UINT8 *videoram = state->m_videoram.target();
131132   int tileno;
132133   tileno = videoram[tile_index];
133134
r14896r14897
163164static SCREEN_UPDATE_IND16(pturn)
164165{
165166   pturn_state *state = screen.machine().driver_data<pturn_state>();
166   UINT8 *spriteram = state->m_spriteram;
167   UINT8 *spriteram = state->m_spriteram.target();
167168   int offs;
168169   int sx, sy;
169170   int flipx, flipy;
r14896r14897
179180      flipy=spriteram[offs+1]&0x80;
180181
181182
182      if (flip_screen_x_get(screen.machine()))
183      if (state->flip_screen_x())
183184      {
184185         sx = 224 - sx;
185186         flipx ^= 0x40;
186187      }
187188
188      if (flip_screen_y_get(screen.machine()))
189      if (state->flip_screen_y())
189190      {
190191         flipy ^= 0x80;
191192         sy = 224 - sy;
r14896r14897
218219
219220WRITE8_MEMBER(pturn_state::pturn_videoram_w)
220221{
221   UINT8 *videoram = m_videoram;
222   UINT8 *videoram = m_videoram.target();
222223   videoram[offset]=data;
223224   m_fgmap->mark_tile_dirty(offset);
224225}
r14896r14897
236237
237238WRITE8_MEMBER(pturn_state::sound_w)
238239{
239   soundlatch_w(space,0,data);
240   soundlatch_byte_w(space,0,data);
240241}
241242
242243
r14896r14897
277278
278279WRITE8_MEMBER(pturn_state::flip_w)
279280{
280   flip_screen_set(machine(), data);
281   flip_screen_set(data);
281282}
282283
283284
r14896r14897
314315
315316   AM_RANGE(0xdfe0, 0xdfe0) AM_NOP
316317
317   AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(pturn_videoram_w) AM_BASE(m_videoram)
318   AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(pturn_videoram_w) AM_SHARE("videoram")
318319   AM_RANGE(0xe400, 0xe400) AM_WRITE(fgpalette_w)
319320   AM_RANGE(0xe800, 0xe800) AM_WRITE(sound_w)
320321
321   AM_RANGE(0xf000, 0xf0ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
322   AM_RANGE(0xf000, 0xf0ff) AM_RAM AM_SHARE("spriteram")
322323
323324   AM_RANGE(0xf400, 0xf400) AM_WRITE(bg_scrollx_w)
324325
r14896r14897
344345static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, pturn_state )
345346   AM_RANGE(0x0000, 0x0fff) AM_ROM
346347   AM_RANGE(0x2000, 0x23ff) AM_RAM
347   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) AM_WRITE(nmi_sub_enable_w)
348   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r) AM_WRITE(nmi_sub_enable_w)
348349   AM_RANGE(0x4000, 0x4000) AM_RAM
349350   AM_RANGE(0x5000, 0x5001) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
350351   AM_RANGE(0x6000, 0x6001) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
r14896r14897
478479{
479480   pturn_state *state = machine.driver_data<pturn_state>();
480481   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
481   state->soundlatch_clear_w(*space,0,0);
482   state->soundlatch_clear_byte_w(*space,0,0);
482483}
483484
484485static MACHINE_CONFIG_START( pturn, pturn_state )
src/mame/drivers/gumbo.c
r14896r14897
4949static ADDRESS_MAP_START( gumbo_map, AS_PROGRAM, 16, gumbo_state )
5050   AM_RANGE(0x000000, 0x03ffff) AM_ROM
5151   AM_RANGE(0x080000, 0x083fff) AM_RAM // main ram
52   AM_RANGE(0x1b0000, 0x1b03ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
52   AM_RANGE(0x1b0000, 0x1b03ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
5353   AM_RANGE(0x1c0100, 0x1c0101) AM_READ_PORT("P1_P2")
5454   AM_RANGE(0x1c0200, 0x1c0201) AM_READ_PORT("DSW")
5555   AM_RANGE(0x1c0300, 0x1c0301) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
r14896r14897
6363   AM_RANGE(0x000000, 0x07ffff) AM_ROM
6464   AM_RANGE(0x100000, 0x103fff) AM_RAM // main ram
6565   AM_RANGE(0x190000, 0x197fff) AM_RAM_WRITE(gumbo_fg_videoram_w) AM_BASE(m_fg_videoram) // fg tilemap
66   AM_RANGE(0x1a0000, 0x1a03ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
66   AM_RANGE(0x1a0000, 0x1a03ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
6767   AM_RANGE(0x1b0100, 0x1b0101) AM_READ_PORT("P1_P2")
6868   AM_RANGE(0x1b0200, 0x1b0201) AM_READ_PORT("DSW")
6969   AM_RANGE(0x1b0300, 0x1b0301) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
r14896r14897
7373static ADDRESS_MAP_START( dblpoint_map, AS_PROGRAM, 16, gumbo_state )
7474   AM_RANGE(0x000000, 0x07ffff) AM_ROM
7575   AM_RANGE(0x080000, 0x083fff) AM_RAM // main ram
76   AM_RANGE(0x1b0000, 0x1b03ff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
76   AM_RANGE(0x1b0000, 0x1b03ff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
7777   AM_RANGE(0x1c0100, 0x1c0101) AM_READ_PORT("P1_P2")
7878   AM_RANGE(0x1c0200, 0x1c0201) AM_READ_PORT("DSW")
7979   AM_RANGE(0x1c0300, 0x1c0301) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
src/mame/drivers/dec0.c
r14896r14897
188188      case 4: /* 6502 sound cpu */
189189         if (ACCESSING_BITS_0_7)
190190         {
191            soundlatch_w(space, 0, data & 0xff);
191            soundlatch_byte_w(space, 0, data & 0xff);
192192            cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
193193         }
194194         break;
r14896r14897
227227      case 0xe: /* 6502 sound cpu */
228228         if (ACCESSING_BITS_0_7)
229229         {
230            soundlatch_w(space, 0, data & 0xff);
230            soundlatch_byte_w(space, 0, data & 0xff);
231231            cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
232232         }
233233         break;
r14896r14897
260260       case 0:
261261         if (ACCESSING_BITS_0_7)
262262         {
263            soundlatch_w(space, 0, data & 0xff);
263            soundlatch_byte_w(space, 0, data & 0xff);
264264            cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
265265         }
266266         break;
r14896r14897
274274{
275275   if (ACCESSING_BITS_0_7)
276276   {
277      soundlatch_w(space, 0, data & 0xff);
277      soundlatch_byte_w(space, 0, data & 0xff);
278278      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
279279   }
280280}
r14896r14897
507507
508508   AM_RANGE(0x304000, 0x307fff) AM_RAM AM_BASE(m_ram)   /* Sly spy main ram */
509509   AM_RANGE(0x308000, 0x3087ff) AM_RAM AM_BASE(m_spriteram)   /* Sprites */
510   AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
510   AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
511511   AM_RANGE(0x314000, 0x314003) AM_WRITE(slyspy_control_w)
512512   AM_RANGE(0x314008, 0x31400f) AM_READ(slyspy_controls_r)
513513   AM_RANGE(0x31c000, 0x31c00f) AM_READ(slyspy_protection_r) AM_WRITENOP
r14896r14897
518518   AM_RANGE(0x000000, 0x07ffff) AM_ROM
519519   AM_RANGE(0x100000, 0x103fff) AM_RAM AM_BASE(m_ram)
520520   AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE(m_spriteram)
521   AM_RANGE(0x140000, 0x1407ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
521   AM_RANGE(0x140000, 0x1407ff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
522522   AM_RANGE(0x160000, 0x160001) AM_WRITE(dec0_priority_w)
523523   AM_RANGE(0x180000, 0x18000f) AM_READ(midres_controls_r)
524524   AM_RANGE(0x180008, 0x18000f) AM_WRITENOP /* ?? watchdog ?? */
r14896r14897
552552   AM_RANGE(0x0000, 0x05ff) AM_RAM
553553   AM_RANGE(0x0800, 0x0801) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
554554   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym2", ym3812_w)
555   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
555   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
556556   AM_RANGE(0x3800, 0x3800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
557557   AM_RANGE(0x8000, 0xffff) AM_ROM
558558ADDRESS_MAP_END
r14896r14897
564564   AM_RANGE(0x0a0000, 0x0a0001) AM_READNOP /* Protection counter */
565565   AM_RANGE(0x0b0000, 0x0b0001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
566566   AM_RANGE(0x0e0000, 0x0e0001) AM_DEVREADWRITE("oki", okim6295_device, read, write)
567   AM_RANGE(0x0f0000, 0x0f0001) AM_READ(soundlatch_r)
567   AM_RANGE(0x0f0000, 0x0f0001) AM_READ(soundlatch_byte_r)
568568   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
569569   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
570570ADDRESS_MAP_END
r14896r14897
574574   AM_RANGE(0x108000, 0x108001) AM_DEVWRITE_LEGACY("ym2", ym3812_w)
575575   AM_RANGE(0x118000, 0x118001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
576576   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki", okim6295_device, read, write)
577   AM_RANGE(0x138000, 0x138001) AM_READ(soundlatch_r)
577   AM_RANGE(0x138000, 0x138001) AM_READ(soundlatch_byte_r)
578578   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
579579   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
580580ADDRESS_MAP_END
r14896r14897
606606   AM_RANGE(0x300c00, 0x300fff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w)
607607   AM_RANGE(0x301000, 0x3017ff) AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_data_r, deco_bac06_pf_data_w)
608608   AM_RANGE(0x301800, 0x307fff) AM_RAM AM_BASE(m_ram) /* Sly spy main ram */
609   AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
609   AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
610610   AM_RANGE(0xb08000, 0xb087ff) AM_RAM AM_BASE(m_spriteram) /* Sprites */
611611ADDRESS_MAP_END
612612
r14896r14897
636636   AM_RANGE(0x300000, 0x30001f) AM_READ(dec0_rotary_r)
637637   AM_RANGE(0x30c000, 0x30c00b) AM_READ(dec0_controls_r)
638638   AM_RANGE(0x30c000, 0x30c01f) AM_WRITE(automat_control_w)         /* Priority, sound, etc. */
639   AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
639   AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
640640   AM_RANGE(0x314000, 0x3147ff) AM_RAM
641641   AM_RANGE(0x400008, 0x400009) AM_WRITE(dec0_priority_w)            // NEW
642642   AM_RANGE(0xff8000, 0xffbfff) AM_RAM AM_BASE(m_ram)            /* Main ram */
r14896r14897
652652   AM_RANGE(0xc000, 0xc7ff) AM_RAM
653653//  AM_RANGE(0xc800, 0xc800) AM_WRITE_LEGACY(ym2203_control_port_0_w)
654654//  AM_RANGE(0xc801, 0xc801) AM_WRITE_LEGACY(ym2203_write_port_0_w)
655   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_r)
655   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r)
656656//  AM_RANGE(0xd000, 0xd000) AM_WRITE_LEGACY(ym2203_control_port_1_w)
657657//  AM_RANGE(0xd001, 0xd001) AM_WRITE_LEGACY(ym2203_write_port_1_w)
658658   AM_RANGE(0xf000, 0xf000) AM_WRITE(automat_adpcm_w)
src/mame/drivers/atarig42.c
r14896r14897
7070 *
7171 *************************************/
7272
73static READ16_HANDLER( special_port2_r )
73READ16_MEMBER(atarig42_state::special_port2_r)
7474{
75   atarig42_state *state = space->machine().driver_data<atarig42_state>();
76   int temp = input_port_read(space->machine(), "IN2");
77   if (state->m_cpu_to_sound_ready) temp ^= 0x0020;
78   if (state->m_sound_to_cpu_ready) temp ^= 0x0010;
75   int temp = input_port_read(machine(), "IN2");
76   if (m_cpu_to_sound_ready) temp ^= 0x0020;
77   if (m_sound_to_cpu_ready) temp ^= 0x0010;
7978   temp ^= 0x0008;      /* A2D.EOC always high for now */
8079   return temp;
8180}
8281
8382
84static WRITE16_HANDLER( a2d_select_w )
83WRITE16_MEMBER(atarig42_state::a2d_select_w)
8584{
8685   static const char *const portnames[] = { "A2D0", "A2D1" };
87   atarig42_state *state = space->machine().driver_data<atarig42_state>();
8886
89   state->m_analog_data = input_port_read(space->machine(), portnames[offset != 0]);
87   m_analog_data = input_port_read(machine(), portnames[offset != 0]);
9088}
9189
9290
93static READ16_HANDLER( a2d_data_r )
91READ16_MEMBER(atarig42_state::a2d_data_r)
9492{
95   atarig42_state *state = space->machine().driver_data<atarig42_state>();
96   return state->m_analog_data << 8;
93   return m_analog_data << 8;
9794}
9895
9996
100static WRITE16_HANDLER( io_latch_w )
97WRITE16_MEMBER(atarig42_state::io_latch_w)
10198{
10299   /* upper byte */
103100   if (ACCESSING_BITS_8_15)
104101   {
105      atarig42_state *state = space->machine().driver_data<atarig42_state>();
106102
107103      /* bit 14 controls the ASIC65 reset line */
108      asic65_reset(space->machine(), (~data >> 14) & 1);
104      asic65_reset(machine(), (~data >> 14) & 1);
109105
110106      /* bits 13-11 are the MO control bits */
111      atarirle_control_w(state->m_rle, (data >> 11) & 7);
107      atarirle_control_w(m_rle, (data >> 11) & 7);
112108   }
113109
114110   /* lower byte */
115111   if (ACCESSING_BITS_0_7)
116112   {
117113      /* bit 4 resets the sound CPU */
118      cputag_set_input_line(space->machine(), "jsa", INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
114      cputag_set_input_line(machine(), "jsa", INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
119115      if (!(data & 0x10)) atarijsa_reset();
120116
121117      /* bit 5 is /XRESET, probably related to the ASIC */
r14896r14897
125121}
126122
127123
128static WRITE16_HANDLER( mo_command_w )
124WRITE16_MEMBER(atarig42_state::mo_command_w)
129125{
130   atarig42_state *state = space->machine().driver_data<atarig42_state>();
131   COMBINE_DATA(state->m_mo_command);
132   atarirle_command_w(state->m_rle, (data == 0) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
126   COMBINE_DATA(m_mo_command);
127   atarirle_command_w(m_rle, (data == 0) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
133128}
134129
135130
r14896r14897
152147}
153148
154149
155static void roadriot_sloop_tweak(atarig42_state *state, int offset)
150void atarig42_state::roadriot_sloop_tweak(int offset)
156151{
157152/*
158153    sequence 1:
r14896r14897
175170   {
176171      /* standard 68000 -> 68eee -> (bank) addressing */
177172      case 0x68000/2:
178         state->m_sloop_state = 1;
173         m_sloop_state = 1;
179174         break;
180175      case 0x68eee/2:
181         if (state->m_sloop_state == 1)
182            state->m_sloop_state = 2;
176         if (m_sloop_state == 1)
177            m_sloop_state = 2;
183178         break;
184179      case 0x00124/2:
185         if (state->m_sloop_state == 2)
180         if (m_sloop_state == 2)
186181         {
187            state->m_sloop_next_bank = 0;
188            state->m_sloop_state = 3;
182            m_sloop_next_bank = 0;
183            m_sloop_state = 3;
189184         }
190185         break;
191186      case 0x00678/2:
192         if (state->m_sloop_state == 2)
187         if (m_sloop_state == 2)
193188         {
194            state->m_sloop_next_bank = 1;
195            state->m_sloop_state = 3;
189            m_sloop_next_bank = 1;
190            m_sloop_state = 3;
196191         }
197192         break;
198193      case 0x00abc/2:
199         if (state->m_sloop_state == 2)
194         if (m_sloop_state == 2)
200195         {
201            state->m_sloop_next_bank = 2;
202            state->m_sloop_state = 3;
196            m_sloop_next_bank = 2;
197            m_sloop_state = 3;
203198         }
204199         break;
205200      case 0x01024/2:
206         if (state->m_sloop_state == 2)
201         if (m_sloop_state == 2)
207202         {
208            state->m_sloop_next_bank = 3;
209            state->m_sloop_state = 3;
203            m_sloop_next_bank = 3;
204            m_sloop_state = 3;
210205         }
211206         break;
212207
r14896r14897
219214         /* written if $ff8007 == 2 */
220215      case 0x71166/2:
221216         /* written if $ff8007 == 3 */
222         if (state->m_sloop_state == 3)
223            state->m_sloop_bank = state->m_sloop_next_bank;
224         state->m_sloop_state = 0;
217         if (m_sloop_state == 3)
218            m_sloop_bank = m_sloop_next_bank;
219         m_sloop_state = 0;
225220         break;
226221
227222      /* bank offsets */
228223      case 0x5edb4/2:
229         if (state->m_sloop_state == 0)
224         if (m_sloop_state == 0)
230225         {
231            state->m_sloop_state = 10;
232            state->m_sloop_offset = 0;
226            m_sloop_state = 10;
227            m_sloop_offset = 0;
233228         }
234         state->m_sloop_offset += 2;
229         m_sloop_offset += 2;
235230         break;
236231      case 0x5db0a/2:
237         if (state->m_sloop_state == 0)
232         if (m_sloop_state == 0)
238233         {
239            state->m_sloop_state = 10;
240            state->m_sloop_offset = 0;
234            m_sloop_state = 10;
235            m_sloop_offset = 0;
241236         }
242         state->m_sloop_offset += 1;
237         m_sloop_offset += 1;
243238         break;
244239
245240      /* apply the offset */
246241      case 0x5f042/2:
247         if (state->m_sloop_state == 10)
242         if (m_sloop_state == 10)
248243         {
249            state->m_sloop_bank = (state->m_sloop_bank + state->m_sloop_offset) & 3;
250            state->m_sloop_offset = 0;
251            state->m_sloop_state = 0;
244            m_sloop_bank = (m_sloop_bank + m_sloop_offset) & 3;
245            m_sloop_offset = 0;
246            m_sloop_state = 0;
252247         }
253248         break;
254249
r14896r14897
264259}
265260
266261
267static READ16_HANDLER( roadriot_sloop_data_r )
262READ16_MEMBER(atarig42_state::roadriot_sloop_data_r)
268263{
269   atarig42_state *state = space->machine().driver_data<atarig42_state>();
270   roadriot_sloop_tweak(state, offset);
264   roadriot_sloop_tweak(offset);
271265   if (offset < 0x78000/2)
272      return state->m_sloop_base[offset];
266      return m_sloop_base[offset];
273267   else
274      return state->m_sloop_base[0x78000/2 + state->m_sloop_bank * 0x1000 + (offset & 0xfff)];
268      return m_sloop_base[0x78000/2 + m_sloop_bank * 0x1000 + (offset & 0xfff)];
275269}
276270
277271
278static WRITE16_HANDLER( roadriot_sloop_data_w )
272WRITE16_MEMBER(atarig42_state::roadriot_sloop_data_w)
279273{
280   atarig42_state *state = space->machine().driver_data<atarig42_state>();
281   roadriot_sloop_tweak(state, offset);
274   roadriot_sloop_tweak(offset);
282275}
283276
284277
r14896r14897
289282 *
290283 *************************************/
291284
292static void guardians_sloop_tweak(atarig42_state *state, int offset)
285void atarig42_state::guardians_sloop_tweak(int offset)
293286{
294   UINT32 *last_accesses = state->m_last_accesses;
287   UINT32 *last_accesses = m_last_accesses;
295288
296289   if (offset >= 0x7f7c0/2)
297290   {
r14896r14897
306299
307300      if (last_accesses[0] == 0x7f7c0/2 && last_accesses[1] == 0x7f7ce/2 && last_accesses[2] == 0x7f7c2/2 && last_accesses[3] == 0x7f7cc/2 &&
308301         last_accesses[4] == 0x7f7c4/2 && last_accesses[5] == 0x7f7ca/2 && last_accesses[6] == 0x7f7c6/2 && last_accesses[7] == 0x7f7c8/2)
309         state->m_sloop_bank = 0;
302         m_sloop_bank = 0;
310303
311304      if (last_accesses[0] == 0x7f7d0/2 && last_accesses[1] == 0x7f7de/2 && last_accesses[2] == 0x7f7d2/2 && last_accesses[3] == 0x7f7dc/2 &&
312305         last_accesses[4] == 0x7f7d4/2 && last_accesses[5] == 0x7f7da/2 && last_accesses[6] == 0x7f7d6/2 && last_accesses[7] == 0x7f7d8/2)
313         state->m_sloop_bank = 1;
306         m_sloop_bank = 1;
314307
315308      if (last_accesses[0] == 0x7f7e0/2 && last_accesses[1] == 0x7f7ee/2 && last_accesses[2] == 0x7f7e2/2 && last_accesses[3] == 0x7f7ec/2 &&
316309         last_accesses[4] == 0x7f7e4/2 && last_accesses[5] == 0x7f7ea/2 && last_accesses[6] == 0x7f7e6/2 && last_accesses[7] == 0x7f7e8/2)
317         state->m_sloop_bank = 2;
310         m_sloop_bank = 2;
318311
319312      if (last_accesses[0] == 0x7f7f0/2 && last_accesses[1] == 0x7f7fe/2 && last_accesses[2] == 0x7f7f2/2 && last_accesses[3] == 0x7f7fc/2 &&
320313         last_accesses[4] == 0x7f7f4/2 && last_accesses[5] == 0x7f7fa/2 && last_accesses[6] == 0x7f7f6/2 && last_accesses[7] == 0x7f7f8/2)
321         state->m_sloop_bank = 3;
314         m_sloop_bank = 3;
322315   }
323316}
324317
325318
326static READ16_HANDLER( guardians_sloop_data_r )
319READ16_MEMBER(atarig42_state::guardians_sloop_data_r)
327320{
328   atarig42_state *state = space->machine().driver_data<atarig42_state>();
329   guardians_sloop_tweak(state, offset);
321   guardians_sloop_tweak(offset);
330322   if (offset < 0x78000/2)
331      return state->m_sloop_base[offset];
323      return m_sloop_base[offset];
332324   else
333      return state->m_sloop_base[0x78000/2 + state->m_sloop_bank * 0x1000 + (offset & 0xfff)];
325      return m_sloop_base[0x78000/2 + m_sloop_bank * 0x1000 + (offset & 0xfff)];
334326}
335327
336328
337static WRITE16_HANDLER( guardians_sloop_data_w )
329WRITE16_MEMBER(atarig42_state::guardians_sloop_data_w)
338330{
339   atarig42_state *state = space->machine().driver_data<atarig42_state>();
340   guardians_sloop_tweak(state, offset);
331   guardians_sloop_tweak(offset);
341332}
342333
343334
r14896r14897
352343   AM_RANGE(0x000000, 0x080001) AM_ROM
353344   AM_RANGE(0xe00000, 0xe00001) AM_READ_PORT("IN0")
354345   AM_RANGE(0xe00002, 0xe00003) AM_READ_PORT("IN1")
355   AM_RANGE(0xe00010, 0xe00011) AM_READ_LEGACY(special_port2_r)
346   AM_RANGE(0xe00010, 0xe00011) AM_READ(special_port2_r)
356347   AM_RANGE(0xe00012, 0xe00013) AM_READ_PORT("JSAIII")
357   AM_RANGE(0xe00020, 0xe00027) AM_READWRITE_LEGACY(a2d_data_r, a2d_select_w)
348   AM_RANGE(0xe00020, 0xe00027) AM_READWRITE(a2d_data_r, a2d_select_w)
358349   AM_RANGE(0xe00030, 0xe00031) AM_READ_LEGACY(atarigen_sound_r)
359350   AM_RANGE(0xe00040, 0xe00041) AM_WRITE_LEGACY(atarigen_sound_w)
360   AM_RANGE(0xe00050, 0xe00051) AM_WRITE_LEGACY(io_latch_w)
351   AM_RANGE(0xe00050, 0xe00051) AM_WRITE(io_latch_w)
361352   AM_RANGE(0xe00060, 0xe00061) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
362353   AM_RANGE(0xe03000, 0xe03001) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
363354   AM_RANGE(0xe03800, 0xe03801) AM_WRITE(watchdog_reset16_w)
r14896r14897
370361   AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE_LEGACY("rle", atarirle_spriteram_r, atarirle_spriteram_w)
371362   AM_RANGE(0xff2000, 0xff5fff) AM_WRITE_LEGACY(atarigen_playfield_w) AM_BASE(m_playfield)
372363   AM_RANGE(0xff6000, 0xff6fff) AM_WRITE_LEGACY(atarigen_alpha_w) AM_BASE(m_alpha)
373   AM_RANGE(0xff7000, 0xff7001) AM_WRITE_LEGACY(mo_command_w) AM_BASE(m_mo_command)
364   AM_RANGE(0xff7000, 0xff7001) AM_WRITE(mo_command_w) AM_BASE(m_mo_command)
374365   AM_RANGE(0xff0000, 0xffffff) AM_RAM
375366ADDRESS_MAP_END
376367
r14896r14897
800791   state->m_playfield_base = 0x400;
801792
802793   address_space *main = machine.device<m68000_device>("maincpu")->space(AS_PROGRAM);
803   state->m_sloop_base = main->install_legacy_readwrite_handler(0x000000, 0x07ffff, FUNC(roadriot_sloop_data_r), FUNC(roadriot_sloop_data_w));
794   state->m_sloop_base = main->install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::roadriot_sloop_data_r),state), write16_delegate(FUNC(atarig42_state::roadriot_sloop_data_w),state));
804795   main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_sloop_direct_handler), &machine));
805796
806797   asic65_config(machine, ASIC65_ROMBASED);
r14896r14897
839830   *(UINT16 *)&machine.region("maincpu")->base()[0x80000] = 0x4E75;
840831
841832   address_space *main = machine.device<m68000_device>("maincpu")->space(AS_PROGRAM);
842   state->m_sloop_base = main->install_legacy_readwrite_handler(0x000000, 0x07ffff, FUNC(guardians_sloop_data_r), FUNC(guardians_sloop_data_w));
833   state->m_sloop_base = main->install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),state), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),state));
843834   main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_sloop_direct_handler), &machine));
844835
845836   asic65_config(machine, ASIC65_GUARDIANS);
src/mame/drivers/jubilee.c
r14896r14897
9494{
9595public:
9696   jubilee_state(const machine_config &mconfig, device_type type, const char *tag)
97      : driver_device(mconfig, type, tag) { }
97      : driver_device(mconfig, type, tag) ,
98      m_videoram(*this, "videoram"){ }
9899
99   UINT8 *m_videoram;
100   required_shared_ptr<UINT8> m_videoram;
100101   tilemap_t *m_bg_tilemap;
101102   DECLARE_WRITE8_MEMBER(jubileep_videoram_w);
102103   DECLARE_READ8_MEMBER(unk_r);
r14896r14897
110111
111112WRITE8_MEMBER(jubilee_state::jubileep_videoram_w)
112113{
113   m_videoram[offset] = data;
114   m_videoram.target()[offset] = data;
114115   m_bg_tilemap->mark_tile_dirty(offset);
115116}
116117
r14896r14897
118119static TILE_GET_INFO( get_bg_tile_info )
119120{
120121   jubilee_state *state = machine.driver_data<jubilee_state>();
121   int code = state->m_videoram[tile_index];
122   int code = state->m_videoram.target()[tile_index];
122123
123124   SET_TILE_INFO( 0, code, 0, 0);
124125}
r14896r14897
164165static ADDRESS_MAP_START( jubileep_map, AS_PROGRAM, 8, jubilee_state )
165166   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
166167   AM_RANGE(0x0000, 0x2fff) AM_ROM
167   AM_RANGE(0x3000, 0x30ff) AM_WRITE(jubileep_videoram_w) AM_BASE(m_videoram)   /* wrong... just placed somewhere */
168   AM_RANGE(0x3000, 0x30ff) AM_WRITE(jubileep_videoram_w) AM_SHARE("videoram")   /* wrong... just placed somewhere */
168169   AM_RANGE(0x3100, 0x3fff) AM_RAM
169170ADDRESS_MAP_END
170171
src/mame/drivers/vindictr.c
r14896r14897
6363 *
6464 *************************************/
6565
66static READ16_HANDLER( port1_r )
66READ16_MEMBER(vindictr_state::port1_r)
6767{
68   vindictr_state *state = space->machine().driver_data<vindictr_state>();
69   int result = input_port_read(space->machine(), "260010");
70   if (state->m_sound_to_cpu_ready) result ^= 0x0004;
71   if (state->m_cpu_to_sound_ready) result ^= 0x0008;
68   int result = input_port_read(machine(), "260010");
69   if (m_sound_to_cpu_ready) result ^= 0x0004;
70   if (m_cpu_to_sound_ready) result ^= 0x0008;
7271   result ^= 0x0010;
7372   return result;
7473}
r14896r14897
8887   AM_RANGE(0x0e0000, 0x0e0fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
8988   AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
9089   AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000")
91   AM_RANGE(0x260010, 0x26001f) AM_READ_LEGACY(port1_r)
90   AM_RANGE(0x260010, 0x26001f) AM_READ(port1_r)
9291   AM_RANGE(0x260020, 0x26002f) AM_READ_PORT("260020")
9392   AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
9493   AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w)
src/mame/drivers/cop01.c
r14896r14897
7272
7373WRITE8_MEMBER(cop01_state::cop01_sound_command_w)
7474{
75   soundlatch_w(space, offset, data);
75   soundlatch_byte_w(space, offset, data);
7676   device_set_input_line(m_audiocpu, 0, ASSERT_LINE );
7777}
7878
7979READ8_MEMBER(cop01_state::cop01_sound_command_r)
8080{
81   int res = (soundlatch_r(space, offset) & 0x7f) << 1;
81   int res = (soundlatch_byte_r(space, offset) & 0x7f) << 1;
8282
8383   /* bit 0 seems to be a timer */
8484   if ((m_audiocpu->total_cycles() / TIMER_RATE) & 1)
src/mame/drivers/goldngam.c
r14896r14897
241241{
242242public:
243243   goldngam_state(const machine_config &mconfig, device_type type, const char *tag)
244      : driver_device(mconfig, type, tag) { }
244      : driver_device(mconfig, type, tag) ,
245      m_videoram(*this, "videoram"){ }
245246
246   UINT16 *m_videoram;
247   required_shared_ptr<UINT16> m_videoram;
247248   DECLARE_READ16_MEMBER(unk_r);
248249};
249250
r14896r14897
263264
264265   int x, y;
265266
266   UINT8 *tmp = (UINT8 *) state->m_videoram;
267   UINT8 *tmp = (UINT8 *) state->m_videoram.target();
267268   int index = 0;
268269
269270   for(y = 0; y < 512; ++y)
r14896r14897
307308   AM_RANGE(0x402000, 0x402001) AM_DEVREAD8_LEGACY("aysnd", ay8910_r, 0x00ff)
308309   AM_RANGE(0x402000, 0x402003) AM_DEVWRITE8_LEGACY("aysnd", ay8910_address_data_w, 0x00ff) //wrong
309310
310   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE(m_videoram)
311   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("videoram")
311312   AM_RANGE(0x500200, 0x50020f) AM_RAM //?
312313   AM_RANGE(0x503000, 0x503001) AM_RAM //int ack ?
313314   AM_RANGE(0x503002, 0x503003) AM_RAM //int ack ?
r14896r14897
351352static ADDRESS_MAP_START( moviecrd_map, AS_PROGRAM, 16, goldngam_state )
352353   AM_RANGE(0x000000, 0x07ffff) AM_ROM
353354   AM_RANGE(0x200000, 0x20ffff) AM_RAM
354   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE(m_videoram)
355   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("videoram")
355356   AM_RANGE(0x503000, 0x5031ff) AM_RAM //int ack ?
356357ADDRESS_MAP_END
357358
src/mame/drivers/circusc.c
r14896r14897
153153   AM_RANGE(0x0003, 0x0004) AM_MIRROR(0x03f8) AM_WRITE(circusc_coin_counter_w)      /* COIN1, COIN2 */
154154   AM_RANGE(0x0005, 0x0005) AM_MIRROR(0x03f8) AM_WRITEONLY AM_BASE(m_spritebank) /* OBJ CHENG */
155155   AM_RANGE(0x0400, 0x0400) AM_MIRROR(0x03ff) AM_WRITE(watchdog_reset_w)         /* WDOG */
156   AM_RANGE(0x0800, 0x0800) AM_MIRROR(0x03ff) AM_WRITE(soundlatch_w)            /* SOUND DATA */
156   AM_RANGE(0x0800, 0x0800) AM_MIRROR(0x03ff) AM_WRITE(soundlatch_byte_w)            /* SOUND DATA */
157157   AM_RANGE(0x0c00, 0x0c00) AM_MIRROR(0x03ff) AM_WRITE(circusc_sh_irqtrigger_w)   /* SOUND-ON causes interrupt on audio CPU */
158158   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x03fc) AM_READ_PORT("SYSTEM")
159159   AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x03fc) AM_READ_PORT("P1")
r14896r14897
174174static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, circusc_state )
175175   AM_RANGE(0x0000, 0x3fff) AM_ROM
176176   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x1c00) AM_RAM
177   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_READ(soundlatch_r)      /* CS0 */
177   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_READ(soundlatch_byte_r)      /* CS0 */
178178   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1fff) AM_READ(circusc_sh_timer_r)   /* CS1 */
179179   AM_RANGE(0xa000, 0xa07f) AM_MIRROR(0x1f80) AM_WRITE(circusc_sound_w)   /* CS2 - CS6 */
180180ADDRESS_MAP_END
src/mame/drivers/laserbas.c
r14896r14897
3939{
4040public:
4141   laserbas_state(const machine_config &mconfig, device_type type, const char *tag)
42      : driver_device(mconfig, type, tag) { }
42      : driver_device(mconfig, type, tag) ,
43      m_protram(*this, "protram"){ }
4344
4445   /* misc */
4546   int      m_count;
r14896r14897
4849   int      m_vrambank;
4950   UINT8    m_vram1[0x8000];
5051   UINT8    m_vram2[0x8000];
51   UINT8    *m_protram;
52   required_shared_ptr<UINT8> m_protram;
5253   DECLARE_READ8_MEMBER(vram_r);
5354   DECLARE_WRITE8_MEMBER(vram_w);
5455   DECLARE_READ8_MEMBER(read_unk);
r14896r14897
125126READ8_MEMBER(laserbas_state::protram_r)
126127{
127128
128   return m_protram[offset];
129   return m_protram.target()[offset];
129130}
130131
131132WRITE8_MEMBER(laserbas_state::protram_w)
132133{
133134
134   m_protram[offset] = data;
135   m_protram.target()[offset] = data;
135136}
136137
137138static ADDRESS_MAP_START( laserbas_memory, AS_PROGRAM, 8, laserbas_state )
r14896r14897
139140   AM_RANGE(0x0000, 0x3fff) AM_ROM
140141   AM_RANGE(0x4000, 0xbfff) AM_READWRITE(vram_r, vram_w)
141142   AM_RANGE(0xc000, 0xf7ff) AM_ROM
142   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(protram_r, protram_w) AM_BASE(m_protram) /* protection device */
143   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(protram_r, protram_w) AM_SHARE("protram") /* protection device */
143144   AM_RANGE(0xfc00, 0xffff) AM_RAM
144145ADDRESS_MAP_END
145146
r14896r14897
154155//  AM_RANGE(0x23, 0x23) AM_WRITE_LEGACY(test_w) bit 2 presumably is a mux for 0x20?
155156   AM_RANGE(0x40, 0x43) AM_DEVREADWRITE_LEGACY("pit0", pit8253_r, pit8253_w)
156157   AM_RANGE(0x44, 0x47) AM_DEVREADWRITE_LEGACY("pit1", pit8253_r, pit8253_w)
157   AM_RANGE(0x80, 0x9f) AM_RAM_WRITE(paletteram_RRRGGGBB_w) AM_SHARE("paletteram")
158   AM_RANGE(0x80, 0x9f) AM_RAM_WRITE(paletteram_RRRGGGBB_byte_w) AM_SHARE("paletteram")
158159ADDRESS_MAP_END
159160
160161static INPUT_PORTS_START( laserbas )
src/mame/drivers/mikie.c
r14896r14897
102102   AM_RANGE(0x2100, 0x2100) AM_WRITE(watchdog_reset_w)
103103   AM_RANGE(0x2200, 0x2200) AM_WRITE(mikie_palettebank_w)
104104   AM_RANGE(0x2300, 0x2300) AM_WRITENOP   // ???
105   AM_RANGE(0x2400, 0x2400) AM_READ_PORT("SYSTEM") AM_WRITE(soundlatch_w)
105   AM_RANGE(0x2400, 0x2400) AM_READ_PORT("SYSTEM") AM_WRITE(soundlatch_byte_w)
106106   AM_RANGE(0x2401, 0x2401) AM_READ_PORT("P1")
107107   AM_RANGE(0x2402, 0x2402) AM_READ_PORT("P2")
108108   AM_RANGE(0x2403, 0x2403) AM_READ_PORT("DSW3")
r14896r14897
122122   AM_RANGE(0x8000, 0x8000) AM_WRITENOP   // sound command latch
123123   AM_RANGE(0x8001, 0x8001) AM_WRITENOP   // ???
124124   AM_RANGE(0x8002, 0x8002) AM_DEVWRITE_LEGACY("sn1", sn76496_w)   // trigger read of latch
125   AM_RANGE(0x8003, 0x8003) AM_READ(soundlatch_r)
125   AM_RANGE(0x8003, 0x8003) AM_READ(soundlatch_byte_r)
126126   AM_RANGE(0x8004, 0x8004) AM_DEVWRITE_LEGACY("sn2", sn76496_w)   // trigger read of latch
127127   AM_RANGE(0x8005, 0x8005) AM_READ(mikie_sh_timer_r)
128128   AM_RANGE(0x8079, 0x8079) AM_WRITENOP   // ???
src/mame/drivers/midvunit.c
r14896r14897
8787 *
8888 *************************************/
8989
90static READ32_HANDLER( port0_r )
90READ32_MEMBER(midvunit_state::port0_r)
9191{
92   midvunit_state *state = space->machine().driver_data<midvunit_state>();
93   UINT16 val = input_port_read(space->machine(), "IN0");
94   UINT16 diff = val ^ state->m_last_port0;
92   UINT16 val = input_port_read(machine(), "IN0");
93   UINT16 diff = val ^ m_last_port0;
9594
9695   /* make sure the shift controls are mutually exclusive */
9796   if ((diff & 0x0400) && !(val & 0x0400))
98      state->m_shifter_state = (state->m_shifter_state == 1) ? 0 : 1;
97      m_shifter_state = (m_shifter_state == 1) ? 0 : 1;
9998   if ((diff & 0x0800) && !(val & 0x0800))
100      state->m_shifter_state = (state->m_shifter_state == 2) ? 0 : 2;
99      m_shifter_state = (m_shifter_state == 2) ? 0 : 2;
101100   if ((diff & 0x1000) && !(val & 0x1000))
102      state->m_shifter_state = (state->m_shifter_state == 4) ? 0 : 4;
101      m_shifter_state = (m_shifter_state == 4) ? 0 : 4;
103102   if ((diff & 0x2000) && !(val & 0x2000))
104      state->m_shifter_state = (state->m_shifter_state == 8) ? 0 : 8;
105   state->m_last_port0 = val;
103      m_shifter_state = (m_shifter_state == 8) ? 0 : 8;
104   m_last_port0 = val;
106105
107   val = (val | 0x3c00) ^ (state->m_shifter_state << 10);
106   val = (val | 0x3c00) ^ (m_shifter_state << 10);
108107
109108   return (val << 16) | val;
110109}
r14896r14897
116115 *
117116 *************************************/
118117
119static READ32_HANDLER( midvunit_adc_r )
118READ32_MEMBER(midvunit_state::midvunit_adc_r)
120119{
121   midvunit_state *state = space->machine().driver_data<midvunit_state>();
122   if (!(state->m_control_data & 0x40))
120   if (!(m_control_data & 0x40))
123121   {
124      cputag_set_input_line(space->machine(), "maincpu", 3, CLEAR_LINE);
125      return state->m_adc_data << state->m_adc_shift;
122      cputag_set_input_line(machine(), "maincpu", 3, CLEAR_LINE);
123      return m_adc_data << m_adc_shift;
126124   }
127125   else
128126      logerror("adc_r without enabling reads!\n");
r14896r14897
136134}
137135
138136
139static WRITE32_HANDLER( midvunit_adc_w )
137WRITE32_MEMBER(midvunit_state::midvunit_adc_w)
140138{
141   midvunit_state *state = space->machine().driver_data<midvunit_state>();
142139   static const char *const adcnames[] = { "WHEEL", "ACCEL", "BRAKE" };
143140
144   if (!(state->m_control_data & 0x20))
141   if (!(m_control_data & 0x20))
145142   {
146      int which = (data >> state->m_adc_shift) - 4;
143      int which = (data >> m_adc_shift) - 4;
147144      if (which < 0 || which > 2)
148145         logerror("adc_w: unexpected which = %02X\n", which + 4);
149      state->m_adc_data = input_port_read_safe(space->machine(), adcnames[which], 0);
150      space->machine().scheduler().timer_set(attotime::from_msec(1), FUNC(adc_ready));
146      m_adc_data = input_port_read_safe(machine(), adcnames[which], 0);
147      machine().scheduler().timer_set(attotime::from_msec(1), FUNC(adc_ready));
151148   }
152149   else
153150      logerror("adc_w without enabling writes!\n");
r14896r14897
161158 *
162159 *************************************/
163160
164static WRITE32_HANDLER( midvunit_cmos_protect_w )
161WRITE32_MEMBER(midvunit_state::midvunit_cmos_protect_w)
165162{
166   midvunit_state *state = space->machine().driver_data<midvunit_state>();
167   state->m_cmos_protected = ((data & 0xc00) != 0xc00);
163   m_cmos_protected = ((data & 0xc00) != 0xc00);
168164}
169165
170166
171static WRITE32_HANDLER( midvunit_cmos_w )
167WRITE32_MEMBER(midvunit_state::midvunit_cmos_w)
172168{
173   midvunit_state *state = space->machine().driver_data<midvunit_state>();
174   if (!state->m_cmos_protected)
175      COMBINE_DATA(state->m_nvram + offset);
169   if (!m_cmos_protected)
170      COMBINE_DATA(m_nvram + offset);
176171}
177172
178173
179static READ32_HANDLER( midvunit_cmos_r )
174READ32_MEMBER(midvunit_state::midvunit_cmos_r)
180175{
181   midvunit_state *state = space->machine().driver_data<midvunit_state>();
182   return state->m_nvram[offset];
176   return m_nvram[offset];
183177}
184178
185179
r14896r14897
190184 *
191185 *************************************/
192186
193static WRITE32_HANDLER( midvunit_control_w )
187WRITE32_MEMBER(midvunit_state::midvunit_control_w)
194188{
195   midvunit_state *state = space->machine().driver_data<midvunit_state>();
196   UINT16 olddata = state->m_control_data;
197   COMBINE_DATA(&state->m_control_data);
189   UINT16 olddata = m_control_data;
190   COMBINE_DATA(&m_control_data);
198191
199192   /* bit 7 is the LED */
200193
201194   /* bit 3 is the watchdog */
202   if ((olddata ^ state->m_control_data) & 0x0008)
203      state->watchdog_reset_w(*space, 0, 0);
195   if ((olddata ^ m_control_data) & 0x0008)
196      watchdog_reset_w(*&space, 0, 0);
204197
205198   /* bit 1 is the DCS sound reset */
206   dcs_reset_w(space->machine(), (~state->m_control_data >> 1) & 1);
199   dcs_reset_w(machine(), (~m_control_data >> 1) & 1);
207200
208201   /* log anything unusual */
209   if ((olddata ^ state->m_control_data) & ~0x00e8)
210      logerror("midvunit_control_w: old=%04X new=%04X diff=%04X\n", olddata, state->m_control_data, olddata ^ state->m_control_data);
202   if ((olddata ^ m_control_data) & ~0x00e8)
203      logerror("midvunit_control_w: old=%04X new=%04X diff=%04X\n", olddata, m_control_data, olddata ^ m_control_data);
211204}
212205
213206
214static WRITE32_HANDLER( crusnwld_control_w )
207WRITE32_MEMBER(midvunit_state::crusnwld_control_w)
215208{
216   midvunit_state *state = space->machine().driver_data<midvunit_state>();
217   UINT16 olddata = state->m_control_data;
218   COMBINE_DATA(&state->m_control_data);
209   UINT16 olddata = m_control_data;
210   COMBINE_DATA(&m_control_data);
219211
220212   /* bit 11 is the DCS sound reset */
221   dcs_reset_w(space->machine(), (~state->m_control_data >> 11) & 1);
213   dcs_reset_w(machine(), (~m_control_data >> 11) & 1);
222214
223215   /* bit 9 is the watchdog */
224   if ((olddata ^ state->m_control_data) & 0x0200)
225      state->watchdog_reset_w(*space, 0, 0);
216   if ((olddata ^ m_control_data) & 0x0200)
217      watchdog_reset_w(*&space, 0, 0);
226218
227219   /* bit 8 is the LED */
228220
229221   /* log anything unusual */
230   if ((olddata ^ state->m_control_data) & ~0xe800)
231      logerror("crusnwld_control_w: old=%04X new=%04X diff=%04X\n", olddata, state->m_control_data, olddata ^ state->m_control_data);
222   if ((olddata ^ m_control_data) & ~0xe800)
223      logerror("crusnwld_control_w: old=%04X new=%04X diff=%04X\n", olddata, m_control_data, olddata ^ m_control_data);
232224}
233225
234226
235static WRITE32_HANDLER( midvunit_sound_w )
227WRITE32_MEMBER(midvunit_state::midvunit_sound_w)
236228{
237229   logerror("Sound W = %02X\n", data);
238   dcs_data_w(space->machine(), data & 0xff);
230   dcs_data_w(machine(), data & 0xff);
239231}
240232
241233
r14896r14897
246238 *
247239 *************************************/
248240
249static READ32_HANDLER( tms32031_control_r )
241READ32_MEMBER(midvunit_state::tms32031_control_r)
250242{
251   midvunit_state *state = space->machine().driver_data<midvunit_state>();
252243   /* watch for accesses to the timers */
253244   if (offset == 0x24 || offset == 0x34)
254245   {
255246      /* timer is clocked at 100ns */
256247      int which = (offset >> 4) & 1;
257      INT32 result = (state->m_timer[which]->time_elapsed() * state->m_timer_rate).as_double();
258//      logerror("%06X:tms32031_control_r(%02X) = %08X\n", cpu_get_pc(&space->device()), offset, result);
248      INT32 result = (m_timer[which]->time_elapsed() * m_timer_rate).as_double();
249//      logerror("%06X:tms32031_control_r(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, result);
259250      return result;
260251   }
261252
262253   /* log anything else except the memory control register */
263254   if (offset != 0x64)
264      logerror("%06X:tms32031_control_r(%02X)\n", cpu_get_pc(&space->device()), offset);
255      logerror("%06X:tms32031_control_r(%02X)\n", cpu_get_pc(&space.device()), offset);
265256
266   return state->m_tms32031_control[offset];
257   return m_tms32031_control[offset];
267258}
268259
269260
270static WRITE32_HANDLER( tms32031_control_w )
261WRITE32_MEMBER(midvunit_state::tms32031_control_w)
271262{
272   midvunit_state *state = space->machine().driver_data<midvunit_state>();
273   COMBINE_DATA(&state->m_tms32031_control[offset]);
263   COMBINE_DATA(&m_tms32031_control[offset]);
274264
275265   /* ignore changes to the memory control register */
276266   if (offset == 0x64)
r14896r14897
280270   else if (offset == 0x20 || offset == 0x30)
281271   {
282272      int which = (offset >> 4) & 1;
283//  logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space->device()), offset, data);
273//  logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, data);
284274      if (data & 0x40)
285         state->m_timer[which]->reset();
275         m_timer[which]->reset();
286276
287277      /* bit 0x200 selects internal clocking, which is 1/2 the main CPU clock rate */
288278      if (data & 0x200)
289         state->m_timer_rate = (double)(space->machine().device("maincpu")->unscaled_clock() * 0.5);
279         m_timer_rate = (double)(machine().device("maincpu")->unscaled_clock() * 0.5);
290280      else
291         state->m_timer_rate = 10000000.;
281         m_timer_rate = 10000000.;
292282   }
293283   else
294      logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space->device()), offset, data);
284      logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, data);
295285}
296286
297287
r14896r14897
303293 *************************************/
304294
305295#if 0
306static READ32_HANDLER( crusnwld_serial_status_r )
296READ32_MEMBER(midvunit_state::crusnwld_serial_status_r)
307297{
308298   int status = midway_serial_pic_status_r();
309   return (input_port_read(space->machine(), "991030") & 0x7fff7fff) | (status << 31) | (status << 15);
299   return (input_port_read(machine(), "991030") & 0x7fff7fff) | (status << 31) | (status << 15);
310300}
311301
312302
313static READ32_HANDLER( crusnwld_serial_data_r )
303READ32_MEMBER(midvunit_state::crusnwld_serial_data_r)
314304{
315305   return midway_serial_pic_r() << 16;
316306}
317307
318308
319static WRITE32_HANDLER( crusnwld_serial_data_w )
309WRITE32_MEMBER(midvunit_state::crusnwld_serial_data_w)
320310{
321311   if ((data & 0xf0000) == 0x10000)
322312   {
r14896r14897
345335};
346336
347337
348static READ32_HANDLER( bit_data_r )
338READ32_MEMBER(midvunit_state::bit_data_r)
349339{
350   midvunit_state *state = space->machine().driver_data<midvunit_state>();
351   int bit = (bit_data[state->m_bit_index / 32] >> (31 - (state->m_bit_index % 32))) & 1;
352   state->m_bit_index = (state->m_bit_index + 1) % 512;
353   return bit ? state->m_nvram[offset] : ~state->m_nvram[offset];
340   int bit = (bit_data[m_bit_index / 32] >> (31 - (m_bit_index % 32))) & 1;
341   m_bit_index = (m_bit_index + 1) % 512;
342   return bit ? m_nvram[offset] : ~m_nvram[offset];
354343}
355344
356345
357static WRITE32_HANDLER( bit_reset_w )
346WRITE32_MEMBER(midvunit_state::bit_reset_w)
358347{
359   midvunit_state *state = space->machine().driver_data<midvunit_state>();
360   state->m_bit_index = 0;
348   m_bit_index = 0;
361349}
362350
363351
r14896r14897
368356 *
369357 *************************************/
370358
371static READ32_HANDLER( offroadc_serial_status_r )
359READ32_MEMBER(midvunit_state::offroadc_serial_status_r)
372360{
373   int status = midway_serial_pic2_status_r(space);
374   return (input_port_read(space->machine(), "991030")  & 0x7fff7fff) | (status << 31) | (status << 15);
361   int status = midway_serial_pic2_status_r(&space);
362   return (input_port_read(machine(), "991030")  & 0x7fff7fff) | (status << 31) | (status << 15);
375363}
376364
377365
378static READ32_HANDLER( offroadc_serial_data_r )
366READ32_MEMBER(midvunit_state::offroadc_serial_data_r)
379367{
380   return midway_serial_pic2_r(space) << 16;
368   return midway_serial_pic2_r(&space) << 16;
381369}
382370
383371
384static WRITE32_HANDLER( offroadc_serial_data_w )
372WRITE32_MEMBER(midvunit_state::offroadc_serial_data_w)
385373{
386   midway_serial_pic2_w(space, data >> 16);
374   midway_serial_pic2_w(&space, data >> 16);
387375}
388376
389377
r14896r14897
394382 *
395383 *************************************/
396384
397static READ32_HANDLER( midvplus_misc_r )
385READ32_MEMBER(midvunit_state::midvplus_misc_r)
398386{
399   midvunit_state *state = space->machine().driver_data<midvunit_state>();
400   UINT32 result = state->m_midvplus_misc[offset];
387   UINT32 result = m_midvplus_misc[offset];
401388
402389   switch (offset)
403390   {
r14896r14897
415402   }
416403
417404   if (offset != 0 && offset != 3)
418      logerror("%06X:midvplus_misc_r(%d) = %08X\n", cpu_get_pc(&space->device()), offset, result);
405      logerror("%06X:midvplus_misc_r(%d) = %08X\n", cpu_get_pc(&space.device()), offset, result);
419406   return result;
420407}
421408
422409
423static WRITE32_HANDLER( midvplus_misc_w )
410WRITE32_MEMBER(midvunit_state::midvplus_misc_w)
424411{
425   midvunit_state *state = space->machine().driver_data<midvunit_state>();
426   UINT32 olddata = state->m_midvplus_misc[offset];
412   UINT32 olddata = m_midvplus_misc[offset];
427413   int logit = 1;
428414
429   COMBINE_DATA(&state->m_midvplus_misc[offset]);
415   COMBINE_DATA(&m_midvplus_misc[offset]);
430416
431417   switch (offset)
432418   {
433419      case 0:
434420         /* bit 0x10 resets watchdog */
435         if ((olddata ^ state->m_midvplus_misc[offset]) & 0x0010)
421         if ((olddata ^ m_midvplus_misc[offset]) & 0x0010)
436422         {
437            state->watchdog_reset_w(*space, 0, 0);
423            watchdog_reset_w(*&space, 0, 0);
438424            logit = 0;
439425         }
440426         break;
r14896r14897
445431   }
446432
447433   if (logit)
448      logerror("%06X:midvplus_misc_w(%d) = %08X\n", cpu_get_pc(&space->device()), offset, data);
434      logerror("%06X:midvplus_misc_w(%d) = %08X\n", cpu_get_pc(&space.device()), offset, data);
449435}
450436
451437
r14896r14897
479465   AM_RANGE(0x000000, 0x01ffff) AM_RAM AM_BASE(m_ram_base)
480466   AM_RANGE(0x400000, 0x41ffff) AM_RAM
481467   AM_RANGE(0x600000, 0x600000) AM_WRITE(midvunit_dma_queue_w)
482   AM_RANGE(0x808000, 0x80807f) AM_READWRITE_LEGACY(tms32031_control_r, tms32031_control_w) AM_BASE(m_tms32031_control)
468   AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(m_tms32031_control)
483469   AM_RANGE(0x809800, 0x809fff) AM_RAM
484470   AM_RANGE(0x900000, 0x97ffff) AM_READWRITE(midvunit_videoram_r, midvunit_videoram_w) AM_BASE(m_videoram)
485471   AM_RANGE(0x980000, 0x980000) AM_READ(midvunit_dma_queue_entries_r)
r14896r14897
491477   AM_RANGE(0x990000, 0x990000) AM_READNOP   // link PAL (low 4 bits must == 4)
492478   AM_RANGE(0x991030, 0x991030) AM_READ_PORT("991030")
493479//  AM_RANGE(0x991050, 0x991050) AM_READONLY // seems to be another port
494   AM_RANGE(0x991060, 0x991060) AM_READ_LEGACY(port0_r)
480   AM_RANGE(0x991060, 0x991060) AM_READ(port0_r)
495481   AM_RANGE(0x992000, 0x992000) AM_READ_PORT("992000")
496   AM_RANGE(0x993000, 0x993000) AM_READWRITE_LEGACY(midvunit_adc_r, midvunit_adc_w)
497   AM_RANGE(0x994000, 0x994000) AM_WRITE_LEGACY(midvunit_control_w)
482   AM_RANGE(0x993000, 0x993000) AM_READWRITE(midvunit_adc_r, midvunit_adc_w)
483   AM_RANGE(0x994000, 0x994000) AM_WRITE(midvunit_control_w)
498484   AM_RANGE(0x995000, 0x995000) AM_WRITENOP   // force feedback?
499   AM_RANGE(0x995020, 0x995020) AM_WRITE_LEGACY(midvunit_cmos_protect_w)
485   AM_RANGE(0x995020, 0x995020) AM_WRITE(midvunit_cmos_protect_w)
500486   AM_RANGE(0x997000, 0x997000) AM_NOP   // communications
501   AM_RANGE(0x9a0000, 0x9a0000) AM_WRITE_LEGACY(midvunit_sound_w)
502   AM_RANGE(0x9c0000, 0x9c1fff) AM_READWRITE_LEGACY(midvunit_cmos_r, midvunit_cmos_w) AM_SHARE("nvram")
487   AM_RANGE(0x9a0000, 0x9a0000) AM_WRITE(midvunit_sound_w)
488   AM_RANGE(0x9c0000, 0x9c1fff) AM_READWRITE(midvunit_cmos_r, midvunit_cmos_w) AM_SHARE("nvram")
503489   AM_RANGE(0x9e0000, 0x9e7fff) AM_RAM_WRITE(midvunit_paletteram_w) AM_SHARE("paletteram")
504490   AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(midvunit_textureram_r, midvunit_textureram_w) AM_BASE(m_textureram)
505491   AM_RANGE(0xc00000, 0xffffff) AM_ROM AM_REGION("user1", 0)
r14896r14897
512498   AM_RANGE(0x000000, 0x01ffff) AM_RAM AM_BASE(m_ram_base)
513499   AM_RANGE(0x400000, 0x41ffff) AM_RAM AM_BASE(m_fastram_base)
514500   AM_RANGE(0x600000, 0x600000) AM_WRITE(midvunit_dma_queue_w)
515   AM_RANGE(0x808000, 0x80807f) AM_READWRITE_LEGACY(tms32031_control_r, tms32031_control_w) AM_BASE(m_tms32031_control)
501   AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(m_tms32031_control)
516502   AM_RANGE(0x809800, 0x809fff) AM_RAM
517503   AM_RANGE(0x900000, 0x97ffff) AM_READWRITE(midvunit_videoram_r, midvunit_videoram_w) AM_BASE(m_videoram)
518504   AM_RANGE(0x980000, 0x980000) AM_READ(midvunit_dma_queue_entries_r)
r14896r14897
522508   AM_RANGE(0x980080, 0x980080) AM_NOP
523509   AM_RANGE(0x980082, 0x980083) AM_READ(midvunit_dma_trigger_r)
524510   AM_RANGE(0x990000, 0x99000f) AM_READWRITE_LEGACY(midway_ioasic_r, midway_ioasic_w)
525   AM_RANGE(0x994000, 0x994000) AM_WRITE_LEGACY(midvunit_control_w)
526   AM_RANGE(0x995020, 0x995020) AM_WRITE_LEGACY(midvunit_cmos_protect_w)
511   AM_RANGE(0x994000, 0x994000) AM_WRITE(midvunit_control_w)
512   AM_RANGE(0x995020, 0x995020) AM_WRITE(midvunit_cmos_protect_w)
527513   AM_RANGE(0x9a0000, 0x9a0007) AM_DEVREADWRITE_LEGACY("ide", midway_ide_asic_r, midway_ide_asic_w)
528514   AM_RANGE(0x9c0000, 0x9c7fff) AM_RAM_WRITE(midvunit_paletteram_w) AM_SHARE("paletteram")
529   AM_RANGE(0x9d0000, 0x9d000f) AM_READWRITE_LEGACY(midvplus_misc_r, midvplus_misc_w) AM_BASE(m_midvplus_misc)
515   AM_RANGE(0x9d0000, 0x9d000f) AM_READWRITE(midvplus_misc_r, midvplus_misc_w) AM_BASE(m_midvplus_misc)
530516   AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(midvunit_textureram_r, midvunit_textureram_w) AM_BASE(m_textureram)
531517   AM_RANGE(0xc00000, 0xcfffff) AM_RAM
532518ADDRESS_MAP_END
r14896r14897
16301616 *
16311617 *************************************/
16321618
1633static READ32_HANDLER( generic_speedup_r )
1619READ32_MEMBER(midvunit_state::generic_speedup_r)
16341620{
1635   midvunit_state *state = space->machine().driver_data<midvunit_state>();
1636   device_eat_cycles(&space->device(), 100);
1637   return state->m_generic_speedup[offset];
1621   device_eat_cycles(&space.device(), 100);
1622   return m_generic_speedup[offset];
16381623}
16391624
16401625
r14896r14897
16451630   state->m_adc_shift = 24;
16461631
16471632   /* speedups */
1648   state->m_generic_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(speedup, speedup + 1, FUNC(generic_speedup_r));
1633   state->m_generic_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),state));
16491634}
16501635static DRIVER_INIT( crusnusa ) { init_crusnusa_common(machine, 0xc93e); }
16511636static DRIVER_INIT( crusnu40 ) { init_crusnusa_common(machine, 0xc957); }
r14896r14897
16591644   state->m_adc_shift = 16;
16601645
16611646   /* control register is different */
1662   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x994000, 0x994000, FUNC(crusnwld_control_w));
1647   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x994000, 0x994000, write32_delegate(FUNC(midvunit_state::crusnwld_control_w),state));
16631648
16641649   /* valid values are 450 or 460 */
16651650   midway_serial_pic_init(machine, 450);
1666   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x991030, 0x991030, FUNC(offroadc_serial_status_r));
1667   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x996000, 0x996000, FUNC(offroadc_serial_data_r));
1668   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x996000, 0x996000, FUNC(offroadc_serial_data_w));
1651   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x991030, 0x991030, read32_delegate(FUNC(midvunit_state::offroadc_serial_status_r),state));
1652   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x996000, 0x996000, read32_delegate(FUNC(midvunit_state::offroadc_serial_data_r),state));
1653   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x996000, 0x996000, write32_delegate(FUNC(midvunit_state::offroadc_serial_data_w),state));
16691654
16701655   /* install strange protection device */
1671   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x9d0000, 0x9d1fff, FUNC(bit_data_r));
1672   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x9d0000, 0x9d0000, FUNC(bit_reset_w));
1656   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x9d0000, 0x9d1fff, read32_delegate(FUNC(midvunit_state::bit_data_r),state));
1657   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x9d0000, 0x9d0000, write32_delegate(FUNC(midvunit_state::bit_reset_w),state));
16731658
16741659   /* speedups */
16751660   if (speedup)
1676      state->m_generic_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(speedup, speedup + 1, FUNC(generic_speedup_r));
1661      state->m_generic_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),state));
16771662}
16781663static DRIVER_INIT( crusnwld ) { init_crusnwld_common(machine, 0xd4c0); }
16791664#if 0
r14896r14897
16881673   state->m_adc_shift = 16;
16891674
16901675   /* control register is different */
1691   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x994000, 0x994000, FUNC(crusnwld_control_w));
1676   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x994000, 0x994000, write32_delegate(FUNC(midvunit_state::crusnwld_control_w),state));
16921677
16931678   /* valid values are 230 or 234 */
16941679   midway_serial_pic2_init(machine, 230, 94);
1695   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x991030, 0x991030, FUNC(offroadc_serial_status_r));
1696   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x996000, 0x996000, FUNC(offroadc_serial_data_r), FUNC(offroadc_serial_data_w));
1680   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x991030, 0x991030, read32_delegate(FUNC(midvunit_state::offroadc_serial_status_r),state));
1681   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x996000, 0x996000, read32_delegate(FUNC(midvunit_state::offroadc_serial_data_r),state), write32_delegate(FUNC(midvunit_state::offroadc_serial_data_w),state));
16971682
16981683   /* speedups */
1699   state->m_generic_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x195aa, 0x195aa, FUNC(generic_speedup_r));
1684   state->m_generic_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x195aa, 0x195aa, read32_delegate(FUNC(midvunit_state::generic_speedup_r),state));
17001685}
17011686
17021687
r14896r14897
17221707   midway_serial_pic2_set_default_nvram(default_nvram);
17231708
17241709   /* speedups */
1725   state->m_generic_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x2f4c, 0x2f4c, FUNC(generic_speedup_r));
1710   state->m_generic_speedup = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x2f4c, 0x2f4c, read32_delegate(FUNC(midvunit_state::generic_speedup_r),state));
17261711}
17271712
17281713
src/mame/drivers/opwolf.c
r14896r14897
362362   AM_RANGE(0x0ff802, 0x0ff803) AM_WRITE(opwolf_cchip_status_w)
363363   AM_RANGE(0x0ffc00, 0x0ffc01) AM_WRITE(opwolf_cchip_bank_w)
364364   AM_RANGE(0x100000, 0x107fff) AM_RAM
365   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
365   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
366366   AM_RANGE(0x380000, 0x380003) AM_READ(opwolf_dsw_r)         /* dip switches */
367367   AM_RANGE(0x380000, 0x380003) AM_WRITE(opwolf_spritectrl_w)   // usually 0x4, changes when you fire
368368   AM_RANGE(0x3a0000, 0x3a0003) AM_READ(opwolf_lightgun_r)      /* lightgun, read at $11e0/6 */
r14896r14897
383383   AM_RANGE(0x0f0008, 0x0f000b) AM_READ(opwolf_in_r)         /* coins and buttons */
384384   AM_RANGE(0x0ff000, 0x0fffff) AM_READWRITE(cchip_r,cchip_w)
385385   AM_RANGE(0x100000, 0x107fff) AM_RAM
386   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
386   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
387387   AM_RANGE(0x380000, 0x380003) AM_READ(opwolf_dsw_r)         /* dip switches */
388388   AM_RANGE(0x380000, 0x380003) AM_WRITE(opwolf_spritectrl_w)   // usually 0x4, changes when you fire
389389   AM_RANGE(0x3a0000, 0x3a0003) AM_READ(opwolf_lightgun_r)      /* lightgun, read at $11e0/6 */
src/mame/drivers/suna16.c
r14896r14897
4242{
4343   if (ACCESSING_BITS_0_7)
4444   {
45      soundlatch_w(space, 0, data & 0xff );
45      soundlatch_byte_w(space, 0, data & 0xff );
4646   }
4747   if (data & ~0xff)   logerror("CPU#0 PC %06X - Sound latch unknown bits: %04X\n", cpu_get_pc(&space.device()), data);
4848}
r14896r14897
202202   AM_RANGE(0x0000, 0x7fff) AM_ROM   // ROM
203203   AM_RANGE(0xf000, 0xf7ff) AM_RAM   // RAM
204204   AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)   // YM2151
205   AM_RANGE(0xfc00, 0xfc00) AM_READ(soundlatch_r)   // From Main CPU
206   AM_RANGE(0xfd00, 0xfd00) AM_WRITE(soundlatch2_w)   // To PCM Z80 #1
207   AM_RANGE(0xfe00, 0xfe00) AM_WRITE(soundlatch3_w)   // To PCM Z80 #2
205   AM_RANGE(0xfc00, 0xfc00) AM_READ(soundlatch_byte_r)   // From Main CPU
206   AM_RANGE(0xfd00, 0xfd00) AM_WRITE(soundlatch2_byte_w)   // To PCM Z80 #1
207   AM_RANGE(0xfe00, 0xfe00) AM_WRITE(soundlatch3_byte_w)   // To PCM Z80 #2
208208ADDRESS_MAP_END
209209
210210/***************************************************************************
r14896r14897
215215   AM_RANGE(0x0000, 0xefff) AM_ROM   // ROM
216216   AM_RANGE(0xf000, 0xf7ff) AM_RAM   // RAM
217217   AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)   // YM2151
218   AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(soundlatch_r, soundlatch2_w)   // To PCM Z80
218   AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w)   // To PCM Z80
219219ADDRESS_MAP_END
220220
221221/***************************************************************************
r14896r14897
226226   AM_RANGE(0x0000, 0xe82f) AM_ROM   // ROM
227227   AM_RANGE(0xe830, 0xf7ff) AM_RAM   // RAM (writes to efxx, could be a program bug tho)
228228   AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)   // YM2151
229   AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(soundlatch_r, soundlatch2_w)   // To PCM Z80
229   AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w)   // To PCM Z80
230230ADDRESS_MAP_END
231231
232232/***************************************************************************
r14896r14897
238238   AM_RANGE( 0xc000, 0xc001 ) AM_DEVWRITE_LEGACY("ymsnd", ym3526_w   )   //
239239   AM_RANGE( 0xc002, 0xc003 ) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w   )   // AY8910
240240   AM_RANGE( 0xe000, 0xe7ff ) AM_RAM                           // RAM
241   AM_RANGE( 0xf000, 0xf000 ) AM_WRITE(soundlatch2_w            )   // To PCM Z80
242   AM_RANGE( 0xf800, 0xf800 ) AM_READ ( soundlatch_r            )   // From Main CPU
241   AM_RANGE( 0xf000, 0xf000 ) AM_WRITE(soundlatch2_byte_w            )   // To PCM Z80
242   AM_RANGE( 0xf800, 0xf800 ) AM_READ ( soundlatch_byte_r            )   // From Main CPU
243243ADDRESS_MAP_END
244244
245245/***************************************************************************
r14896r14897
299299
300300static ADDRESS_MAP_START( bssoccer_pcm_1_io_map, AS_IO, 8, suna16_state )
301301   ADDRESS_MAP_GLOBAL_MASK(0xff)
302   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_r)   // From The Sound Z80
302   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r)   // From The Sound Z80
303303   AM_RANGE(0x00, 0x00) AM_DEVWRITE_LEGACY("dac1", bssoccer_DAC_w)   // 2 x DAC
304304   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("dac2", bssoccer_DAC_w)   // 2 x DAC
305305   AM_RANGE(0x03, 0x03) AM_WRITE(bssoccer_pcm_1_bankswitch_w)   // Rom Bank
r14896r14897
307307
308308static ADDRESS_MAP_START( bssoccer_pcm_2_io_map, AS_IO, 8, suna16_state )
309309   ADDRESS_MAP_GLOBAL_MASK(0xff)
310   AM_RANGE(0x00, 0x00) AM_READ(soundlatch3_r)   // From The Sound Z80
310   AM_RANGE(0x00, 0x00) AM_READ(soundlatch3_byte_r)   // From The Sound Z80
311311   AM_RANGE(0x00, 0x00) AM_DEVWRITE_LEGACY("dac3", bssoccer_DAC_w)   // 2 x DAC
312312   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("dac4", bssoccer_DAC_w)   // 2 x DAC
313313   AM_RANGE(0x03, 0x03) AM_WRITE(bssoccer_pcm_2_bankswitch_w)   // Rom Bank
r14896r14897
337337
338338static ADDRESS_MAP_START( uballoon_pcm_1_io_map, AS_IO, 8, suna16_state )
339339   ADDRESS_MAP_GLOBAL_MASK(0xff)
340   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_r)   // From The Sound Z80
340   AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r)   // From The Sound Z80
341341   AM_RANGE(0x00, 0x00) AM_DEVWRITE_LEGACY("dac1", bssoccer_DAC_w)   // 2 x DAC
342342   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("dac2", bssoccer_DAC_w)   // 2 x DAC
343343   AM_RANGE(0x03, 0x03) AM_WRITE(uballoon_pcm_1_bankswitch_w)   // Rom Bank
r14896r14897
361361
362362static ADDRESS_MAP_START( bestbest_pcm_1_iomap, AS_IO, 8, suna16_state )
363363   ADDRESS_MAP_GLOBAL_MASK(0xff)
364   AM_RANGE(0x00, 0x00) AM_READ (soundlatch2_r    )   // From The Sound Z80
364   AM_RANGE(0x00, 0x00) AM_READ (soundlatch2_byte_r    )   // From The Sound Z80
365365   AM_RANGE(0x00, 0x00) AM_MIRROR(0x02) AM_DEVWRITE_LEGACY("dac1", bssoccer_DAC_w)   // 2 x DAC
366366   AM_RANGE(0x01, 0x01) AM_MIRROR(0x02) AM_DEVWRITE_LEGACY("dac2", bssoccer_DAC_w)   // 2 x DAC
367367ADDRESS_MAP_END
src/mame/drivers/shadfrce.c
r14896r14897
151151
152152WRITE16_MEMBER(shadfrce_state::shadfrce_flip_screen)
153153{
154   flip_screen_set(machine(), data & 0x01);
154   flip_screen_set(data & 0x01);
155155}
156156
157157
r14896r14897
262262{
263263   if (ACCESSING_BITS_8_15)
264264   {
265      soundlatch_w(space, 1, data >> 8);
265      soundlatch_byte_w(space, 1, data >> 8);
266266      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE );
267267   }
268268   else
r14896r14897
368368   AM_RANGE(0x102000, 0x1027ff) AM_RAM_WRITE(shadfrce_bg1videoram_w) AM_BASE(m_bg1videoram) /* bg 2 */
369369   AM_RANGE(0x102800, 0x103fff) AM_RAM
370370   AM_RANGE(0x140000, 0x141fff) AM_RAM_WRITE(shadfrce_fgvideoram_w) AM_BASE(m_fgvideoram)
371   AM_RANGE(0x142000, 0x143fff) AM_RAM AM_BASE(m_spvideoram) AM_SIZE(m_spvideoram_size) /* sprites */
372   AM_RANGE(0x180000, 0x187fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
371   AM_RANGE(0x142000, 0x143fff) AM_RAM AM_BASE_SIZE(m_spvideoram,m_spvideoram_size) /* sprites */
372   AM_RANGE(0x180000, 0x187fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
373373   AM_RANGE(0x1c0000, 0x1c0001) AM_WRITE(shadfrce_bg0scrollx_w) /* SCROLL X */
374374   AM_RANGE(0x1c0002, 0x1c0003) AM_WRITE(shadfrce_bg0scrolly_w) /* SCROLL Y */
375375   AM_RANGE(0x1c0004, 0x1c0005) AM_WRITE(shadfrce_bg1scrollx_w) /* SCROLL X */
r14896r14897
401401   AM_RANGE(0xc000, 0xc7ff) AM_RAM
402402   AM_RANGE(0xc800, 0xc801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
403403   AM_RANGE(0xd800, 0xd800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
404   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
404   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
405405   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE_LEGACY("oki", oki_bankswitch_w)
406406   AM_RANGE(0xf000, 0xffff) AM_RAM
407407ADDRESS_MAP_END
src/mame/drivers/firebeat.c
r14896r14897
147147{
148148public:
149149   firebeat_state(const machine_config &mconfig, device_type type, const char *tag)
150      : driver_device(mconfig, type, tag) { }
150      : driver_device(mconfig, type, tag) ,
151      m_work_ram(*this, "work_ram"){ }
151152
152153   UINT8 m_extend_board_irq_enable;
153154   UINT8 m_extend_board_irq_active;
r14896r14897
170171   const int * m_cur_cab_data;
171172   int m_keyboard_state[2];
172173   UINT8 m_spu_shared_ram[0x400];
173   UINT32 *m_work_ram;
174   required_shared_ptr<UINT32> m_work_ram;
174175   IBUTTON m_ibutton;
175176   int m_ibutton_state;
176177   int m_ibutton_read_subkey_ptr;
r14896r14897
17421743   ppcdrc_set_options(machine.device("maincpu"), PPCDRC_COMPATIBLE_OPTIONS);
17431744
17441745   /* configure fast RAM regions for DRC */
1745   ppcdrc_add_fastram(machine.device("maincpu"), 0x00000000, 0x01ffffff, FALSE, state->m_work_ram);
1746   ppcdrc_add_fastram(machine.device("maincpu"), 0x00000000, 0x01ffffff, FALSE, state->m_work_ram.target());
17461747
17471748   state->m_flash[0] = machine.device<fujitsu_29f016a_device>("flash0");
17481749   state->m_flash[1] = machine.device<fujitsu_29f016a_device>("flash1");
r14896r14897
17501751}
17511752
17521753static ADDRESS_MAP_START( firebeat_map, AS_PROGRAM, 32, firebeat_state )
1753   AM_RANGE(0x00000000, 0x01ffffff) AM_RAM AM_BASE(m_work_ram)
1754   AM_RANGE(0x00000000, 0x01ffffff) AM_RAM AM_SHARE("work_ram")
17541755   AM_RANGE(0x70000000, 0x70000fff) AM_READWRITE_LEGACY(midi_uart_r, midi_uart_w)
17551756   AM_RANGE(0x70006000, 0x70006003) AM_WRITE_LEGACY(extend_board_irq_w)
17561757   AM_RANGE(0x70008000, 0x7000800f) AM_READ_LEGACY(keyboard_wheel_r)
src/mame/drivers/clayshoo.c
r14896r14897
2121{
2222public:
2323   clayshoo_state(const machine_config &mconfig, device_type type, const char *tag)
24      : driver_device(mconfig, type, tag) { }
24      : driver_device(mconfig, type, tag) ,
25      m_videoram(*this, "videoram"){ }
2526
2627   /* memory pointers */
27   UINT8 *   m_videoram;
28   size_t    m_videoram_size;
28   required_shared_ptr<UINT8> m_videoram;
2929
3030   /* misc */
3131   emu_timer *m_analog_timer_1, *m_analog_timer_2;
r14896r14897
188188   clayshoo_state *state = screen.machine().driver_data<clayshoo_state>();
189189   offs_t offs;
190190
191   for (offs = 0; offs < state->m_videoram_size; offs++)
191   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
192192   {
193193      int i;
194194      UINT8 x = offs << 3;
195195      UINT8 y = ~(offs >> 5);
196      UINT8 data = state->m_videoram[offs];
196      UINT8 data = state->m_videoram.target()[offs];
197197
198198      for (i = 0; i < 8; i++)
199199      {
r14896r14897
220220   AM_RANGE(0x0000, 0x1fff) AM_ROM
221221   AM_RANGE(0x2000, 0x23ff) AM_RAM
222222   AM_RANGE(0x4000, 0x47ff) AM_ROM
223   AM_RANGE(0x8000, 0x97ff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)   /* 6k of video ram according to readme */
223   AM_RANGE(0x8000, 0x97ff) AM_RAM AM_SHARE("videoram")   /* 6k of video ram according to readme */
224224   AM_RANGE(0x9800, 0xa800) AM_WRITENOP     /* not really mapped, but cleared */
225225   AM_RANGE(0xc800, 0xc800) AM_READWRITE(analog_r, analog_reset_w)
226226ADDRESS_MAP_END
src/mame/drivers/inufuku.c
r14896r14897
9090         return;
9191
9292      m_pending_command = 1;
93      soundlatch_w(space, 0, data & 0xff);
93      soundlatch_byte_w(space, 0, data & 0xff);
9494      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
9595   }
9696}
r14896r14897
139139   AM_RANGE(0x200000, 0x200001) AM_WRITE_PORT("EEPROMOUT")
140140   AM_RANGE(0x280000, 0x280001) AM_WRITE(inufuku_soundcommand_w)   // sound command
141141
142   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram16_xGGGGGBBBBBRRRRR_word_w) AM_SHARE("paletteram")                  // palette ram
142   AM_RANGE(0x300000, 0x301fff) AM_RAM_WRITE(paletteram_xGGGGGBBBBBRRRRR_word_w) AM_SHARE("paletteram")                  // palette ram
143143   AM_RANGE(0x380000, 0x3801ff) AM_WRITEONLY AM_BASE(m_bg_rasterram)                           // bg raster ram
144144   AM_RANGE(0x400000, 0x401fff) AM_READWRITE(inufuku_bg_videoram_r, inufuku_bg_videoram_w) AM_BASE(m_bg_videoram)      // bg ram
145145   AM_RANGE(0x402000, 0x403fff) AM_READWRITE(inufuku_tx_videoram_r, inufuku_tx_videoram_w) AM_BASE(m_tx_videoram)      // text ram
r14896r14897
170170static ADDRESS_MAP_START( inufuku_sound_io_map, AS_IO, 8, inufuku_state )
171171   ADDRESS_MAP_GLOBAL_MASK(0xff)
172172   AM_RANGE(0x00, 0x00) AM_WRITE(inufuku_soundrombank_w)
173   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r) AM_WRITE(pending_command_clear_w)
173   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_byte_r) AM_WRITE(pending_command_clear_w)
174174   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
175175ADDRESS_MAP_END
176176
src/mame/drivers/tattack.c
r14896r14897
2626{
2727public:
2828   tattack_state(const machine_config &mconfig, device_type type, const char *tag)
29      : driver_device(mconfig, type, tag) { }
29      : driver_device(mconfig, type, tag) ,
30      m_videoram(*this, "videoram"),
31      m_colorram(*this, "colorram"){ }
3032
31   UINT8 *m_videoram;
32   UINT8 *m_colorram;
33   required_shared_ptr<UINT8> m_videoram;
34   required_shared_ptr<UINT8> m_colorram;
3335   tilemap_t *m_tmap;
3436};
3537
r14896r14897
3840static TILE_GET_INFO( get_tile_info )
3941{
4042   tattack_state *state = machine.driver_data<tattack_state>();
41   int code = state->m_videoram[tile_index];
42   int color = state->m_colorram[tile_index];
43   int code = state->m_videoram.target()[tile_index];
44   int color = state->m_colorram.target()[tile_index];
4345
4446   if((color&1 ) || (color>15) )
4547      logerror("COLOR %i\n",color);
r14896r14897
7072static ADDRESS_MAP_START( mem, AS_PROGRAM, 8, tattack_state )
7173   AM_RANGE(0x0000, 0x0fff) AM_ROM
7274//  AM_RANGE(0x4000, 0x4000) AM_READNOP $315
73   AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE(m_videoram)
74   AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE(m_colorram)   // color map ? something else .. only bits 1-3 are used
75   AM_RANGE(0x5000, 0x53ff) AM_RAM AM_SHARE("videoram")
76   AM_RANGE(0x7000, 0x73ff) AM_RAM AM_SHARE("colorram")   // color map ? something else .. only bits 1-3 are used
7577   AM_RANGE(0x6000, 0x6000) AM_READ_PORT("DSW2")
7678   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("DSW1")      // dsw ? something else ?
7779   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("INPUTS") AM_WRITENOP
src/mame/drivers/cbuster.c
r14896r14897
3939      return;
4040
4141    case 2: /* Sound CPU write */
42      soundlatch_w(space, 0, data & 0xff);
42      soundlatch_byte_w(space, 0, data & 0xff);
4343      device_set_input_line(m_audiocpu, 0, HOLD_LINE);
4444       return;
4545
r14896r14897
133133   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ym2", ym2151_r, ym2151_w)
134134   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
135135   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
136   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
136   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
137137   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
138138   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
139139   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/ghosteo.c
r14896r14897
7878{
7979public:
8080   ghosteo_state(const machine_config &mconfig, device_type type, const char *tag)
81      : driver_device(mconfig, type, tag) { }
81      : driver_device(mconfig, type, tag) ,
82      m_system_memory(*this, "systememory"){ }
8283
83   UINT32 *m_system_memory;
84   required_shared_ptr<UINT32> m_system_memory;
8485   int m_security_count;
8586   UINT32 m_bballoon_port[20];
8687   struct nand_t m_nand;
r14896r14897
352353   AM_RANGE(0x10100000, 0x10100003) AM_READ_PORT("10100000")
353354   AM_RANGE(0x10200000, 0x10200003) AM_READ_PORT("10200000")
354355   AM_RANGE(0x10300000, 0x10300003) AM_WRITE(sound_w)
355   AM_RANGE(0x30000000, 0x31ffffff) AM_RAM AM_BASE(m_system_memory) AM_MIRROR(0x02000000)
356   AM_RANGE(0x30000000, 0x31ffffff) AM_RAM AM_SHARE("systememory") AM_MIRROR(0x02000000)
356357ADDRESS_MAP_END
357358
358359/*
src/mame/drivers/n8080.c
r14896r14897
5555
5656   AM_RANGE(0x02, 0x02) AM_WRITE(n8080_shift_bits_w)
5757   AM_RANGE(0x03, 0x03) AM_WRITE(n8080_shift_data_w)
58   AM_RANGE(0x04, 0x04) AM_WRITE_LEGACY(n8080_sound_1_w)
59   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(n8080_sound_2_w)
58   AM_RANGE(0x04, 0x04) AM_WRITE(n8080_sound_1_w)
59   AM_RANGE(0x05, 0x05) AM_WRITE(n8080_sound_2_w)
6060   AM_RANGE(0x06, 0x06) AM_WRITE(n8080_video_control_w)
6161ADDRESS_MAP_END
6262
src/mame/drivers/kncljoe.c
r14896r14897
3737{
3838
3939   if ((data & 0x80) == 0)
40      soundlatch_w(space, 0, data & 0x7f);
40      soundlatch_byte_w(space, 0, data & 0x7f);
4141   else
4242      device_set_input_line(m_soundcpu, 0, ASSERT_LINE);
4343}
r14896r14897
235235{
236236   AY8910_LEGACY_OUTPUT,
237237   AY8910_DEFAULT_LOADS,
238   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
238   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
239239   DEVCB_NULL,
240240   DEVCB_NULL,
241241   DEVCB_HANDLER(unused_w)
src/mame/drivers/spdodgeb.c
r14896r14897
3131
3232WRITE8_MEMBER(spdodgeb_state::sound_command_w)
3333{
34   soundlatch_w(space, offset, data);
34   soundlatch_byte_w(space, offset, data);
3535   cputag_set_input_line(machine(), "audiocpu", M6809_IRQ_LINE, HOLD_LINE);
3636}
3737
r14896r14897
263263
264264static ADDRESS_MAP_START( spdodgeb_sound_map, AS_PROGRAM, 8, spdodgeb_state )
265265   AM_RANGE(0x0000, 0x0fff) AM_RAM
266   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_r)
266   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_byte_r)
267267   AM_RANGE(0x2800, 0x2801) AM_DEVWRITE_LEGACY("ymsnd", ym3812_w)
268268   AM_RANGE(0x3800, 0x3807) AM_WRITE(spd_adpcm_w)
269269   AM_RANGE(0x8000, 0xffff) AM_ROM
src/mame/drivers/deco_ld.c
r14896r14897
112112public:
113113   deco_ld_state(const machine_config &mconfig, device_type type, const char *tag)
114114      : driver_device(mconfig, type, tag),
115        m_laserdisc(*this, "laserdisc") { }
115        m_laserdisc(*this, "laserdisc") ,
116      m_videoram(*this, "videoram"){ }
116117
117   UINT8 *m_videoram;
118   required_device<pioneer_ldv1000_device> m_laserdisc;
119   required_shared_ptr<UINT8> m_videoram;
118120   UINT8 m_vram_bank;
119   required_device<pioneer_ldv1000_device> m_laserdisc;
120121   UINT8 m_laserdisc_data;
121122   int m_nmimask;
122123   DECLARE_WRITE8_MEMBER(rblaster_sound_w);
r14896r14897
132133static SCREEN_UPDATE_IND16( rblaster )
133134{
134135   deco_ld_state *state = screen.machine().driver_data<deco_ld_state>();
135   UINT8 *videoram = state->m_videoram;
136   UINT8 *videoram = state->m_videoram.target();
136137   const gfx_element *gfx = screen.machine().gfx[0];
137138   int count = 0x0000;
138139
r14896r14897
156157#if 0
157158WRITE8_MEMBER(deco_ld_state::rblaster_sound_w)
158159{
159   soundlatch_w(space,0,data);
160   soundlatch_byte_w(space,0,data);
160161   device_set_input_line(machine().cpu[1], 0, HOLD_LINE);
161162}
162163#endif
r14896r14897
196197   AM_RANGE(0x1003, 0x1003) AM_WRITE(rblaster_vram_bank_w) //might be 1001
197198   AM_RANGE(0x1006, 0x1006) AM_NOP //ld status / command
198199   AM_RANGE(0x1007, 0x1007) AM_READWRITE(laserdisc_r,laserdisc_w) // ld data
199   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(paletteram_RRRGGGBB_w) AM_SHARE("paletteram")
200   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(paletteram_RRRGGGBB_byte_w) AM_SHARE("paletteram")
200201   AM_RANGE(0x2000, 0x27ff) AM_RAM
201   AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE(m_videoram)
202   AM_RANGE(0x2800, 0x2fff) AM_RAM AM_SHARE("videoram")
202203   AM_RANGE(0x3000, 0x3fff) AM_RAM
203204   AM_RANGE(0x4000, 0xffff) AM_ROM
204205ADDRESS_MAP_END
r14896r14897
214215   AM_RANGE(0x1004, 0x1004) AM_WRITE(rblaster_vram_bank_w) //might be 1001
215216   AM_RANGE(0x1006, 0x1006) AM_NOP //ld status / command
216217   AM_RANGE(0x1007, 0x1007) AM_READWRITE(laserdisc_r,laserdisc_w) // ld data
217   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(paletteram_RRRGGGBB_w) AM_SHARE("paletteram")
218   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(paletteram_RRRGGGBB_byte_w) AM_SHARE("paletteram")
218219   AM_RANGE(0x2000, 0x2fff) AM_RAM
219220   AM_RANGE(0x3000, 0x37ff) AM_RAM //vram attr?
220   AM_RANGE(0x3800, 0x3fff) AM_RAM AM_BASE(m_videoram)
221   AM_RANGE(0x3800, 0x3fff) AM_RAM AM_SHARE("videoram")
221222   AM_RANGE(0x4000, 0xffff) AM_ROM
222223ADDRESS_MAP_END
223224
r14896r14897
230231   AM_RANGE(0x1003, 0x1003) AM_WRITE(rblaster_vram_bank_w) //might be 1001
231232   AM_RANGE(0x1006, 0x1006) AM_NOP //ld status / command
232233   AM_RANGE(0x1007, 0x1007) AM_READWRITE(laserdisc_r,laserdisc_w) // ld data
233   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(paletteram_RRRGGGBB_w) AM_SHARE("paletteram")
234   AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE(m_videoram)
234   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(paletteram_RRRGGGBB_byte_w) AM_SHARE("paletteram")
235   AM_RANGE(0x2800, 0x2fff) AM_RAM AM_SHARE("videoram")
235236   AM_RANGE(0x3000, 0x3fff) AM_RAM
236237   AM_RANGE(0xc000, 0xffff) AM_ROM
237238ADDRESS_MAP_END
r14896r14897
258259   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE_LEGACY("ay1", ay8910_address_w)
259260   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_LEGACY("ay2", ay8910_data_w)
260261   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE_LEGACY("ay2", ay8910_address_w)
261   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
262   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
262263   AM_RANGE(0xe000, 0xffff) AM_ROM
263264ADDRESS_MAP_END
264265
src/mame/drivers/cvs.c
r14896r14897
391391
392392   /* FIXME: this was by observation on board ???
393393     *          -bit 7 is TMS status (active LO) */
394   return ((tms5110_ctl_r(m_tms, 0) ^ 1) << 7) | (soundlatch_r(space, 0) & 0x7f);
394   return ((tms5110_ctl_r(m_tms, 0) ^ 1) << 7) | (soundlatch_byte_r(space, 0) & 0x7f);
395395}
396396
397397
r14896r14897
459459
460460   LOG(("data %02x\n", data));
461461   /* cause interrupt on audio CPU if bit 7 set */
462   soundlatch_w(space, 0, data);
462   soundlatch_byte_w(space, 0, data);
463463   cvs_slave_cpu_interrupt(m_audiocpu, data & 0x80 ? 1 : 0);
464464}
465465
r14896r14897
506506   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
507507   AM_RANGE(0x0000, 0x0fff) AM_ROM
508508   AM_RANGE(0x1000, 0x107f) AM_RAM
509   AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r)
509   AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_byte_r)
510510   AM_RANGE(0x1840, 0x1840) AM_DEVWRITE_LEGACY("dac1", dac_w)
511511   AM_RANGE(0x1880, 0x1883) AM_DEVWRITE_LEGACY("dac2", cvs_4_bit_dac_data_w) AM_BASE(m_cvs_4_bit_dac_data)
512512   AM_RANGE(0x1884, 0x1887) AM_DEVWRITE_LEGACY("dac3", cvs_unknown_w)   AM_BASE(m_dac3_state)   /* ???? not connected to anything */
src/mame/drivers/tnzs.c
r14896r14897
761761   /* arknoid2, extrmatn, plumppop and drtoppel have PROMs instead of RAM */
762762   /* drtoppel writes here anyway! (maybe leftover from tests during development) */
763763   /* so the handler is patched out in init_drtopple() */
764   AM_RANGE(0xf800, 0xfbff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
764   AM_RANGE(0xf800, 0xfbff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
765765ADDRESS_MAP_END
766766
767767static ADDRESS_MAP_START( cpu0_type2, AS_PROGRAM, 8, tnzs_state )
r14896r14897
807807
808808WRITE8_MEMBER(tnzs_state::tnzsb_sound_command_w)
809809{
810   soundlatch_w(space, offset, data);
810   soundlatch_byte_w(space, offset, data);
811811   device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0xff);
812812}
813813
r14896r14897
824824   AM_RANGE(0xd000, 0xdfff) AM_RAM
825825   AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1")
826826   AM_RANGE(0xf000, 0xf003) AM_READONLY
827   AM_RANGE(0xf000, 0xf3ff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
827   AM_RANGE(0xf000, 0xf3ff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
828828ADDRESS_MAP_END
829829
830830static ADDRESS_MAP_START( kabukiz_cpu1_map, AS_PROGRAM, 8, tnzs_state )
r14896r14897
839839   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2")
840840   AM_RANGE(0xd000, 0xdfff) AM_RAM
841841   AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1")
842   AM_RANGE(0xf800, 0xfbff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
842   AM_RANGE(0xf800, 0xfbff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
843843ADDRESS_MAP_END
844844
845845static ADDRESS_MAP_START( tnzsb_cpu2_map, AS_PROGRAM, 8, tnzs_state )
r14896r14897
856856static ADDRESS_MAP_START( tnzsb_io_map, AS_IO, 8, tnzs_state )
857857   ADDRESS_MAP_GLOBAL_MASK(0xff)
858858   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
859   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
859   AM_RANGE(0x02, 0x02) AM_READ(soundlatch_byte_r)
860860ADDRESS_MAP_END
861861
862862static ADDRESS_MAP_START( i8742_io_map, AS_IO, 8, tnzs_state )
src/mame/drivers/rohga.c
r14896r14897
266266   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)
267267   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
268268   AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
269   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
269   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
270270   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
271271   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
272272   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/plygonet.c
r14896r14897
161161/* sound CPU communications */
162162READ32_MEMBER(polygonet_state::sound_r)
163163{
164   int latch = soundlatch3_r(space, 0);
164   int latch = soundlatch3_byte_r(space, 0);
165165
166166   if ((latch == 0xd) || (latch == 0xe)) latch = 0xf;   /* hack: until 54539 NMI disable found */
167167
r14896r14897
172172{
173173   if (ACCESSING_BITS_8_15)
174174   {
175      soundlatch_w(space, 0, (data>>8)&0xff);
175      soundlatch_byte_w(space, 0, (data>>8)&0xff);
176176   }
177177   else
178178   {
179      soundlatch2_w(space, 0, data&0xff);
179      soundlatch2_byte_w(space, 0, data&0xff);
180180   }
181181}
182182
r14896r14897
570570   AM_RANGE(0xe230, 0xe3ff) AM_RAM
571571   AM_RANGE(0xe400, 0xe62f) AM_DEVREADWRITE("konami2", k054539_device, read, write)
572572   AM_RANGE(0xe630, 0xe7ff) AM_RAM
573   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
574   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
575   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
573   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_byte_w)
574   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_byte_r)
575   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_byte_r)
576576   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
577577   AM_RANGE(0xfff1, 0xfff3) AM_WRITENOP
578578ADDRESS_MAP_END
src/mame/drivers/batman.c
r14896r14897
6868 *
6969 *************************************/
7070
71static READ16_HANDLER( batman_atarivc_r )
71READ16_MEMBER(batman_state::batman_atarivc_r)
7272{
73   return atarivc_r(*space->machine().primary_screen, offset);
73   return atarivc_r(*machine().primary_screen, offset);
7474}
7575
7676
77static WRITE16_HANDLER( batman_atarivc_w )
77WRITE16_MEMBER(batman_state::batman_atarivc_w)
7878{
79   atarivc_w(*space->machine().primary_screen, offset, data, mem_mask);
79   atarivc_w(*machine().primary_screen, offset, data, mem_mask);
8080}
8181
8282
r14896r14897
8787 *
8888 *************************************/
8989
90static READ16_HANDLER( special_port2_r )
90READ16_MEMBER(batman_state::special_port2_r)
9191{
92   batman_state *state = space->machine().driver_data<batman_state>();
93   int result = input_port_read(space->machine(), "260010");
94   if (state->m_sound_to_cpu_ready) result ^= 0x0010;
95   if (state->m_cpu_to_sound_ready) result ^= 0x0020;
92   int result = input_port_read(machine(), "260010");
93   if (m_sound_to_cpu_ready) result ^= 0x0010;
94   if (m_cpu_to_sound_ready) result ^= 0x0020;
9695   return result;
9796}
9897
9998
100static WRITE16_HANDLER( latch_w )
99WRITE16_MEMBER(batman_state::latch_w)
101100{
102   batman_state *state = space->machine().driver_data<batman_state>();
103   int oldword = state->m_latch_data;
104   COMBINE_DATA(&state->m_latch_data);
101   int oldword = m_latch_data;
102   COMBINE_DATA(&m_latch_data);
105103
106104   /* bit 4 is connected to the /RESET pin on the 6502 */
107   if (state->m_latch_data & 0x0010)
108      cputag_set_input_line(space->machine(), "jsa", INPUT_LINE_RESET, CLEAR_LINE);
105   if (m_latch_data & 0x0010)
106      cputag_set_input_line(machine(), "jsa", INPUT_LINE_RESET, CLEAR_LINE);
109107   else
110      cputag_set_input_line(space->machine(), "jsa", INPUT_LINE_RESET, ASSERT_LINE);
108      cputag_set_input_line(machine(), "jsa", INPUT_LINE_RESET, ASSERT_LINE);
111109
112110   /* alpha bank is selected by the upper 4 bits */
113   if ((oldword ^ state->m_latch_data) & 0x7000)
111   if ((oldword ^ m_latch_data) & 0x7000)
114112   {
115      space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos());
116      state->m_alpha_tilemap->mark_all_dirty();
117      state->m_alpha_tile_bank = (state->m_latch_data >> 12) & 7;
113      machine().primary_screen->update_partial(machine().primary_screen->vpos());
114      m_alpha_tilemap->mark_all_dirty();
115      m_alpha_tile_bank = (m_latch_data >> 12) & 7;
118116   }
119117}
120118
r14896r14897
137135   AM_RANGE(0x120000, 0x120fff) AM_MIRROR(0x01f000) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
138136   AM_RANGE(0x260000, 0x260001) AM_MIRROR(0x11ff8c) AM_READ_PORT("260000")
139137   AM_RANGE(0x260002, 0x260003) AM_MIRROR(0x11ff8c) AM_READ_PORT("260002")
140   AM_RANGE(0x260010, 0x260011) AM_MIRROR(0x11ff8e) AM_READ_LEGACY(special_port2_r)
138   AM_RANGE(0x260010, 0x260011) AM_MIRROR(0x11ff8e) AM_READ(special_port2_r)
141139   AM_RANGE(0x260030, 0x260031) AM_MIRROR(0x11ff8e) AM_READ_LEGACY(atarigen_sound_r)
142140   AM_RANGE(0x260040, 0x260041) AM_MIRROR(0x11ff8e) AM_WRITE_LEGACY(atarigen_sound_w)
143   AM_RANGE(0x260050, 0x260051) AM_MIRROR(0x11ff8e) AM_WRITE_LEGACY(latch_w)
141   AM_RANGE(0x260050, 0x260051) AM_MIRROR(0x11ff8e) AM_WRITE(latch_w)
144142   AM_RANGE(0x260060, 0x260061) AM_MIRROR(0x11ff8e) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
145143   AM_RANGE(0x2a0000, 0x2a0001) AM_MIRROR(0x11fffe) AM_WRITE(watchdog_reset16_w)
146144   AM_RANGE(0x3e0000, 0x3e0fff) AM_MIRROR(0x100000) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram_w) AM_SHARE("paletteram")
147   AM_RANGE(0x3effc0, 0x3effff) AM_MIRROR(0x100000) AM_READWRITE_LEGACY(batman_atarivc_r, batman_atarivc_w) AM_BASE(m_atarivc_data)
145   AM_RANGE(0x3effc0, 0x3effff) AM_MIRROR(0x100000) AM_READWRITE(batman_atarivc_r, batman_atarivc_w) AM_BASE(m_atarivc_data)
148146   AM_RANGE(0x3f0000, 0x3f1fff) AM_MIRROR(0x100000) AM_WRITE_LEGACY(atarigen_playfield2_latched_msb_w) AM_BASE(m_playfield2)
149147   AM_RANGE(0x3f2000, 0x3f3fff) AM_MIRROR(0x100000) AM_WRITE_LEGACY(atarigen_playfield_latched_lsb_w) AM_BASE(m_playfield)
150148   AM_RANGE(0x3f4000, 0x3f5fff) AM_MIRROR(0x100000) AM_WRITE_LEGACY(atarigen_playfield_dual_upper_w) AM_BASE(m_playfield_upper)
src/mame/drivers/nemesis.c
r14896r14897
241241WRITE16_MEMBER(nemesis_state::nemesis_soundlatch_word_w)
242242{
243243   if (ACCESSING_BITS_0_7)
244      soundlatch_w(space, offset, data & 0xff);
244      soundlatch_byte_w(space, offset, data & 0xff);
245245}
246246
247247static WRITE8_DEVICE_HANDLER( gx400_speech_start_w )
r14896r14897
426426   AM_RANGE(0x4000, 0x47ff) AM_RAM
427427   AM_RANGE(0xa000, 0xafff) AM_DEVWRITE_LEGACY("k007232", k005289_pitch_A_w)
428428   AM_RANGE(0xc000, 0xcfff) AM_DEVWRITE_LEGACY("k007232", k005289_pitch_B_w)
429   AM_RANGE(0xe001, 0xe001) AM_READ(soundlatch_r)
429   AM_RANGE(0xe001, 0xe001) AM_READ(soundlatch_byte_r)
430430   AM_RANGE(0xe003, 0xe003) AM_DEVWRITE_LEGACY("k007232", k005289_keylatch_A_w)
431431   AM_RANGE(0xe004, 0xe004) AM_DEVWRITE_LEGACY("k007232", k005289_keylatch_B_w)
432432   AM_RANGE(0xe005, 0xe005) AM_DEVWRITE_LEGACY("ay2", ay8910_address_w)
r14896r14897
443443   AM_RANGE(0xa000, 0xafff) AM_DEVWRITE_LEGACY("k007232", k005289_pitch_A_w)
444444   AM_RANGE(0xc000, 0xcfff) AM_DEVWRITE_LEGACY("k007232", k005289_pitch_B_w)
445445   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE_LEGACY("vlm", vlm5030_data_w)
446   AM_RANGE(0xe001, 0xe001) AM_READ(soundlatch_r)
446   AM_RANGE(0xe001, 0xe001) AM_READ(soundlatch_byte_r)
447447   AM_RANGE(0xe003, 0xe003) AM_DEVWRITE_LEGACY("k007232", k005289_keylatch_A_w)
448448   AM_RANGE(0xe004, 0xe004) AM_DEVWRITE_LEGACY("k007232", k005289_keylatch_B_w)
449449   AM_RANGE(0xe005, 0xe005) AM_DEVWRITE_LEGACY("ay2", ay8910_address_w)
r14896r14897
569569static ADDRESS_MAP_START( sal_sound_map, AS_PROGRAM, 8, nemesis_state )
570570   AM_RANGE(0x0000, 0x7fff) AM_ROM
571571   AM_RANGE(0x8000, 0x87ff) AM_RAM
572   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
572   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
573573   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)
574574   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
575575   AM_RANGE(0xd000, 0xd000) AM_DEVWRITE_LEGACY("vlm", vlm5030_data_w)
r14896r14897
580580static ADDRESS_MAP_START( blkpnthr_sound_map, AS_PROGRAM, 8, nemesis_state )
581581   AM_RANGE(0x0000, 0x7fff) AM_ROM
582582   AM_RANGE(0x8000, 0x87ff) AM_RAM
583   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
583   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
584584   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)
585585   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
586586   AM_RANGE(0xe000, 0xe000) AM_READ(wd_r) /* watchdog?? */
r14896r14897
597597   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)
598598   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)
599599   AM_RANGE(0xc000, 0xc000) AM_DEVWRITE_LEGACY("k007232", city_sound_bank_w) /* 7232 bankswitch */
600   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
600   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r)
601601ADDRESS_MAP_END
602602
603603/******************************************************************************/
src/mame/drivers/progolf.c
r14896r14897
6060{
6161public:
6262   progolf_state(const machine_config &mconfig, device_type type, const char *tag)
63      : driver_device(mconfig, type, tag) { }
63      : driver_device(mconfig, type, tag) ,
64      m_fbram(*this, "fbram"){ }
6465
6566   UINT8 *m_videoram;
6667   UINT8 m_char_pen;
6768   UINT8 m_char_pen_vreg;
6869   UINT8 *m_fg_fb;
69   UINT8 *m_fbram;
70   required_shared_ptr<UINT8> m_fbram;
7071   UINT8 m_scrollx_hi;
7172   UINT8 m_scrollx_lo;
7273   UINT8 m_gfx_switch;
r14896r14897
152153WRITE8_MEMBER(progolf_state::progolf_charram_w)
153154{
154155   int i;
155   m_fbram[offset] = data;
156   m_fbram.target()[offset] = data;
156157
157158   if(m_char_pen == 7)
158159   {
r14896r14897
190191
191192WRITE8_MEMBER(progolf_state::progolf_flip_screen_w)
192193{
193   flip_screen_set(machine(), data & 1);
194   flip_screen_set(data & 1);
194195   if(data & 0xfe)
195196      printf("$9600 with data = %02x used\n",data);
196197}
r14896r14897
243244
244245static ADDRESS_MAP_START( main_cpu, AS_PROGRAM, 8, progolf_state )
245246   AM_RANGE(0x0000, 0x5fff) AM_RAM
246   AM_RANGE(0x6000, 0x7fff) AM_RAM_WRITE(progolf_charram_w) AM_BASE(m_fbram)
247   AM_RANGE(0x6000, 0x7fff) AM_RAM_WRITE(progolf_charram_w) AM_SHARE("fbram")
247248   AM_RANGE(0x8000, 0x8fff) AM_READWRITE(progolf_videoram_r,progolf_videoram_w)
248249   AM_RANGE(0x9000, 0x9000) AM_READ_PORT("IN2") AM_WRITE(progolf_char_vregs_w)
249250   AM_RANGE(0x9200, 0x9200) AM_READ_PORT("P1") AM_WRITE(progolf_scrollx_hi_w) //p1 inputs
src/mame/drivers/jackie.c
r14896r14897
5353public:
5454   jackie_state(const machine_config &mconfig, device_type type, const char *tag)
5555      : driver_device(mconfig, type, tag),
56      m_maincpu(*this,"maincpu")
57      { }
56      m_maincpu(*this,"maincpu"),
57      m_bg_scroll2(*this, "bg_scroll2"),
58      m_bg_scroll(*this, "bg_scroll"),
59      m_reel1_ram(*this, "reel1_ram"),
60      m_reel2_ram(*this, "reel2_ram"),
61      m_reel3_ram(*this, "reel3_ram"),
62      m_fg_tile_ram(*this, "fg_tile_ram"),
63      m_fg_color_ram(*this, "fg_color_ram"){ }
5864
65   required_device<cpu_device> m_maincpu;
66   required_shared_ptr<UINT8> m_bg_scroll2;
67   required_shared_ptr<UINT8> m_bg_scroll;
68   required_shared_ptr<UINT8> m_reel1_ram;
69   required_shared_ptr<UINT8> m_reel2_ram;
70   required_shared_ptr<UINT8> m_reel3_ram;
71   required_shared_ptr<UINT8> m_fg_tile_ram;
72   required_shared_ptr<UINT8> m_fg_color_ram;
5973   int m_exp_bank;
60   UINT8 *m_fg_tile_ram;
61   UINT8 *m_fg_color_ram;
6274   tilemap_t *m_fg_tilemap;
63   UINT8 *m_bg_scroll;
64   UINT8 *m_bg_scroll2;
6575   tilemap_t *m_reel1_tilemap;
66   UINT8 *m_reel1_ram;
6776   tilemap_t *m_reel2_tilemap;
68   UINT8 *m_reel2_ram;
6977   tilemap_t *m_reel3_tilemap;
70   UINT8 *m_reel3_ram;
7178   int m_irq_enable;
7279   int m_nmi_enable;
7380   int m_bg_enable;
r14896r14897
7582   UINT8 m_out[3];
7683   UINT16 m_unk_reg[3][5];
7784
78   required_device<cpu_device> m_maincpu;
7985   DECLARE_WRITE8_MEMBER(fg_tile_w);
8086   DECLARE_WRITE8_MEMBER(fg_color_w);
8187   DECLARE_WRITE8_MEMBER(bg_scroll_w);
r14896r14897
105111static TILE_GET_INFO( get_fg_tile_info )
106112{
107113   jackie_state *state = machine.driver_data<jackie_state>();
108   int code = state->m_fg_tile_ram[tile_index] | (state->m_fg_color_ram[tile_index] << 8);
114   int code = state->m_fg_tile_ram.target()[tile_index] | (state->m_fg_color_ram.target()[tile_index] << 8);
109115   int tile = code & 0x1fff;
110116   SET_TILE_INFO(0, code, tile != 0x1fff ? ((code >> 12) & 0xe) + 1 : 0, 0);
111117}
112118
113119WRITE8_MEMBER(jackie_state::fg_tile_w)
114120{
115   m_fg_tile_ram[offset] = data;
121   m_fg_tile_ram.target()[offset] = data;
116122   m_fg_tilemap->mark_tile_dirty(offset);
117123}
118124
119125WRITE8_MEMBER(jackie_state::fg_color_w)
120126{
121   m_fg_color_ram[offset] = data;
127   m_fg_color_ram.target()[offset] = data;
122128   m_fg_tilemap->mark_tile_dirty(offset);
123129}
124130
r14896r14897
127133
128134WRITE8_MEMBER(jackie_state::bg_scroll_w)
129135{
130   m_bg_scroll[offset] = data;
136   m_bg_scroll.target()[offset] = data;
131137}
132138
133139
134140WRITE8_MEMBER(jackie_state::jackie_reel1_ram_w)
135141{
136   m_reel1_ram[offset] = data;
142   m_reel1_ram.target()[offset] = data;
137143   m_reel1_tilemap->mark_tile_dirty(offset);
138144}
139145
140146static TILE_GET_INFO( get_jackie_reel1_tile_info )
141147{
142148   jackie_state *state = machine.driver_data<jackie_state>();
143   int code = state->m_reel1_ram[tile_index];
149   int code = state->m_reel1_ram.target()[tile_index];
144150   SET_TILE_INFO(1, code, 0, 0);
145151}
146152
r14896r14897
148154
149155WRITE8_MEMBER(jackie_state::jackie_reel2_ram_w)
150156{
151   m_reel2_ram[offset] = data;
157   m_reel2_ram.target()[offset] = data;
152158   m_reel2_tilemap->mark_tile_dirty(offset);
153159}
154160
155161static TILE_GET_INFO( get_jackie_reel2_tile_info )
156162{
157163   jackie_state *state = machine.driver_data<jackie_state>();
158   int code = state->m_reel2_ram[tile_index];
164   int code = state->m_reel2_ram.target()[tile_index];
159165   SET_TILE_INFO(1, code, 0, 0);
160166}
161167
162168
163169WRITE8_MEMBER(jackie_state::jackie_reel3_ram_w)
164170{
165   m_reel3_ram[offset] = data;
171   m_reel3_ram.target()[offset] = data;
166172   m_reel3_tilemap->mark_tile_dirty(offset);
167173}
168174
169175static TILE_GET_INFO( get_jackie_reel3_tile_info )
170176{
171177   jackie_state *state = machine.driver_data<jackie_state>();
172   int code = state->m_reel3_ram[tile_index];
178   int code = state->m_reel3_ram.target()[tile_index];
173179   SET_TILE_INFO(1, code, 0, 0);
174180}
175181
r14896r14897
200206
201207   for (i=0;i < 0x40;i++)
202208   {
203      state->m_reel1_tilemap->set_scrolly(i, state->m_bg_scroll[i+0x000]);
204      state->m_reel2_tilemap->set_scrolly(i, state->m_bg_scroll[i+0x040]);
205      state->m_reel3_tilemap->set_scrolly(i, state->m_bg_scroll[i+0x080]);
209      state->m_reel1_tilemap->set_scrolly(i, state->m_bg_scroll.target()[i+0x000]);
210      state->m_reel2_tilemap->set_scrolly(i, state->m_bg_scroll.target()[i+0x040]);
211      state->m_reel3_tilemap->set_scrolly(i, state->m_bg_scroll.target()[i+0x080]);
206212   }
207213
208214   for (j=0; j < 0x100-1; j++)
209215   {
210216      rectangle clip;
211      int rowenable = state->m_bg_scroll2[j];
217      int rowenable = state->m_bg_scroll2.target()[j];
212218
213219      /* draw top of screen */
214220      clip.set(visarea.min_x, visarea.max_x, startclipmin, startclipmin+1);
r14896r14897
361367   AM_RANGE(0x05a0, 0x05a4) AM_WRITE(jackie_unk_reg3_lo_w)
362368   AM_RANGE(0x0da0, 0x0da4) AM_WRITE(jackie_unk_reg3_hi_w)
363369   AM_RANGE(0x1000, 0x1107) AM_RAM AM_BASE(m_bg_scroll2 )
364   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_SHARE("paletteram")
365   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_SHARE("paletteram2")
370   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) AM_SHARE("paletteram")
371   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) AM_SHARE("paletteram2")
366372   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW1")         /* DSW1 */
367373   AM_RANGE(0x4001, 0x4001) AM_READ_PORT("DSW2")         /* DSW2 */
368374   AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3")         /* DSW3 */
src/mame/drivers/goal92.c
r14896r14897
1919{
2020   if (ACCESSING_BITS_8_15)
2121   {
22      soundlatch_w(space, 0, (data >> 8) & 0xff);
22      soundlatch_byte_w(space, 0, (data >> 8) & 0xff);
2323      device_set_input_line(m_audiocpu, 0, HOLD_LINE);
2424   }
2525}
r14896r14897
5353   AM_RANGE(0x101000, 0x1017ff) AM_RAM_WRITE(goal92_foreground_w) AM_BASE(m_fg_data)
5454   AM_RANGE(0x101800, 0x101fff) AM_RAM // it has tiles for clouds, but they aren't used
5555   AM_RANGE(0x102000, 0x102fff) AM_RAM_WRITE(goal92_text_w) AM_BASE(m_tx_data)
56   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
56   AM_RANGE(0x103000, 0x103fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
5757   AM_RANGE(0x104000, 0x13ffff) AM_RAM
5858   AM_RANGE(0x140000, 0x1407ff) AM_RAM AM_BASE(m_spriteram)
5959   AM_RANGE(0x140800, 0x140801) AM_WRITENOP
r14896r14897
8787   AM_RANGE(0xe800, 0xe801) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
8888   AM_RANGE(0xec00, 0xec01) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r, ym2203_w)
8989   AM_RANGE(0xf000, 0xf7ff) AM_RAM
90   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
90   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
9191ADDRESS_MAP_END
9292
9393static INPUT_PORTS_START( goal92 )
src/mame/drivers/bombjack.c
r14896r14897
142142   AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(bombjack_colorram_w) AM_BASE(m_colorram)
143143   AM_RANGE(0x9820, 0x987f) AM_WRITEONLY AM_BASE_SIZE(m_spriteram, m_spriteram_size)
144144   AM_RANGE(0x9a00, 0x9a00) AM_WRITENOP
145   AM_RANGE(0x9c00, 0x9cff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_SHARE("paletteram")
145   AM_RANGE(0x9c00, 0x9cff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
146146   AM_RANGE(0x9e00, 0x9e00) AM_WRITE(bombjack_background_w)
147147   AM_RANGE(0xb000, 0xb000) AM_READ_PORT("P1")
148148   AM_RANGE(0xb000, 0xb000) AM_WRITE(irq_mask_w)
src/mame/drivers/blockhl.c
r14896r14897
5151{
5252
5353   if (m_palette_selected)
54      paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset, data);
54      paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
5555   else
5656      m_ram[offset] = data;
5757}
r14896r14897
9292
9393
9494static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, blockhl_state )
95   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_w)
95   AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_byte_w)
9696   AM_RANGE(0x1f88, 0x1f88) AM_WRITE(blockhl_sh_irqtrigger_w)
9797   AM_RANGE(0x1f8c, 0x1f8c) AM_WRITE(watchdog_reset_w)
9898   AM_RANGE(0x1f94, 0x1f94) AM_READ_PORT("DSW3")
r14896r14897
110110static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, blockhl_state )
111111   AM_RANGE(0x0000, 0x7fff) AM_ROM
112112   AM_RANGE(0x8000, 0x87ff) AM_RAM
113   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
113   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
114114   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
115115   AM_RANGE(0xe00c, 0xe00d) AM_WRITENOP      /* leftover from missing 007232? */
116116ADDRESS_MAP_END
src/mame/drivers/gcpinbal.c
r14896r14897
233233   AM_RANGE(0x000000, 0x1fffff) AM_ROM
234234   AM_RANGE(0xc00000, 0xc03fff) AM_READWRITE(gcpinbal_tilemaps_word_r, gcpinbal_tilemaps_word_w) AM_BASE(m_tilemapram)
235235   AM_RANGE(0xc80000, 0xc80fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)   /* sprite ram */
236   AM_RANGE(0xd00000, 0xd00fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
236   AM_RANGE(0xd00000, 0xd00fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
237237   AM_RANGE(0xd80000, 0xd800ff) AM_READWRITE(ioc_r, ioc_w) AM_BASE(m_ioc_ram)
238238   AM_RANGE(0xff0000, 0xffffff) AM_RAM   /* RAM */
239239ADDRESS_MAP_END
src/mame/drivers/blackt96.c
r14896r14897
5757{
5858public:
5959   blackt96_state(const machine_config &mconfig, device_type type, const char *tag)
60      : driver_device(mconfig, type, tag) { }
60      : driver_device(mconfig, type, tag) ,
61      m_tilemapram(*this, "tilemapram"),
62      m_tilemapram2(*this, "tilemapram2"){ }
6163
62   UINT16* m_tilemapram;
63   UINT16* m_tilemapram2;
64   required_shared_ptr<UINT16> m_tilemapram;
65   required_shared_ptr<UINT16> m_tilemapram2;
6466   DECLARE_WRITE16_MEMBER(blackt96_c0000_w);
6567   DECLARE_WRITE16_MEMBER(blackt96_80000_w);
6668   DECLARE_READ8_MEMBER(PIC16C5X_T0_clk_r);
r14896r14897
8890
8991   for (y=0;y<32;y++)
9092   {
91      UINT16 tile = (state->m_tilemapram2[count*2 + (base/2)+1]&0x3fff);
92      UINT16 flipx = (state->m_tilemapram2[count*2 + (base/2)+1]&0x4000);
93      UINT16 colour = (state->m_tilemapram2[count*2 + (base/2)]&0x00ff);
93      UINT16 tile = (state->m_tilemapram2.target()[count*2 + (base/2)+1]&0x3fff);
94      UINT16 flipx = (state->m_tilemapram2.target()[count*2 + (base/2)+1]&0x4000);
95      UINT16 colour = (state->m_tilemapram2.target()[count*2 + (base/2)]&0x00ff);
9496
9597      if (tile&0x2000)
9698      {
r14896r14897
119121      int yy;
120122      int s = 0;
121123
122      xx=  ((state->m_tilemapram2[x+0]&0x001f)<<4) | (state->m_tilemapram2[x+1]&0xf000)>>12;
123      yy = ((state->m_tilemapram2[x+1]&0x1ff));
124      xx=  ((state->m_tilemapram2.target()[x+0]&0x001f)<<4) | (state->m_tilemapram2.target()[x+1]&0xf000)>>12;
125      yy = ((state->m_tilemapram2.target()[x+1]&0x1ff));
124126
125127      if (xx&0x100) xx-=0x200;
126128      yy = 0x1ff-yy;
r14896r14897
154156   {
155157      for (y=0;y<32;y++)
156158      {
157         UINT16 tile = (state->m_tilemapram[count*2]&0x7ff)+0x800; // +0xc00 for korean text
159         UINT16 tile = (state->m_tilemapram.target()[count*2]&0x7ff)+0x800; // +0xc00 for korean text
158160         drawgfx_transpen(bitmap,cliprect,gfx,tile,0,0,0,x*8,-16+y*8,0);
159161         count++;
160162      }
r14896r14897
185187   AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("DSW1")
186188   AM_RANGE(0x0f0008, 0x0f0009) AM_READ_PORT("DSW2")
187189
188   AM_RANGE(0x100000, 0x100fff) AM_RAM AM_BASE(m_tilemapram) // text tilemap
189   AM_RANGE(0x200000, 0x207fff) AM_RAM AM_BASE(m_tilemapram2)// sprite list + sprite tilemaps
190   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
190   AM_RANGE(0x100000, 0x100fff) AM_RAM AM_SHARE("tilemapram") // text tilemap
191   AM_RANGE(0x200000, 0x207fff) AM_RAM AM_SHARE("tilemapram2")// sprite list + sprite tilemaps
192   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
191193   AM_RANGE(0xc00000, 0xc03fff) AM_RAM // main ram
192194
193195ADDRESS_MAP_END
src/mame/drivers/segag80v.c
r14896r14897
377377   AM_RANGE(0x0000, 0x07ff) AM_ROM      /* CPU board ROM */
378378   AM_RANGE(0x0800, 0xbfff) AM_ROM      /* PROM board ROM area */
379379   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(mainram_w) AM_BASE(m_mainram)
380   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(vectorram_w) AM_BASE(m_vectorram) AM_SIZE(m_vectorram_size)
380   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(vectorram_w) AM_BASE_SIZE(m_vectorram,m_vectorram_size)
381381ADDRESS_MAP_END
382382
383383
r14896r14897
12981298
12991299   /* configure sound */
13001300   state->m_usb = NULL;
1301   iospace->install_legacy_write_handler(0x3e, 0x3e, FUNC(elim1_sh_w));
1302   iospace->install_legacy_write_handler(0x3f, 0x3f, FUNC(elim2_sh_w));
1301   iospace->install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::elim1_sh_w),state));
1302   iospace->install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::elim2_sh_w),state));
13031303}
13041304
13051305
r14896r14897
13131313
13141314   /* configure sound */
13151315   state->m_usb = NULL;
1316   iospace->install_legacy_write_handler(0x3e, 0x3e, FUNC(elim1_sh_w));
1317   iospace->install_legacy_write_handler(0x3f, 0x3f, FUNC(elim2_sh_w));
1316   iospace->install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::elim1_sh_w),state));
1317   iospace->install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::elim2_sh_w),state));
13181318
13191319   /* configure inputs */
13201320   iospace->install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),state));
r14896r14897
13341334   state->m_usb = NULL;
13351335   iospace->install_legacy_write_handler(*machine.device("segaspeech"), 0x38, 0x38, FUNC(sega_speech_data_w));
13361336   iospace->install_legacy_write_handler(*machine.device("segaspeech"), 0x3b, 0x3b, FUNC(sega_speech_control_w));
1337   iospace->install_legacy_write_handler(0x3e, 0x3e, FUNC(spacfury1_sh_w));
1338   iospace->install_legacy_write_handler(0x3f, 0x3f, FUNC(spacfury2_sh_w));
1337   iospace->install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::spacfury1_sh_w),state));
1338   iospace->install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::spacfury2_sh_w),state));
13391339}
13401340
13411341
r14896r14897
13531353   iospace->install_legacy_write_handler(*machine.device("segaspeech"), 0x38, 0x38, FUNC(sega_speech_data_w));
13541354   iospace->install_legacy_write_handler(*machine.device("segaspeech"), 0x3b, 0x3b, FUNC(sega_speech_control_w));
13551355   iospace->install_legacy_write_handler(*ay, 0x3c, 0x3d, FUNC(ay8910_address_data_w));
1356   iospace->install_legacy_write_handler(0x3e, 0x3e, FUNC(zektor1_sh_w));
1357   iospace->install_legacy_write_handler(0x3f, 0x3f, FUNC(zektor2_sh_w));
1356   iospace->install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::zektor1_sh_w),state));
1357   iospace->install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::zektor2_sh_w),state));
13581358
13591359   /* configure inputs */
13601360   iospace->install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),state));
src/mame/drivers/ace.c
r14896r14897
4747{
4848public:
4949   aceal_state(const machine_config &mconfig, device_type type, const char *tag)
50      : driver_device(mconfig, type, tag) { }
50      : driver_device(mconfig, type, tag) ,
51      m_scoreram(*this, "scoreram"),
52      m_ram2(*this, "ram2"),
53      m_characterram(*this, "characterram"){ }
5154
5255   /* video-related */
53   UINT8 *  m_ram2;
54   UINT8 *  m_scoreram;
55   UINT8 *  m_characterram;
56   required_shared_ptr<UINT8> m_scoreram;
57   required_shared_ptr<UINT8> m_ram2;
58   required_shared_ptr<UINT8> m_characterram;
5659
5760   /* input-related */
5861   int m_objpos[8];
r14896r14897
7982static VIDEO_START( ace )
8083{
8184   aceal_state *state = machine.driver_data<aceal_state>();
82   gfx_element_set_source(machine.gfx[1], state->m_characterram);
83   gfx_element_set_source(machine.gfx[2], state->m_characterram);
84   gfx_element_set_source(machine.gfx[3], state->m_characterram);
85   gfx_element_set_source(machine.gfx[4], state->m_scoreram);
85   gfx_element_set_source(machine.gfx[1], state->m_characterram.target());
86   gfx_element_set_source(machine.gfx[2], state->m_characterram.target());
87   gfx_element_set_source(machine.gfx[3], state->m_characterram.target());
88   gfx_element_set_source(machine.gfx[4], state->m_scoreram.target());
8689}
8790
8891static SCREEN_UPDATE_IND16( ace )
r14896r14897
133136
134137WRITE8_MEMBER(aceal_state::ace_characterram_w)
135138{
136   if (m_characterram[offset] != data)
139   if (m_characterram.target()[offset] != data)
137140   {
138141      if (data & ~0x07)
139142      {
140143         logerror("write to %04x data = %02x\n", 0x8000 + offset, data);
141144         popmessage("write to %04x data = %02x\n", 0x8000 + offset, data);
142145      }
143      m_characterram[offset] = data;
146      m_characterram.target()[offset] = data;
144147      gfx_element_mark_dirty(machine().gfx[1], 0);
145148      gfx_element_mark_dirty(machine().gfx[2], 0);
146149      gfx_element_mark_dirty(machine().gfx[3], 0);
r14896r14897
149152
150153WRITE8_MEMBER(aceal_state::ace_scoreram_w)
151154{
152   m_scoreram[offset] = data;
155   m_scoreram.target()[offset] = data;
153156   gfx_element_mark_dirty(machine().gfx[4], offset / 32);
154157}
155158
r14896r14897
167170
168171   AM_RANGE(0x0000, 0x09ff) AM_ROM
169172
170   AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(ace_scoreram_w) AM_BASE(m_scoreram)   /* 2x2101 */
171   AM_RANGE(0x8300, 0x83ff) AM_RAM AM_BASE(m_ram2)   /* 2x2101 */
172   AM_RANGE(0x8000, 0x80ff) AM_RAM_WRITE(ace_characterram_w) AM_BASE(m_characterram)   /* 3x3101 (3bits: 0, 1, 2) */
173   AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(ace_scoreram_w) AM_SHARE("scoreram")   /* 2x2101 */
174   AM_RANGE(0x8300, 0x83ff) AM_RAM AM_SHARE("ram2")   /* 2x2101 */
175   AM_RANGE(0x8000, 0x80ff) AM_RAM_WRITE(ace_characterram_w) AM_SHARE("characterram")   /* 3x3101 (3bits: 0, 1, 2) */
173176
174177   AM_RANGE(0xc000, 0xc005) AM_WRITE(ace_objpos_w)
175178
src/mame/drivers/bottom9.c
r14896r14897
9393   if (m_k052109_selected)
9494      k052109_051960_w(space, offset + 0x2000, data);
9595   else
96      paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset, data);
96      paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
9797}
9898
9999WRITE8_MEMBER(bottom9_state::bankswitch_w)
r14896r14897
169169   AM_RANGE(0x1f80, 0x1f80) AM_WRITE(bankswitch_w)
170170   AM_RANGE(0x1f90, 0x1f90) AM_WRITE(bottom9_1f90_w)
171171   AM_RANGE(0x1fa0, 0x1fa0) AM_WRITE(watchdog_reset_w)
172   AM_RANGE(0x1fb0, 0x1fb0) AM_WRITE(soundlatch_w)
172   AM_RANGE(0x1fb0, 0x1fb0) AM_WRITE(soundlatch_byte_w)
173173   AM_RANGE(0x1fc0, 0x1fc0) AM_WRITE(bottom9_sh_irqtrigger_w)
174174   AM_RANGE(0x1fd0, 0x1fd0) AM_READ_PORT("SYSTEM")
175175   AM_RANGE(0x1fd1, 0x1fd1) AM_READ_PORT("P1")
r14896r14897
190190   AM_RANGE(0x9000, 0x9000) AM_WRITE(sound_bank_w)
191191   AM_RANGE(0xa000, 0xa00d) AM_DEVREADWRITE_LEGACY("k007232_1", k007232_r, k007232_w)
192192   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("k007232_2", k007232_r, k007232_w)
193   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
193   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r)
194194   AM_RANGE(0xf000, 0xf000) AM_WRITE(nmi_enable_w)
195195ADDRESS_MAP_END
196196
src/mame/drivers/dreamwld.c
r14896r14897
125125{
126126public:
127127   dreamwld_state(const machine_config &mconfig, device_type type, const char *tag)
128      : driver_device(mconfig, type, tag) { }
128      : driver_device(mconfig, type, tag) ,
129      m_spriteram(*this, "spriteram"),
130      m_paletteram(*this, "paletteram"),
131      m_bg_videoram(*this, "bg_videoram"),
132      m_bg2_videoram(*this, "bg2_videoram"),
133      m_vregs(*this, "vregs"),
134      m_workram(*this, "workram"){ }
129135
130136   /* memory pointers */
131   UINT32 *  m_bg_videoram;
132   UINT32 *  m_bg2_videoram;
133   UINT32 *  m_vregs;
134   UINT32 *  m_paletteram;
135   UINT32 *  m_spriteram;
136   UINT32 *  m_workram;
137   required_shared_ptr<UINT32> m_spriteram;
138   required_shared_ptr<UINT32> m_paletteram;
139   required_shared_ptr<UINT32> m_bg_videoram;
140   required_shared_ptr<UINT32> m_bg2_videoram;
141   required_shared_ptr<UINT32> m_vregs;
142   required_shared_ptr<UINT32> m_workram;
137143
138144   /* video-related */
139145   tilemap_t  *m_bg_tilemap;
r14896r14897
223229
224230WRITE32_MEMBER(dreamwld_state::dreamwld_bg_videoram_w)
225231{
226   COMBINE_DATA(&m_bg_videoram[offset]);
232   COMBINE_DATA(&m_bg_videoram.target()[offset]);
227233   m_bg_tilemap->mark_tile_dirty(offset * 2);
228234   m_bg_tilemap->mark_tile_dirty(offset * 2 + 1);
229235}
r14896r14897
232238{
233239   dreamwld_state *state = machine.driver_data<dreamwld_state>();
234240   int tileno, colour;
235   tileno = (tile_index & 1) ? (state->m_bg_videoram[tile_index >> 1] & 0xffff) : ((state->m_bg_videoram[tile_index >> 1] >> 16) & 0xffff);
241   tileno = (tile_index & 1) ? (state->m_bg_videoram.target()[tile_index >> 1] & 0xffff) : ((state->m_bg_videoram.target()[tile_index >> 1] >> 16) & 0xffff);
236242   colour = tileno >> 13;
237243   tileno &= 0x1fff;
238244   SET_TILE_INFO(1, tileno + state->m_tilebank[0] * 0x2000, 0x80 + colour, 0);
r14896r14897
241247
242248WRITE32_MEMBER(dreamwld_state::dreamwld_bg2_videoram_w)
243249{
244   COMBINE_DATA(&m_bg2_videoram[offset]);
250   COMBINE_DATA(&m_bg2_videoram.target()[offset]);
245251   m_bg2_tilemap->mark_tile_dirty(offset * 2);
246252   m_bg2_tilemap->mark_tile_dirty(offset * 2 + 1);
247253}
r14896r14897
250256{
251257   dreamwld_state *state = machine.driver_data<dreamwld_state>();
252258   UINT16 tileno, colour;
253   tileno = (tile_index & 1) ? (state->m_bg2_videoram[tile_index >> 1] & 0xffff) : ((state->m_bg2_videoram[tile_index >> 1] >> 16) & 0xffff);
259   tileno = (tile_index & 1) ? (state->m_bg2_videoram.target()[tile_index >> 1] & 0xffff) : ((state->m_bg2_videoram.target()[tile_index >> 1] >> 16) & 0xffff);
254260   colour = tileno >> 13;
255261   tileno &= 0x1fff;
256262   SET_TILE_INFO(1, tileno + state->m_tilebank[1] * 0x2000, 0xc0 + colour, 0);
r14896r14897
298304   tmptilemap0 = state->m_bg_tilemap;
299305   tmptilemap1 = state->m_bg2_tilemap;
300306
301   int layer0_scrolly = state->m_vregs[(0x400 / 4)] + 32;
302   int layer1_scrolly = state->m_vregs[(0x400 / 4) + 2] + 32;
307   int layer0_scrolly = state->m_vregs.target()[(0x400 / 4)] + 32;
308   int layer1_scrolly = state->m_vregs.target()[(0x400 / 4) + 2] + 32;
303309
304   int layer0_scrollx = state->m_vregs[(0x400 / 4) + 1] + 3;
305   int layer1_scrollx = state->m_vregs[(0x400 / 4) + 3] + 5;
306   UINT32 layer0_ctrl = state->m_vregs[0x412 / 4];
307   UINT32 layer1_ctrl = state->m_vregs[0x416 / 4];
310   int layer0_scrollx = state->m_vregs.target()[(0x400 / 4) + 1] + 3;
311   int layer1_scrollx = state->m_vregs.target()[(0x400 / 4) + 3] + 5;
312   UINT32 layer0_ctrl = state->m_vregs.target()[0x412 / 4];
313   UINT32 layer1_ctrl = state->m_vregs.target()[0x416 / 4];
308314
309315   tmptilemap0->set_scrolly(0, layer0_scrolly);
310316   tmptilemap1->set_scrolly(0, layer1_scrolly);
r14896r14897
338344      {
339345         if (layer0_ctrl & 0x0200)
340346            /* per-tile rowscroll */
341            x0 = ((UINT16 *)state->m_vregs)[BYTE_XOR_BE(0x000/2 + i/16)];
347            x0 = ((UINT16 *)state->m_vregs.target())[BYTE_XOR_BE(0x000/2 + i/16)];
342348         else
343349            /* per-line rowscroll */
344            x0 = ((UINT16 *)state->m_vregs)[BYTE_XOR_BE(0x000/2 + ((i + layer0_scrolly)&0xff))]; // different handling to psikyo.c? ( + scrolly )
350            x0 = ((UINT16 *)state->m_vregs.target())[BYTE_XOR_BE(0x000/2 + ((i + layer0_scrolly)&0xff))]; // different handling to psikyo.c? ( + scrolly )
345351      }
346352
347353
r14896r14897
355361      {
356362         if (layer1_ctrl & 0x0200)
357363            /* per-tile rowscroll */
358            x1 = ((UINT16 *)state->m_vregs)[BYTE_XOR_BE(0x200/2 + i/16)];
364            x1 = ((UINT16 *)state->m_vregs.target())[BYTE_XOR_BE(0x200/2 + i/16)];
359365         else
360366            /* per-line rowscroll */
361            x1 = ((UINT16 *)state->m_vregs)[BYTE_XOR_BE(0x200/2 + ((i + layer1_scrolly)&0xff))];  // different handling to psikyo.c? ( + scrolly )
367            x1 = ((UINT16 *)state->m_vregs.target())[BYTE_XOR_BE(0x200/2 + ((i + layer1_scrolly)&0xff))];  // different handling to psikyo.c? ( + scrolly )
362368      }
363369
364370
r14896r14897
368374   }
369375
370376
371   state->m_tilebank[0] = (state->m_vregs[(0x400 / 4) + 4] >> 6) & 1;
372   state->m_tilebank[1] = (state->m_vregs[(0x400 / 4) + 5] >> 6) & 1;
377   state->m_tilebank[0] = (state->m_vregs.target()[(0x400 / 4) + 4] >> 6) & 1;
378   state->m_tilebank[1] = (state->m_vregs.target()[(0x400 / 4) + 5] >> 6) & 1;
373379
374380   if (state->m_tilebank[0] != state->m_tilebankold[0])
375381   {
r14896r14897
432438      logerror("OKI1: unk bank write %x mem_mask %8x\n", data, mem_mask);
433439}
434440
435// why doesn't using paletteram16_xRRRRRGGGGGBBBBB_word_w with a 16-bit handler work? colours are
441// why doesn't using paletteram_xRRRRRGGGGGBBBBB_word_w with a 16-bit handler work? colours are
436442// severely corrupt on dream world's semicom screen + many sprites, seems palette values get duplicated.
437443WRITE32_MEMBER(dreamwld_state::dreamwld_palette_w)
438444{
439445   UINT16 dat;
440446   int color;
441447
442   COMBINE_DATA(&m_paletteram[offset]);
448   COMBINE_DATA(&m_paletteram.target()[offset]);
443449   color = offset * 2;
444450
445   dat = m_paletteram[offset] & 0x7fff;
451   dat = m_paletteram.target()[offset] & 0x7fff;
446452   palette_set_color_rgb(machine(), color+1, pal5bit(dat >> 10), pal5bit(dat >> 5), pal5bit(dat >> 0));
447453
448   dat = (m_paletteram[offset] >> 16) & 0x7fff;
454   dat = (m_paletteram.target()[offset] >> 16) & 0x7fff;
449455   palette_set_color_rgb(machine(), color, pal5bit(dat >> 10), pal5bit(dat >> 5), pal5bit(dat >> 0));
450456}
451457
r14896r14897
454460static ADDRESS_MAP_START( baryon_map, AS_PROGRAM, 32, dreamwld_state )
455461   AM_RANGE(0x000000, 0x0fffff) AM_ROM  AM_WRITENOP
456462
457   AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE(m_spriteram)
458   AM_RANGE(0x600000, 0x601fff) AM_RAM AM_WRITE(dreamwld_palette_w) AM_BASE(m_paletteram)
459   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(dreamwld_bg_videoram_w ) AM_BASE(m_bg_videoram)
460   AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(dreamwld_bg2_videoram_w ) AM_BASE(m_bg2_videoram)
461   AM_RANGE(0x804000, 0x805fff) AM_RAM AM_BASE(m_vregs)  // scroll regs etc.
463   AM_RANGE(0x400000, 0x401fff) AM_RAM AM_SHARE("spriteram")
464   AM_RANGE(0x600000, 0x601fff) AM_RAM AM_WRITE(dreamwld_palette_w) AM_SHARE("paletteram")
465   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(dreamwld_bg_videoram_w ) AM_SHARE("bg_videoram")
466   AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(dreamwld_bg2_videoram_w ) AM_SHARE("bg2_videoram")
467   AM_RANGE(0x804000, 0x805fff) AM_RAM AM_SHARE("vregs")  // scroll regs etc.
462468
463469   AM_RANGE(0xc00000, 0xc00003) AM_READ_PORT("INPUTS")
464470   AM_RANGE(0xc00004, 0xc00007) AM_READ_PORT("c00004")
r14896r14897
468474
469475   AM_RANGE(0xc00030, 0xc00033) AM_READ(dreamwld_protdata_r) // it reads protection data (irq code) from here and puts it at ffd000
470476
471   AM_RANGE(0xfe0000, 0xffffff) AM_RAM AM_BASE(m_workram) // work ram
477   AM_RANGE(0xfe0000, 0xffffff) AM_RAM AM_SHARE("workram") // work ram
472478ADDRESS_MAP_END
473479
474480static ADDRESS_MAP_START( dreamwld_map, AS_PROGRAM, 32, dreamwld_state )
src/mame/drivers/astrocde.c
r14896r14897
522522
523523WRITE8_MEMBER(astrocde_state::tenpindx_sound_w)
524524{
525   soundlatch_w(space, offset, data);
525   soundlatch_byte_w(space, offset, data);
526526   cputag_set_input_line(machine(), "sub", INPUT_LINE_NMI, PULSE_LINE);
527527}
528528
r14896r14897
708708static ADDRESS_MAP_START( tenpin_sub_io_map, AS_IO, 8, astrocde_state )
709709   ADDRESS_MAP_GLOBAL_MASK(0xff)
710710   AM_RANGE(0x90, 0x93) AM_DEVREADWRITE_LEGACY("ctc", z80ctc_r, z80ctc_w)
711   AM_RANGE(0x97, 0x97) AM_READ(soundlatch_r)
711   AM_RANGE(0x97, 0x97) AM_READ(soundlatch_byte_r)
712712   AM_RANGE(0x98, 0x98) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
713713   AM_RANGE(0x98, 0x98) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
714714   AM_RANGE(0x9a, 0x9a) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
src/mame/drivers/megazone.c
r14896r14897
100100static ADDRESS_MAP_START( megazone_sound_map, AS_PROGRAM, 8, megazone_state )
101101   AM_RANGE(0x0000, 0x1fff) AM_ROM
102102   AM_RANGE(0x2000, 0x2000) AM_WRITE(megazone_i8039_irq_w)   /* START line. Interrupts 8039 */
103   AM_RANGE(0x4000, 0x4000) AM_WRITE(soundlatch_w)         /* CODE  line. Command Interrupts 8039 */
103   AM_RANGE(0x4000, 0x4000) AM_WRITE(soundlatch_byte_w)         /* CODE  line. Command Interrupts 8039 */
104104   AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0")         /* IO Coin */
105105   AM_RANGE(0x6001, 0x6001) AM_READ_PORT("IN1")         /* P1 IO */
106106   AM_RANGE(0x6002, 0x6002) AM_READ_PORT("IN2")         /* P2 IO */
r14896r14897
124124ADDRESS_MAP_END
125125
126126static ADDRESS_MAP_START( megazone_i8039_io_map, AS_IO, 8, megazone_state )
127   AM_RANGE(0x00, 0xff) AM_READ(soundlatch_r)
127   AM_RANGE(0x00, 0xff) AM_READ(soundlatch_byte_r)
128128   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE_LEGACY("dac", dac_w)
129129   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(i8039_irqen_and_status_w)
130130ADDRESS_MAP_END
src/mame/drivers/pass.c
r14896r14897
113113   AM_RANGE(0x080000, 0x083fff) AM_RAM
114114   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(pass_bg_videoram_w) AM_BASE(m_bg_videoram) // Background
115115   AM_RANGE(0x210000, 0x213fff) AM_RAM_WRITE(pass_fg_videoram_w) AM_BASE(m_fg_videoram) // Foreground
116   AM_RANGE(0x220000, 0x2203ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
116   AM_RANGE(0x220000, 0x2203ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
117117   AM_RANGE(0x230000, 0x230001) AM_WRITE(soundlatch_word_w)
118118   AM_RANGE(0x230100, 0x230101) AM_READ_PORT("DSW")
119119   AM_RANGE(0x230200, 0x230201) AM_READ_PORT("INPUTS")
r14896r14897
127127
128128static ADDRESS_MAP_START( pass_sound_io_map, AS_IO, 8, pass_state )
129129   ADDRESS_MAP_GLOBAL_MASK(0xff)
130   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
130   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)
131131   AM_RANGE(0x70, 0x71) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
132132   AM_RANGE(0x80, 0x80) AM_DEVWRITE("oki", okim6295_device, write)
133   AM_RANGE(0xc0, 0xc0) AM_WRITE(soundlatch_clear_w)
133   AM_RANGE(0xc0, 0xc0) AM_WRITE(soundlatch_clear_byte_w)
134134ADDRESS_MAP_END
135135
136136/* todo : work out function of unknown but used dsw */
src/mame/drivers/40love.c
r14896r14897
236236
237237WRITE8_MEMBER(fortyl_state::sound_command_w)
238238{
239   soundlatch_w(space, 0, data);
239   soundlatch_byte_w(space, 0, data);
240240   machine().scheduler().synchronize(FUNC(nmi_callback), data);
241241}
242242
r14896r14897
750750   AM_RANGE(0xca00, 0xca0d) AM_DEVWRITE_LEGACY("msm", msm5232_w)
751751   AM_RANGE(0xcc00, 0xcc00) AM_DEVWRITE_LEGACY("msm", sound_control_0_w)
752752   AM_RANGE(0xce00, 0xce00) AM_DEVWRITE_LEGACY("msm", sound_control_1_w)
753   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_r) AM_WRITE(to_main_w)
753   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r) AM_WRITE(to_main_w)
754754   AM_RANGE(0xda00, 0xda00) AM_READNOP AM_WRITE(nmi_enable_w) /* unknown read */
755755   AM_RANGE(0xdc00, 0xdc00) AM_WRITE(nmi_disable_w)
756756   AM_RANGE(0xde00, 0xde00) AM_READNOP AM_DEVWRITE_LEGACY("dac", dac_signed_w)      /* signed 8-bit DAC - unknown read */
src/mame/drivers/galaga.c
r14896r14897
725725
726726WRITE8_MEMBER(galaga_state::galaga_flip_screen_w)
727727{
728   flip_screen_set(machine(), data & 1);
728   flip_screen_set(data & 1);
729729}
730730
731731WRITE8_MEMBER(bosco_state::bosco_flip_screen_w)
732732{
733   flip_screen_set(machine(), ~data & 1);
733   flip_screen_set(~data & 1);
734734}
735735
736736
r14896r14897
777777   }
778778}
779779
780CUSTOM_INPUT_MEMBER(galaga_state::shifted_port_r){ return input_port_read(machine(), (const char *)param) >> 4; }
780CUSTOM_INPUT_MEMBER(digdug_state::shifted_port_r){ return input_port_read(machine(), (const char *)param) >> 4; }
781781
782782static WRITE8_DEVICE_HANDLER( out_0 )
783783{
r14896r14897
14161416   PORT_DIPSETTING(    0xc0, "5" )
14171417
14181418   PORT_START("DSWA_HI")
1419   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bosco_state,shifted_port_r, "DSWA")
1419   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, digdug_state,shifted_port_r, "DSWA")
14201420
14211421   PORT_START("DSWB") // reverse order against SWA
14221422   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_A ) )           PORT_DIPLOCATION("SWB:1,2")
r14896r14897
14431443   PORT_DIPSETTING(    0x03, DEF_STR( Hardest ) )
14441444
14451445   PORT_START("DSWB_HI")
1446   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bosco_state,shifted_port_r, "DSWB")
1446   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, digdug_state,shifted_port_r, "DSWB")
14471447INPUT_PORTS_END
14481448
14491449/*
src/mame/drivers/panicr.c
r14896r14897
6969{
7070public:
7171   panicr_state(const machine_config &mconfig, device_type type, const char *tag)
72      : driver_device(mconfig, type, tag) { }
72      : driver_device(mconfig, type, tag) ,
73      m_mainram(*this, "mainram"),
74      m_spriteram(*this, "spriteram"),
75      m_videoram(*this, "videoram"),
76      m_scrollram(*this, "scrollram"){ }
7377
74   UINT8 *m_videoram;
78   required_shared_ptr<UINT8> m_mainram;
79   required_shared_ptr<UINT8> m_spriteram;
80   required_shared_ptr<UINT8> m_videoram;
81   required_shared_ptr<UINT8> m_scrollram;
7582   tilemap_t *m_bgtilemap;
7683   tilemap_t *m_txttilemap;
77   UINT8 *m_scrollram;
78   UINT8 *m_mainram;
79   UINT8 *m_spriteram;
8084   DECLARE_READ8_MEMBER(t5182shared_r);
8185   DECLARE_WRITE8_MEMBER(t5182shared_w);
8286};
r14896r14897
159163static TILE_GET_INFO( get_txttile_info )
160164{
161165   panicr_state *state = machine.driver_data<panicr_state>();
162   UINT8 *videoram = state->m_videoram;
166   UINT8 *videoram = state->m_videoram.target();
163167   int code=videoram[tile_index*4];
164168   int attr=videoram[tile_index*4+2];
165169   int color = attr & 0x07;
r14896r14897
189193
190194
191195static ADDRESS_MAP_START( panicr_map, AS_PROGRAM, 8, panicr_state )
192   AM_RANGE(0x00000, 0x01fff) AM_RAM AM_BASE(m_mainram)
193   AM_RANGE(0x02000, 0x02fff) AM_RAM AM_BASE(m_spriteram)
196   AM_RANGE(0x00000, 0x01fff) AM_RAM AM_SHARE("mainram")
197   AM_RANGE(0x02000, 0x02fff) AM_RAM AM_SHARE("spriteram")
194198   AM_RANGE(0x03000, 0x03fff) AM_RAM
195199   AM_RANGE(0x08000, 0x0bfff) AM_RAM AM_REGION("user3", 0) //attribue map ?
196   AM_RANGE(0x0c000, 0x0cfff) AM_RAM AM_BASE(m_videoram)
200   AM_RANGE(0x0c000, 0x0cfff) AM_RAM AM_SHARE("videoram")
197201   AM_RANGE(0x0d000, 0x0d000) AM_WRITE_LEGACY(t5182_sound_irq_w)
198202   AM_RANGE(0x0d002, 0x0d002) AM_READ_LEGACY(t5182_sharedram_semaphore_snd_r)
199203   AM_RANGE(0x0d004, 0x0d004) AM_WRITE_LEGACY(t5182_sharedram_semaphore_main_acquire_w)
r14896r14897
204208   AM_RANGE(0x0d404, 0x0d404) AM_READ_PORT("START")
205209   AM_RANGE(0x0d406, 0x0d406) AM_READ_PORT("DSW1")
206210   AM_RANGE(0x0d407, 0x0d407) AM_READ_PORT("DSW2")
207   AM_RANGE(0x0d800, 0x0d81f) AM_RAM AM_BASE(m_scrollram)
211   AM_RANGE(0x0d800, 0x0d81f) AM_RAM AM_SHARE("scrollram")
208212   AM_RANGE(0xf0000, 0xfffff) AM_ROM
209213ADDRESS_MAP_END
210214
r14896r14897
220224static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
221225{
222226   panicr_state *state = machine.driver_data<panicr_state>();
223   UINT8 *spriteram = state->m_spriteram;
227   UINT8 *spriteram = state->m_spriteram.target();
224228   int offs,flipx,flipy,x,y,color,sprite;
225229
226230   for (offs = 0; offs<0x1000; offs+=16)
r14896r14897
232236      if (spriteram[offs+1] & 0x40) x -= 0x100;
233237
234238      color = spriteram[offs+1] & 0x0f;
235      sprite = spriteram[offs+0]+(state->m_scrollram[0x0c]<<8);
239      sprite = spriteram[offs+0]+(state->m_scrollram.target()[0x0c]<<8);
236240
237241      drawgfx_transmask(bitmap,cliprect,machine.gfx[2],
238242            sprite,
r14896r14897
246250   panicr_state *state = screen.machine().driver_data<panicr_state>();
247251   bitmap.fill(get_black_pen(screen.machine()), cliprect);
248252   state->m_txttilemap ->mark_all_dirty();
249   state->m_bgtilemap->set_scrollx(0, ((state->m_scrollram[0x02]&0x0f)<<12)+((state->m_scrollram[0x02]&0xf0)<<4)+((state->m_scrollram[0x04]&0x7f)<<1)+((state->m_scrollram[0x04]&0x80)>>7) );
253   state->m_bgtilemap->set_scrollx(0, ((state->m_scrollram.target()[0x02]&0x0f)<<12)+((state->m_scrollram.target()[0x02]&0xf0)<<4)+((state->m_scrollram.target()[0x04]&0x7f)<<1)+((state->m_scrollram.target()[0x04]&0x80)>>7) );
250254   state->m_bgtilemap->draw(bitmap, cliprect, 0,0);
251255   draw_sprites(screen.machine(),bitmap,cliprect);
252256   state->m_txttilemap->draw(bitmap, cliprect, 0,0);
src/mame/drivers/istellar.c
r14896r14897
3030public:
3131   istellar_state(const machine_config &mconfig, device_type type, const char *tag)
3232      : driver_device(mconfig, type, tag),
33        m_laserdisc(*this, "laserdisc") { }
33        m_laserdisc(*this, "laserdisc") ,
34      m_tile_ram(*this, "tile_ram"),
35      m_tile_control_ram(*this, "tile_control_ram"),
36      m_sprite_ram(*this, "sprite_ram"){ }
3437
3538   required_device<pioneer_ldv1000_device> m_laserdisc;
36   UINT8 *m_tile_ram;
37   UINT8 *m_tile_control_ram;
38   UINT8 *m_sprite_ram;
39   required_shared_ptr<UINT8> m_tile_ram;
40   required_shared_ptr<UINT8> m_tile_control_ram;
41   required_shared_ptr<UINT8> m_sprite_ram;
3942   UINT8 m_ldp_latch1;
4043   UINT8 m_ldp_latch2;
4144   UINT8 m_z80_2_nmi_enable;
r14896r14897
6770   /*
6871    for (charx = 0; charx < 0x400; charx ++)
6972    {
70        printf ("%x ", state->m_sprite_ram[charx]) ;
73        printf ("%x ", state->m_sprite_ram.target()[charx]) ;
7174    }
7275    printf("\n\n\n");
7376    */
r14896r14897
8083         int current_screen_character = (chary*32) + charx;
8184
8285         drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[0],
83               state->m_tile_ram[current_screen_character],
84               (state->m_tile_control_ram[current_screen_character] & 0x0f),
86               state->m_tile_ram.target()[current_screen_character],
87               (state->m_tile_control_ram.target()[current_screen_character] & 0x0f),
8588               0, 0, charx*8, chary*8, 0);
8689      }
8790   }
r14896r14897
170173static ADDRESS_MAP_START( z80_0_mem, AS_PROGRAM, 8, istellar_state )
171174   AM_RANGE(0x0000,0x9fff) AM_ROM
172175   AM_RANGE(0xa000,0xa7ff) AM_RAM
173   AM_RANGE(0xa800,0xabff) AM_RAM AM_BASE(m_tile_ram)
174   AM_RANGE(0xac00,0xafff) AM_RAM AM_BASE(m_tile_control_ram)
175   AM_RANGE(0xb000,0xb3ff) AM_RAM AM_BASE(m_sprite_ram)
176   AM_RANGE(0xa800,0xabff) AM_RAM AM_SHARE("tile_ram")
177   AM_RANGE(0xac00,0xafff) AM_RAM AM_SHARE("tile_control_ram")
178   AM_RANGE(0xb000,0xb3ff) AM_RAM AM_SHARE("sprite_ram")
176179ADDRESS_MAP_END
177180
178181static ADDRESS_MAP_START( z80_1_mem, AS_PROGRAM, 8, istellar_state )
src/mame/drivers/lasso.c
r14896r14897
4949/* Write to the sound latch and generate an IRQ on the sound CPU */
5050WRITE8_MEMBER(lasso_state::sound_command_w)
5151{
52   soundlatch_w(space, offset, data);
53   generic_pulse_irq_line(m_audiocpu, 0, 1);
52   soundlatch_byte_w(space, offset, data);
53   generic_pulse_irq_line(m_audiocpu->execute(), 0, 1);
5454}
5555
5656WRITE8_MEMBER(lasso_state::pinbo_sound_command_w)
5757{
58   soundlatch_w(space, offset, data);
58   soundlatch_byte_w(space, offset, data);
5959   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
6060}
6161
r14896r14897
100100   AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_BASE(m_chip_data)
101101   AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w)
102102   AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r)
103   AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_r)
103   AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_byte_r)
104104   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("audiocpu", 0x7000)
105105ADDRESS_MAP_END
106106
r14896r14897
138138   AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_BASE(m_chip_data)
139139   AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w)
140140   AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r)
141   AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_r)
141   AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_byte_r)
142142   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("audiocpu", 0x7000)
143143ADDRESS_MAP_END
144144
r14896r14897
169169   AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w)
170170   AM_RANGE(0xb003, 0xb003) AM_DEVWRITE_LEGACY("dac", dac_w)
171171   AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r)
172   AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_r)
172   AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_byte_r)
173173ADDRESS_MAP_END
174174
175175
r14896r14897
203203   AM_RANGE(0x02, 0x02) AM_DEVREAD_LEGACY("ay1", ay8910_r)
204204   AM_RANGE(0x04, 0x05) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
205205   AM_RANGE(0x06, 0x06) AM_DEVREAD_LEGACY("ay2", ay8910_r)
206   AM_RANGE(0x08, 0x08) AM_READ(soundlatch_r) AM_WRITENOP /* ??? */
206   AM_RANGE(0x08, 0x08) AM_READ(soundlatch_byte_r) AM_WRITENOP /* ??? */
207207   AM_RANGE(0x14, 0x14) AM_WRITENOP   /* ??? */
208208ADDRESS_MAP_END
209209
src/mame/drivers/macs.c
r14896r14897
137137{
138138   memory_set_bankptr(machine(),  "bank1", machine().region("maincpu")->base() + (data* 0x4000) + 0x10000 + macs_cart_slot*0x400000 );
139139
140   st0016_rom_bank=data;
140   m_st0016_rom_bank=data;
141141}
142142
143143WRITE8_MEMBER(macs_state::macs_output_w)
src/mame/drivers/sbowling.c
r14896r14897
4949public:
5050   sbowling_state(const machine_config &mconfig, device_type type, const char *tag)
5151      : driver_device(mconfig, type, tag),
52      m_maincpu(*this, "maincpu")
53      { }
52      m_maincpu(*this, "maincpu"),
53      m_videoram(*this, "videoram"){ }
5454
5555   int m_bgmap;
56   UINT8 *m_videoram;
56   required_device<cpu_device> m_maincpu;
57   required_shared_ptr<UINT8> m_videoram;
5758
5859   int m_sbw_system;
5960   tilemap_t *m_sb_tilemap;
r14896r14897
6263   UINT8 m_pix_sh;
6364   UINT8 m_pix[2];
6465
65   required_device<cpu_device> m_maincpu;
6666   DECLARE_WRITE8_MEMBER(sbw_videoram_w);
6767   DECLARE_WRITE8_MEMBER(pix_shift_w);
6868   DECLARE_WRITE8_MEMBER(pix_data_w);
r14896r14897
9393
9494WRITE8_MEMBER(sbowling_state::sbw_videoram_w)
9595{
96   int flip = flip_screen_get(machine());
96   int flip = flip_screen();
9797   int x,y,i,v1,v2;
9898
99   m_videoram[offset] = data;
99   m_videoram.target()[offset] = data;
100100
101101   offset &= 0x1fff;
102102
103103   y = offset / 32;
104104   x = (offset % 32) * 8;
105105
106   v1 = m_videoram[offset];
107   v2 = m_videoram[offset+0x2000];
106   v1 = m_videoram.target()[offset];
107   v2 = m_videoram.target()[offset+0x2000];
108108
109109   for (i = 0; i < 8; i++)
110110   {
r14896r14897
183183    */
184184
185185
186   flip_screen_set(machine(), data&1);
186   flip_screen_set(data&1);
187187
188188   if ((m_sbw_system^data)&1)
189189   {
190190      int offs;
191191      for (offs = 0;offs < 0x4000; offs++)
192         sbw_videoram_w(space, offs, m_videoram[offs]);
192         sbw_videoram_w(space, offs, m_videoram.target()[offs]);
193193   }
194194   m_sbw_system = data;
195195}
r14896r14897
223223
224224static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, sbowling_state )
225225   AM_RANGE(0x0000, 0x2fff) AM_ROM
226   AM_RANGE(0x8000, 0xbfff) AM_RAM_WRITE(sbw_videoram_w) AM_BASE(m_videoram)
226   AM_RANGE(0x8000, 0xbfff) AM_RAM_WRITE(sbw_videoram_w) AM_SHARE("videoram")
227227   AM_RANGE(0xf800, 0xf801) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
228228   AM_RANGE(0xf801, 0xf801) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
229229   AM_RANGE(0xfc00, 0xffff) AM_RAM
src/mame/drivers/psychic5.c
r14896r14897
319319{
320320   psychic5_state *state = machine.driver_data<psychic5_state>();
321321   state->m_bank_latch = 0xff;
322   flip_screen_set(machine, 0);
322   state->flip_screen_set(0);
323323}
324324
325325/***************************************************************************
r14896r14897
386386   // bit 7 toggles flip screen
387387   if (data & 0x80)
388388   {
389      flip_screen_set(machine(), !flip_screen_get(machine()));
389      flip_screen_set(!flip_screen());
390390   }
391391}
392392
r14896r14897
395395   // bit 7 toggles flip screen
396396   if (data & 0x80)
397397   {
398      flip_screen_set(machine(), !flip_screen_get(machine()));
398      flip_screen_set(!flip_screen());
399399   }
400400}
401401
r14896r14897
411411   AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1")
412412   AM_RANGE(0xc000, 0xdfff) AM_READWRITE(psychic5_paged_ram_r, psychic5_paged_ram_w)
413413   AM_RANGE(0xe000, 0xefff) AM_RAM
414   AM_RANGE(0xf000, 0xf000) AM_RAM_WRITE(soundlatch_w)
414   AM_RANGE(0xf000, 0xf000) AM_RAM_WRITE(soundlatch_byte_w)
415415   AM_RANGE(0xf001, 0xf001) AM_READNOP AM_WRITE(psychic5_coin_counter_w)
416416   AM_RANGE(0xf002, 0xf002) AM_READWRITE(psychic5_bankselect_r, psychic5_bankselect_w)
417417   AM_RANGE(0xf003, 0xf003) AM_READWRITE(psychic5_vram_page_select_r, psychic5_vram_page_select_w)
r14896r14897
425425static ADDRESS_MAP_START( psychic5_sound_map, AS_PROGRAM, 8, psychic5_state )
426426   AM_RANGE(0x0000, 0x7fff) AM_ROM
427427   AM_RANGE(0xc000, 0xc7ff) AM_RAM
428   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
428   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
429429ADDRESS_MAP_END
430430
431431static ADDRESS_MAP_START( psychic5_soundport_map, AS_IO, 8, psychic5_state )
r14896r14897
441441   AM_RANGE(0xc000, 0xcfff) AM_RAM
442442
443443   /* ports look like the other games */
444   AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch_w) // confirmed
444   AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch_byte_w) // confirmed
445445   AM_RANGE(0xd001, 0xd001) AM_WRITE(bombsa_flipscreen_w)
446446   AM_RANGE(0xd002, 0xd002) AM_READWRITE(psychic5_bankselect_r, bombsa_bankselect_w)
447447   AM_RANGE(0xd003, 0xd003) AM_READWRITE(psychic5_vram_page_select_r, psychic5_vram_page_select_w)
r14896r14897
457457static ADDRESS_MAP_START( bombsa_sound_map, AS_PROGRAM, 8, psychic5_state )
458458   AM_RANGE(0x0000, 0xbfff) AM_ROM
459459   AM_RANGE(0xc000, 0xc7ff) AM_RAM
460   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
460   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
461461   AM_RANGE(0xf000, 0xf000) AM_WRITEONLY                        // Is this a confirm of some sort?
462462ADDRESS_MAP_END
463463
src/mame/drivers/good.c
r14896r14897
3939{
4040public:
4141   good_state(const machine_config &mconfig, device_type type, const char *tag)
42      : driver_device(mconfig, type, tag) { }
42      : driver_device(mconfig, type, tag) ,
43      m_fg_tilemapram(*this, "fg_tilemapram"),
44      m_bg_tilemapram(*this, "bg_tilemapram"){ }
4345
4446   /* memory pointers */
45   UINT16 *  m_bg_tilemapram;
46   UINT16 *  m_fg_tilemapram;
47   required_shared_ptr<UINT16> m_fg_tilemapram;
48   required_shared_ptr<UINT16> m_bg_tilemapram;
4749   UINT16 *  m_sprites;
4850//  UINT16 *  m_paletteram;   // currently this uses generic palette handling
4951
r14896r14897
5759
5860WRITE16_MEMBER(good_state::fg_tilemapram_w)
5961{
60   COMBINE_DATA(&m_fg_tilemapram[offset]);
62   COMBINE_DATA(&m_fg_tilemapram.target()[offset]);
6163   m_fg_tilemap->mark_tile_dirty(offset / 2);
6264}
6365
6466static TILE_GET_INFO( get_fg_tile_info )
6567{
6668   good_state *state = machine.driver_data<good_state>();
67   int tileno = state->m_fg_tilemapram[tile_index * 2];
68   int attr = state->m_fg_tilemapram[tile_index * 2 + 1] & 0xf;
69   int tileno = state->m_fg_tilemapram.target()[tile_index * 2];
70   int attr = state->m_fg_tilemapram.target()[tile_index * 2 + 1] & 0xf;
6971   SET_TILE_INFO(0, tileno, attr, 0);
7072}
7173
7274WRITE16_MEMBER(good_state::bg_tilemapram_w)
7375{
74   COMBINE_DATA(&m_bg_tilemapram[offset]);
76   COMBINE_DATA(&m_bg_tilemapram.target()[offset]);
7577   m_bg_tilemap->mark_tile_dirty(offset / 2);
7678}
7779
7880static TILE_GET_INFO( get_bg_tile_info )
7981{
8082   good_state *state = machine.driver_data<good_state>();
81   int tileno = state->m_bg_tilemapram[tile_index * 2];
82   int attr = state->m_bg_tilemapram[tile_index * 2 + 1] & 0xf;
83   int tileno = state->m_bg_tilemapram.target()[tile_index * 2];
84   int attr = state->m_bg_tilemapram.target()[tile_index * 2 + 1] & 0xf;
8385   SET_TILE_INFO(1, tileno, attr, 0);
8486}
8587
r14896r14897
111113   AM_RANGE(0x280002, 0x280003) AM_READ_PORT("IN1")
112114   AM_RANGE(0x280004, 0x280005) AM_READ_PORT("IN2")
113115
114   AM_RANGE(0x800000, 0x8007ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
116   AM_RANGE(0x800000, 0x8007ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
115117
116   AM_RANGE(0x820000, 0x820fff) AM_RAM_WRITE(fg_tilemapram_w) AM_BASE(m_fg_tilemapram)
117   AM_RANGE(0x822000, 0x822fff) AM_RAM_WRITE(bg_tilemapram_w) AM_BASE(m_bg_tilemapram)
118   AM_RANGE(0x820000, 0x820fff) AM_RAM_WRITE(fg_tilemapram_w) AM_SHARE("fg_tilemapram")
119   AM_RANGE(0x822000, 0x822fff) AM_RAM_WRITE(bg_tilemapram_w) AM_SHARE("bg_tilemapram")
118120
119121   AM_RANGE(0xff0000, 0xffefff) AM_RAM
120122ADDRESS_MAP_END
src/mame/drivers/8080bw.c
r14896r14897
346346   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
347347   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
348348   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
349   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(invadpt2_sh_port_1_w)
349   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(invadpt2_sh_port_1_w)
350350   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
351   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(invadpt2_sh_port_2_w)
351   AM_RANGE(0x05, 0x05) AM_WRITE(invadpt2_sh_port_2_w)
352352   AM_RANGE(0x06, 0x06) AM_WRITE(watchdog_reset_w)
353353ADDRESS_MAP_END
354354
r14896r14897
412412   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
413413   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
414414   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
415   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(spcewars_sh_port_w)
415   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(spcewars_sh_port_w)
416416   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
417   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(invadpt2_sh_port_2_w)
417   AM_RANGE(0x05, 0x05) AM_WRITE(invadpt2_sh_port_2_w)
418418ADDRESS_MAP_END
419419
420420
r14896r14897
538538   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITENOP
539539   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1") AM_WRITENOP
540540   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_WRITENOP
541   AM_RANGE(0x03, 0x03) AM_WRITE_LEGACY(invadpt2_sh_port_1_w)
542   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(cosmo_sh_port_2_w)
541   AM_RANGE(0x03, 0x03) AM_WRITE(invadpt2_sh_port_1_w)
542   AM_RANGE(0x05, 0x05) AM_WRITE(cosmo_sh_port_2_w)
543543   AM_RANGE(0x06, 0x06) AM_WRITE(watchdog_reset_w)
544544   AM_RANGE(0x07, 0x07) AM_WRITENOP
545545ADDRESS_MAP_END
r14896r14897
638638   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
639639   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
640640   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
641   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(invrvnge_sh_port_w)
641   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(invrvnge_sh_port_w)
642642   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
643643ADDRESS_MAP_END
644644
r14896r14897
771771   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
772772   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
773773   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
774   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(lrescue_sh_port_1_w)
774   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(lrescue_sh_port_1_w)
775775   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
776   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(lrescue_sh_port_2_w)
776   AM_RANGE(0x05, 0x05) AM_WRITE(lrescue_sh_port_2_w)
777777ADDRESS_MAP_END
778778
779779
r14896r14897
910910
911911
912912static ADDRESS_MAP_START( rollingc_io_map, AS_IO, 8, _8080bw_state )
913   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE_LEGACY(rollingc_sh_port_w)
913   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(rollingc_sh_port_w)
914914   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
915915   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
916916   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r)
r14896r14897
976976   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
977977   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
978978   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
979   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(schaser_sh_port_1_w)
979   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(schaser_sh_port_1_w)
980980   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
981   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(schaser_sh_port_2_w)
981   AM_RANGE(0x05, 0x05) AM_WRITE(schaser_sh_port_2_w)
982982   AM_RANGE(0x06, 0x06) AM_WRITE(watchdog_reset_w)
983983ADDRESS_MAP_END
984984
r14896r14897
10931093   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
10941094   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
10951095   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
1096   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(schasercv_sh_port_1_w)
1096   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(schasercv_sh_port_1_w)
10971097   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
1098   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(schasercv_sh_port_2_w)
1098   AM_RANGE(0x05, 0x05) AM_WRITE(schasercv_sh_port_2_w)
10991099ADDRESS_MAP_END
11001100
11011101
r14896r14897
12321232   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
12331233   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
12341234   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
1235   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(lupin3_sh_port_1_w)
1235   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(lupin3_sh_port_1_w)
12361236   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
1237   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(lupin3_sh_port_2_w)
1237   AM_RANGE(0x05, 0x05) AM_WRITE(lupin3_sh_port_2_w)
12381238   AM_RANGE(0x06, 0x06) AM_WRITE(watchdog_reset_w)
12391239ADDRESS_MAP_END
12401240
r14896r14897
15591559   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
15601560   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
15611561   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
1562   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(ballbomb_sh_port_1_w)
1562   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(ballbomb_sh_port_1_w)
15631563   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
1564   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(ballbomb_sh_port_2_w)
1564   AM_RANGE(0x05, 0x05) AM_WRITE(ballbomb_sh_port_2_w)
15651565ADDRESS_MAP_END
15661566
15671567
r14896r14897
16111611static ADDRESS_MAP_START( yosakdon_io_map, AS_IO, 8, _8080bw_state )
16121612   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN0")
16131613   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1")
1614   AM_RANGE(0x03, 0x03) AM_WRITE_LEGACY(yosakdon_sh_port_1_w)
1615   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(yosakdon_sh_port_2_w)
1614   AM_RANGE(0x03, 0x03) AM_WRITE(yosakdon_sh_port_1_w)
1615   AM_RANGE(0x05, 0x05) AM_WRITE(yosakdon_sh_port_2_w)
16161616   AM_RANGE(0x06, 0x06) AM_WRITENOP /* character numbers */
16171617ADDRESS_MAP_END
16181618
r14896r14897
17241724
17251725*/
17261726
1727static READ8_HANDLER(indianbt_r)
1727READ8_MEMBER(_8080bw_state::indianbt_r)
17281728{
1729   switch(cpu_get_pc(&space->device()))
1729   switch(cpu_get_pc(&space.device()))
17301730   {
17311731      case 0x5fed:   return 0x10;
17321732      case 0x5ffc:   return 0;
17331733   }
1734   logerror("unknown port 0 read @ %x\n",cpu_get_pc(&space->device()));
1735   return space->machine().rand();
1734   logerror("unknown port 0 read @ %x\n",cpu_get_pc(&space.device()));
1735   return machine().rand();
17361736}
17371737
17381738static ADDRESS_MAP_START( indianbt_io_map, AS_IO, 8, _8080bw_state )
1739   AM_RANGE(0x00, 0x00) AM_READ_LEGACY(indianbt_r)
1739   AM_RANGE(0x00, 0x00) AM_READ(indianbt_r)
17401740   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN0")
17411741   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
1742   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(indianbt_sh_port_1_w)
1742   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(indianbt_sh_port_1_w)
17431743   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
1744   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(indianbt_sh_port_2_w)
1744   AM_RANGE(0x05, 0x05) AM_WRITE(indianbt_sh_port_2_w)
17451745   AM_RANGE(0x06, 0x06) AM_WRITENOP /* sound ? */
17461746   AM_RANGE(0x07, 0x07) AM_DEVWRITE_LEGACY("discrete", indianbt_sh_port_3_w)
17471747ADDRESS_MAP_END
r14896r14897
17761776/*                                                     */
17771777/*******************************************************/
17781778
1779static WRITE8_HANDLER( steelwkr_sh_port_3_w )
1779WRITE8_MEMBER(_8080bw_state::steelwkr_sh_port_3_w)
17801780{
1781   coin_lockout_global_w(space->machine(), !(~data & 0x03));      /* possibly */
1781   coin_lockout_global_w(machine(), !(~data & 0x03));      /* possibly */
17821782}
17831783
17841784static ADDRESS_MAP_START( steelwkr_io_map, AS_IO, 8, _8080bw_state )
17851785   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
17861786   AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_count_w)
1787   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE_LEGACY(invadpt2_sh_port_1_w)
1787   AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY("mb14241", mb14241_shift_result_r) AM_WRITE(invadpt2_sh_port_1_w)
17881788   AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("mb14241", mb14241_shift_data_w)
1789   AM_RANGE(0x05, 0x05) AM_WRITE_LEGACY(invadpt2_sh_port_2_w)
1790   AM_RANGE(0x06, 0x06) AM_WRITE_LEGACY(steelwkr_sh_port_3_w)
1789   AM_RANGE(0x05, 0x05) AM_WRITE(invadpt2_sh_port_2_w)
1790   AM_RANGE(0x06, 0x06) AM_WRITE(steelwkr_sh_port_3_w)
17911791ADDRESS_MAP_END
17921792
17931793static INPUT_PORTS_START( steelwkr )
r14896r14897
19501950
19511951static ADDRESS_MAP_START( shuttlei_io_map, AS_IO, 8, _8080bw_state )
19521952   AM_RANGE(0xfc, 0xfc) AM_WRITENOP /* game writes 0xAA every so often (perhaps when base hit?) */
1953   AM_RANGE(0xfd, 0xfd) AM_WRITE_LEGACY(shuttlei_sh_port_1_w)
1954   AM_RANGE(0xfe, 0xfe) AM_READ_PORT("DSW") AM_WRITE_LEGACY(shuttlei_sh_port_2_w)
1953   AM_RANGE(0xfd, 0xfd) AM_WRITE(shuttlei_sh_port_1_w)
1954   AM_RANGE(0xfe, 0xfe) AM_READ_PORT("DSW") AM_WRITE(shuttlei_sh_port_2_w)
19551955   AM_RANGE(0xff, 0xff) AM_READ_PORT("INPUTS")
19561956//         port fd (write) is for sound
19571957ADDRESS_MAP_END
src/mame/drivers/quasar.c
r14896r14897
4444
4545************************************************************************/
4646
47static WRITE8_HANDLER( video_page_select_w )
47WRITE8_MEMBER(quasar_state::video_page_select_w)
4848{
49   quasar_state *state = space->machine().driver_data<quasar_state>();
50   state->m_page = offset & 0x03;
49   m_page = offset & 0x03;
5150}
5251
53static WRITE8_HANDLER( io_page_select_w )
52WRITE8_MEMBER(quasar_state::io_page_select_w)
5453{
55   quasar_state *state = space->machine().driver_data<quasar_state>();
56   state->m_io_page = offset & 0x03;
54   m_io_page = offset & 0x03;
5755}
5856
59static WRITE8_HANDLER( quasar_video_w )
57WRITE8_MEMBER(quasar_state::quasar_video_w)
6058{
61   quasar_state *state = space->machine().driver_data<quasar_state>();
6259
63   switch (state->m_page)
60   switch (m_page)
6461   {
65   case 0:  state->m_video_ram[offset] = data; break;
66   case 1:  state->m_color_ram[offset] = data & 7; break;   // 3 bits of ram only - 3 x 2102
67   case 2:  state->m_effectram[offset] = data; break;
68   case 3:  state->m_effectcontrol = data; break;
62   case 0:  m_video_ram[offset] = data; break;
63   case 1:  m_color_ram[offset] = data & 7; break;   // 3 bits of ram only - 3 x 2102
64   case 2:  m_effectram[offset] = data; break;
65   case 3:  m_effectcontrol = data; break;
6966   }
7067}
7168
72static READ8_HANDLER( quasar_IO_r )
69READ8_MEMBER(quasar_state::quasar_IO_r)
7370{
74   quasar_state *state = space->machine().driver_data<quasar_state>();
7571   UINT8 ans = 0;
7672
77   switch (state->m_io_page)
73   switch (m_io_page)
7874   {
79   case 0:  ans = input_port_read(space->machine(), "IN0"); break;
80   case 1:  ans = input_port_read(space->machine(), "IN1"); break;
81   case 2:  ans = input_port_read(space->machine(), "DSW0"); break;
82   case 3:  ans = input_port_read(space->machine(), "DSW1"); break;
75   case 0:  ans = input_port_read(machine(), "IN0"); break;
76   case 1:  ans = input_port_read(machine(), "IN1"); break;
77   case 2:  ans = input_port_read(machine(), "DSW0"); break;
78   case 3:  ans = input_port_read(machine(), "DSW1"); break;
8379   }
8480
8581   return ans;
8682}
8783
88static WRITE8_HANDLER( quasar_bullet_w )
84WRITE8_MEMBER(quasar_state::quasar_bullet_w)
8985{
90   quasar_state *state = space->machine().driver_data<quasar_state>();
91   state->m_bullet_ram[offset] = (data ^ 0xff);
86   m_bullet_ram[offset] = (data ^ 0xff);
9287}
9388
94static WRITE8_HANDLER( quasar_sh_command_w )
89WRITE8_MEMBER(quasar_state::quasar_sh_command_w)
9590{
9691   // bit 4 = Sound Invader : Linked to an NE555V circuit
9792   // Not handled yet
r14896r14897
9994   // lower nibble = command to I8035
10095   // not necessarily like this, but it seems to work better than direct mapping
10196   // (although schematics has it as direct - but then the schematics are wrong elsewhere to!)
102   quasar_state *state = space->machine().driver_data<quasar_state>();
103   state->soundlatch_w(*space, 0, (data & 8) + ((data >> 1) & 3) + ((data << 2) & 4));
97   soundlatch_byte_w(*&space, 0, (data & 8) + ((data >> 1) & 3) + ((data << 2) & 4));
10498}
10599
106static READ8_HANDLER( quasar_sh_command_r )
100READ8_MEMBER(quasar_state::quasar_sh_command_r)
107101{
108   quasar_state *state = space->machine().driver_data<quasar_state>();
109   return state->soundlatch_r(*space, 0) + (input_port_read(space->machine(), "DSW2") & 0x30);
102   return soundlatch_byte_r(*&space, 0) + (input_port_read(machine(), "DSW2") & 0x30);
110103}
111104
112static READ8_HANDLER( audio_t1_r )
105READ8_MEMBER(quasar_state::audio_t1_r)
113106{
114   quasar_state *state = space->machine().driver_data<quasar_state>();
115   return (state->soundlatch_r(*space, 0) == 0);
107   return (soundlatch_byte_r(*&space, 0) == 0);
116108}
117109
118110// memory map taken from the manual
119111
120112static ADDRESS_MAP_START( quasar, AS_PROGRAM, 8, quasar_state )
121113   AM_RANGE(0x0000, 0x13ff) AM_ROM
122   AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READ(cvs_bullet_ram_or_palette_r) AM_WRITE_LEGACY(quasar_bullet_w) AM_BASE(m_bullet_ram)
114   AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READ(cvs_bullet_ram_or_palette_r) AM_WRITE(quasar_bullet_w) AM_BASE(m_bullet_ram)
123115   AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w)
124116   AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w)
125117   AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w)
126   AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ(cvs_video_or_color_ram_r) AM_WRITE_LEGACY(quasar_video_w) AM_BASE(m_video_ram)
118   AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READ(cvs_video_or_color_ram_r) AM_WRITE(quasar_video_w) AM_BASE(m_video_ram)
127119   AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
128120   AM_RANGE(0x2000, 0x33ff) AM_ROM
129121   AM_RANGE(0x4000, 0x53ff) AM_ROM
r14896r14897
131123ADDRESS_MAP_END
132124
133125static ADDRESS_MAP_START( quasar_io, AS_IO, 8, quasar_state )
134   AM_RANGE(0x00, 0x03) AM_READWRITE_LEGACY(quasar_IO_r, video_page_select_w)
135   AM_RANGE(0x08, 0x0b) AM_WRITE_LEGACY(io_page_select_w)
136   AM_RANGE(S2650_DATA_PORT,  S2650_DATA_PORT) AM_READ(cvs_collision_clear) AM_WRITE_LEGACY(quasar_sh_command_w)
126   AM_RANGE(0x00, 0x03) AM_READWRITE(quasar_IO_r, video_page_select_w)
127   AM_RANGE(0x08, 0x0b) AM_WRITE(io_page_select_w)
128   AM_RANGE(S2650_DATA_PORT,  S2650_DATA_PORT) AM_READ(cvs_collision_clear) AM_WRITE(quasar_sh_command_w)
137129   AM_RANGE(S2650_CTRL_PORT,  S2650_CTRL_PORT) AM_READ(cvs_collision_r) AM_WRITENOP
138130   AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
139131   AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_BASE(m_fo_state)
r14896r14897
151143
152144static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, quasar_state )
153145   AM_RANGE(0x00, 0x7f) AM_RAM
154   AM_RANGE(0x80, 0x80) AM_READ_LEGACY(quasar_sh_command_r)
155   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ_LEGACY(audio_t1_r)
146   AM_RANGE(0x80, 0x80) AM_READ(quasar_sh_command_r)
147   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(audio_t1_r)
156148   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE_LEGACY("dac", dac_signed_w)
157149ADDRESS_MAP_END
158150
src/mame/drivers/1943.c
r14896r14897
5959   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSWA")
6060   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSWB")
6161   AM_RANGE(0xc007, 0xc007) AM_READ(c1943_protection_r)
62   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
62   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_byte_w)
6363   AM_RANGE(0xc804, 0xc804) AM_WRITE(c1943_c804_w)   // ROM bank switch, screen flip
6464   AM_RANGE(0xc806, 0xc806) AM_WRITE(watchdog_reset_w)
6565   AM_RANGE(0xc807, 0xc807) AM_WRITENOP // ???
r14896r14897
8080static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, _1943_state )
8181   AM_RANGE(0x0000, 0x7fff) AM_ROM
8282   AM_RANGE(0xc000, 0xc7ff) AM_RAM
83   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
83   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r)
8484   AM_RANGE(0xe000, 0xe001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
8585   AM_RANGE(0xe002, 0xe003) AM_DEVWRITE_LEGACY("ym2", ym2203_w)
8686ADDRESS_MAP_END
src/mame/drivers/pacland.c
r14896r14897
187187WRITE8_MEMBER(pacland_state::pacland_flipscreen_w)
188188{
189189   int bit = !BIT(offset,11);
190   /* can't use flip_screen_set(machine(), ) because the visible area is asymmetrical */
191   flip_screen_set_no_update(machine(), bit);
192   machine().tilemap().set_flip_all(flip_screen_get(machine()) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
190   /* can't use flip_screen_set() because the visible area is asymmetrical */
191   flip_screen_set_no_update(bit);
192   machine().tilemap().set_flip_all(flip_screen() ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
193193}
194194
195195
src/mame/drivers/rollrace.c
r14896r14897
4343   AM_RANGE(0xd900, 0xd900) AM_READWRITE(ra_fake_d800_r,ra_fake_d800_w) /* protection ??*/
4444   AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE(m_videoram)
4545   AM_RANGE(0xe400, 0xe47f) AM_RAM AM_BASE(m_colorram)
46   AM_RANGE(0xe800, 0xe800) AM_WRITE(soundlatch_w)
46   AM_RANGE(0xe800, 0xe800) AM_WRITE(soundlatch_byte_w)
4747   AM_RANGE(0xec00, 0xec0f) AM_NOP /* Analog sound effects ?? ec00 sound enable ?*/
4848   AM_RANGE(0xf000, 0xf0ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
4949   AM_RANGE(0xf400, 0xf400) AM_WRITE(rollrace_backgroundcolor_w)
r14896r14897
6464static ADDRESS_MAP_START( rollrace_sound_map, AS_PROGRAM, 8, rollrace_state )
6565   AM_RANGE(0x0000, 0x0fff) AM_ROM
6666   AM_RANGE(0x2000, 0x2fff) AM_RAM
67   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) AM_WRITE(sound_nmi_mask_w)
67   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r) AM_WRITE(sound_nmi_mask_w)
6868   AM_RANGE(0x4000, 0x4001) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
6969   AM_RANGE(0x5000, 0x5001) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
7070   AM_RANGE(0x6000, 0x6001) AM_DEVWRITE_LEGACY("ay3", ay8910_address_data_w)
src/mame/drivers/mirage.c
r14896r14897
5151        m_deco_tilegen1(*this, "tilegen1"),
5252        m_oki_sfx(*this, "oki_sfx"),
5353        m_oki_bgm(*this, "oki_bgm"),
54        m_spriteram(*this, "spriteram") { }
54        m_spriteram(*this, "spriteram") ,
55      m_pf1_rowscroll(*this, "pf1_rowscroll"),
56      m_pf2_rowscroll(*this, "pf2_rowscroll"){ }
5557
56   /* memory pointers */
57   UINT16 *  m_pf1_rowscroll;
58   UINT16 *  m_pf2_rowscroll;
59//  UINT16 *  m_paletteram;    // currently this uses generic palette handling (in decocomn.c)
6058
6159   /* misc */
6260   UINT8 m_mux_data;
r14896r14897
6765   required_device<okim6295_device> m_oki_sfx;
6866   required_device<okim6295_device> m_oki_bgm;
6967   required_device<buffered_spriteram16_device> m_spriteram;
68   /* memory pointers */
69   required_shared_ptr<UINT16> m_pf1_rowscroll;
70   required_shared_ptr<UINT16> m_pf2_rowscroll;
71//  UINT16 *  m_paletteram;    // currently this uses generic palette handling (in decocomn.c)
7072   DECLARE_WRITE16_MEMBER(mirage_mux_w);
7173   DECLARE_READ16_MEMBER(mirage_input_r);
7274   DECLARE_WRITE16_MEMBER(okim1_rombank_w);
r14896r14897
8385   miragemi_state *state = screen.machine().driver_data<miragemi_state>();
8486   UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
8587
86   flip_screen_set(screen.machine(), BIT(flip, 7));
88   state->flip_screen_set(BIT(flip, 7));
8789
8890   screen.machine().device<decospr_device>("spritegen")->draw_sprites(bitmap, cliprect, state->m_spriteram->buffer(), 0x400);
8991
90   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
92   deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll.target());
9193
9294   bitmap.fill(256, cliprect); /* not verified */
9395
r14896r14897
137139   AM_RANGE(0x100000, 0x101fff) AM_DEVREADWRITE_LEGACY("tilegen1", deco16ic_pf1_data_r, deco16ic_pf1_data_w) // 0x100000 - 0x101fff tested
138140   AM_RANGE(0x102000, 0x103fff) AM_DEVREADWRITE_LEGACY("tilegen1", deco16ic_pf2_data_r, deco16ic_pf2_data_w) // 0x102000 - 0x102fff tested
139141   /* linescroll */
140   AM_RANGE(0x110000, 0x110bff) AM_RAM AM_BASE(m_pf1_rowscroll)
141   AM_RANGE(0x112000, 0x112bff) AM_RAM AM_BASE(m_pf2_rowscroll)
142   AM_RANGE(0x110000, 0x110bff) AM_RAM AM_SHARE("pf1_rowscroll")
143   AM_RANGE(0x112000, 0x112bff) AM_RAM AM_SHARE("pf2_rowscroll")
142144   AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_SHARE("spriteram")
143   AM_RANGE(0x130000, 0x1307ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
145   AM_RANGE(0x130000, 0x1307ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
144146   AM_RANGE(0x140000, 0x14000f) AM_DEVREADWRITE8("oki_sfx", okim6295_device, read, write, 0x00ff)
145147   AM_RANGE(0x150000, 0x15000f) AM_DEVREADWRITE8("oki_bgm", okim6295_device, read, write, 0x00ff)
146148//  AM_RANGE(0x140006, 0x140007) AM_READ_LEGACY(random_readers)
src/mame/drivers/taito_x.c
r14896r14897
328328      : seta_state(mconfig, type, tag) { }
329329
330330   int m_banknum;
331   DECLARE_READ16_MEMBER(superman_dsw_input_r);
332   DECLARE_READ16_MEMBER(daisenpu_input_r);
333   DECLARE_WRITE16_MEMBER(daisenpu_input_w);
334   DECLARE_WRITE16_MEMBER(kyustrkr_input_w);
335   DECLARE_WRITE8_MEMBER(sound_bankswitch_w);
331336};
332337
333static READ16_HANDLER( superman_dsw_input_r )
338READ16_MEMBER(taitox_state::superman_dsw_input_r)
334339{
335340   switch (offset)
336341   {
337342      case 0x00:
338         return  input_port_read(space->machine(), "DSWA") & 0x0f;
343         return  input_port_read(machine(), "DSWA") & 0x0f;
339344      case 0x01:
340         return (input_port_read(space->machine(), "DSWA") & 0xf0) >> 4;
345         return (input_port_read(machine(), "DSWA") & 0xf0) >> 4;
341346      case 0x02:
342         return  input_port_read(space->machine(), "DSWB") & 0x0f;
347         return  input_port_read(machine(), "DSWB") & 0x0f;
343348      case 0x03:
344         return (input_port_read(space->machine(), "DSWB") & 0xf0) >> 4;
349         return (input_port_read(machine(), "DSWB") & 0xf0) >> 4;
345350      default:
346351         logerror("taitox unknown dsw read offset: %04x\n", offset);
347352         return 0x00;
348353   }
349354}
350355
351static READ16_HANDLER( daisenpu_input_r )
356READ16_MEMBER(taitox_state::daisenpu_input_r)
352357{
353358   switch (offset)
354359   {
355360      case 0x00:
356         return input_port_read(space->machine(), "IN0");    /* Player 1 controls + START1 */
361         return input_port_read(machine(), "IN0");    /* Player 1 controls + START1 */
357362      case 0x01:
358         return input_port_read(space->machine(), "IN1");    /* Player 2 controls + START2 */
363         return input_port_read(machine(), "IN1");    /* Player 2 controls + START2 */
359364      case 0x02:
360         return input_port_read(space->machine(), "IN2");    /* COINn + SERVICE1 + TILT */
365         return input_port_read(machine(), "IN2");    /* COINn + SERVICE1 + TILT */
361366
362367      default:
363368         logerror("taitox unknown input read offset: %04x\n", offset);
r14896r14897
365370   }
366371}
367372
368static WRITE16_HANDLER( daisenpu_input_w )
373WRITE16_MEMBER(taitox_state::daisenpu_input_w)
369374{
370375   switch (offset)
371376   {
372377      case 0x04:   /* coin counters and lockout */
373         coin_counter_w(space->machine(), 0,data & 0x01);
374         coin_counter_w(space->machine(), 1,data & 0x02);
375         coin_lockout_w(space->machine(), 0,~data & 0x04);
376         coin_lockout_w(space->machine(), 1,~data & 0x08);
378         coin_counter_w(machine(), 0,data & 0x01);
379         coin_counter_w(machine(), 1,data & 0x02);
380         coin_lockout_w(machine(), 0,~data & 0x04);
381         coin_lockout_w(machine(), 1,~data & 0x08);
377382//logerror("taitox coin control %04x to offset %04x\n",data,offset);
378383         break;
379384
r14896r14897
383388}
384389
385390
386static WRITE16_HANDLER( kyustrkr_input_w )
391WRITE16_MEMBER(taitox_state::kyustrkr_input_w)
387392{
388393   switch (offset)
389394   {
390395      case 0x04:   /* coin counters and lockout */
391         coin_counter_w(space->machine(), 0,data & 0x01);
392         coin_counter_w(space->machine(), 1,data & 0x02);
393         coin_lockout_w(space->machine(), 0,data & 0x04);
394         coin_lockout_w(space->machine(), 1,data & 0x08);
396         coin_counter_w(machine(), 0,data & 0x01);
397         coin_counter_w(machine(), 1,data & 0x02);
398         coin_lockout_w(machine(), 0,data & 0x04);
399         coin_lockout_w(machine(), 1,data & 0x08);
395400//logerror("taitox coin control %04x to offset %04x\n",data,offset);
396401         break;
397402
r14896r14897
410415   memory_set_bankptr(machine,  "bank2", machine.region("audiocpu")->base() + (state->m_banknum * 0x4000) + 0x10000 );
411416}
412417
413static WRITE8_HANDLER( sound_bankswitch_w )
418WRITE8_MEMBER(taitox_state::sound_bankswitch_w)
414419{
415   taitox_state *state = space->machine().driver_data<taitox_state>();
416420
417   state->m_banknum = (data - 1) & 3;
418   reset_sound_region(space->machine());
421   m_banknum = (data - 1) & 3;
422   reset_sound_region(machine());
419423}
420424
421425
r14896r14897
425429   AM_RANGE(0x000000, 0x07ffff) AM_ROM
426430   AM_RANGE(0x300000, 0x300001) AM_WRITENOP   /* written each frame at $3a9c, mostly 0x10 */
427431   AM_RANGE(0x400000, 0x400001) AM_WRITENOP   /* written each frame at $3aa2, mostly 0x10 */
428   AM_RANGE(0x500000, 0x500007) AM_READ_LEGACY(superman_dsw_input_r)
432   AM_RANGE(0x500000, 0x500007) AM_READ(superman_dsw_input_r)
429433   AM_RANGE(0x600000, 0x600001) AM_WRITENOP   /* written each frame at $3ab0, mostly 0x10 */
430434   AM_RANGE(0x800000, 0x800001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
431435   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
432436   AM_RANGE(0x900000, 0x9007ff) AM_READWRITE_LEGACY(cchip1_ram_r, cchip1_ram_w)
433437   AM_RANGE(0x900802, 0x900803) AM_READWRITE_LEGACY(cchip1_ctrl_r, cchip1_ctrl_w)
434438   AM_RANGE(0x900c00, 0x900c01) AM_WRITE_LEGACY(cchip1_bank_w)
435   AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
439   AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
436440   AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)   // Sprites Y
437441   AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
438442   AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)   // Sprites Code + X + Attr
r14896r14897
442446static ADDRESS_MAP_START( daisenpu_map, AS_PROGRAM, 16, taitox_state )
443447   AM_RANGE(0x000000, 0x03ffff) AM_ROM
444448//  AM_RANGE(0x400000, 0x400001) AM_WRITENOP    /* written each frame at $2ac, values change */
445   AM_RANGE(0x500000, 0x50000f) AM_READ_LEGACY(superman_dsw_input_r)
449   AM_RANGE(0x500000, 0x50000f) AM_READ(superman_dsw_input_r)
446450//  AM_RANGE(0x600000, 0x600001) AM_WRITENOP    /* written each frame at $2a2, values change */
447451   AM_RANGE(0x800000, 0x800001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
448452   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
449   AM_RANGE(0x900000, 0x90000f) AM_READWRITE_LEGACY(daisenpu_input_r, daisenpu_input_w)
450   AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
453   AM_RANGE(0x900000, 0x90000f) AM_READWRITE(daisenpu_input_r, daisenpu_input_w)
454   AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
451455   AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)   // Sprites Y
452456   AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
453457   AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)   // Sprites Code + X + Attr
r14896r14897
457461static ADDRESS_MAP_START( gigandes_map, AS_PROGRAM, 16, taitox_state )
458462   AM_RANGE(0x000000, 0x07ffff) AM_ROM
459463   AM_RANGE(0x400000, 0x400001) AM_WRITENOP   /* 0x1 written each frame at $d42, watchdog? */
460   AM_RANGE(0x500000, 0x500007) AM_READ_LEGACY(superman_dsw_input_r)
464   AM_RANGE(0x500000, 0x500007) AM_READ(superman_dsw_input_r)
461465   AM_RANGE(0x600000, 0x600001) AM_WRITENOP   /* 0x1 written each frame at $d3c, watchdog? */
462466   AM_RANGE(0x800000, 0x800001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
463467   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
464   AM_RANGE(0x900000, 0x90000f) AM_READWRITE_LEGACY(daisenpu_input_r, daisenpu_input_w)
465   AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
468   AM_RANGE(0x900000, 0x90000f) AM_READWRITE(daisenpu_input_r, daisenpu_input_w)
469   AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
466470   AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)   // Sprites Y
467471   AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
468472   AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)   // Sprites Code + X + Attr
r14896r14897
472476static ADDRESS_MAP_START( ballbros_map, AS_PROGRAM, 16, taitox_state )
473477   AM_RANGE(0x000000, 0x03ffff) AM_ROM
474478   AM_RANGE(0x400000, 0x400001) AM_WRITENOP   /* 0x1 written each frame at $c56, watchdog? */
475   AM_RANGE(0x500000, 0x50000f) AM_READ_LEGACY(superman_dsw_input_r)
479   AM_RANGE(0x500000, 0x50000f) AM_READ(superman_dsw_input_r)
476480   AM_RANGE(0x600000, 0x600001) AM_WRITENOP   /* 0x1 written each frame at $c4e, watchdog? */
477481   AM_RANGE(0x800000, 0x800001) AM_READNOP AM_DEVWRITE8_LEGACY("tc0140syt", tc0140syt_port_w, 0x00ff)
478482   AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8_LEGACY("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
479   AM_RANGE(0x900000, 0x90000f) AM_READWRITE_LEGACY(daisenpu_input_r, daisenpu_input_w)
480   AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
483   AM_RANGE(0x900000, 0x90000f) AM_READWRITE(daisenpu_input_r, daisenpu_input_w)
484   AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
481485   AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spriteylow_r16, spriteylow_w16)   // Sprites Y
482486   AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritectrl_r16, spritectrl_w16)
483487   AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_DEVREADWRITE_LEGACY("spritegen", spritecode_r16, spritecode_w16)   // Sprites Code + X + Attr
r14896r14897
498502   AM_RANGE(0xea00, 0xea00) AM_READNOP
499503   AM_RANGE(0xee00, 0xee00) AM_WRITENOP /* ? */
500504   AM_RANGE(0xf000, 0xf000) AM_WRITENOP /* ? */
501   AM_RANGE(0xf200, 0xf200) AM_WRITE_LEGACY(sound_bankswitch_w) /* bankswitch ? */
505   AM_RANGE(0xf200, 0xf200) AM_WRITE(sound_bankswitch_w) /* bankswitch ? */
502506ADDRESS_MAP_END
503507
504508static ADDRESS_MAP_START( daisenpu_sound_map, AS_PROGRAM, 8, taitox_state )
r14896r14897
512516   AM_RANGE(0xea00, 0xea00) AM_READNOP
513517   AM_RANGE(0xee00, 0xee00) AM_WRITENOP /* ? */
514518   AM_RANGE(0xf000, 0xf000) AM_WRITENOP
515   AM_RANGE(0xf200, 0xf200) AM_WRITE_LEGACY(sound_bankswitch_w)
519   AM_RANGE(0xf200, 0xf200) AM_WRITE(sound_bankswitch_w)
516520ADDRESS_MAP_END
517521
518522
r14896r14897
12211225
12221226static DRIVER_INIT( kyustrkr )
12231227{
1224   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x900000, 0x90000f, FUNC(kyustrkr_input_w));
1228   taitox_state *state = machine.driver_data<taitox_state>();
1229   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x900000, 0x90000f, write16_delegate(FUNC(taitox_state::kyustrkr_input_w),state));
12251230}
12261231
12271232
src/mame/drivers/djboy.c
r14896r14897
232232
233233WRITE8_MEMBER(djboy_state::trigger_nmi_on_sound_cpu2)
234234{
235   soundlatch_w(space, 0, data);
235   soundlatch_byte_w(space, 0, data);
236236   device_set_input_line(m_cpu2, INPUT_LINE_NMI, PULSE_LINE);
237237} /* trigger_nmi_on_sound_cpu2 */
238238
r14896r14897
293293   ADDRESS_MAP_GLOBAL_MASK(0xff)
294294   AM_RANGE(0x00, 0x00) AM_WRITE(cpu2_bankswitch_w)
295295   AM_RANGE(0x02, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
296   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r)
296   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_byte_r)
297297   AM_RANGE(0x06, 0x06) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
298298   AM_RANGE(0x07, 0x07) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
299299ADDRESS_MAP_END
src/mame/drivers/ladyfrog.c
r14896r14897
8282
8383WRITE8_MEMBER(ladyfrog_state::sound_command_w)
8484{
85   soundlatch_w(space, 0, data);
85   soundlatch_byte_w(space, 0, data);
8686   machine().scheduler().synchronize(FUNC(nmi_callback), data);
8787}
8888
r14896r14897
157157   AM_RANGE(0xca00, 0xca00) AM_WRITENOP
158158   AM_RANGE(0xcb00, 0xcb00) AM_WRITENOP
159159   AM_RANGE(0xcc00, 0xcc00) AM_WRITENOP
160   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r) AM_WRITE(to_main_w)
160   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r) AM_WRITE(to_main_w)
161161   AM_RANGE(0xd200, 0xd200) AM_READNOP AM_WRITE(nmi_enable_w)
162162   AM_RANGE(0xd400, 0xd400) AM_WRITE(nmi_disable_w)
163163   AM_RANGE(0xd600, 0xd600) AM_WRITENOP
src/mame/drivers/sidearms.c
r14896r14897
7272static ADDRESS_MAP_START( sidearms_map, AS_PROGRAM, 8, sidearms_state )
7373   AM_RANGE(0x0000, 0x7fff) AM_ROM
7474   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
75   AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split1_w) AM_SHARE("paletteram")
76   AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split2_w) AM_SHARE("paletteram2")
77   AM_RANGE(0xc800, 0xc800) AM_READ_PORT("SYSTEM") AM_WRITE(soundlatch_w)
75   AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_lo_w) AM_SHARE("paletteram")
76   AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_hi_w) AM_SHARE("paletteram2")
77   AM_RANGE(0xc800, 0xc800) AM_READ_PORT("SYSTEM") AM_WRITE(soundlatch_byte_w)
7878   AM_RANGE(0xc801, 0xc801) AM_READ_PORT("P1") AM_WRITE(sidearms_bankswitch_w)
7979   AM_RANGE(0xc802, 0xc802) AM_READ_PORT("P2") AM_WRITE(watchdog_reset_w)
8080   AM_RANGE(0xc803, 0xc803) AM_READ_PORT("DSW0")
r14896r14897
9595   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
9696   AM_RANGE(0xc000, 0xcfff) AM_RAM
9797   AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("spriteram")
98   AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split1_w) AM_SHARE("paletteram")
99   AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split2_w) AM_SHARE("paletteram2")
98   AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_lo_w) AM_SHARE("paletteram")
99   AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_hi_w) AM_SHARE("paletteram2")
100100   AM_RANGE(0xe800, 0xe807) AM_READ(turtship_ports_r)
101   AM_RANGE(0xe800, 0xe800) AM_WRITE(soundlatch_w)
101   AM_RANGE(0xe800, 0xe800) AM_WRITE(soundlatch_byte_w)
102102   AM_RANGE(0xe801, 0xe801) AM_WRITE(sidearms_bankswitch_w)
103103   AM_RANGE(0xe802, 0xe802) AM_WRITE(watchdog_reset_w)
104104   AM_RANGE(0xe804, 0xe804) AM_WRITE(sidearms_c804_w)
r14896r14897
114114static ADDRESS_MAP_START( sidearms_sound_map, AS_PROGRAM, 8, sidearms_state )
115115   AM_RANGE(0x0000, 0x7fff) AM_ROM
116116   AM_RANGE(0xc000, 0xc7ff) AM_RAM
117   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
117   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r)
118118   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r,ym2203_w)
119119   AM_RANGE(0xf002, 0xf003) AM_DEVREADWRITE_LEGACY("ym2", ym2203_r,ym2203_w)
120120ADDRESS_MAP_END
r14896r14897
142142static ADDRESS_MAP_START( whizz_map, AS_PROGRAM, 8, sidearms_state )
143143   AM_RANGE(0x0000, 0x7fff) AM_ROM
144144   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
145   AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split1_w) AM_SHARE("paletteram")
146   AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split2_w) AM_SHARE("paletteram2")
147   AM_RANGE(0xc800, 0xc800) AM_READ_PORT("DSW0") AM_WRITE(soundlatch_w)
145   AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_lo_w) AM_SHARE("paletteram")
146   AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_split_hi_w) AM_SHARE("paletteram2")
147   AM_RANGE(0xc800, 0xc800) AM_READ_PORT("DSW0") AM_WRITE(soundlatch_byte_w)
148148   AM_RANGE(0xc801, 0xc801) AM_READ_PORT("DSW1") AM_WRITE(whizz_bankswitch_w)
149149   AM_RANGE(0xc802, 0xc802) AM_READ_PORT("DSW2") AM_WRITE(watchdog_reset_w)
150150   AM_RANGE(0xc803, 0xc803) AM_READ_PORT("IN0") AM_WRITENOP
r14896r14897
172172   ADDRESS_MAP_GLOBAL_MASK(0xff)
173173   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
174174   AM_RANGE(0x40, 0x40) AM_WRITENOP
175   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
175   AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
176176ADDRESS_MAP_END
177177
178178
src/mame/drivers/tumblep.c
r14896r14897
7070
7171WRITE16_MEMBER(tumblep_state::tumblep_sound_w)
7272{
73   soundlatch_w(space, 0, data & 0xff);
73   soundlatch_byte_w(space, 0, data & 0xff);
7474   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
7575}
7676
7777#ifdef UNUSED_FUNCTION
7878WRITE16_MEMBER(tumblep_state::jumppop_sound_w)
7979{
80   soundlatch_w(space, 0, data & 0xff);
80   soundlatch_byte_w(space, 0, data & 0xff);
8181   cputag_set_input_line(m_audiocpu, 0, ASSERT_LINE );
8282}
8383#endif
r14896r14897
113113#endif
114114   AM_RANGE(0x100000, 0x100001) AM_WRITE(tumblep_sound_w)
115115   AM_RANGE(0x120000, 0x123fff) AM_RAM
116   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
116   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
117117   AM_RANGE(0x180000, 0x18000f) AM_READ(tumblepop_controls_r)
118118   AM_RANGE(0x18000c, 0x18000d) AM_WRITENOP
119119   AM_RANGE(0x1a0000, 0x1a07ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
133133   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
134134   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki", okim6295_device, read, write)
135135   AM_RANGE(0x130000, 0x130001) AM_NOP   /* This board only has 1 oki chip */
136   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
136   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
137137   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
138138   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
139139   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/dietgo.c
r14896r14897
3737   AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
3838   AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE("oki", okim6295_device, read, write)
3939   AM_RANGE(0x130000, 0x130001) AM_NOP      /* This board only has 1 oki chip */
40   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
40   AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_byte_r)
4141   AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK("bank8")
4242   AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE_LEGACY(h6280_timer_w)
4343   AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE_LEGACY(h6280_irq_status_w)
src/mame/drivers/bfmsys85.c
r14896r14897
245245   for (i=0; i<8; i++)
246246   if ( changed & (1 << i) )   MechMtr_update(i, data & (1 << i) );
247247
248   if ( data ) generic_pulse_irq_line(machine().device("maincpu"), M6809_FIRQ_LINE, 1);
248   if ( data ) generic_pulse_irq_line(machine().device("maincpu")->execute(), M6809_FIRQ_LINE, 1);
249249}
250250///////////////////////////////////////////////////////////////////////////
251251
src/mame/drivers/kingobox.c
r14896r14897
3939
4040WRITE8_MEMBER(kingofb_state::sound_command_w)
4141{
42   soundlatch_w(space, 0, data);
42   soundlatch_byte_w(space, 0, data);
4343   device_set_input_line_and_vector(m_audio_cpu, 0, HOLD_LINE, 0xff);
4444}
4545
r14896r14897
439439{
440440   AY8910_LEGACY_OUTPUT,
441441   AY8910_DEFAULT_LOADS,
442   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r)
442   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r)
443443};
444444
445445static INTERRUPT_GEN( kingofb_interrupt )
src/mame/drivers/blockout.c
r14896r14897
7979
8080   if (ACCESSING_BITS_0_7)
8181   {
82      soundlatch_w(space, offset, data & 0xff);
82      soundlatch_byte_w(space, offset, data & 0xff);
8383      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
8484   }
8585}
r14896r14897
147147   AM_RANGE(0x8000, 0x87ff) AM_RAM
148148   AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
149149   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
150   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
150   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
151151ADDRESS_MAP_END
152152
153153
src/mame/drivers/tsamurai.c
r14896r14897
9797
9898WRITE8_MEMBER(tsamurai_state::flip_screen_w)
9999{
100   flip_screen_set(machine(), data);
100   flip_screen_set(data);
101101}
102102
103103WRITE8_MEMBER(tsamurai_state::tsamurai_coin_counter_w)
r14896r14897
299299
300300WRITE8_MEMBER(tsamurai_state::vsgongf_sound_command_w)
301301{
302   soundlatch_w(space, offset, data);
302   soundlatch_byte_w(space, offset, data);
303303   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
304304}
305305
r14896r14897
333333static ADDRESS_MAP_START( sound_vsgongf_map, AS_PROGRAM, 8, tsamurai_state )
334334   AM_RANGE(0x0000, 0x3fff) AM_ROM
335335   AM_RANGE(0x6000, 0x63ff) AM_RAM /* work RAM */
336   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r) AM_WRITE(vsgongf_sound_nmi_enable_w) /* NMI enable */
336   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_byte_r) AM_WRITE(vsgongf_sound_nmi_enable_w) /* NMI enable */
337337   AM_RANGE(0xa000, 0xa000) AM_DEVWRITE_LEGACY("dac", dac_w)
338338ADDRESS_MAP_END
339339
src/mame/drivers/ettrivia.c
r14896r14897
3535{
3636public:
3737   ettrivia_state(const machine_config &mconfig, device_type type, const char *tag)
38      : driver_device(mconfig, type, tag) { }
38      : driver_device(mconfig, type, tag) ,
39      m_fg_videoram(*this, "fg_videoram"),
40      m_bg_videoram(*this, "bg_videoram"){ }
3941
4042   int m_palreg;
4143   int m_gfx_bank;
r14896r14897
4345   int m_b000_val;
4446   int m_b000_ret;
4547   int m_b800_prev;
46   UINT8 *m_bg_videoram;
47   UINT8 *m_fg_videoram;
48   required_shared_ptr<UINT8> m_fg_videoram;
49   required_shared_ptr<UINT8> m_bg_videoram;
4850   tilemap_t *m_bg_tilemap;
4951   tilemap_t *m_fg_tilemap;
5052   DECLARE_WRITE8_MEMBER(ettrivia_fg_w);
r14896r14897
5961
6062WRITE8_MEMBER(ettrivia_state::ettrivia_fg_w)
6163{
62   m_fg_videoram[offset] = data;
64   m_fg_videoram.target()[offset] = data;
6365   m_fg_tilemap->mark_tile_dirty(offset);
6466}
6567
6668WRITE8_MEMBER(ettrivia_state::ettrivia_bg_w)
6769{
68   m_bg_videoram[offset] = data;
70   m_bg_videoram.target()[offset] = data;
6971   m_bg_tilemap->mark_tile_dirty(offset);
7072}
7173
r14896r14897
8082
8183   coin_counter_w(machine(), 0, data & 0x80);
8284
83   flip_screen_set(machine(), data & 1);
85   flip_screen_set(data & 1);
8486}
8587
8688READ8_MEMBER(ettrivia_state::ettrivia_question_r)
r14896r14897
139141   AM_RANGE(0xa000, 0xa000) AM_WRITENOP
140142   AM_RANGE(0xb000, 0xb000) AM_READ(b000_r) AM_WRITE(b000_w)
141143   AM_RANGE(0xb800, 0xb800) AM_WRITE(b800_w)
142   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(ettrivia_fg_w) AM_BASE(m_fg_videoram)
143   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(ettrivia_bg_w) AM_BASE(m_bg_videoram)
144   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(ettrivia_fg_w) AM_SHARE("fg_videoram")
145   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(ettrivia_bg_w) AM_SHARE("bg_videoram")
144146ADDRESS_MAP_END
145147
146148static ADDRESS_MAP_START( io_map, AS_IO, 8, ettrivia_state )
src/mame/drivers/jalmah.c
r14896r14897
118118{
119119public:
120120   jalmah_state(const machine_config &mconfig, device_type type, const char *tag)
121      : driver_device(mconfig, type, tag) { }
121      : driver_device(mconfig, type, tag) ,
122      m_sc0_vram(*this, "sc0_vram"),
123      m_sc1_vram(*this, "sc1_vram"),
124      m_sc2_vram(*this, "sc2_vram"),
125      m_sc3_vram(*this, "sc3_vram"),
126      m_jm_shared_ram(*this, "jshared_ram"),
127      m_jm_mcu_code(*this, "jmcu_code"){ }
122128
123129   tilemap_t *m_sc0_tilemap_0;
124130   tilemap_t *m_sc0_tilemap_1;
r14896r14897
135141   tilemap_t *m_sc3_tilemap_0;
136142   tilemap_t *m_sc3_tilemap_2;
137143   tilemap_t *m_sc3_tilemap_3;
138   UINT16 *m_sc0_vram;
139   UINT16 *m_sc1_vram;
140   UINT16 *m_sc2_vram;
141   UINT16 *m_sc3_vram;
144   required_shared_ptr<UINT16> m_sc0_vram;
145   required_shared_ptr<UINT16> m_sc1_vram;
146   required_shared_ptr<UINT16> m_sc2_vram;
147   required_shared_ptr<UINT16> m_sc3_vram;
142148   UINT16 *m_jm_scrollram;
143149   UINT16 *m_jm_vregs;
144150   UINT16 m_sc0bank;
r14896r14897
147153   UINT8 m_sc1_prin;
148154   UINT8 m_sc2_prin;
149155   UINT8 m_sc3_prin;
150   UINT16 *m_jm_shared_ram;
151   UINT16 *m_jm_mcu_code;
156   required_shared_ptr<UINT16> m_jm_shared_ram;
157   required_shared_ptr<UINT16> m_jm_mcu_code;
152158   UINT8 m_mcu_prg;
153159   int m_respcount;
154160   UINT8 m_test_mode;
r14896r14897
233239static TILE_GET_INFO( get_sc0_tile_info )
234240{
235241   jalmah_state *state = machine.driver_data<jalmah_state>();
236   int code = state->m_sc0_vram[tile_index];
242   int code = state->m_sc0_vram.target()[tile_index];
237243   SET_TILE_INFO(
238244         3,
239245         (code & 0xfff) + ((state->m_sc0bank & 3) << 12),
r14896r14897
244250static TILE_GET_INFO( get_sc1_tile_info )
245251{
246252   jalmah_state *state = machine.driver_data<jalmah_state>();
247   int code = state->m_sc1_vram[tile_index];
253   int code = state->m_sc1_vram.target()[tile_index];
248254   SET_TILE_INFO(
249255         2,
250256         code & 0xfff,
r14896r14897
255261static TILE_GET_INFO( get_sc2_tile_info )
256262{
257263   jalmah_state *state = machine.driver_data<jalmah_state>();
258   int code = state->m_sc2_vram[tile_index];
264   int code = state->m_sc2_vram.target()[tile_index];
259265   SET_TILE_INFO(
260266         1,
261267         code & 0xfff,
r14896r14897
266272static TILE_GET_INFO( get_sc3_tile_info )
267273{
268274   jalmah_state *state = machine.driver_data<jalmah_state>();
269   int code = state->m_sc3_vram[tile_index];
275   int code = state->m_sc3_vram.target()[tile_index];
270276   SET_TILE_INFO(
271277         0,
272278         code & 0xfff,
r14896r14897
496502
497503WRITE16_MEMBER(jalmah_state::sc0_vram_w)
498504{
499   COMBINE_DATA(&m_sc0_vram[offset]);
505   COMBINE_DATA(&m_sc0_vram.target()[offset]);
500506   /*2048x256 tilemap*/
501507   m_sc0_tilemap_0->mark_tile_dirty(offset);
502508   /*1024x512 tilemap*/
r14896r14897
509515
510516WRITE16_MEMBER(jalmah_state::sc3_vram_w)
511517{
512   COMBINE_DATA(&m_sc3_vram[offset]);
518   COMBINE_DATA(&m_sc3_vram.target()[offset]);
513519   /*2048x256 tilemap*/
514520   m_sc3_tilemap_0->mark_tile_dirty(offset);
515521   /*1024x512 tilemap*/
r14896r14897
520526
521527WRITE16_MEMBER(jalmah_state::sc1_vram_w)
522528{
523   COMBINE_DATA(&m_sc1_vram[offset]);
529   COMBINE_DATA(&m_sc1_vram.target()[offset]);
524530   /*2048x256 tilemap*/
525531   m_sc1_tilemap_0->mark_tile_dirty(offset);
526532   /*1024x512 tilemap*/
r14896r14897
533539
534540WRITE16_MEMBER(jalmah_state::sc2_vram_w)
535541{
536   COMBINE_DATA(&m_sc2_vram[offset]);
542   COMBINE_DATA(&m_sc2_vram.target()[offset]);
537543   /*2048x256 tilemap*/
538544   m_sc2_tilemap_0->mark_tile_dirty(offset);
539545   /*1024x512 tilemap*/
r14896r14897
611617
612618WRITE16_MEMBER(jalmah_state::urashima_sc0_vram_w)
613619{
614   COMBINE_DATA(&m_sc0_vram[offset]);
620   COMBINE_DATA(&m_sc0_vram.target()[offset]);
615621   m_sc0_tilemap_0->mark_tile_dirty(offset);
616622}
617623
618624WRITE16_MEMBER(jalmah_state::urashima_sc3_vram_w)
619625{
620   COMBINE_DATA(&m_sc3_vram[offset]);
626   COMBINE_DATA(&m_sc3_vram.target()[offset]);
621627   m_sc3_tilemap_0->mark_tile_dirty(offset);
622628}
623629
r14896r14897
733739static void daireika_mcu_run(running_machine &machine)
734740{
735741   jalmah_state *state = machine.driver_data<jalmah_state>();
736   UINT16 *jm_shared_ram = state->m_jm_shared_ram;
742   UINT16 *jm_shared_ram = state->m_jm_shared_ram.target();
737743
738744   if(((jm_shared_ram[0x550/2] & 0xf00) == 0x700) && ((jm_shared_ram[0x540/2] & 0xf00) != state->m_dma_old))
739745   {
r14896r14897
783789static void mjzoomin_mcu_run(running_machine &machine)
784790{
785791   jalmah_state *state = machine.driver_data<jalmah_state>();
786   UINT16 *jm_shared_ram = state->m_jm_shared_ram;
792   UINT16 *jm_shared_ram = state->m_jm_shared_ram.target();
787793
788794   if(state->m_test_mode)   //service_mode
789795   {
r14896r14897
828834static void urashima_mcu_run(running_machine &machine)
829835{
830836   jalmah_state *state = machine.driver_data<jalmah_state>();
831   UINT16 *jm_shared_ram = state->m_jm_shared_ram;
837   UINT16 *jm_shared_ram = state->m_jm_shared_ram.target();
832838
833839   if(state->m_test_mode)   //service_mode
834840   {
r14896r14897
873879static void second_mcu_run(running_machine &machine)
874880{
875881   jalmah_state *state = machine.driver_data<jalmah_state>();
876   UINT16 *jm_shared_ram = state->m_jm_shared_ram;
882   UINT16 *jm_shared_ram = state->m_jm_shared_ram.target();
877883   if(state->m_test_mode)   //service_mode
878884   {
879885      jm_shared_ram[0x200/2] = input_port_read(machine, "KEY0");
r14896r14897
974980WRITE16_MEMBER(jalmah_state::jalmah_flip_screen_w)
975981{
976982   /*---- ----x flip screen*/
977   flip_screen_set(machine(), data & 1);
983   flip_screen_set(data & 1);
978984
979985//  popmessage("%04x",data);
980986}
r14896r14897
993999/**/AM_RANGE(0x080020, 0x08003f) AM_RAM_WRITE(jalmah_scroll_w)
9941000   AM_RANGE(0x080040, 0x080041) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
9951001   //       0x084000, 0x084001  ?
996   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram") /* Palette RAM */
997   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(sc0_vram_w) AM_BASE(m_sc0_vram)
998   AM_RANGE(0x094000, 0x097fff) AM_RAM_WRITE(sc1_vram_w) AM_BASE(m_sc1_vram)
999   AM_RANGE(0x098000, 0x09bfff) AM_RAM_WRITE(sc2_vram_w) AM_BASE(m_sc2_vram)
1000   AM_RANGE(0x09c000, 0x09ffff) AM_RAM_WRITE(sc3_vram_w) AM_BASE(m_sc3_vram)
1001   AM_RANGE(0x0f0000, 0x0f0fff) AM_RAM AM_BASE(m_jm_shared_ram)/*shared with MCU*/
1002   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram") /* Palette RAM */
1003   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(sc0_vram_w) AM_SHARE("sc0_vram")
1004   AM_RANGE(0x094000, 0x097fff) AM_RAM_WRITE(sc1_vram_w) AM_SHARE("sc1_vram")
1005   AM_RANGE(0x098000, 0x09bfff) AM_RAM_WRITE(sc2_vram_w) AM_SHARE("sc2_vram")
1006   AM_RANGE(0x09c000, 0x09ffff) AM_RAM_WRITE(sc3_vram_w) AM_SHARE("sc3_vram")
1007   AM_RANGE(0x0f0000, 0x0f0fff) AM_RAM AM_SHARE("jshared_ram")/*shared with MCU*/
10021008   AM_RANGE(0x0f1000, 0x0fffff) AM_RAM /*Work Ram*/
1003   AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_BASE(m_jm_mcu_code)/*extra RAM for MCU code prg (NOT ON REAL HW!!!)*/
1009   AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_SHARE("jmcu_code")/*extra RAM for MCU code prg (NOT ON REAL HW!!!)*/
10041010ADDRESS_MAP_END
10051011
10061012static ADDRESS_MAP_START( urashima, AS_PROGRAM, 16, jalmah_state )
r14896r14897
10171023/**/AM_RANGE(0x08001c, 0x08001d) AM_RAM_WRITE(urashima_bank_w)
10181024   AM_RANGE(0x080040, 0x080041) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
10191025   //       0x084000, 0x084001  ?
1020   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram") /* Palette RAM */
1021   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(urashima_sc0_vram_w) AM_BASE(m_sc0_vram)
1026   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram") /* Palette RAM */
1027   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(urashima_sc0_vram_w) AM_SHARE("sc0_vram")
10221028   AM_RANGE(0x094000, 0x097fff) AM_RAM_WRITE(urashima_sc0_vram_w)
10231029   AM_RANGE(0x098000, 0x09bfff) AM_RAM_WRITE(urashima_sc0_vram_w)
1024//  AM_RANGE(0x094000, 0x097fff) AM_RAM_WRITE_LEGACY(urashima_sc1_vram_w) AM_BASE(m_sc1_vram)/*unused*/
1025//  AM_RANGE(0x098000, 0x09bfff) AM_RAM_WRITE_LEGACY(urashima_sc2_vram_w) AM_BASE(m_sc2_vram)/*unused*/
1030//  AM_RANGE(0x094000, 0x097fff) AM_RAM_WRITE_LEGACY(urashima_sc1_vram_w) AM_SHARE("sc1_vram")/*unused*/
1031//  AM_RANGE(0x098000, 0x09bfff) AM_RAM_WRITE_LEGACY(urashima_sc2_vram_w) AM_SHARE("sc2_vram")/*unused*/
10261032   /*$9c000-$9cfff Video Registers*/
10271033/**/AM_RANGE(0x09c000, 0x09dfff) AM_WRITE(urashima_vregs_w)
10281034/**///AM_RANGE(0x09c480, 0x09c49f) AM_RAM_WRITE_LEGACY(urashima_sc2vregs_w)
1029   AM_RANGE(0x09e000, 0x0a1fff) AM_RAM_WRITE(urashima_sc3_vram_w) AM_BASE(m_sc3_vram)
1030   AM_RANGE(0x0f0000, 0x0f0fff) AM_RAM AM_BASE(m_jm_shared_ram)/*shared with MCU*/
1035   AM_RANGE(0x09e000, 0x0a1fff) AM_RAM_WRITE(urashima_sc3_vram_w) AM_SHARE("sc3_vram")
1036   AM_RANGE(0x0f0000, 0x0f0fff) AM_RAM AM_SHARE("jshared_ram")/*shared with MCU*/
10311037   AM_RANGE(0x0f1000, 0x0fffff) AM_RAM /*Work Ram*/
1032   AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_BASE(m_jm_mcu_code)/*extra RAM for MCU code prg (NOT ON REAL HW!!!)*/
1038   AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_SHARE("jmcu_code")/*extra RAM for MCU code prg (NOT ON REAL HW!!!)*/
10331039ADDRESS_MAP_END
10341040
10351041static INPUT_PORTS_START( common )
r14896r14897
17531759*/
17541760WRITE16_MEMBER(jalmah_state::urashima_mcu_w)
17551761{
1756   UINT16 *jm_shared_ram = m_jm_shared_ram;
1757   UINT16 *jm_mcu_code = m_jm_mcu_code;
1762   UINT16 *jm_shared_ram = m_jm_shared_ram.target();
1763   UINT16 *jm_mcu_code = m_jm_mcu_code.target();
17581764   if(ACCESSING_BITS_0_7 && data)
17591765   {
17601766      /*******************************************************
r14896r14897
19741980
19751981WRITE16_MEMBER(jalmah_state::daireika_mcu_w)
19761982{
1977   UINT16 *jm_shared_ram = m_jm_shared_ram;
1978   UINT16 *jm_mcu_code = m_jm_mcu_code;
1983   UINT16 *jm_shared_ram = m_jm_shared_ram.target();
1984   UINT16 *jm_mcu_code = m_jm_mcu_code.target();
19791985   UINT16 i;
19801986
19811987   if(ACCESSING_BITS_0_7 && data)
r14896r14897
22502256*/
22512257WRITE16_MEMBER(jalmah_state::mjzoomin_mcu_w)
22522258{
2253   UINT16 *jm_shared_ram = m_jm_shared_ram;
2254   UINT16 *jm_mcu_code = m_jm_mcu_code;
2259   UINT16 *jm_shared_ram = m_jm_shared_ram.target();
2260   UINT16 *jm_mcu_code = m_jm_mcu_code.target();
22552261   if(ACCESSING_BITS_0_7 && data)
22562262   {
22572263      /******************************************************
src/mame/drivers/f1gp.c
r14896r14897
7171   if (ACCESSING_BITS_0_7)
7272   {
7373      m_pending_command = 1;
74      soundlatch_w(space, offset, data & 0xff);
74      soundlatch_byte_w(space, offset, data & 0xff);
7575      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
7676   }
7777}
r14896r14897
103103   AM_RANGE(0xff8000, 0xffbfff) AM_RAM                                             // WORK RAM-1
104104   AM_RANGE(0xffc000, 0xffcfff) AM_READWRITE(sharedram_r, sharedram_w) AM_BASE(m_sharedram)      // DUAL RAM
105105   AM_RANGE(0xffd000, 0xffdfff) AM_RAM_WRITE(f1gp_fgvideoram_w) AM_BASE(m_fgvideoram)         // CHARACTER
106   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // PALETTE
106   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // PALETTE
107107   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("INPUTS")
108108   AM_RANGE(0xfff000, 0xfff001) AM_WRITE(f1gp_gfxctrl_w)
109109//  AM_RANGE(0xfff002, 0xfff003)    analog wheel?
r14896r14897
125125   AM_RANGE(0xff8000, 0xffbfff) AM_RAM                                                // WORK RAM-1
126126   AM_RANGE(0xffc000, 0xffcfff) AM_READWRITE(sharedram_r, sharedram_w) AM_BASE(m_sharedram)         // DUAL RAM
127127   AM_RANGE(0xffd000, 0xffdfff) AM_RAM_WRITE(f1gp_fgvideoram_w) AM_BASE(m_fgvideoram)            // CHARACTER
128   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")         // PALETTE
128   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")         // PALETTE
129129   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("INPUTS") AM_WRITE(f1gp2_gfxctrl_w)
130130//  AM_RANGE(0xfff002, 0xfff003)    analog wheel?
131131   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW1")
r14896r14897
152152   ADDRESS_MAP_GLOBAL_MASK(0xff)
153153   AM_RANGE(0x00, 0x00) AM_WRITE(f1gp_sh_bankswitch_w)   // f1gp
154154   AM_RANGE(0x0c, 0x0c) AM_WRITE(f1gp_sh_bankswitch_w)   // f1gp2
155   AM_RANGE(0x14, 0x14) AM_READ(soundlatch_r) AM_WRITE(pending_command_clear_w)
155   AM_RANGE(0x14, 0x14) AM_READ(soundlatch_byte_r) AM_WRITE(pending_command_clear_w)
156156   AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
157157ADDRESS_MAP_END
158158
r14896r14897
198198   AM_RANGE(0xff8000, 0xffbfff) AM_RAM
199199   AM_RANGE(0xffc000, 0xffcfff) AM_READWRITE(sharedram_r, sharedram_w) AM_BASE(m_sharedram)
200200   AM_RANGE(0xffd000, 0xffdfff) AM_RAM_WRITE(f1gp_fgvideoram_w) AM_BASE(m_fgvideoram)
201   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
201   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
202202   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("INPUTS")
203203   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW1")
204204   AM_RANGE(0xfff006, 0xfff007) AM_READ_PORT("DSW2")
src/mame/drivers/supdrapo.c
r14896r14897
6969{
7070public:
7171   supdrapo_state(const machine_config &mconfig, device_type type, const char *tag)
72      : driver_device(mconfig, type, tag) { }
72      : driver_device(mconfig, type, tag) ,
73      m_col_line(*this, "col_line"),
74      m_videoram(*this, "videoram"),
75      m_char_bank(*this, "char_bank"){ }
7376
74   UINT8 *m_char_bank;
75   UINT8 *m_col_line;
76   UINT8 *m_videoram;
77   required_shared_ptr<UINT8> m_col_line;
78   required_shared_ptr<UINT8> m_videoram;
79   required_shared_ptr<UINT8> m_char_bank;
7780   UINT8 m_wdog;
7881   DECLARE_READ8_MEMBER(sdpoker_rng_r);
7982   DECLARE_WRITE8_MEMBER(wdog8000_w);
r14896r14897
106109   {
107110      for(x = 0; x < 32; x++)
108111      {
109         int tile = state->m_videoram[count] + state->m_char_bank[count] * 0x100;
112         int tile = state->m_videoram.target()[count] + state->m_char_bank.target()[count] * 0x100;
110113         /* Global Column Coloring, GUESS! */
111         color = state->m_col_line[(x*2) + 1] ? (state->m_col_line[(x*2) + 1] - 1) & 7 : 0;
114         color = state->m_col_line.target()[(x*2) + 1] ? (state->m_col_line.target()[(x*2) + 1] - 1) & 7 : 0;
112115
113116         drawgfx_opaque(bitmap, cliprect, screen.machine().gfx[0], tile,color, 0, 0, x*8, y*8);
114117
r14896r14897
251254   AM_RANGE(0x0000, 0x4fff) AM_ROM
252255   AM_RANGE(0x5000, 0x50ff) AM_RAM AM_SHARE("share1")
253256   AM_RANGE(0x57ff, 0x57ff) AM_RAM AM_SHARE("share1")
254   AM_RANGE(0x5800, 0x58ff) AM_RAM AM_SHARE("share1") AM_BASE(m_col_line)
257   AM_RANGE(0x5800, 0x58ff) AM_RAM AM_SHARE("share1") AM_SHARE("col_line")
255258   AM_RANGE(0x6000, 0x67ff) AM_RAM //work ram
256   AM_RANGE(0x6800, 0x6bff) AM_RAM AM_BASE(m_videoram)
257   AM_RANGE(0x6c00, 0x6fff) AM_RAM AM_BASE(m_char_bank)
259   AM_RANGE(0x6800, 0x6bff) AM_RAM AM_SHARE("videoram")
260   AM_RANGE(0x6c00, 0x6fff) AM_RAM AM_SHARE("char_bank")
258261   AM_RANGE(0x7000, 0x7bff) AM_RAM //$7600 seems watchdog
259262   AM_RANGE(0x7c00, 0x7c00) AM_WRITE(debug7c00_w)
260263   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN4") AM_WRITE(wdog8000_w)
src/mame/drivers/exzisus.c
r14896r14897
5959      }
6060   }
6161
62   flip_screen_set(machine(), data & 0x40);
62   flip_screen_set(data & 0x40);
6363}
6464
6565WRITE8_MEMBER(exzisus_state::exzisus_cpub_bankswitch_w)
r14896r14897
7575      }
7676   }
7777
78   flip_screen_set(machine(), data & 0x40);
78   flip_screen_set(data & 0x40);
7979}
8080
8181WRITE8_MEMBER(exzisus_state::exzisus_coincounter_w)
r14896r14897
137137static ADDRESS_MAP_START( cpua_map, AS_PROGRAM, 8, exzisus_state )
138138   AM_RANGE(0x0000, 0x7fff) AM_ROM
139139   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2")
140   AM_RANGE(0xc000, 0xc5ff) AM_READWRITE(exzisus_objectram_1_r, exzisus_objectram_1_w) AM_BASE(m_objectram1) AM_SIZE(m_objectram_size1)
140   AM_RANGE(0xc000, 0xc5ff) AM_READWRITE(exzisus_objectram_1_r, exzisus_objectram_1_w) AM_BASE_SIZE(m_objectram1,m_objectram_size1)
141141   AM_RANGE(0xc600, 0xdfff) AM_READWRITE(exzisus_videoram_1_r, exzisus_videoram_1_w) AM_BASE(m_videoram1)
142142   AM_RANGE(0xe000, 0xefff) AM_READWRITE(exzisus_sharedram_ac_r, exzisus_sharedram_ac_w) AM_BASE(m_sharedram_ac)
143143   AM_RANGE(0xf400, 0xf400) AM_WRITE(exzisus_cpua_bankswitch_w)
r14896r14897
148148static ADDRESS_MAP_START( cpub_map, AS_PROGRAM, 8, exzisus_state )
149149   AM_RANGE(0x0000, 0x7fff) AM_ROM
150150   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
151   AM_RANGE(0xc000, 0xc5ff) AM_READWRITE(exzisus_objectram_0_r, exzisus_objectram_0_w) AM_BASE(m_objectram0) AM_SIZE(m_objectram_size0)
151   AM_RANGE(0xc000, 0xc5ff) AM_READWRITE(exzisus_objectram_0_r, exzisus_objectram_0_w) AM_BASE_SIZE(m_objectram0,m_objectram_size0)
152152   AM_RANGE(0xc600, 0xdfff) AM_READWRITE(exzisus_videoram_0_r, exzisus_videoram_0_w) AM_BASE(m_videoram0)
153153   AM_RANGE(0xe000, 0xefff) AM_RAM
154154   AM_RANGE(0xf000, 0xf000) AM_READNOP AM_DEVWRITE_LEGACY("tc0140syt", tc0140syt_port_w)
src/mame/drivers/tx1.c
r14896r14897
5959 *************************************/
6060
6161/* Main CPU and Z80 synchronisation */
62static WRITE16_HANDLER( z80_busreq_w )
62WRITE16_MEMBER(tx1_state::z80_busreq_w)
6363{
64   cputag_set_input_line(space->machine(), "audio_cpu", INPUT_LINE_HALT, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
64   cputag_set_input_line(machine(), "audio_cpu", INPUT_LINE_HALT, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
6565}
6666
67static WRITE16_HANDLER( resume_math_w )
67WRITE16_MEMBER(tx1_state::resume_math_w)
6868{
69   cputag_set_input_line(space->machine(), "math_cpu", INPUT_LINE_TEST, ASSERT_LINE);
69   cputag_set_input_line(machine(), "math_cpu", INPUT_LINE_TEST, ASSERT_LINE);
7070}
7171
72static WRITE16_HANDLER( halt_math_w )
72WRITE16_MEMBER(tx1_state::halt_math_w)
7373{
74   cputag_set_input_line(space->machine(), "math_cpu", INPUT_LINE_TEST, CLEAR_LINE);
74   cputag_set_input_line(machine(), "math_cpu", INPUT_LINE_TEST, CLEAR_LINE);
7575}
7676
7777/* Z80 can trigger its own interrupts */
78static WRITE8_HANDLER( z80_intreq_w )
78WRITE8_MEMBER(tx1_state::z80_intreq_w)
7979{
80   cputag_set_input_line(space->machine(), "audio_cpu", 0, HOLD_LINE);
80   cputag_set_input_line(machine(), "audio_cpu", 0, HOLD_LINE);
8181}
8282
8383/* Periodic Z80 interrupt */
r14896r14897
8686   device_set_input_line(device, 0, HOLD_LINE);
8787}
8888
89static READ16_HANDLER( z80_shared_r )
89READ16_MEMBER(tx1_state::z80_shared_r)
9090{
91   address_space *cpu2space = space->machine().device("audio_cpu")->memory().space(AS_PROGRAM);
91   address_space *cpu2space = machine().device("audio_cpu")->memory().space(AS_PROGRAM);
9292   return cpu2space->read_byte(offset);
9393}
9494
95static WRITE16_HANDLER( z80_shared_w )
95WRITE16_MEMBER(tx1_state::z80_shared_w)
9696{
97   address_space *cpu2space = space->machine().device("audio_cpu")->memory().space(AS_PROGRAM);
97   address_space *cpu2space = machine().device("audio_cpu")->memory().space(AS_PROGRAM);
9898   cpu2space->write_byte(offset, data & 0xff);
9999}
100100
r14896r14897
379379   PORT_BIT( 0x1f, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00, 0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
380380INPUT_PORTS_END
381381
382static READ16_HANDLER( dipswitches_r )
382READ16_MEMBER(tx1_state::dipswitches_r)
383383{
384   tx1_state *state = space->machine().driver_data<tx1_state>();
385   return (input_port_read(space->machine(), "DSW") & 0xfffe) | state->m_ts;
384   return (input_port_read(machine(), "DSW") & 0xfffe) | m_ts;
386385}
387386
388387/*
389388    (TODO) TS: Connected in place of dipswitch A bit 0
390389    Accessed on startup as some sort of acknowledgement
391390*/
392static WRITE8_HANDLER( ts_w )
391WRITE8_MEMBER(tx1_state::ts_w)
393392{
394   tx1_state *state = space->machine().driver_data<tx1_state>();
395393//  TS = 1;
396   state->m_z80_ram[offset] = data;
394   m_z80_ram[offset] = data;
397395}
398396
399static READ8_HANDLER( ts_r )
397READ8_MEMBER(tx1_state::ts_r)
400398{
401   tx1_state *state = space->machine().driver_data<tx1_state>();
402399//  TS = 1;
403   return state->m_z80_ram[offset];
400   return m_z80_ram[offset];
404401}
405402
406403
r14896r14897
418415//  coin_counter_w(device->machine(), 2, data & 0x04);
419416}
420417
421static WRITE8_HANDLER( tx1_ppi_latch_w )
418WRITE8_MEMBER(tx1_state::tx1_ppi_latch_w)
422419{
423   tx1_state *state = space->machine().driver_data<tx1_state>();
424   state->m_ppi_latch_a = ((input_port_read(space->machine(), "AN_BRAKE") & 0xf) << 4) | (input_port_read(space->machine(), "AN_ACCELERATOR") & 0xf);
425   state->m_ppi_latch_b = input_port_read(space->machine(), "AN_STEERING");
420   m_ppi_latch_a = ((input_port_read(machine(), "AN_BRAKE") & 0xf) << 4) | (input_port_read(machine(), "AN_ACCELERATOR") & 0xf);
421   m_ppi_latch_b = input_port_read(machine(), "AN_STEERING");
426422}
427423
428424static READ8_DEVICE_HANDLER( tx1_ppi_porta_r )
r14896r14897
447443   return val;
448444}
449445
450static READ8_HANDLER( bb_analog_r )
446READ8_MEMBER(tx1_state::bb_analog_r)
451447{
452448   if (offset == 0)
453      return bit_reverse8(((input_port_read(space->machine(), "AN_ACCELERATOR") & 0xf) << 4) | input_port_read(space->machine(), "AN_STEERING"));
449      return bit_reverse8(((input_port_read(machine(), "AN_ACCELERATOR") & 0xf) << 4) | input_port_read(machine(), "AN_STEERING"));
454450   else
455      return bit_reverse8((input_port_read(space->machine(), "AN_BRAKE") & 0xf) << 4);
451      return bit_reverse8((input_port_read(machine(), "AN_BRAKE") & 0xf) << 4);
456452}
457453
458static READ8_HANDLER( bbjr_analog_r )
454READ8_MEMBER(tx1_state::bbjr_analog_r)
459455{
460456   if (offset == 0)
461      return ((input_port_read(space->machine(), "AN_ACCELERATOR") & 0xf) << 4) | input_port_read(space->machine(), "AN_STEERING");
457      return ((input_port_read(machine(), "AN_ACCELERATOR") & 0xf) << 4) | input_port_read(machine(), "AN_STEERING");
462458   else
463      return (input_port_read(space->machine(), "AN_BRAKE") & 0xf) << 4;
459      return (input_port_read(machine(), "AN_BRAKE") & 0xf) << 4;
464460}
465461
466462
r14896r14897
506502   AM_RANGE(0x06000, 0x06fff) AM_READWRITE(tx1_crtc_r, tx1_crtc_w)
507503   AM_RANGE(0x08000, 0x09fff) AM_RAM AM_BASE(m_vram)
508504   AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE("share1") AM_BASE(m_rcram)
509   AM_RANGE(0x0b000, 0x0b001) AM_READWRITE_LEGACY(dipswitches_r, z80_busreq_w)
505   AM_RANGE(0x0b000, 0x0b001) AM_READWRITE(dipswitches_r, z80_busreq_w)
510506   AM_RANGE(0x0c000, 0x0c001) AM_WRITE(tx1_scolst_w)
511507   AM_RANGE(0x0d000, 0x0d003) AM_WRITE(tx1_slincs_w)
512508   AM_RANGE(0x0e000, 0x0e001) AM_WRITE(tx1_slock_w)
513   AM_RANGE(0x0f000, 0x0f001) AM_READ(watchdog_reset16_r) AM_WRITE_LEGACY(resume_math_w)
514   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE_LEGACY(z80_shared_r, z80_shared_w)
509   AM_RANGE(0x0f000, 0x0f001) AM_READ(watchdog_reset16_r) AM_WRITE(resume_math_w)
510   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(z80_shared_r, z80_shared_w)
515511   AM_RANGE(0xf0000, 0xfffff) AM_ROM
516512ADDRESS_MAP_END
517513
r14896r14897
521517   AM_RANGE(0x01000, 0x01fff) AM_RAM AM_SHARE("share1")
522518   AM_RANGE(0x02000, 0x022ff) AM_RAM AM_BASE(m_objram)
523519   AM_RANGE(0x02400, 0x027ff) AM_WRITE(tx1_bankcs_w)
524   AM_RANGE(0x02800, 0x02bff) AM_WRITE_LEGACY(halt_math_w)
520   AM_RANGE(0x02800, 0x02bff) AM_WRITE(halt_math_w)
525521   AM_RANGE(0x02C00, 0x02fff) AM_WRITE(tx1_flgcs_w)
526522   AM_RANGE(0x03000, 0x03fff) AM_READWRITE(tx1_math_r, tx1_math_w)
527523   AM_RANGE(0x05000, 0x07fff) AM_READ(tx1_spcs_rom_r)
r14896r14897
533529static ADDRESS_MAP_START( tx1_sound_prg, AS_PROGRAM, 8, tx1_state )
534530   AM_RANGE(0x0000, 0x1fff) AM_ROM
535531   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_MIRROR(0x800) AM_BASE(m_z80_ram)
536   AM_RANGE(0x4000, 0x4000) AM_WRITE_LEGACY(z80_intreq_w)
532   AM_RANGE(0x4000, 0x4000) AM_WRITE(z80_intreq_w)
537533   AM_RANGE(0x5000, 0x5003) AM_DEVREADWRITE_LEGACY("ppi8255", ppi8255_r, ppi8255_w)
538534   AM_RANGE(0x6000, 0x6003) AM_DEVREADWRITE_LEGACY("tx1", tx1_pit8253_r, tx1_pit8253_w)
539   AM_RANGE(0x7000, 0x7fff) AM_WRITE_LEGACY(tx1_ppi_latch_w)
540   AM_RANGE(0xb000, 0xbfff) AM_READWRITE_LEGACY(ts_r, ts_w)
535   AM_RANGE(0x7000, 0x7fff) AM_WRITE(tx1_ppi_latch_w)
536   AM_RANGE(0xb000, 0xbfff) AM_READWRITE(ts_r, ts_w)
541537ADDRESS_MAP_END
542538
543539static ADDRESS_MAP_START( tx1_sound_io, AS_IO, 8, tx1_state )
r14896r14897
557553   AM_RANGE(0x04000, 0x04fff) AM_READWRITE(tx1_crtc_r, tx1_crtc_w)
558554   AM_RANGE(0x08000, 0x09fff) AM_RAM AM_BASE(m_vram)
559555   AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE("share1") AM_BASE(m_rcram)
560   AM_RANGE(0x0b000, 0x0b001) AM_READWRITE_LEGACY(dipswitches_r, z80_busreq_w)
556   AM_RANGE(0x0b000, 0x0b001) AM_READWRITE(dipswitches_r, z80_busreq_w)
561557   AM_RANGE(0x0c000, 0x0c001) AM_WRITE(buggyboy_scolst_w)
562558   AM_RANGE(0x0d000, 0x0d003) AM_WRITE(tx1_slincs_w)
563559   AM_RANGE(0x0e000, 0x0e001) AM_WRITE(buggyboy_sky_w)
564   AM_RANGE(0x0f000, 0x0f003) AM_READ(watchdog_reset16_r) AM_WRITE_LEGACY(resume_math_w)
565   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE_LEGACY(z80_shared_r, z80_shared_w)
560   AM_RANGE(0x0f000, 0x0f003) AM_READ(watchdog_reset16_r) AM_WRITE(resume_math_w)
561   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(z80_shared_r, z80_shared_w)
566562   AM_RANGE(0x20000, 0x2ffff) AM_ROM
567563   AM_RANGE(0xf0000, 0xfffff) AM_ROM
568564ADDRESS_MAP_END
r14896r14897
572568   AM_RANGE(0x04000, 0x04fff) AM_READWRITE(tx1_crtc_r, tx1_crtc_w)
573569   AM_RANGE(0x08000, 0x08fff) AM_RAM AM_BASE(m_vram)
574570   AM_RANGE(0x0a000, 0x0afff) AM_RAM AM_SHARE("share1") AM_BASE(m_rcram)
575   AM_RANGE(0x0b000, 0x0b001) AM_READWRITE_LEGACY(dipswitches_r, z80_busreq_w)
571   AM_RANGE(0x0b000, 0x0b001) AM_READWRITE(dipswitches_r, z80_busreq_w)
576572   AM_RANGE(0x0c000, 0x0c001) AM_WRITE(buggyboy_scolst_w)
577573   AM_RANGE(0x0d000, 0x0d003) AM_WRITE(tx1_slincs_w)
578574   AM_RANGE(0x0e000, 0x0e001) AM_WRITE(buggyboy_sky_w)
579   AM_RANGE(0x0f000, 0x0f003) AM_READ(watchdog_reset16_r) AM_WRITE_LEGACY(resume_math_w)
580   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE_LEGACY(z80_shared_r, z80_shared_w)
575   AM_RANGE(0x0f000, 0x0f003) AM_READ(watchdog_reset16_r) AM_WRITE(resume_math_w)
576   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(z80_shared_r, z80_shared_w)
581577   AM_RANGE(0x20000, 0x2ffff) AM_ROM
582578   AM_RANGE(0xf0000, 0xfffff) AM_ROM
583579ADDRESS_MAP_END
r14896r14897
600596static ADDRESS_MAP_START( buggyboy_sound_prg, AS_PROGRAM, 8, tx1_state )
601597   AM_RANGE(0x0000, 0x3fff) AM_ROM
602598   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(m_z80_ram)
603   AM_RANGE(0x6000, 0x6001) AM_READ_LEGACY(bb_analog_r)
599   AM_RANGE(0x6000, 0x6001) AM_READ(bb_analog_r)
604600   AM_RANGE(0x6800, 0x6803) AM_DEVREADWRITE_LEGACY("ppi8255", ppi8255_r, ppi8255_w)
605601   AM_RANGE(0x7000, 0x7003) AM_DEVREADWRITE_LEGACY("buggyboy", tx1_pit8253_r, tx1_pit8253_w)
606   AM_RANGE(0x7800, 0x7800) AM_WRITE_LEGACY(z80_intreq_w)
607   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE_LEGACY(ts_r, ts_w)
602   AM_RANGE(0x7800, 0x7800) AM_WRITE(z80_intreq_w)
603   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(ts_r, ts_w)
608604ADDRESS_MAP_END
609605
610606/* Buggy Boy Jr Sound PCB TC043 */
r14896r14897
612608   AM_RANGE(0x0000, 0x3fff) AM_ROM
613609   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(m_z80_ram)
614610   AM_RANGE(0x5000, 0x5003) AM_DEVREADWRITE_LEGACY("buggyboy", tx1_pit8253_r, tx1_pit8253_w)
615   AM_RANGE(0x6000, 0x6001) AM_READ_LEGACY(bbjr_analog_r)
616   AM_RANGE(0x7000, 0x7000) AM_WRITE_LEGACY(z80_intreq_w)
617   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE_LEGACY(ts_r, ts_w)
611   AM_RANGE(0x6000, 0x6001) AM_READ(bbjr_analog_r)
612   AM_RANGE(0x7000, 0x7000) AM_WRITE(z80_intreq_w)
613   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(ts_r, ts_w)
618614ADDRESS_MAP_END
619615
620616/* Common */
src/mame/drivers/merit.c
r14896r14897
5858{
5959public:
6060   merit_state(const machine_config &mconfig, device_type type, const char *tag)
61      : driver_device(mconfig, type, tag) { }
61      : driver_device(mconfig, type, tag) ,
62      m_ram_attr(*this, "raattr"),
63      m_ram_video(*this, "ravideo"),
64      m_backup_ram(*this, "backup_ram"){ }
6265
6366   void dodge_nvram_init(nvram_device &nvram, void *base, size_t size);
6467   pen_t m_pens[NUM_PENS];
65   UINT8 *m_ram_attr;
66   UINT8 *m_ram_video;
68   required_shared_ptr<UINT8> m_ram_attr;
69   required_shared_ptr<UINT8> m_ram_video;
6770   UINT8 *m_ram_palette;
6871   UINT8 m_lscnblk;
6972   int m_extra_video_bank_bit;
7073   int m_question_address;
7174   int m_decryption_key;
72   UINT8 *m_backup_ram;
75   required_shared_ptr<UINT8> m_backup_ram;
7376   DECLARE_READ8_MEMBER(questions_r);
7477   DECLARE_WRITE8_MEMBER(low_offset_w);
7578   DECLARE_WRITE8_MEMBER(med_offset_w);
r14896r14897
171174{
172175   int co;
173176
174   co = ((m_ram_attr[offset] & 0x7F) << 3) | (offset & 0x07);
177   co = ((m_ram_attr.target()[offset] & 0x7F) << 3) | (offset & 0x07);
175178   return m_ram_palette[co];
176179}
177180
r14896r14897
182185   machine().primary_screen->update_now();
183186   data &= 0x0f;
184187
185   co = ((m_ram_attr[offset] & 0x7F) << 3) | (offset & 0x07);
188   co = ((m_ram_attr.target()[offset] & 0x7F) << 3) | (offset & 0x07);
186189   m_ram_palette[co] = data;
187190
188191}
r14896r14897
225228   for (cx = 0; cx < x_count; cx++)
226229   {
227230      int i;
228      int attr = state->m_ram_attr[ma & 0x7ff];
231      int attr = state->m_ram_attr.target()[ma & 0x7ff];
229232      int region = (attr & 0x40) >> 6;
230      int addr = ((state->m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (state->m_extra_video_bank_bit)) << 4) | (ra & 0x0f);
233      int addr = ((state->m_ram_video.target()[ma & 0x7ff] | ((attr & 0x80) << 1) | (state->m_extra_video_bank_bit)) << 4) | (ra & 0x0f);
231234      int colour = (attr & 0x7f) << 3;
232235      UINT8   *data;
233236
r14896r14897
308311static WRITE8_DEVICE_HANDLER( misc_w )
309312{
310313   merit_state *state = device->machine().driver_data<merit_state>();
311   flip_screen_set(device->machine(), ~data & 0x10);
314   state->flip_screen_set(~data & 0x10);
312315   state->m_extra_video_bank_bit = (data & 2) << 8;
313316   state->m_lscnblk = (data >> 3) & 1;
314317
r14896r14897
318321static WRITE8_DEVICE_HANDLER( misc_couple_w )
319322{
320323   merit_state *state = device->machine().driver_data<merit_state>();
321   flip_screen_set(device->machine(), ~data & 0x10);
324   state->flip_screen_set(~data & 0x10);
322325   state->m_extra_video_bank_bit = (data & 2) << 8;
323326   state->m_lscnblk = (data >> 3) & 1;
324327
325328   /* other bits unknown */
326329
327330   /*kludge to avoid jumps on ram area in The Couples*/
328   state->m_backup_ram[0x1011] = 0xc9; //ret
331   state->m_backup_ram.target()[0x1011] = 0xc9; //ret
329332}
330333
331334WRITE8_MEMBER(merit_state::casino5_bank_w)
r14896r14897
358361   AM_RANGE(0xc000, 0xc003) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
359362   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_device, address_w)
360363   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_device, register_w)
361   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
362   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
364   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
365   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
363366   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
364367ADDRESS_MAP_END
365368
r14896r14897
374377   AM_RANGE(0xc000, 0xc003) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
375378   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_device, address_w)
376379   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_device, register_w)
377   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
378   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
380   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
381   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
379382   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
380383ADDRESS_MAP_END
381384
r14896r14897
386389   AM_RANGE(0xc008, 0xc00b) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)
387390   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_device, address_w)
388391   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_device, register_w)
389   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
390   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
392   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
393   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
391394   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
392395ADDRESS_MAP_END
393396
r14896r14897
398401   AM_RANGE(0xc008, 0xc00b) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
399402   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_device, address_w)
400403   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_device, register_w)
401   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
402   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
404   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
405   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
403406   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
404407ADDRESS_MAP_END
405408
r14896r14897
418421   AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x1df0) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
419422   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, address_w)
420423   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, register_w)
421   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
422   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
424   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
425   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
423426   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
424427ADDRESS_MAP_END
425428
r14896r14897
439442   AM_RANGE(0xda00, 0xdaff) AM_WRITE(med_offset_w)
440443   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, address_w)
441444   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, register_w)
442   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
443   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
445   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
446   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
444447   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
445448ADDRESS_MAP_END
446449
r14896r14897
460463   AM_RANGE(0xda00, 0xdaff) AM_WRITE(med_offset_w)
461464   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, address_w)
462465   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, register_w)
463   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
464   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
466   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
467   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
465468   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
466469ADDRESS_MAP_END
467470
r14896r14897
481484   AM_RANGE(0xda00, 0xdaff) AM_WRITE(med_offset_w)
482485   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, address_w)
483486   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, register_w)
484   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
485   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
487   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
488   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
486489   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
487490ADDRESS_MAP_END
488491
r14896r14897
497500   AM_RANGE(0xda00, 0xdaff) AM_WRITE(med_offset_w)
498501   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, address_w)
499502   AM_RANGE(0xe001, 0xe001) AM_MIRROR(0x05f0) AM_DEVWRITE("crtc", mc6845_device, register_w)
500   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
501   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
503   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
504   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
502505   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
503506ADDRESS_MAP_END
504507
505508static ADDRESS_MAP_START( couple_map, AS_PROGRAM, 8, merit_state )
506509   AM_RANGE(0x0000, 0x7fff) AM_ROM
507510   AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1")
508   AM_RANGE(0xa000, 0xbfff) AM_RAM AM_BASE(m_backup_ram)
511   AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("backup_ram")
509512   AM_RANGE(0xc004, 0xc007) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w)
510513   AM_RANGE(0xc008, 0xc00b) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w)
511514   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_device, address_w)
512515   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_device, register_w)
513   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
514   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
516   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
517   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
515518   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
516519ADDRESS_MAP_END
517520
src/mame/drivers/blstroid.c
r14896r14897
4141}
4242
4343
44static WRITE16_HANDLER( blstroid_halt_until_hblank_0_w )
44WRITE16_MEMBER(blstroid_state::blstroid_halt_until_hblank_0_w)
4545{
46   atarigen_halt_until_hblank_0(*space->machine().primary_screen);
46   atarigen_halt_until_hblank_0(*machine().primary_screen);
4747}
4848
4949
r14896r14897
7171 *
7272 *************************************/
7373
74static READ16_HANDLER( inputs_r )
74READ16_MEMBER(blstroid_state::inputs_r)
7575{
7676   static const char *const iptnames[] = { "IN0", "IN1" };
77   blstroid_state *state = space->machine().driver_data<blstroid_state>();
78   int temp = input_port_read(space->machine(), iptnames[offset & 1]);
77   int temp = input_port_read(machine(), iptnames[offset & 1]);
7978
80   if (state->m_cpu_to_sound_ready) temp ^= 0x0040;
81   if (atarigen_get_hblank(*space->machine().primary_screen)) temp ^= 0x0010;
79   if (m_cpu_to_sound_ready) temp ^= 0x0040;
80   if (atarigen_get_hblank(*machine().primary_screen)) temp ^= 0x0010;
8281   return temp;
8382}
8483
r14896r14897
101100   AM_RANGE(0xff8800, 0xff89ff) AM_MIRROR(0x7f8000) AM_WRITEONLY AM_BASE(m_priorityram)
102101   AM_RANGE(0xff8a00, 0xff8a01) AM_MIRROR(0x7f81fe) AM_WRITE_LEGACY(atarigen_sound_w)
103102   AM_RANGE(0xff8c00, 0xff8c01) AM_MIRROR(0x7f81fe) AM_WRITE_LEGACY(atarigen_sound_reset_w)
104   AM_RANGE(0xff8e00, 0xff8e01) AM_MIRROR(0x7f81fe) AM_WRITE_LEGACY(blstroid_halt_until_hblank_0_w)
103   AM_RANGE(0xff8e00, 0xff8e01) AM_MIRROR(0x7f81fe) AM_WRITE(blstroid_halt_until_hblank_0_w)
105104   AM_RANGE(0xff9400, 0xff9401) AM_MIRROR(0x7f83fe) AM_READ_LEGACY(atarigen_sound_r)
106105   AM_RANGE(0xff9800, 0xff9801) AM_MIRROR(0x7f83f8) AM_READ_PORT("DIAL0")
107106   AM_RANGE(0xff9804, 0xff9805) AM_MIRROR(0x7f83f8) AM_READ_PORT("DIAL1")
108   AM_RANGE(0xff9c00, 0xff9c03) AM_MIRROR(0x7f83fc) AM_READ_LEGACY(inputs_r)
109   AM_RANGE(0xffa000, 0xffa3ff) AM_MIRROR(0x7f8c00) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
107   AM_RANGE(0xff9c00, 0xff9c03) AM_MIRROR(0x7f83fc) AM_READ(inputs_r)
108   AM_RANGE(0xffa000, 0xffa3ff) AM_MIRROR(0x7f8c00) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
110109   AM_RANGE(0xffb000, 0xffb3ff) AM_MIRROR(0x7f8c00) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
111110   AM_RANGE(0xffc000, 0xffcfff) AM_MIRROR(0x7f8000) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_BASE(m_playfield)
112111   AM_RANGE(0xffd000, 0xffdfff) AM_MIRROR(0x7f8000) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
src/mame/drivers/gotya.c
r14896r14897
4646   AM_RANGE(0x6001, 0x6001) AM_READ_PORT("P2")
4747   AM_RANGE(0x6002, 0x6002) AM_READ_PORT("DSW")
4848   AM_RANGE(0x6004, 0x6004) AM_WRITE(gotya_video_control_w)
49   AM_RANGE(0x6005, 0x6005) AM_WRITE_LEGACY(gotya_soundlatch_w)
49   AM_RANGE(0x6005, 0x6005) AM_WRITE(gotya_soundlatch_w)
5050   AM_RANGE(0x6006, 0x6006) AM_WRITEONLY AM_BASE(m_scroll)
5151   AM_RANGE(0x6007, 0x6007) AM_WRITE(watchdog_reset_w)
5252   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(gotya_videoram_w) AM_BASE(m_videoram)
src/mame/drivers/aztarac.c
r14896r14897
8080   AM_RANGE(0x022000, 0x0220ff) AM_READ(nvram_r) AM_WRITEONLY AM_SHARE("nvram")
8181   AM_RANGE(0x027000, 0x027001) AM_READ(joystick_r)
8282   AM_RANGE(0x027004, 0x027005) AM_READ_PORT("INPUTS")
83   AM_RANGE(0x027008, 0x027009) AM_READWRITE_LEGACY(aztarac_sound_r, aztarac_sound_w)
83   AM_RANGE(0x027008, 0x027009) AM_READWRITE(aztarac_sound_r, aztarac_sound_w)
8484   AM_RANGE(0x02700c, 0x02700d) AM_READ_PORT("DIAL")
8585   AM_RANGE(0x02700e, 0x02700f) AM_READ(watchdog_reset16_r)
8686   AM_RANGE(0xff8000, 0xffafff) AM_RAM AM_BASE(m_vectorram)
r14896r14897
9999static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, aztarac_state )
100100   AM_RANGE(0x0000, 0x1fff) AM_ROM
101101   AM_RANGE(0x8000, 0x87ff) AM_RAM
102   AM_RANGE(0x8800, 0x8800) AM_READ_LEGACY(aztarac_snd_command_r)
102   AM_RANGE(0x8800, 0x8800) AM_READ(aztarac_snd_command_r)
103103   AM_RANGE(0x8c00, 0x8c01) AM_DEVREADWRITE_LEGACY("ay1", ay8910_r, ay8910_data_address_w)
104104   AM_RANGE(0x8c02, 0x8c03) AM_DEVREADWRITE_LEGACY("ay2", ay8910_r, ay8910_data_address_w)
105105   AM_RANGE(0x8c04, 0x8c05) AM_DEVREADWRITE_LEGACY("ay3", ay8910_r, ay8910_data_address_w)
106106   AM_RANGE(0x8c06, 0x8c07) AM_DEVREADWRITE_LEGACY("ay4", ay8910_r, ay8910_data_address_w)
107   AM_RANGE(0x9000, 0x9000) AM_READWRITE_LEGACY(aztarac_snd_status_r, aztarac_snd_status_w)
107   AM_RANGE(0x9000, 0x9000) AM_READWRITE(aztarac_snd_status_r, aztarac_snd_status_w)
108108ADDRESS_MAP_END
109109
110110
src/mame/drivers/retofinv.c
r14896r14897
6565
6666WRITE8_MEMBER(retofinv_state::soundcommand_w)
6767{
68      soundlatch_w(space, 0, data);
68      soundlatch_byte_w(space, 0, data);
6969      cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
7070}
7171
r14896r14897
135135static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, retofinv_state )
136136   AM_RANGE(0x0000, 0x1fff) AM_ROM
137137   AM_RANGE(0x2000, 0x27ff) AM_RAM
138   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r)
138   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r)
139139   AM_RANGE(0x6000, 0x6000) AM_WRITE(cpu2_m6000_w)
140140   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE_LEGACY("sn1", sn76496_w)
141141   AM_RANGE(0xa000, 0xa000) AM_DEVWRITE_LEGACY("sn2", sn76496_w)
src/mame/drivers/dotrikun.c
r14896r14897
2828{
2929public:
3030   dotrikun_state(const machine_config &mconfig, device_type type, const char *tag)
31      : driver_device(mconfig, type, tag) { }
31      : driver_device(mconfig, type, tag) ,
32      m_dotrikun_bitmap(*this, "dotrikun_bitmap"){ }
3233
3334   /* memory pointers */
34   UINT8 *        m_dotrikun_bitmap;
35   required_shared_ptr<UINT8> m_dotrikun_bitmap;
3536
3637   /* video-related */
3738   UINT8          m_color;
r14896r14897
7172   {
7273      for (x = 0; x < 256; x+=16)
7374      {
74         UINT8 data = state->m_dotrikun_bitmap[((x/16)+((y/2)*16))];
75         UINT8 data = state->m_dotrikun_bitmap.target()[((x/16)+((y/2)*16))];
7576
7677         for (i = 0; i < 8; i++)
7778         {
r14896r14897
9899
99100static ADDRESS_MAP_START( dotrikun_map, AS_PROGRAM, 8, dotrikun_state )
100101   AM_RANGE(0x0000, 0x3fff) AM_ROM
101   AM_RANGE(0x8000, 0x85ff) AM_RAM AM_BASE(m_dotrikun_bitmap)
102   AM_RANGE(0x8000, 0x85ff) AM_RAM AM_SHARE("dotrikun_bitmap")
102103   AM_RANGE(0x8600, 0x87ff) AM_RAM
103104ADDRESS_MAP_END
104105
src/mame/drivers/harddriv.c
r14896r14897
642642static ADDRESS_MAP_START( driversnd_68k_map, AS_PROGRAM, 16, harddriv_state )
643643   ADDRESS_MAP_UNMAP_HIGH
644644   AM_RANGE(0x000000, 0x01ffff) AM_ROM
645   AM_RANGE(0xff0000, 0xff0fff) AM_READWRITE_LEGACY(hdsnd68k_data_r, hdsnd68k_data_w)
646   AM_RANGE(0xff1000, 0xff1fff) AM_READWRITE_LEGACY(hdsnd68k_switches_r, hdsnd68k_latches_w)
647   AM_RANGE(0xff2000, 0xff2fff) AM_READWRITE_LEGACY(hdsnd68k_320port_r, hdsnd68k_speech_w)
648   AM_RANGE(0xff3000, 0xff3fff) AM_READWRITE_LEGACY(hdsnd68k_status_r, hdsnd68k_irqclr_w)
649   AM_RANGE(0xff4000, 0xff5fff) AM_READWRITE_LEGACY(hdsnd68k_320ram_r, hdsnd68k_320ram_w)
650   AM_RANGE(0xff6000, 0xff7fff) AM_READWRITE_LEGACY(hdsnd68k_320ports_r, hdsnd68k_320ports_w)
651   AM_RANGE(0xff8000, 0xffbfff) AM_READWRITE_LEGACY(hdsnd68k_320com_r, hdsnd68k_320com_w)
645   AM_RANGE(0xff0000, 0xff0fff) AM_READWRITE(hdsnd68k_data_r, hdsnd68k_data_w)
646   AM_RANGE(0xff1000, 0xff1fff) AM_READWRITE(hdsnd68k_switches_r, hdsnd68k_latches_w)
647   AM_RANGE(0xff2000, 0xff2fff) AM_READWRITE(hdsnd68k_320port_r, hdsnd68k_speech_w)
648   AM_RANGE(0xff3000, 0xff3fff) AM_READWRITE(hdsnd68k_status_r, hdsnd68k_irqclr_w)
649   AM_RANGE(0xff4000, 0xff5fff) AM_READWRITE(hdsnd68k_320ram_r, hdsnd68k_320ram_w)
650   AM_RANGE(0xff6000, 0xff7fff) AM_READWRITE(hdsnd68k_320ports_r, hdsnd68k_320ports_w)
651   AM_RANGE(0xff8000, 0xffbfff) AM_READWRITE(hdsnd68k_320com_r, hdsnd68k_320com_w)
652652   AM_RANGE(0xffc000, 0xffffff) AM_RAM
653653ADDRESS_MAP_END
654654
r14896r14897
663663
664664
665665static ADDRESS_MAP_START( driversnd_dsp_io_map, AS_IO, 16, harddriv_state )
666   AM_RANGE(0, 0) AM_READ_LEGACY(hdsnddsp_rom_r) AM_DEVWRITE_LEGACY("dac", hdsnddsp_dac_w)
667   AM_RANGE(1, 1) AM_READ_LEGACY(hdsnddsp_comram_r)
668   AM_RANGE(2, 2) AM_READ_LEGACY(hdsnddsp_compare_r)
666   AM_RANGE(0, 0) AM_READ(hdsnddsp_rom_r) AM_DEVWRITE_LEGACY("dac", hdsnddsp_dac_w)
667   AM_RANGE(1, 1) AM_READ(hdsnddsp_comram_r)
668   AM_RANGE(2, 2) AM_READ(hdsnddsp_compare_r)
669669   AM_RANGE(1, 2) AM_WRITENOP
670   AM_RANGE(3, 3) AM_WRITE_LEGACY(hdsnddsp_comport_w)
671   AM_RANGE(4, 4) AM_WRITE_LEGACY(hdsnddsp_mute_w)
672   AM_RANGE(5, 5) AM_WRITE_LEGACY(hdsnddsp_gen68kirq_w)
673   AM_RANGE(6, 7) AM_WRITE_LEGACY(hdsnddsp_soundaddr_w)
674   AM_RANGE(TMS32010_BIO, TMS32010_BIO) AM_READ_LEGACY(hdsnddsp_get_bio)
670   AM_RANGE(3, 3) AM_WRITE(hdsnddsp_comport_w)
671   AM_RANGE(4, 4) AM_WRITE(hdsnddsp_mute_w)
672   AM_RANGE(5, 5) AM_WRITE(hdsnddsp_gen68kirq_w)
673   AM_RANGE(6, 7) AM_WRITE(hdsnddsp_soundaddr_w)
674   AM_RANGE(TMS32010_BIO, TMS32010_BIO) AM_READ(hdsnddsp_get_bio)
675675ADDRESS_MAP_END
676676
677677
r14896r14897
40104010   hdsnd_init(machine);
40114011
40124012   /* install sound handlers */
4013   state->m_maincpu->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x840000, 0x840001, FUNC(hd68k_snd_data_r), FUNC(hd68k_snd_data_w));
4014   state->m_maincpu->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x844000, 0x844001, FUNC(hd68k_snd_status_r));
4015   state->m_maincpu->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x84c000, 0x84c001, FUNC(hd68k_snd_reset_w));
4013   state->m_maincpu->memory().space(AS_PROGRAM)->install_readwrite_handler(0x840000, 0x840001, read16_delegate(FUNC(harddriv_state::hd68k_snd_data_r),state), write16_delegate(FUNC(harddriv_state::hd68k_snd_data_w),state));
4014   state->m_maincpu->memory().space(AS_PROGRAM)->install_read_handler(0x844000, 0x844001, read16_delegate(FUNC(harddriv_state::hd68k_snd_status_r),state));
4015   state->m_maincpu->memory().space(AS_PROGRAM)->install_write_handler(0x84c000, 0x84c001, write16_delegate(FUNC(harddriv_state::hd68k_snd_reset_w),state));
40164016}
40174017
40184018
r14896r14897
41524152
41534153
41544154
4155static READ16_HANDLER( steeltal_dummy_r )
4155READ16_MEMBER(harddriv_state::steeltal_dummy_r)
41564156{
41574157   /* this is required so that INT 4 is recongized as a sound INT */
41584158   return ~0;
r14896r14897
41694169   init_dspcom(machine);
41704170   atarijsa_init(machine, "IN0", 0x0020);
41714171
4172   state->m_maincpu->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x908000, 0x908001, FUNC(steeltal_dummy_r));
4172   state->m_maincpu->memory().space(AS_PROGRAM)->install_read_handler(0x908000, 0x908001, read16_delegate(FUNC(harddriv_state::steeltal_dummy_r),state));
41734173
41744174   /* set up the SLOOP */
41754175   if (!proto_sloop)
src/mame/drivers/spoker.c
r14896r14897
2626{
2727public:
2828   spoker_state(const machine_config &mconfig, device_type type, const char *tag)
29      : driver_device(mconfig, type, tag) { }
29      : driver_device(mconfig, type, tag) ,
30      m_bg_tile_ram(*this, "bg_tile_ram"),
31      m_fg_tile_ram(*this, "fg_tile_ram"),
32      m_fg_color_ram(*this, "fg_color_ram"){ }
3033
31   UINT8   *m_bg_tile_ram;
34   required_shared_ptr<UINT8> m_bg_tile_ram;
3235   tilemap_t *m_bg_tilemap;
3336
34   UINT8 *m_fg_tile_ram;
35   UINT8 *m_fg_color_ram;
37   required_shared_ptr<UINT8> m_fg_tile_ram;
38   required_shared_ptr<UINT8> m_fg_color_ram;
3639   tilemap_t *m_fg_tilemap;
3740
3841   int m_video_enable;
r14896r14897
5457WRITE8_MEMBER(spoker_state::bg_tile_w)
5558{
5659
57   m_bg_tile_ram[offset] = data;
60   m_bg_tile_ram.target()[offset] = data;
5861   m_bg_tilemap->mark_tile_dirty(offset);
5962}
6063
6164static TILE_GET_INFO( get_bg_tile_info )
6265{
6366   spoker_state *state = machine.driver_data<spoker_state>();
64   int code = state->m_bg_tile_ram[tile_index];
67   int code = state->m_bg_tile_ram.target()[tile_index];
6568   SET_TILE_INFO(1 + (tile_index & 3), code & 0xff, 0, 0);
6669}
6770
6871static TILE_GET_INFO( get_fg_tile_info )
6972{
7073   spoker_state *state = machine.driver_data<spoker_state>();
71   int code = state->m_fg_tile_ram[tile_index] | (state->m_fg_color_ram[tile_index] << 8);
74   int code = state->m_fg_tile_ram.target()[tile_index] | (state->m_fg_color_ram.target()[tile_index] << 8);
7275   SET_TILE_INFO(0, code, (4*(code >> 14)+3), 0);
7376}
7477
7578WRITE8_MEMBER(spoker_state::fg_tile_w)
7679{
7780
78   m_fg_tile_ram[offset] = data;
81   m_fg_tile_ram.target()[offset] = data;
7982   m_fg_tilemap->mark_tile_dirty(offset);
8083}
8184
8285WRITE8_MEMBER(spoker_state::fg_color_w)
8386{
8487
85   m_fg_color_ram[offset] = data;
88   m_fg_color_ram.target()[offset] = data;
8689   m_fg_tilemap->mark_tile_dirty(offset);
8790}
8891
r14896r14897
224227static ADDRESS_MAP_START( spoker_portmap, AS_IO, 8, spoker_state )
225228   AM_RANGE( 0x0000, 0x003f ) AM_RAM // Z180 internal regs
226229
227   AM_RANGE( 0x2000, 0x23ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_SHARE("paletteram")
228   AM_RANGE( 0x2400, 0x27ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_SHARE("paletteram2")
230   AM_RANGE( 0x2000, 0x23ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) AM_SHARE("paletteram")
231   AM_RANGE( 0x2400, 0x27ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) AM_SHARE("paletteram2")
229232
230233   AM_RANGE( 0x3000, 0x33ff ) AM_RAM_WRITE(bg_tile_w ) AM_BASE(m_bg_tile_ram )
231234
r14896r14897
255258static ADDRESS_MAP_START( 3super8_portmap, AS_IO, 8, spoker_state )
256259//  AM_RANGE( 0x1000, 0x1fff ) AM_WRITENOP
257260
258   AM_RANGE( 0x2000, 0x27ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_SHARE("paletteram")
259   AM_RANGE( 0x2800, 0x2fff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_SHARE("paletteram2")
261   AM_RANGE( 0x2000, 0x27ff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) AM_SHARE("paletteram")
262   AM_RANGE( 0x2800, 0x2fff ) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) AM_SHARE("paletteram2")
260263
261264   AM_RANGE( 0x3000, 0x33ff ) AM_RAM_WRITE(bg_tile_w ) AM_BASE(m_bg_tile_ram )
262265
src/mame/drivers/srmp2.c
r14896r14897
428428   AM_RANGE(0x300000, 0x300001) AM_READ8(mjyuugi_irq4_ack_r,0x00ff) /* irq ack lv 4? */
429429   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW3-1")            /* DSW 3-1 */
430430   AM_RANGE(0x500010, 0x500011) AM_READ_PORT("DSW3-2")            /* DSW 3-2 */
431   AM_RANGE(0x700000, 0x7003ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
431   AM_RANGE(0x700000, 0x7003ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
432432   AM_RANGE(0x800000, 0x800001) AM_READNOP            /* ??? */
433433   AM_RANGE(0x900000, 0x900001) AM_READWRITE8(iox_mux_r, iox_command_w,0x00ff)   /* key matrix | I/O */
434434   AM_RANGE(0x900002, 0x900003) AM_READWRITE8(iox_status_r,iox_data_w,0x00ff)
src/mame/drivers/ohmygod.c
r14896r14897
4545   AM_RANGE(0x308000, 0x30ffff) AM_RAM
4646   AM_RANGE(0x400000, 0x400001) AM_WRITE(ohmygod_scrollx_w)
4747   AM_RANGE(0x400002, 0x400003) AM_WRITE(ohmygod_scrolly_w)
48   AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")
48   AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")
4949   AM_RANGE(0x700000, 0x703fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
5050   AM_RANGE(0x704000, 0x707fff) AM_RAM
5151   AM_RANGE(0x708000, 0x70ffff) AM_RAM    /* Work RAM */
src/mame/drivers/snk68.c
r14896r14897
108108{
109109   if (ACCESSING_BITS_8_15)
110110   {
111      soundlatch_w(space, 0, data >> 8);
111      soundlatch_byte_w(space, 0, data >> 8);
112112      cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
113113   }
114114}
r14896r14897
159159static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, snk68_state )
160160   AM_RANGE(0x0000, 0xefff) AM_ROM
161161   AM_RANGE(0xf000, 0xf7ff) AM_RAM
162   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r) AM_WRITE(sound_status_w)
162   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) AM_WRITE(sound_status_w)
163163ADDRESS_MAP_END
164164
165165static WRITE8_DEVICE_HANDLER( D7759_write_port_0_w )
src/mame/drivers/aeroboto.c
r14896r14897
8383   AM_RANGE(0x2900, 0x2fff) AM_WRITENOP               // cleared along with sprite RAM
8484   AM_RANGE(0x2973, 0x2973) AM_READ(aeroboto_2973_r)         // protection read
8585   AM_RANGE(0x3000, 0x3000) AM_READWRITE(aeroboto_in0_r, aeroboto_3000_w)
86   AM_RANGE(0x3001, 0x3001) AM_READ_PORT("DSW1") AM_WRITE(soundlatch_w)
87   AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW2") AM_WRITE(soundlatch2_w)
86   AM_RANGE(0x3001, 0x3001) AM_READ_PORT("DSW1") AM_WRITE(soundlatch_byte_w)
87   AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW2") AM_WRITE(soundlatch2_byte_w)
8888   AM_RANGE(0x3003, 0x3003) AM_WRITEONLY AM_BASE(m_vscroll)
8989   AM_RANGE(0x3004, 0x3004) AM_READ(aeroboto_201_r) AM_WRITEONLY AM_BASE(m_starx)
9090   AM_RANGE(0x3005, 0x3005) AM_WRITEONLY AM_BASE(m_stary)   // usable but probably wrong
r14896r14897
217217{
218218   AY8910_LEGACY_OUTPUT,
219219   AY8910_DEFAULT_LOADS,
220   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
221   DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_r),
220   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
221   DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_byte_r),
222222   DEVCB_NULL,
223223   DEVCB_NULL
224224};
src/mame/drivers/madalien.c
r14896r14897
5555WRITE8_MEMBER(madalien_state::madalien_sound_command_w)
5656{
5757   cputag_set_input_line(machine(), "audiocpu", 0, ASSERT_LINE);
58   soundlatch_w(space, offset, data);
58   soundlatch_byte_w(space, offset, data);
5959}
6060
6161
6262READ8_MEMBER(madalien_state::madalien_sound_command_r)
6363{
6464   cputag_set_input_line(machine(), "audiocpu", 0, CLEAR_LINE);
65   return soundlatch_r(space, offset);
65   return soundlatch_byte_r(space, offset);
6666}
6767
6868
r14896r14897
8787   AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x0ff0) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
8888   AM_RANGE(0x8004, 0x8004) AM_MIRROR(0x0ff0) AM_WRITEONLY AM_BASE(m_video_control)
8989   AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x0ff0) AM_WRITE(madalien_output_w)
90   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x0ff0) AM_READ(soundlatch2_r) AM_WRITE(madalien_sound_command_w)
90   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x0ff0) AM_READ(soundlatch2_byte_r) AM_WRITE(madalien_sound_command_w)
9191   AM_RANGE(0x8008, 0x8008) AM_MIRROR(0x07f0) AM_RAM_READ(shift_r) AM_BASE(m_shift_hi)
9292   AM_RANGE(0x8009, 0x8009) AM_MIRROR(0x07f0) AM_RAM_READ(shift_rev_r) AM_BASE(m_shift_lo)
9393   AM_RANGE(0x800b, 0x800b) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE(m_video_flags)
r14896r14897
109109   AM_RANGE(0x6000, 0x6003) AM_MIRROR(0x1ffc) AM_RAM /* unknown device in an epoxy block, might be tilt detection */
110110   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1ffc) AM_READ(madalien_sound_command_r)
111111   AM_RANGE(0x8000, 0x8001) AM_MIRROR(0x1ffc) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
112   AM_RANGE(0x8002, 0x8002) AM_MIRROR(0x1ffc) AM_WRITE(soundlatch2_w)
112   AM_RANGE(0x8002, 0x8002) AM_MIRROR(0x1ffc) AM_WRITE(soundlatch2_byte_w)
113113   AM_RANGE(0xf800, 0xffff) AM_ROM
114114ADDRESS_MAP_END
115115
src/mame/drivers/konamigv.c
r14896r14897
145145   sharp_lh28f400_device *m_flash16[4];
146146
147147   UINT8 m_sector_buffer[ 4096 ];
148   DECLARE_WRITE32_MEMBER(mb89371_w);
149   DECLARE_READ32_MEMBER(mb89371_r);
150   DECLARE_READ32_MEMBER(flash_r);
151   DECLARE_WRITE32_MEMBER(flash_w);
152   DECLARE_READ32_MEMBER(trackball_r);
153   DECLARE_READ32_MEMBER(unknown_r);
154   DECLARE_READ32_MEMBER(btcflash_r);
155   DECLARE_WRITE32_MEMBER(btcflash_w);
156   DECLARE_READ32_MEMBER(btc_trackball_r);
157   DECLARE_WRITE32_MEMBER(btc_trackball_w);
158   DECLARE_READ32_MEMBER(tokimeki_serial_r);
159   DECLARE_WRITE32_MEMBER(tokimeki_serial_w);
160   DECLARE_WRITE32_MEMBER(kdeadeye_0_w);
148161};
149162
150163/* EEPROM handlers */
r14896r14897
157170   eeprom->set_cs_line((data&0x02) ? CLEAR_LINE : ASSERT_LINE);
158171}
159172
160static WRITE32_HANDLER( mb89371_w )
173WRITE32_MEMBER(konamigv_state::mb89371_w)
161174{
162175}
163176
164static READ32_HANDLER( mb89371_r )
177READ32_MEMBER(konamigv_state::mb89371_r)
165178{
166179   return 0xffffffff;
167180}
r14896r14897
173186   AM_RANGE(0x1f100004, 0x1f100007) AM_READ_PORT("P2")
174187   AM_RANGE(0x1f100008, 0x1f10000b) AM_READ_PORT("P3_P4")
175188   AM_RANGE(0x1f180000, 0x1f180003) AM_DEVWRITE_LEGACY("eeprom", eeprom_w)
176   AM_RANGE(0x1f680000, 0x1f68001f) AM_READWRITE_LEGACY(mb89371_r, mb89371_w)
189   AM_RANGE(0x1f680000, 0x1f68001f) AM_READWRITE(mb89371_r, mb89371_w)
177190   AM_RANGE(0x1f780000, 0x1f780003) AM_WRITENOP /* watchdog? */
178191   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_SHARE("share2") AM_REGION("user1", 0) /* bios */
179192   AM_RANGE(0x80000000, 0x801fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
r14896r14897
414427
415428/* Simpsons Bowling */
416429
417static READ32_HANDLER( flash_r )
430READ32_MEMBER(konamigv_state::flash_r)
418431{
419   konamigv_state *state = space->machine().driver_data<konamigv_state>();
420432   int reg = offset*2;
421433   //int shift = 0;
422434
r14896r14897
428440
429441   if (reg == 4)   // set odd address
430442   {
431      state->m_flash_address |= 1;
443      m_flash_address |= 1;
432444   }
433445
434446   if (reg == 0)
435447   {
436      int chip = (state->m_flash_address >= 0x200000) ? 2 : 0;
448      int chip = (m_flash_address >= 0x200000) ? 2 : 0;
437449      int ret;
438450
439      ret = state->m_flash8[chip]->read(state->m_flash_address & 0x1fffff) & 0xff;
440      ret |= state->m_flash8[chip+1]->read(state->m_flash_address & 0x1fffff)<<8;
441      state->m_flash_address++;
451      ret = m_flash8[chip]->read(m_flash_address & 0x1fffff) & 0xff;
452      ret |= m_flash8[chip+1]->read(m_flash_address & 0x1fffff)<<8;
453      m_flash_address++;
442454
443455      return ret;
444456   }
445457   return 0;
446458}
447459
448static WRITE32_HANDLER( flash_w )
460WRITE32_MEMBER(konamigv_state::flash_w)
449461{
450   konamigv_state *state = space->machine().driver_data<konamigv_state>();
451462   int reg = offset*2;
452463   int chip;
453464
r14896r14897
460471   switch (reg)
461472   {
462473      case 0:
463         chip = (state->m_flash_address >= 0x200000) ? 2 : 0;
464         state->m_flash8[chip]->write(state->m_flash_address & 0x1fffff, data&0xff);
465         state->m_flash8[chip+1]->write(state->m_flash_address & 0x1fffff, (data>>8)&0xff);
474         chip = (m_flash_address >= 0x200000) ? 2 : 0;
475         m_flash8[chip]->write(m_flash_address & 0x1fffff, data&0xff);
476         m_flash8[chip+1]->write(m_flash_address & 0x1fffff, (data>>8)&0xff);
466477         break;
467478
468479      case 1:
469         state->m_flash_address = 0;
470         state->m_flash_address |= (data<<1);
480         m_flash_address = 0;
481         m_flash_address |= (data<<1);
471482         break;
472483      case 2:
473         state->m_flash_address &= 0xff00ff;
474         state->m_flash_address |= (data<<8);
484         m_flash_address &= 0xff00ff;
485         m_flash_address |= (data<<8);
475486         break;
476487      case 3:
477         state->m_flash_address &= 0x00ffff;
478         state->m_flash_address |= (data<<15);
488         m_flash_address &= 0x00ffff;
489         m_flash_address |= (data<<15);
479490         break;
480491   }
481492}
482493
483static READ32_HANDLER( trackball_r )
494READ32_MEMBER(konamigv_state::trackball_r)
484495{
485   konamigv_state *state = space->machine().driver_data<konamigv_state>();
486496
487497   if( offset == 0 && mem_mask == 0x0000ffff )
488498   {
r14896r14897
493503
494504      for( axis = 0; axis < 2; axis++ )
495505      {
496         value = input_port_read(space->machine(), axisnames[axis]);
497         diff = value - state->m_trackball_prev[ axis ];
498         state->m_trackball_prev[ axis ] = value;
499         state->m_trackball_data[ axis ] = ( ( diff & 0xf00 ) << 16 ) | ( ( diff & 0xff ) << 8 );
506         value = input_port_read(machine(), axisnames[axis]);
507         diff = value - m_trackball_prev[ axis ];
508         m_trackball_prev[ axis ] = value;
509         m_trackball_data[ axis ] = ( ( diff & 0xf00 ) << 16 ) | ( ( diff & 0xff ) << 8 );
500510      }
501511   }
502   return state->m_trackball_data[ offset ];
512   return m_trackball_data[ offset ];
503513}
504514
505static READ32_HANDLER( unknown_r )
515READ32_MEMBER(konamigv_state::unknown_r)
506516{
507517   return 0xffffffff;
508518}
r14896r14897
516526   state->m_flash8[2] = machine.device<fujitsu_29f016a_device>("flash2");
517527   state->m_flash8[3] = machine.device<fujitsu_29f016a_device>("flash3");
518528
519   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f680080, 0x1f68008f, FUNC(flash_r), FUNC(flash_w) );
520   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler     ( 0x1f6800c0, 0x1f6800c7, FUNC(trackball_r) );
521   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler     ( 0x1f6800c8, 0x1f6800cb, FUNC(unknown_r) ); /* ?? */
529   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::flash_r),state), write32_delegate(FUNC(konamigv_state::flash_w),state) );
530   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler     ( 0x1f6800c0, 0x1f6800c7, read32_delegate(FUNC(konamigv_state::trackball_r),state));
531   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler     ( 0x1f6800c8, 0x1f6800cb, read32_delegate(FUNC(konamigv_state::unknown_r),state)); /* ?? */
522532
523533   DRIVER_INIT_CALL(konamigv);
524534}
r14896r14897
543553
544554/* Beat the Champ */
545555
546static READ32_HANDLER( btcflash_r )
556READ32_MEMBER(konamigv_state::btcflash_r)
547557{
548   konamigv_state *state = space->machine().driver_data<konamigv_state>();
549558
550559   if (mem_mask == 0x0000ffff)
551560   {
552      return state->m_flash16[0]->read(offset*2);
561      return m_flash16[0]->read(offset*2);
553562   }
554563   else if (mem_mask == 0xffff0000)
555564   {
556      return state->m_flash16[0]->read((offset*2)+1)<<16;
565      return m_flash16[0]->read((offset*2)+1)<<16;
557566   }
558567
559568   return 0;
560569}
561570
562static WRITE32_HANDLER( btcflash_w )
571WRITE32_MEMBER(konamigv_state::btcflash_w)
563572{
564   konamigv_state *state = space->machine().driver_data<konamigv_state>();
565573
566574   if (mem_mask == 0x0000ffff)
567575   {
568      state->m_flash16[0]->write(offset*2, data&0xffff);
576      m_flash16[0]->write(offset*2, data&0xffff);
569577   }
570578   else if (mem_mask == 0xffff0000)
571579   {
572      state->m_flash16[0]->write((offset*2)+1, (data>>16)&0xffff);
580      m_flash16[0]->write((offset*2)+1, (data>>16)&0xffff);
573581   }
574582}
575583
576static READ32_HANDLER( btc_trackball_r )
584READ32_MEMBER(konamigv_state::btc_trackball_r)
577585{
578   konamigv_state *state = space->machine().driver_data<konamigv_state>();
579586
580//  mame_printf_debug( "r %08x %08x %08x\n", cpu_get_pc(&space->device()), offset, mem_mask );
587//  mame_printf_debug( "r %08x %08x %08x\n", cpu_get_pc(&space.device()), offset, mem_mask );
581588
582589   if( offset == 1 && mem_mask == 0xffff0000 )
583590   {
r14896r14897
588595
589596      for( axis = 0; axis < 4; axis++ )
590597      {
591         value = input_port_read(space->machine(), axisnames[axis]);
592         diff = value - state->m_btc_trackball_prev[ axis ];
593         state->m_btc_trackball_prev[ axis ] = value;
594         state->m_btc_trackball_data[ axis ] = ( ( diff & 0xf00 ) << 16 ) | ( ( diff & 0xff ) << 8 );
598         value = input_port_read(machine(), axisnames[axis]);
599         diff = value - m_btc_trackball_prev[ axis ];
600         m_btc_trackball_prev[ axis ] = value;
601         m_btc_trackball_data[ axis ] = ( ( diff & 0xf00 ) << 16 ) | ( ( diff & 0xff ) << 8 );
595602      }
596603   }
597604
598   return state->m_btc_trackball_data[ offset ] | ( state->m_btc_trackball_data[ offset + 2 ] >> 8 );
605   return m_btc_trackball_data[ offset ] | ( m_btc_trackball_data[ offset + 2 ] >> 8 );
599606}
600607
601static WRITE32_HANDLER( btc_trackball_w )
608WRITE32_MEMBER(konamigv_state::btc_trackball_w)
602609{
603//  mame_printf_debug( "w %08x %08x %08x %08x\n", cpu_get_pc(&space->device()), offset, data, mem_mask );
610//  mame_printf_debug( "w %08x %08x %08x %08x\n", cpu_get_pc(&space.device()), offset, data, mem_mask );
604611}
605612
606613static DRIVER_INIT( btchamp )
r14896r14897
609616
610617   state->m_flash16[0] = machine.device<sharp_lh28f400_device>("flash");
611618
612   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f680080, 0x1f68008f, FUNC(btc_trackball_r), FUNC(btc_trackball_w) );
619   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::btc_trackball_r),state), write32_delegate(FUNC(konamigv_state::btc_trackball_w),state));
613620   machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write                  ( 0x1f6800e0, 0x1f6800e3);
614   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f380000, 0x1f3fffff, FUNC(btcflash_r), FUNC(btcflash_w) );
621   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),state), write32_delegate(FUNC(konamigv_state::btcflash_w),state) );
615622
616623   DRIVER_INIT_CALL(konamigv);
617624}
r14896r14897
638645
639646/* Tokimeki Memorial games - have a mouse and printer and who knows what else */
640647
641static READ32_HANDLER( tokimeki_serial_r )
648READ32_MEMBER(konamigv_state::tokimeki_serial_r)
642649{
643650   // bits checked: 0x80 and 0x20 for periodic status (800b6968 and 800b69e0 in tokimosh)
644651   // 0x08 for reading the serial device (8005e624)
r14896r14897
646653   return 0xffffffff;
647654}
648655
649static WRITE32_HANDLER( tokimeki_serial_w )
656WRITE32_MEMBER(konamigv_state::tokimeki_serial_w)
650657{
651658   /*
652659        serial EEPROM-like device here: when mem_mask == 0x000000ff only,
r14896r14897
664671
665672static DRIVER_INIT( tokimosh )
666673{
667   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler ( 0x1f680080, 0x1f680083, FUNC(tokimeki_serial_r) );
668   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1f680090, 0x1f680093, FUNC(tokimeki_serial_w) );
674   konamigv_state *state = machine.driver_data<konamigv_state>();
675   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1f680080, 0x1f680083, read32_delegate(FUNC(konamigv_state::tokimeki_serial_r),state));
676   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1f680090, 0x1f680093, write32_delegate(FUNC(konamigv_state::tokimeki_serial_w),state));
669677
670678   DRIVER_INIT_CALL(konamigv);
671679}
r14896r14897
680688    A01
681689*/
682690
683static WRITE32_HANDLER( kdeadeye_0_w )
691WRITE32_MEMBER(konamigv_state::kdeadeye_0_w)
684692{
685693}
686694
r14896r14897
695703   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_port  ( 0x1f6800a0, 0x1f6800a3, "GUNX2" );
696704   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_port  ( 0x1f6800b0, 0x1f6800b3, "GUNY2" );
697705   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_port  ( 0x1f6800c0, 0x1f6800c3, "BUTTONS" );
698   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler    ( 0x1f6800e0, 0x1f6800e3, FUNC(kdeadeye_0_w) );
699   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f380000, 0x1f3fffff, FUNC(btcflash_r), FUNC(btcflash_w) );
706   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1f6800e0, 0x1f6800e3, write32_delegate(FUNC(konamigv_state::kdeadeye_0_w),state) );
707   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),state), write32_delegate(FUNC(konamigv_state::btcflash_w),state));
700708
701709   DRIVER_INIT_CALL(konamigv);
702710}
src/mame/drivers/firetrap.c
r14896r14897
303303
304304WRITE8_MEMBER(firetrap_state::firetrap_sound_command_w)
305305{
306   soundlatch_w(space, offset, data);
306   soundlatch_byte_w(space, offset, data);
307307   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
308308}
309309
r14896r14897
337337
338338WRITE8_MEMBER(firetrap_state::flip_screen_w)
339339{
340   flip_screen_set(machine(), data);
340   flip_screen_set(data);
341341}
342342
343343
r14896r14897
400400   AM_RANGE(0x2000, 0x2000) AM_WRITE(firetrap_adpcm_data_w)   /* ADPCM data for the MSM5205 chip */
401401   AM_RANGE(0x2400, 0x2400) AM_WRITE(firetrap_sound_2400_w)
402402   AM_RANGE(0x2800, 0x2800) AM_WRITE(firetrap_sound_bankselect_w)
403   AM_RANGE(0x3400, 0x3400) AM_READ(soundlatch_r)
403   AM_RANGE(0x3400, 0x3400) AM_READ(soundlatch_byte_r)
404404   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2")
405405   AM_RANGE(0x8000, 0xffff) AM_ROM
406406ADDRESS_MAP_END
src/mame/drivers/thedeep.c
r14896r14897
4545
4646WRITE8_MEMBER(thedeep_state::thedeep_sound_w)
4747{
48   soundlatch_w(space, 0, data);
48   soundlatch_byte_w(space, 0, data);
4949   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
5050}
5151
r14896r14897
7070   switch (m_protection_command)
7171   {
7272      case 0x11:
73         flip_screen_set(machine(), 1);
73         flip_screen_set(1);
7474      break;
7575
7676      case 0x20:
77         flip_screen_set(machine(), 0);
77         flip_screen_set(0);
7878      break;
7979
8080      case 0x30:
r14896r14897
177177static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, thedeep_state )
178178   AM_RANGE(0x0000, 0x07ff) AM_RAM
179179   AM_RANGE(0x0800, 0x0801) AM_DEVWRITE_LEGACY("ymsnd", ym2203_w)   //
180   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)   // From Main CPU
180   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)   // From Main CPU
181181   AM_RANGE(0x8000, 0xffff) AM_ROM
182182ADDRESS_MAP_END
183183
r14896r14897
207207
208208WRITE8_MEMBER(thedeep_state::thedeep_p1_w)
209209{
210   flip_screen_set(machine(), (data & 1) ^ 1);
210   flip_screen_set((data & 1) ^ 1);
211211   thedeep_maincpu_bankswitch(machine(),(data & 6) >> 1);
212212   logerror("P1 %02x\n",data);
213213}
src/mame/drivers/oneshot.c
r14896r14897
103103static ADDRESS_MAP_START( oneshot_map, AS_PROGRAM, 16, oneshot_state )
104104   AM_RANGE(0x000000, 0x03ffff) AM_ROM
105105   AM_RANGE(0x080000, 0x087fff) AM_RAM
106   AM_RANGE(0x0c0000, 0x0c07ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
106   AM_RANGE(0x0c0000, 0x0c07ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
107107   AM_RANGE(0x120000, 0x120fff) AM_RAM AM_BASE(m_sprites)
108108   AM_RANGE(0x180000, 0x180fff) AM_RAM_WRITE(oneshot_mid_videoram_w) AM_BASE(m_mid_videoram) // some people , girl etc.
109109   AM_RANGE(0x181000, 0x181fff) AM_RAM_WRITE(oneshot_fg_videoram_w) AM_BASE(m_fg_videoram) // credits etc.
r14896r14897
125125
126126static ADDRESS_MAP_START( oneshot_sound_map, AS_PROGRAM, 8, oneshot_state )
127127   AM_RANGE(0x0000, 0x7fff) AM_ROM
128   AM_RANGE(0x8000, 0x8000) AM_READWRITE(soundlatch_r,soundlatch_w)
128   AM_RANGE(0x8000, 0x8000) AM_READWRITE(soundlatch_byte_r,soundlatch_byte_w)
129129   AM_RANGE(0x8001, 0x87ff) AM_RAM
130130   AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r,ym3812_w)
131131   AM_RANGE(0xe010, 0xe010) AM_DEVREADWRITE("oki", okim6295_device, read, write)
src/mame/drivers/stlforce.c
r14896r14897
101101   AM_RANGE(0x103400, 0x1037ff) AM_RAM AM_BASE(m_mlow_scrollram)
102102   AM_RANGE(0x103800, 0x103bff) AM_RAM AM_BASE(m_mhigh_scrollram)
103103   AM_RANGE(0x103c00, 0x103fff) AM_RAM AM_BASE(m_vidattrram)
104   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
104   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
105105   AM_RANGE(0x105000, 0x107fff) AM_RAM /* unknown / ram */
106106   AM_RANGE(0x108000, 0x108fff) AM_RAM AM_BASE(m_spriteram)
107107   AM_RANGE(0x109000, 0x11ffff) AM_RAM
src/mame/drivers/zr107.c
r14896r14897
181181{
182182public:
183183   zr107_state(const machine_config &mconfig, device_type type, const char *tag)
184      : driver_device(mconfig, type, tag) { }
184      : driver_device(mconfig, type, tag) ,
185      m_workram(*this, "workram"){ }
185186
186187   UINT8 m_led_reg0;
187188   UINT8 m_led_reg1;
188189   int m_ccu_vcth;
189190   int m_ccu_vctl;
190   UINT32 *m_workram;
191   required_shared_ptr<UINT32> m_workram;
191192   UINT32 *m_sharc_dataram;
192193   DECLARE_WRITE32_MEMBER(paletteram32_w);
193194   DECLARE_READ8_MEMBER(sysreg_r);
r14896r14897
404405   ppcdrc_set_options(machine.device("maincpu"), PPCDRC_COMPATIBLE_OPTIONS);
405406
406407   /* configure fast RAM regions for DRC */
407   ppcdrc_add_fastram(machine.device("maincpu"), 0x00000000, 0x000fffff, FALSE, state->m_workram);
408   ppcdrc_add_fastram(machine.device("maincpu"), 0x00000000, 0x000fffff, FALSE, state->m_workram.target());
408409}
409410
410411static ADDRESS_MAP_START( zr107_map, AS_PROGRAM, 32, zr107_state )
411   AM_RANGE(0x00000000, 0x000fffff) AM_RAM   AM_BASE(m_workram)   /* Work RAM */
412   AM_RANGE(0x00000000, 0x000fffff) AM_RAM   AM_SHARE("workram")   /* Work RAM */
412413   AM_RANGE(0x74000000, 0x74003fff) AM_DEVREADWRITE_LEGACY("k056832", k056832_ram_long_r, k056832_ram_long_w)
413414   AM_RANGE(0x74020000, 0x7402003f) AM_DEVREADWRITE_LEGACY("k056832", k056832_long_r, k056832_long_w)
414415   AM_RANGE(0x74060000, 0x7406003f) AM_READWRITE(ccu_r, ccu_w)
src/mame/drivers/dominob.c
r14896r14897
6868{
6969public:
7070   dominob_state(const machine_config &mconfig, device_type type, const char *tag)
71      : driver_device(mconfig, type, tag) { }
71      : driver_device(mconfig, type, tag) ,
72      m_videoram(*this, "videoram"),
73      m_spriteram(*this, "spriteram"),
74      m_bgram(*this, "bgram"){ }
7275
7376   /* memory pointers */
74   UINT8 *  m_spriteram;
75   UINT8 *  m_videoram;
76   UINT8 *  m_bgram;
77   required_shared_ptr<UINT8> m_videoram;
78   required_shared_ptr<UINT8> m_spriteram;
79   required_shared_ptr<UINT8> m_bgram;
7780//  UINT8 *  m_paletteram;    // currently this uses generic palette handling
78   size_t   m_spriteram_size;
7981
8082   /* input-related */
8183   //UINT8 m_paddle_select;
r14896r14897
9496   dominob_state *state = machine.driver_data<dominob_state>();
9597   int offs;
9698
97   for (offs = 0; offs < state->m_spriteram_size; offs += 4)
99   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
98100   {
99101      int sx, sy, code;
100102
101      sx = state->m_spriteram[offs];
102      sy = 248 - state->m_spriteram[offs + 1];
103      if (flip_screen_x_get(machine)) sx = 248 - sx;
104      if (flip_screen_y_get(machine)) sy = 248 - sy;
103      sx = state->m_spriteram.target()[offs];
104      sy = 248 - state->m_spriteram.target()[offs + 1];
105      if (state->flip_screen_x()) sx = 248 - sx;
106      if (state->flip_screen_y()) sy = 248 - sy;
105107
106      code = state->m_spriteram[offs + 3] + ((state->m_spriteram[offs + 2] & 0x03) << 8)  ;
108      code = state->m_spriteram.target()[offs + 3] + ((state->m_spriteram.target()[offs + 2] & 0x03) << 8)  ;
107109
108110      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
109111            2 * code,
110            ((state->m_spriteram[offs + 2] & 0xf8) >> 3)  ,
111            flip_screen_x_get(machine),flip_screen_y_get(machine),
112            sx,sy + (flip_screen_y_get(machine) ? 8 : -8),0);
112            ((state->m_spriteram.target()[offs + 2] & 0xf8) >> 3)  ,
113            state->flip_screen_x(),state->flip_screen_y(),
114            sx,sy + (state->flip_screen_y() ? 8 : -8),0);
113115      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
114116            2 * code + 1,
115            ((state->m_spriteram[offs + 2] & 0xf8) >> 3)  ,
116            flip_screen_x_get(machine),flip_screen_y_get(machine),
117            ((state->m_spriteram.target()[offs + 2] & 0xf8) >> 3)  ,
118            state->flip_screen_x(),state->flip_screen_y(),
117119            sx,sy,0);
118120   }
119121}
r14896r14897
133135         drawgfx_opaque(bitmap,
134136               cliprect,
135137               screen.machine().gfx[1],
136               state->m_bgram[index] + 256 * (state->m_bgram[index + 1] & 0xf),
137               state->m_bgram[index + 1] >> 4,
138               state->m_bgram.target()[index] + 256 * (state->m_bgram.target()[index + 1] & 0xf),
139               state->m_bgram.target()[index + 1] >> 4,
138140               0, 0,
139141               x * 32, y * 32);
140142         index += 2;
r14896r14897
148150         drawgfx_transpen(   bitmap,
149151               cliprect,
150152               screen.machine().gfx[0],
151               state->m_videoram[(y * 32 + x) * 2 + 1] + (state->m_videoram[(y * 32 + x) * 2] & 7) * 256,
152               (state->m_videoram[(y * 32 + x) * 2] >> 3),
153               state->m_videoram.target()[(y * 32 + x) * 2 + 1] + (state->m_videoram.target()[(y * 32 + x) * 2] & 7) * 256,
154               (state->m_videoram.target()[(y * 32 + x) * 2] >> 3),
153155               0, 0,
154156               x * 8, y * 8,0);
155157      }
r14896r14897
177179   AM_RANGE(0xd010, 0xd010) AM_READ_PORT("IN1") AM_WRITENOP
178180   AM_RANGE(0xd018, 0xd018) AM_READ_PORT("IN2") AM_WRITENOP
179181
180   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE(m_videoram)
181   AM_RANGE(0xe800, 0xe83f) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
182   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("videoram")
183   AM_RANGE(0xe800, 0xe83f) AM_RAM AM_SHARE("spriteram")
182184   AM_RANGE(0xe840, 0xefff) AM_RAM
183   AM_RANGE(0xf000, 0xf07f) AM_RAM AM_BASE(m_bgram)
185   AM_RANGE(0xf000, 0xf07f) AM_RAM AM_SHARE("bgram")
184186   AM_RANGE(0xf080, 0xf7ff) AM_RAM
185   AM_RANGE(0xf800, 0xfbff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_le_w) AM_SHARE("paletteram")
187   AM_RANGE(0xf800, 0xfbff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_le_w) AM_SHARE("paletteram")
186188   AM_RANGE(0xfc00, 0xffff) AM_RAM
187189ADDRESS_MAP_END
188190
src/mame/drivers/ksys573.c
r14896r14897
468468   DECLARE_CUSTOM_INPUT_MEMBER(gn845pwbb_read);
469469   DECLARE_CUSTOM_INPUT_MEMBER(gunmania_tank_shutter_sensor);
470470   DECLARE_CUSTOM_INPUT_MEMBER(gunmania_cable_holder_sensor);
471   DECLARE_WRITE32_MEMBER(mb89371_w);
472   DECLARE_READ32_MEMBER(mb89371_r);
473   DECLARE_READ32_MEMBER(jamma_r);
474   DECLARE_READ32_MEMBER(control_r);
475   DECLARE_WRITE32_MEMBER(control_w);
476   DECLARE_READ32_MEMBER(atapi_r);
477   DECLARE_WRITE32_MEMBER(atapi_w);
478   DECLARE_WRITE32_MEMBER(atapi_reset_w);
479   DECLARE_WRITE32_MEMBER(security_w);
480   DECLARE_READ32_MEMBER(security_r);
481   DECLARE_READ32_MEMBER(flash_r);
482   DECLARE_WRITE32_MEMBER(flash_w);
483   DECLARE_READ32_MEMBER(ge765pwbba_r);
484   DECLARE_WRITE32_MEMBER(ge765pwbba_w);
485   DECLARE_READ32_MEMBER(gx700pwbf_io_r);
486   DECLARE_WRITE32_MEMBER(gx700pwbf_io_w);
487   DECLARE_READ32_MEMBER(gtrfrks_io_r);
488   DECLARE_WRITE32_MEMBER(gtrfrks_io_w);
489   DECLARE_READ32_MEMBER(gx894pwbba_r);
490   DECLARE_WRITE32_MEMBER(gx894pwbba_w);
491   DECLARE_WRITE32_MEMBER(dmx_io_w);
492   DECLARE_WRITE32_MEMBER(mamboagg_io_w);
493   DECLARE_WRITE32_MEMBER(gunmania_w);
494   DECLARE_READ32_MEMBER(gunmania_r);
471495};
472496
473497INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
r14896r14897
485509
486510static const char *const diskregions[] = { ":cdrom0", ":cdrom1" };
487511
488static WRITE32_HANDLER( mb89371_w )
512WRITE32_MEMBER(ksys573_state::mb89371_w)
489513{
490   verboselog( space->machine(), 2, "mb89371_w %08x %08x %08x\n", offset, mem_mask, data );
514   verboselog( machine(), 2, "mb89371_w %08x %08x %08x\n", offset, mem_mask, data );
491515}
492516
493static READ32_HANDLER( mb89371_r )
517READ32_MEMBER(ksys573_state::mb89371_r)
494518{
495519   UINT32 data = 0xffffffff;
496   verboselog( space->machine(), 2, "mb89371_r %08x %08x %08x\n", offset, mem_mask, data );
520   verboselog( machine(), 2, "mb89371_r %08x %08x %08x\n", offset, mem_mask, data );
497521   return data;
498522}
499523
500static READ32_HANDLER( jamma_r )
524READ32_MEMBER(ksys573_state::jamma_r)
501525{
502   ksys573_state *state = space->machine().driver_data<ksys573_state>();
503   running_machine &machine = space->machine();
504   int security_cart_number = state->m_security_cart_number;
505   UINT32 data = input_port_read(machine, "IN1");
526   int security_cart_number = m_security_cart_number;
527   UINT32 data = input_port_read(machine(), "IN1");
506528   data |= 0x000000c0;
507529
508   ds2401_device *ds2401 = space->machine().device<ds2401_device>(security_cart_number ? "game_id" : "install_id");
509   device_secure_serial_flash *secflash = space->machine().device<device_secure_serial_flash>(security_cart_number ? "game_eeprom" : "install_eeprom");
530   ds2401_device *ds2401 = machine().device<ds2401_device>(security_cart_number ? "game_id" : "install_id");
531   device_secure_serial_flash *secflash = machine().device<device_secure_serial_flash>(security_cart_number ? "game_eeprom" : "install_eeprom");
510532
511533   if( ds2401 )
512534   {
r14896r14897
516538   if( secflash )
517539      data |= secflash->sda_r() << 18;
518540
519   if( state->m_flash_device[1][0] == NULL )
541   if( m_flash_device[1][0] == NULL )
520542   {
521543      data |= ( 1 << 26 );
522544   }
523   if( state->m_flash_device[2][0] == NULL )
545   if( m_flash_device[2][0] == NULL )
524546   {
525547      data |= ( 1 << 27 );
526548   }
527549
528   verboselog( machine, 2, "jamma_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
550   verboselog( machine(), 2, "jamma_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
529551
530552   return data;
531553}
532554
533static READ32_HANDLER( control_r )
555READ32_MEMBER(ksys573_state::control_r)
534556{
535   ksys573_state *state = space->machine().driver_data<ksys573_state>();
536557
537   verboselog( space->machine(), 2, "control_r( %08x, %08x ) %08x\n", offset, mem_mask, state->m_control );
558   verboselog( machine(), 2, "control_r( %08x, %08x ) %08x\n", offset, mem_mask, m_control );
538559
539   return state->m_control;
560   return m_control;
540561}
541562
542static WRITE32_HANDLER( control_w )
563WRITE32_MEMBER(ksys573_state::control_w)
543564{
544   ksys573_state *state = space->machine().driver_data<ksys573_state>();
545565   UINT32 control;
546   int old_bank = state->m_flash_bank;
566   int old_bank = m_flash_bank;
547567
548   COMBINE_DATA(&state->m_control);
549   control = state->m_control;
568   COMBINE_DATA(&m_control);
569   control = m_control;
550570
551   verboselog( space->machine(), 2, "control_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
571   verboselog( machine(), 2, "control_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
552572
553   state->m_flash_bank = -1;
573   m_flash_bank = -1;
554574
555575   // zs01 only, others are reached through security_w
556   device_secure_serial_flash *secflash = space->machine().device<device_secure_serial_flash>(state->m_security_cart_number ? "game_eeprom" : "install_eeprom");
576   device_secure_serial_flash *secflash = machine().device<device_secure_serial_flash>(m_security_cart_number ? "game_eeprom" : "install_eeprom");
557577   if( dynamic_cast<zs01_device *>(secflash) )
558578      secflash->sda_w( !( ( control >> 6 ) & 1 ) ); /* 0x40 */
559579
560   if( state->m_flash_device[0][0] != NULL && ( control & ~0x43 ) == 0x00 )
580   if( m_flash_device[0][0] != NULL && ( control & ~0x43 ) == 0x00 )
561581   {
562      state->m_flash_bank = (0 << 8) + ( ( control & 3 ) * 2 );
563      if( state->m_flash_bank != old_bank ) verboselog( space->machine(), 1, "onboard %d\n", control & 3 );
582      m_flash_bank = (0 << 8) + ( ( control & 3 ) * 2 );
583      if( m_flash_bank != old_bank ) verboselog( machine(), 1, "onboard %d\n", control & 3 );
564584   }
565   else if( state->m_flash_device[1][0] != NULL && ( control & ~0x47 ) == 0x10 )
585   else if( m_flash_device[1][0] != NULL && ( control & ~0x47 ) == 0x10 )
566586   {
567      state->m_flash_bank = (1 << 8) + ( ( control & 7 ) * 2 );
568      if( state->m_flash_bank != old_bank ) verboselog( space->machine(), 1, "pccard1 %d\n", control & 7 );
587      m_flash_bank = (1 << 8) + ( ( control & 7 ) * 2 );
588      if( m_flash_bank != old_bank ) verboselog( machine(), 1, "pccard1 %d\n", control & 7 );
569589   }
570   else if( state->m_flash_device[2][0] != NULL && ( control & ~0x47 ) == 0x20 )
590   else if( m_flash_device[2][0] != NULL && ( control & ~0x47 ) == 0x20 )
571591   {
572      state->m_flash_bank = (2 << 8) + ( ( control & 7 ) * 2 );
573      if( state->m_flash_bank != old_bank ) verboselog( space->machine(), 1, "pccard2 %d\n", control & 7 );
592      m_flash_bank = (2 << 8) + ( ( control & 7 ) * 2 );
593      if( m_flash_bank != old_bank ) verboselog( machine(), 1, "pccard2 %d\n", control & 7 );
574594   }
575   else if( state->m_flash_device[3][0] != NULL && ( control & ~0x47 ) == 0x20 )
595   else if( m_flash_device[3][0] != NULL && ( control & ~0x47 ) == 0x20 )
576596   {
577      state->m_flash_bank = (3 << 8) + ( ( control & 7 ) * 2 );
578      if( state->m_flash_bank != old_bank ) verboselog( space->machine(), 1, "pccard3 %d\n", control & 7 );
597      m_flash_bank = (3 << 8) + ( ( control & 7 ) * 2 );
598      if( m_flash_bank != old_bank ) verboselog( machine(), 1, "pccard3 %d\n", control & 7 );
579599   }
580   else if( state->m_flash_device[4][0] != NULL && ( control & ~0x47 ) == 0x28 )
600   else if( m_flash_device[4][0] != NULL && ( control & ~0x47 ) == 0x28 )
581601   {
582      state->m_flash_bank = (4 << 8) + ( ( control & 7 ) * 2 );
583      if( state->m_flash_bank != old_bank ) verboselog( space->machine(), 1, "pccard4 %d\n", control & 7 );
602      m_flash_bank = (4 << 8) + ( ( control & 7 ) * 2 );
603      if( m_flash_bank != old_bank ) verboselog( machine(), 1, "pccard4 %d\n", control & 7 );
584604   }
585605}
586606
r14896r14897
652672   verboselog( machine, 2, "atapi_xfer_end: %d %d\n", state->m_atapi_xferlen, state->m_atapi_xfermod );
653673}
654674
655static READ32_HANDLER( atapi_r )
675READ32_MEMBER(ksys573_state::atapi_r)
656676{
657   ksys573_state *state = space->machine().driver_data<ksys573_state>();
658   UINT8 *atapi_regs = state->m_atapi_regs;
659   running_machine &machine = space->machine();
677   UINT8 *atapi_regs = m_atapi_regs;
660678   int reg, data;
661679
662680   if (mem_mask == 0x0000ffff)   // word-wide command read
r14896r14897
664682//      mame_printf_debug("ATAPI: packet read = %04x\n", atapi_data[atapi_data_ptr]);
665683
666684      // assert IRQ and drop DRQ
667      if (state->m_atapi_data_ptr == 0 && state->m_atapi_data_len == 0)
685      if (m_atapi_data_ptr == 0 && m_atapi_data_len == 0)
668686      {
669687         // get the data from the device
670         if( state->m_atapi_xferlen > 0 )
688         if( m_atapi_xferlen > 0 )
671689         {
672            SCSIReadData( state->m_inserted_cdrom, state->m_atapi_data, state->m_atapi_xferlen );
673            state->m_atapi_data_len = state->m_atapi_xferlen;
690            SCSIReadData( m_inserted_cdrom, m_atapi_data, m_atapi_xferlen );
691            m_atapi_data_len = m_atapi_xferlen;
674692         }
675693
676         if (state->m_atapi_xfermod > MAX_TRANSFER_SIZE)
694         if (m_atapi_xfermod > MAX_TRANSFER_SIZE)
677695         {
678            state->m_atapi_xferlen = MAX_TRANSFER_SIZE;
679            state->m_atapi_xfermod = state->m_atapi_xfermod - MAX_TRANSFER_SIZE;
696            m_atapi_xferlen = MAX_TRANSFER_SIZE;
697            m_atapi_xfermod = m_atapi_xfermod - MAX_TRANSFER_SIZE;
680698         }
681699         else
682700         {
683            state->m_atapi_xferlen = state->m_atapi_xfermod;
684            state->m_atapi_xfermod = 0;
701            m_atapi_xferlen = m_atapi_xfermod;
702            m_atapi_xfermod = 0;
685703         }
686704
687         verboselog( machine, 2, "atapi_r: atapi_xferlen=%d\n", state->m_atapi_xferlen );
688         if( state->m_atapi_xferlen != 0 )
705         verboselog( machine(), 2, "atapi_r: atapi_xferlen=%d\n", m_atapi_xferlen );
706         if( m_atapi_xferlen != 0 )
689707         {
690708            atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_DRQ | ATAPI_STAT_SERVDSC;
691709            atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;
r14896r14897
697715            atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;
698716         }
699717
700         atapi_regs[ATAPI_REG_COUNTLOW] = state->m_atapi_xferlen & 0xff;
701         atapi_regs[ATAPI_REG_COUNTHIGH] = (state->m_atapi_xferlen>>8)&0xff;
718         atapi_regs[ATAPI_REG_COUNTLOW] = m_atapi_xferlen & 0xff;
719         atapi_regs[ATAPI_REG_COUNTHIGH] = (m_atapi_xferlen>>8)&0xff;
702720
703         psx_irq_set(space->machine(), 0x400);
721         psx_irq_set(machine(), 0x400);
704722      }
705723
706      if( state->m_atapi_data_ptr < state->m_atapi_data_len )
724      if( m_atapi_data_ptr < m_atapi_data_len )
707725      {
708         data = state->m_atapi_data[state->m_atapi_data_ptr++];
709         data |= ( state->m_atapi_data[state->m_atapi_data_ptr++] << 8 );
710         if( state->m_atapi_data_ptr >= state->m_atapi_data_len )
726         data = m_atapi_data[m_atapi_data_ptr++];
727         data |= ( m_atapi_data[m_atapi_data_ptr++] << 8 );
728         if( m_atapi_data_ptr >= m_atapi_data_len )
711729         {
712//              verboselog( machine, 2, "atapi_r: read all bytes\n" );
713            state->m_atapi_data_ptr = 0;
714            state->m_atapi_data_len = 0;
730//              verboselog( machine(), 2, "atapi_r: read all bytes\n" );
731            m_atapi_data_ptr = 0;
732            m_atapi_data_len = 0;
715733
716            if( state->m_atapi_xferlen == 0 )
734            if( m_atapi_xferlen == 0 )
717735            {
718736               atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
719737               atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;
720               psx_irq_set(space->machine(), 0x400);
738               psx_irq_set(machine(), 0x400);
721739            }
722740         }
723741      }
r14896r14897
742760      switch( reg )
743761      {
744762      case ATAPI_REG_DATA:
745         verboselog( machine, 1, "atapi_r: data=%02x\n", data );
763         verboselog( machine(), 1, "atapi_r: data=%02x\n", data );
746764         break;
747765      case ATAPI_REG_ERRFEAT:
748         verboselog( machine, 1, "atapi_r: errfeat=%02x\n", data );
766         verboselog( machine(), 1, "atapi_r: errfeat=%02x\n", data );
749767         break;
750768      case ATAPI_REG_INTREASON:
751         verboselog( machine, 1, "atapi_r: intreason=%02x\n", data );
769         verboselog( machine(), 1, "atapi_r: intreason=%02x\n", data );
752770         break;
753771      case ATAPI_REG_SAMTAG:
754         verboselog( machine, 1, "atapi_r: samtag=%02x\n", data );
772         verboselog( machine(), 1, "atapi_r: samtag=%02x\n", data );
755773         break;
756774      case ATAPI_REG_COUNTLOW:
757         verboselog( machine, 1, "atapi_r: countlow=%02x\n", data );
775         verboselog( machine(), 1, "atapi_r: countlow=%02x\n", data );
758776         break;
759777      case ATAPI_REG_COUNTHIGH:
760         verboselog( machine, 1, "atapi_r: counthigh=%02x\n", data );
778         verboselog( machine(), 1, "atapi_r: counthigh=%02x\n", data );
761779         break;
762780      case ATAPI_REG_DRIVESEL:
763         verboselog( machine, 1, "atapi_r: drivesel=%02x\n", data );
781         verboselog( machine(), 1, "atapi_r: drivesel=%02x\n", data );
764782         break;
765783      case ATAPI_REG_CMDSTATUS:
766         verboselog( machine, 1, "atapi_r: cmdstatus=%02x\n", data );
784         verboselog( machine(), 1, "atapi_r: cmdstatus=%02x\n", data );
767785         break;
768786      }
769787
770//      mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, cpu_get_pc(&space->device()));
788//      mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, cpu_get_pc(&space.device()));
771789
772790      data <<= shift;
773791   }
774792
775   verboselog( machine, 2, "atapi_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
793   verboselog( machine(), 2, "atapi_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
776794   return data;
777795}
778796
779static WRITE32_HANDLER( atapi_w )
797WRITE32_MEMBER(ksys573_state::atapi_w)
780798{
781   ksys573_state *state = space->machine().driver_data<ksys573_state>();
782   UINT8 *atapi_regs = state->m_atapi_regs;
783   UINT8 *atapi_data = state->m_atapi_data;
784   running_machine &machine = space->machine();
799   UINT8 *atapi_regs = m_atapi_regs;
800   UINT8 *atapi_data = m_atapi_data;
785801   int reg;
786802
787   verboselog( machine, 2, "atapi_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
803   verboselog( machine(), 2, "atapi_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
788804
789805   if (mem_mask == 0x0000ffff)   // word-wide command write
790806   {
791      verboselog( machine, 2, "atapi_w: data=%04x\n", data );
807      verboselog( machine(), 2, "atapi_w: data=%04x\n", data );
792808
793809//      mame_printf_debug("ATAPI: packet write %04x\n", data);
794      atapi_data[state->m_atapi_data_ptr++] = data & 0xff;
795      atapi_data[state->m_atapi_data_ptr++] = data >> 8;
810      atapi_data[m_atapi_data_ptr++] = data & 0xff;
811      atapi_data[m_atapi_data_ptr++] = data >> 8;
796812
797      if (state->m_atapi_cdata_wait)
813      if (m_atapi_cdata_wait)
798814      {
799//          mame_printf_debug("ATAPI: waiting, ptr %d wait %d\n", state->m_atapi_data_ptr, state->m_atapi_cdata_wait);
800         if (state->m_atapi_data_ptr == state->m_atapi_cdata_wait)
815//          mame_printf_debug("ATAPI: waiting, ptr %d wait %d\n", m_atapi_data_ptr, m_atapi_cdata_wait);
816         if (m_atapi_data_ptr == m_atapi_cdata_wait)
801817         {
802818            // send it to the device
803            SCSIWriteData( state->m_inserted_cdrom, atapi_data, state->m_atapi_cdata_wait );
819            SCSIWriteData( m_inserted_cdrom, atapi_data, m_atapi_cdata_wait );
804820
805821            // assert IRQ
806            psx_irq_set(space->machine(), 0x400);
822            psx_irq_set(machine(), 0x400);
807823
808824            // not sure here, but clear DRQ at least?
809825            atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
810826         }
811827      }
812828
813      else if ( state->m_atapi_data_ptr == 12 )
829      else if ( m_atapi_data_ptr == 12 )
814830      {
815831         int phase;
816832
817         verboselog( machine, 2, "atapi_w: command %02x\n", atapi_data[0]&0xff );
833         verboselog( machine(), 2, "atapi_w: command %02x\n", atapi_data[0]&0xff );
818834
819835         // reset data pointer for reading SCSI results
820         state->m_atapi_data_ptr = 0;
821         state->m_atapi_data_len = 0;
836         m_atapi_data_ptr = 0;
837         m_atapi_data_len = 0;
822838
823839         // send it to the SCSI device
824         SCSISetCommand( state->m_inserted_cdrom, state->m_atapi_data, 12 );
825         SCSIExecCommand( state->m_inserted_cdrom, &state->m_atapi_xferlen );
826         SCSIGetPhase( state->m_inserted_cdrom, &phase );
840         SCSISetCommand( m_inserted_cdrom, m_atapi_data, 12 );
841         SCSIExecCommand( m_inserted_cdrom, &m_atapi_xferlen );
842         SCSIGetPhase( m_inserted_cdrom, &phase );
827843
828         if (state->m_atapi_xferlen != -1)
844         if (m_atapi_xferlen != -1)
829845         {
830//              mame_printf_debug("ATAPI: SCSI command %02x returned %d bytes from the device\n", atapi_data[0]&0xff, state->m_atapi_xferlen);
846//              mame_printf_debug("ATAPI: SCSI command %02x returned %d bytes from the device\n", atapi_data[0]&0xff, m_atapi_xferlen);
831847
832848            // store the returned command length in the ATAPI regs, splitting into
833849            // multiple transfers if necessary
834            state->m_atapi_xfermod = 0;
835            if (state->m_atapi_xferlen > MAX_TRANSFER_SIZE)
850            m_atapi_xfermod = 0;
851            if (m_atapi_xferlen > MAX_TRANSFER_SIZE)
836852            {
837               state->m_atapi_xfermod = state->m_atapi_xferlen - MAX_TRANSFER_SIZE;
838               state->m_atapi_xferlen = MAX_TRANSFER_SIZE;
853               m_atapi_xfermod = m_atapi_xferlen - MAX_TRANSFER_SIZE;
854               m_atapi_xferlen = MAX_TRANSFER_SIZE;
839855            }
840856
841            atapi_regs[ATAPI_REG_COUNTLOW] = state->m_atapi_xferlen & 0xff;
842            atapi_regs[ATAPI_REG_COUNTHIGH] = (state->m_atapi_xferlen>>8)&0xff;
857            atapi_regs[ATAPI_REG_COUNTLOW] = m_atapi_xferlen & 0xff;
858            atapi_regs[ATAPI_REG_COUNTHIGH] = (m_atapi_xferlen>>8)&0xff;
843859
844            if (state->m_atapi_xferlen == 0)
860            if (m_atapi_xferlen == 0)
845861            {
846862               // if no data to return, set the registers properly
847863               atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_DRDY;
r14896r14897
857873            switch( phase )
858874            {
859875            case SCSI_PHASE_DATAOUT:
860               state->m_atapi_cdata_wait = state->m_atapi_xferlen;
876               m_atapi_cdata_wait = m_atapi_xferlen;
861877               break;
862878            }
863879
r14896r14897
871887
872888               case 0x45: // PLAY
873889                  atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_BSY;
874                  state->m_atapi_timer->adjust( downcast<cpu_device *>(&space->device())->cycles_to_attotime( ATAPI_CYCLES_PER_SECTOR ) );
890                  m_atapi_timer->adjust( downcast<cpu_device *>(&space.device())->cycles_to_attotime( ATAPI_CYCLES_PER_SECTOR ) );
875891                  break;
876892            }
877893
878894            // assert IRQ
879            psx_irq_set(space->machine(), 0x400);
895            psx_irq_set(machine(), 0x400);
880896         }
881897         else
882898         {
r14896r14897
901917      switch( reg )
902918      {
903919      case ATAPI_REG_DATA:
904         verboselog( machine, 1, "atapi_w: data=%02x\n", data );
920         verboselog( machine(), 1, "atapi_w: data=%02x\n", data );
905921         break;
906922      case ATAPI_REG_ERRFEAT:
907         verboselog( machine, 1, "atapi_w: errfeat=%02x\n", data );
923         verboselog( machine(), 1, "atapi_w: errfeat=%02x\n", data );
908924         break;
909925      case ATAPI_REG_INTREASON:
910         verboselog( machine, 1, "atapi_w: intreason=%02x\n", data );
926         verboselog( machine(), 1, "atapi_w: intreason=%02x\n", data );
911927         break;
912928      case ATAPI_REG_SAMTAG:
913         verboselog( machine, 1, "atapi_w: samtag=%02x\n", data );
929         verboselog( machine(), 1, "atapi_w: samtag=%02x\n", data );
914930         break;
915931      case ATAPI_REG_COUNTLOW:
916         verboselog( machine, 1, "atapi_w: countlow=%02x\n", data );
932         verboselog( machine(), 1, "atapi_w: countlow=%02x\n", data );
917933         break;
918934      case ATAPI_REG_COUNTHIGH:
919         verboselog( machine, 1, "atapi_w: counthigh=%02x\n", data );
935         verboselog( machine(), 1, "atapi_w: counthigh=%02x\n", data );
920936         break;
921937      case ATAPI_REG_DRIVESEL:
922         verboselog( machine, 1, "atapi_w: drivesel=%02x\n", data );
938         verboselog( machine(), 1, "atapi_w: drivesel=%02x\n", data );
923939         break;
924940      case ATAPI_REG_CMDSTATUS:
925         verboselog( machine, 1, "atapi_w: cmdstatus=%02x\n", data );
941         verboselog( machine(), 1, "atapi_w: cmdstatus=%02x\n", data );
926942         break;
927943      }
928944
929945      atapi_regs[reg] = data;
930//      mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, cpu_get_pc(&space->device()));
946//      mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, cpu_get_pc(&space.device()));
931947
932948      if (reg == ATAPI_REG_CMDSTATUS)
933949      {
934//          mame_printf_debug("ATAPI command %x issued! (PC=%x)\n", data, cpu_get_pc(&space->device()));
950//          mame_printf_debug("ATAPI command %x issued! (PC=%x)\n", data, cpu_get_pc(&space.device()));
935951
936952         switch (data)
937953         {
r14896r14897
939955               atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_DRQ;
940956               atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_COMMAND;
941957
942               state->m_atapi_data_ptr = 0;
943               state->m_atapi_data_len = 0;
958               m_atapi_data_ptr = 0;
959               m_atapi_data_len = 0;
944960
945961               /* we have no data */
946               state->m_atapi_xferlen = 0;
947               state->m_atapi_xfermod = 0;
962               m_atapi_xferlen = 0;
963               m_atapi_xfermod = 0;
948964
949               state->m_atapi_cdata_wait = 0;
965               m_atapi_cdata_wait = 0;
950966               break;
951967
952968            case 0xa1:   // IDENTIFY PACKET DEVICE
953969               atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_DRQ;
954970
955               state->m_atapi_data_ptr = 0;
956               state->m_atapi_data_len = 512;
971               m_atapi_data_ptr = 0;
972               m_atapi_data_len = 512;
957973
958974               /* we have no data */
959               state->m_atapi_xferlen = 0;
960               state->m_atapi_xfermod = 0;
975               m_atapi_xferlen = 0;
976               m_atapi_xfermod = 0;
961977
962               memset( atapi_data, 0, state->m_atapi_data_len );
978               memset( atapi_data, 0, m_atapi_data_len );
963979
964980               atapi_data[ 0 ^ 1 ] = 0x85;   // ATAPI device, cmd set 5 compliant, DRQ within 3 ms of PACKET command
965981               atapi_data[ 1 ^ 1 ] = 0x00;
r14896r14897
9931009               atapi_regs[ATAPI_REG_COUNTLOW] = 0;
9941010               atapi_regs[ATAPI_REG_COUNTHIGH] = 2;
9951011
996               psx_irq_set(space->machine(), 0x400);
1012               psx_irq_set(machine(), 0x400);
9971013               break;
9981014
9991015            case 0xef:   // SET FEATURES
10001016               atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
10011017
1002               state->m_atapi_data_ptr = 0;
1003               state->m_atapi_data_len = 0;
1018               m_atapi_data_ptr = 0;
1019               m_atapi_data_len = 0;
10041020
1005               psx_irq_set(space->machine(), 0x400);
1021               psx_irq_set(machine(), 0x400);
10061022               break;
10071023
10081024            default:
r14896r14897
10681084   state->save_item( NAME(state->m_atapi_xfermod) );
10691085}
10701086
1071static WRITE32_HANDLER( atapi_reset_w )
1087WRITE32_MEMBER(ksys573_state::atapi_reset_w)
10721088{
1073   ksys573_state *state = space->machine().driver_data<ksys573_state>();
1074   UINT8 *atapi_regs = state->m_atapi_regs;
1089   UINT8 *atapi_regs = m_atapi_regs;
10751090
1076   verboselog( space->machine(), 2, "atapi_reset_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
1091   verboselog( machine(), 2, "atapi_reset_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
10771092
10781093   if (data)
10791094   {
1080      verboselog( space->machine(), 2, "atapi_reset_w: reset\n" );
1095      verboselog( machine(), 2, "atapi_reset_w: reset\n" );
10811096
10821097//      mame_printf_debug("ATAPI reset\n");
10831098
r14896r14897
10861101      atapi_regs[ATAPI_REG_COUNTLOW] = 0x14;
10871102      atapi_regs[ATAPI_REG_COUNTHIGH] = 0xeb;
10881103
1089      state->m_atapi_data_ptr = 0;
1090      state->m_atapi_data_len = 0;
1091      state->m_atapi_cdata_wait = 0;
1104      m_atapi_data_ptr = 0;
1105      m_atapi_data_len = 0;
1106      m_atapi_cdata_wait = 0;
10921107
1093      state->m_atapi_xferlen = 0;
1094      state->m_atapi_xfermod = 0;
1108      m_atapi_xferlen = 0;
1109      m_atapi_xfermod = 0;
10951110   }
10961111}
10971112
r14896r14897
11141129   state->m_atapi_timer->adjust(state->machine().device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (state->m_atapi_xferlen/2048))));
11151130}
11161131
1117static WRITE32_HANDLER( security_w )
1132WRITE32_MEMBER(ksys573_state::security_w)
11181133{
1119   ksys573_state *state = space->machine().driver_data<ksys573_state>();
1120   int security_cart_number = state->m_security_cart_number;
1121   running_machine &machine = space->machine();
1122   COMBINE_DATA( &state->m_n_security_control );
1134   int security_cart_number = m_security_cart_number;
1135   COMBINE_DATA( &m_n_security_control );
11231136
1124   verboselog( space->machine(), 2, "security_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
1137   verboselog( machine(), 2, "security_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
11251138
11261139   if( ACCESSING_BITS_0_15 )
11271140   {
1128      ds2401_device *ds2401 = space->machine().device<ds2401_device>(security_cart_number ? "game_id" : "install_id");
1129      device_secure_serial_flash *secflash = space->machine().device<device_secure_serial_flash>(security_cart_number ? "game_eeprom" : "install_eeprom");
1141      ds2401_device *ds2401 = machine().device<ds2401_device>(security_cart_number ? "game_id" : "install_id");
1142      device_secure_serial_flash *secflash = machine().device<device_secure_serial_flash>(security_cart_number ? "game_eeprom" : "install_eeprom");
11301143
11311144      if( secflash ) {
11321145         if( !dynamic_cast<zs01_device *>(secflash) )
r14896r14897
11411154         ds2401->write(!( ( data >> 4 ) & 1 ));
11421155      }
11431156
1144      if( state->m_security_callback != NULL )
1157      if( m_security_callback != NULL )
11451158      {
1146         (*state->m_security_callback)( machine, data & 0xff );
1159         (*m_security_callback)( machine(), data & 0xff );
11471160      }
11481161   }
11491162
1150   input_port_write_safe( machine, "OUT1", data, mem_mask );
1163   input_port_write_safe( machine(), "OUT1", data, mem_mask );
11511164}
11521165
1153static READ32_HANDLER( security_r )
1166READ32_MEMBER(ksys573_state::security_r)
11541167{
1155   ksys573_state *state = space->machine().driver_data<ksys573_state>();
11561168
1157   UINT32 data = state->m_n_security_control;
1158   verboselog( space->machine(), 2, "security_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
1169   UINT32 data = m_n_security_control;
1170   verboselog( machine(), 2, "security_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
11591171   return data;
11601172}
11611173
1162static READ32_HANDLER( flash_r )
1174READ32_MEMBER(ksys573_state::flash_r)
11631175{
1164   ksys573_state *state = space->machine().driver_data<ksys573_state>();
11651176   UINT32 data = 0;
11661177
1167   if( state->m_flash_bank < 0 )
1178   if( m_flash_bank < 0 )
11681179   {
1169      mame_printf_debug( "%08x: flash_r( %08x, %08x ) no bank selected %08x\n", cpu_get_pc(&space->device()), offset, mem_mask, state->m_control );
1180      mame_printf_debug( "%08x: flash_r( %08x, %08x ) no bank selected %08x\n", cpu_get_pc(&space.device()), offset, mem_mask, m_control );
11701181      data = 0xffffffff;
11711182   }
11721183   else
11731184   {
1174      fujitsu_29f016a_device **flash_base = &state->m_flash_device[state->m_flash_bank >> 8][state->m_flash_bank & 0xff];
1185      fujitsu_29f016a_device **flash_base = &m_flash_device[m_flash_bank >> 8][m_flash_bank & 0xff];
11751186      int adr = offset * 2;
11761187
11771188      if( ACCESSING_BITS_0_7 )
r14896r14897
11921203      }
11931204   }
11941205
1195   verboselog( space->machine(), 2, "flash_r( %08x, %08x, %08x) bank = %08x\n", offset, mem_mask, data, state->m_flash_bank );
1206   verboselog( machine(), 2, "flash_r( %08x, %08x, %08x) bank = %08x\n", offset, mem_mask, data, m_flash_bank );
11961207
11971208   return data;
11981209}
11991210
1200static WRITE32_HANDLER( flash_w )
1211WRITE32_MEMBER(ksys573_state::flash_w)
12011212{
1202   ksys573_state *state = space->machine().driver_data<ksys573_state>();
12031213
1204   verboselog( space->machine(), 2, "flash_w( %08x, %08x, %08x\n", offset, mem_mask, data );
1214   verboselog( machine(), 2, "flash_w( %08x, %08x, %08x\n", offset, mem_mask, data );
12051215
1206   if( state->m_flash_bank < 0 )
1216   if( m_flash_bank < 0 )
12071217   {
1208      mame_printf_debug( "%08x: flash_w( %08x, %08x, %08x ) no bank selected %08x\n", cpu_get_pc(&space->device()), offset, mem_mask, data, state->m_control );
1218      mame_printf_debug( "%08x: flash_w( %08x, %08x, %08x ) no bank selected %08x\n", cpu_get_pc(&space.device()), offset, mem_mask, data, m_control );
12091219   }
12101220   else
12111221   {
1212      fujitsu_29f016a_device **flash_base = &state->m_flash_device[state->m_flash_bank >> 8][state->m_flash_bank & 0xff];
1222      fujitsu_29f016a_device **flash_base = &m_flash_device[m_flash_bank >> 8][m_flash_bank & 0xff];
12131223      int adr = offset * 2;
12141224
12151225      if( ACCESSING_BITS_0_7 )
r14896r14897
12331243
12341244static ADDRESS_MAP_START( konami573_map, AS_PROGRAM, 32, ksys573_state )
12351245   AM_RANGE(0x00000000, 0x003fffff) AM_RAM   AM_SHARE("share1") /* ram */
1236   AM_RANGE(0x1f000000, 0x1f3fffff) AM_READWRITE_LEGACY(flash_r, flash_w )
1246   AM_RANGE(0x1f000000, 0x1f3fffff) AM_READWRITE(flash_r, flash_w )
12371247   AM_RANGE(0x1f400000, 0x1f400003) AM_READ_PORT( "IN0" ) AM_WRITE_PORT( "OUT0" )
1238   AM_RANGE(0x1f400004, 0x1f400007) AM_READ_LEGACY(jamma_r )
1248   AM_RANGE(0x1f400004, 0x1f400007) AM_READ(jamma_r )
12391249   AM_RANGE(0x1f400008, 0x1f40000b) AM_READ_PORT( "IN2" )
12401250   AM_RANGE(0x1f40000c, 0x1f40000f) AM_READ_PORT( "IN3" )
1241   AM_RANGE(0x1f480000, 0x1f48000f) AM_READWRITE_LEGACY(atapi_r, atapi_w )   // IDE controller, used mostly in ATAPI mode (only 3 pure IDE commands seen so far)
1242   AM_RANGE(0x1f500000, 0x1f500003) AM_READWRITE_LEGACY(control_r, control_w )   // Konami can't make a game without a "control" register.
1243   AM_RANGE(0x1f560000, 0x1f560003) AM_WRITE_LEGACY(atapi_reset_w )
1251   AM_RANGE(0x1f480000, 0x1f48000f) AM_READWRITE(atapi_r, atapi_w )   // IDE controller, used mostly in ATAPI mode (only 3 pure IDE commands seen so far)
1252   AM_RANGE(0x1f500000, 0x1f500003) AM_READWRITE(control_r, control_w )   // Konami can't make a game without a "control" register.
1253   AM_RANGE(0x1f560000, 0x1f560003) AM_WRITE(atapi_reset_w )
12441254   AM_RANGE(0x1f5c0000, 0x1f5c0003) AM_WRITENOP            // watchdog?
12451255   AM_RANGE(0x1f620000, 0x1f623fff) AM_DEVREADWRITE8_LEGACY("m48t58", timekeeper_r, timekeeper_w, 0x00ff00ff)
1246   AM_RANGE(0x1f680000, 0x1f68001f) AM_READWRITE_LEGACY(mb89371_r, mb89371_w)
1247   AM_RANGE(0x1f6a0000, 0x1f6a0003) AM_READWRITE_LEGACY(security_r, security_w )
1256   AM_RANGE(0x1f680000, 0x1f68001f) AM_READWRITE(mb89371_r, mb89371_w)
1257   AM_RANGE(0x1f6a0000, 0x1f6a0003) AM_READWRITE(security_r, security_w )
12481258   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_SHARE("share2") AM_REGION("bios", 0)
12491259   AM_RANGE(0x80000000, 0x803fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
12501260   AM_RANGE(0x9fc00000, 0x9fc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */
r14896r14897
13981408
13991409*/
14001410
1401static READ32_HANDLER( ge765pwbba_r )
1411READ32_MEMBER(ksys573_state::ge765pwbba_r)
14021412{
1403   device_t *upd4701 = space->machine().device("upd4701");
1413   device_t *upd4701 = machine().device("upd4701");
14041414   UINT32 data = 0;
14051415
14061416   switch (offset)
14071417   {
14081418   case 0x26:
1409      upd4701_y_add(upd4701, 0, input_port_read_safe(space->machine(), "uPD4701_y", 0), 0xffff);
1410      upd4701_switches_set(upd4701, 0, input_port_read_safe(space->machine(), "uPD4701_switches", 0));
1419      upd4701_y_add(upd4701, 0, input_port_read_safe(machine(), "uPD4701_y", 0), 0xffff);
1420      upd4701_switches_set(upd4701, 0, input_port_read_safe(machine(), "uPD4701_switches", 0));
14111421
14121422      upd4701_cs_w(upd4701, 0, 0);
14131423      upd4701_xy_w(upd4701, 0, 1);
r14896r14897
14281438      break;
14291439
14301440   default:
1431      verboselog(space->machine(), 0, "ge765pwbba_r: unhandled offset %08x %08x\n", offset, mem_mask);
1441      verboselog(machine(), 0, "ge765pwbba_r: unhandled offset %08x %08x\n", offset, mem_mask);
14321442      break;
14331443   }
14341444
1435   verboselog(space->machine(), 2, "ge765pwbba_r( %08x, %08x ) %08x\n", offset, mem_mask, data);
1445   verboselog(machine(), 2, "ge765pwbba_r( %08x, %08x ) %08x\n", offset, mem_mask, data);
14361446   return data;
14371447}
14381448
1439static WRITE32_HANDLER( ge765pwbba_w )
1449WRITE32_MEMBER(ksys573_state::ge765pwbba_w)
14401450{
1441   device_t *upd4701 = space->machine().device("upd4701");
1451   device_t *upd4701 = machine().device("upd4701");
14421452   switch (offset)
14431453   {
14441454   case 0x04:
r14896r14897
14671477      break;
14681478
14691479   default:
1470      verboselog(space->machine(), 0, "ge765pwbba_w: unhandled offset %08x %08x %08x\n", offset, mem_mask, data);
1480      verboselog(machine(), 0, "ge765pwbba_w: unhandled offset %08x %08x %08x\n", offset, mem_mask, data);
14711481      break;
14721482   }
14731483
1474   verboselog(space->machine(), 2, "ge765pwbba_w( %08x, %08x, %08x )\n", offset, mem_mask, data);
1484   verboselog(machine(), 2, "ge765pwbba_w( %08x, %08x, %08x )\n", offset, mem_mask, data);
14751485}
14761486
14771487static DRIVER_INIT( ge765pwbba )
14781488{
1489   ksys573_state *state = machine.driver_data<ksys573_state>();
14791490   DRIVER_INIT_CALL(konami573);
1480   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f640000, 0x1f6400ff, FUNC(ge765pwbba_r), FUNC(ge765pwbba_w) );
1491   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::ge765pwbba_r),state), write32_delegate(FUNC(ksys573_state::ge765pwbba_w),state));
14811492}
14821493
14831494/*
r14896r14897
14881499
14891500*/
14901501
1491static READ32_HANDLER( gx700pwbf_io_r )
1502READ32_MEMBER(ksys573_state::gx700pwbf_io_r)
14921503{
14931504   UINT32 data = 0;
14941505   switch( offset )
r14896r14897
15141525      break;
15151526   }
15161527
1517   verboselog( space->machine(), 2, "gx700pwbf_io_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
1528   verboselog( machine(), 2, "gx700pwbf_io_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
15181529
15191530   return data;
15201531}
r14896r14897
15401551   state->m_gx700pwbf_output_data[ offset ] = data;
15411552}
15421553
1543static WRITE32_HANDLER( gx700pwbf_io_w )
1554WRITE32_MEMBER(ksys573_state::gx700pwbf_io_w)
15441555{
1545   verboselog( space->machine(), 2, "gx700pwbf_io_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
1556   verboselog( machine(), 2, "gx700pwbf_io_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
15461557
15471558   switch( offset )
15481559   {
r14896r14897
15501561
15511562      if( ACCESSING_BITS_0_15 )
15521563      {
1553         gx700pwbf_output( space->machine(), 0, data & 0xff );
1564         gx700pwbf_output( machine(), 0, data & 0xff );
15541565      }
15551566      break;
15561567
15571568   case 0x22:
15581569      if( ACCESSING_BITS_0_15 )
15591570      {
1560         gx700pwbf_output( space->machine(), 1, data & 0xff );
1571         gx700pwbf_output( machine(), 1, data & 0xff );
15611572      }
15621573      break;
15631574
15641575   case 0x24:
15651576      if( ACCESSING_BITS_0_15 )
15661577      {
1567         gx700pwbf_output( space->machine(), 2, data & 0xff );
1578         gx700pwbf_output( machine(), 2, data & 0xff );
15681579      }
15691580      break;
15701581
15711582   case 0x26:
15721583      if( ACCESSING_BITS_0_15 )
15731584      {
1574         gx700pwbf_output( space->machine(), 3, data & 0xff );
1585         gx700pwbf_output( machine(), 3, data & 0xff );
15751586      }
15761587      break;
15771588
r14896r14897
15891600
15901601   state->m_gx700pwfbf_output_callback = output_callback_func;
15911602
1592   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f640000, 0x1f6400ff, FUNC(gx700pwbf_io_r), FUNC(gx700pwbf_io_w) );
1603   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx700pwbf_io_r),state), write32_delegate(FUNC(ksys573_state::gx700pwbf_io_w),state));
15931604
15941605   state->save_item( NAME(state->m_gx700pwbf_output_data) );
15951606}
r14896r14897
17861797
17871798*/
17881799
1789static READ32_HANDLER( gtrfrks_io_r )
1800READ32_MEMBER(ksys573_state::gtrfrks_io_r)
17901801{
17911802   UINT32 data = 0;
17921803   switch( offset )
r14896r14897
17951806      break;
17961807
17971808   default:
1798      verboselog( space->machine(), 0, "gtrfrks_io_r: unhandled offset %08x, %08x\n", offset, mem_mask );
1809      verboselog( machine(), 0, "gtrfrks_io_r: unhandled offset %08x, %08x\n", offset, mem_mask );
17991810      break;
18001811   }
18011812
1802   verboselog( space->machine(), 2, "gtrfrks_io_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
1813   verboselog( machine(), 2, "gtrfrks_io_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
18031814   return data;
18041815}
18051816
1806static WRITE32_HANDLER( gtrfrks_io_w )
1817WRITE32_MEMBER(ksys573_state::gtrfrks_io_w)
18071818{
1808   verboselog( space->machine(), 2, "gtrfrks_io_w( %08x, %08x ) %08x\n", offset, mem_mask, data );
1819   verboselog( machine(), 2, "gtrfrks_io_w( %08x, %08x ) %08x\n", offset, mem_mask, data );
18091820
18101821   switch( offset )
18111822   {
r14896r14897
18201831      break;
18211832
18221833   default:
1823      verboselog( space->machine(), 0, "gtrfrks_io_w: unhandled offset %08x, %08x\n", offset, mem_mask );
1834      verboselog( machine(), 0, "gtrfrks_io_w: unhandled offset %08x, %08x\n", offset, mem_mask );
18241835      break;
18251836   }
18261837}
r14896r14897
18281839static DRIVER_INIT( gtrfrks )
18291840{
18301841   DRIVER_INIT_CALL(konami573);
1831
1832   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f600000, 0x1f6000ff, FUNC(gtrfrks_io_r), FUNC(gtrfrks_io_w) );
1842   ksys573_state *state = machine.driver_data<ksys573_state>();
1843   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),state), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),state));
18331844}
18341845
18351846/* GX894 digital i/o */
18361847
1837static READ32_HANDLER( gx894pwbba_r )
1848READ32_MEMBER(ksys573_state::gx894pwbba_r)
18381849{
1839   ksys573_state *state = space->machine().driver_data<ksys573_state>();
18401850   UINT32 data = 0;
18411851
18421852   switch( offset )
r14896r14897
18531863   case 0x2b:
18541864      if( ACCESSING_BITS_0_15 )
18551865      {
1856         mas3507d_device *mas3507d = space->machine().device<mas3507d_device>("mpeg");
1866         mas3507d_device *mas3507d = machine().device<mas3507d_device>("mpeg");
18571867         data |= mas3507d->i2c_scl_r() << 13;
18581868         data |= mas3507d->i2c_sda_r() << 12;
18591869      }
r14896r14897
18651875   case 0x2d:
18661876      if( ACCESSING_BITS_0_15 )
18671877      {
1868         data |= state->m_gx894_ram[ state->m_gx894_ram_read_offset / 2 ];
1869         state->m_gx894_ram_read_offset += 2;
1878         data |= m_gx894_ram[ m_gx894_ram_read_offset / 2 ];
1879         m_gx894_ram_read_offset += 2;
18701880      }
18711881      if( ACCESSING_BITS_16_31 )
18721882      {
r14896r14897
19141924   case 0x3b:
19151925      if( ACCESSING_BITS_16_31 )
19161926      {
1917         data |= space->machine().device<ds2401_device>("digital_id")->read() << 28;
1927         data |= machine().device<ds2401_device>("digital_id")->read() << 28;
19181928      }
19191929      break;
19201930   case 0x3d:
r14896r14897
19371947      break;
19381948   }
19391949
1940   verboselog( space->machine(), 2, "gx894pwbba_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
1941//  printf( "%08x: gx894pwbba_r( %08x, %08x ) %08x\n", cpu_get_pc(&space->device()), offset, mem_mask, data );
1950   verboselog( machine(), 2, "gx894pwbba_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
1951//  printf( "%08x: gx894pwbba_r( %08x, %08x ) %08x\n", cpu_get_pc(&space.device()), offset, mem_mask, data );
19421952   return data;
19431953}
19441954
r14896r14897
19741984   state->m_gx894pwbba_output_data[ offset ] = data;
19751985}
19761986
1977static WRITE32_HANDLER( gx894pwbba_w )
1987WRITE32_MEMBER(ksys573_state::gx894pwbba_w)
19781988{
1979   ksys573_state *state = space->machine().driver_data<ksys573_state>();
19801989   char buff[33];
1981   UINT32 olda=state->m_a,oldb=state->m_b,oldc=state->m_c,oldd=state->m_d;
1990   UINT32 olda=m_a,oldb=m_b,oldc=m_c,oldd=m_d;
19821991
19831992//  printf( "gx894pwbba_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
19841993
r14896r14897
19871996      return;
19881997   }
19891998
1990   verboselog( space->machine(), 2, "gx894pwbba_w( %08x, %08x, %08x) %s\n", offset, mem_mask, data, binary( buff, data ) );
1999   verboselog( machine(), 2, "gx894pwbba_w( %08x, %08x, %08x) %s\n", offset, mem_mask, data, binary( buff, data ) );
19912000
19922001   switch( offset )
19932002   {
r14896r14897
20092018      break;
20102019   case 0x2b:
20112020      if(ACCESSING_BITS_0_15) {
2012         mas3507d_device *mas3507d = space->machine().device<mas3507d_device>("mpeg");
2021         mas3507d_device *mas3507d = machine().device<mas3507d_device>("mpeg");
20132022         mas3507d->i2c_scl_w(data & 0x2000);
20142023         mas3507d->i2c_sda_w(data & 0x1000);
20152024      }
r14896r14897
20242033   case 0x2c:
20252034      if( ACCESSING_BITS_0_15 )
20262035      {
2027         state->m_gx894_ram_write_offset &= 0x0000ffff;
2028         state->m_gx894_ram_write_offset |= ( data & 0x0000ffff ) << 16;
2036         m_gx894_ram_write_offset &= 0x0000ffff;
2037         m_gx894_ram_write_offset |= ( data & 0x0000ffff ) << 16;
20292038      }
20302039      if( ACCESSING_BITS_16_31 )
20312040      {
2032         state->m_gx894_ram_write_offset &= 0xffff0000;
2033         state->m_gx894_ram_write_offset |= ( data & 0xffff0000 ) >> 16;
2041         m_gx894_ram_write_offset &= 0xffff0000;
2042         m_gx894_ram_write_offset |= ( data & 0xffff0000 ) >> 16;
20342043      }
20352044      break;
20362045   case 0x2d:
20372046      if( ACCESSING_BITS_0_15 )
20382047      {
2039         state->m_gx894_ram[ state->m_gx894_ram_write_offset / 2 ] = data & 0xffff;
2040         state->m_gx894_ram_write_offset += 2;
2048         m_gx894_ram[ m_gx894_ram_write_offset / 2 ] = data & 0xffff;
2049         m_gx894_ram_write_offset += 2;
20412050      }
20422051      if( ACCESSING_BITS_16_31 )
20432052      {
2044         state->m_gx894_ram_read_offset &= 0x0000ffff;
2045         state->m_gx894_ram_read_offset |= ( data & 0xffff0000 ) << 0;
2053         m_gx894_ram_read_offset &= 0x0000ffff;
2054         m_gx894_ram_read_offset |= ( data & 0xffff0000 ) << 0;
20462055      }
20472056      break;
20482057   case 0x2e:
20492058      if( ACCESSING_BITS_0_15 )
20502059      {
2051         state->m_gx894_ram_read_offset &= 0xffff0000;
2052         state->m_gx894_ram_read_offset |= ( data & 0x0000ffff ) >> 0;
2060         m_gx894_ram_read_offset &= 0xffff0000;
2061         m_gx894_ram_read_offset |= ( data & 0x0000ffff ) >> 0;
20532062      }
20542063      if( ACCESSING_BITS_16_31 )
20552064      {
r14896r14897
20592068   case 0x38:
20602069      if( ACCESSING_BITS_16_31 )
20612070      {
2062         gx894pwbba_output( space->machine(), 0, ( data >> 28 ) & 0xf );
2071         gx894pwbba_output( machine(), 0, ( data >> 28 ) & 0xf );
20632072      }
20642073      if( ACCESSING_BITS_0_15 )
20652074      {
2066         gx894pwbba_output( space->machine(), 1, ( data >> 12 ) & 0xf );
2075         gx894pwbba_output( machine(), 1, ( data >> 12 ) & 0xf );
20672076      }
2068      COMBINE_DATA( &state->m_a );
2077      COMBINE_DATA( &m_a );
20692078      break;
20702079   case 0x39:
20712080      if( ACCESSING_BITS_16_31 )
20722081      {
2073         gx894pwbba_output( space->machine(), 7, ( data >> 28 ) & 0xf );
2082         gx894pwbba_output( machine(), 7, ( data >> 28 ) & 0xf );
20742083      }
20752084      if( ACCESSING_BITS_0_15 )
20762085      {
2077         gx894pwbba_output( space->machine(), 3, ( data >> 12 ) & 0xf );
2086         gx894pwbba_output( machine(), 3, ( data >> 12 ) & 0xf );
20782087      }
2079      COMBINE_DATA( &state->m_b );
2088      COMBINE_DATA( &m_b );
20802089      break;
20812090   case 0x3a:
20822091      if( ACCESSING_BITS_16_31 )
r14896r14897
20872096         logerror("FPGA MPEG key 3/3 %02x\n", data & 0xff);
20882097      if( ACCESSING_BITS_16_31 )
20892098      {
2090         space->machine().device<ds2401_device>("digital_id")->write( !( ( data >> 28 ) & 1 ) );
2099         machine().device<ds2401_device>("digital_id")->write( !( ( data >> 28 ) & 1 ) );
20912100      }
20922101      break;
20932102   case 0x3e:
r14896r14897
20992108         /* 15 */
21002109
21012110         /* fpga */
2102         state->m_s = ( state->m_s >> 1 ) | ( ( data & 0x8000 ) >> 8 );
2103         state->m_f++;
2104         if( state->m_f == 8 )
2111         m_s = ( m_s >> 1 ) | ( ( data & 0x8000 ) >> 8 );
2112         m_f++;
2113         if( m_f == 8 )
21052114         {
21062115//              printf( "%04x %02x\n", o, s );
2107            state->m_c = 0;
2108            state->m_f = 0;
2109            state->m_o++;
2116            m_c = 0;
2117            m_f = 0;
2118            m_o++;
21102119         }
21112120      }
21122121
21132122      if( ACCESSING_BITS_16_31 )
21142123      {
2115         gx894pwbba_output( space->machine(), 4, ( data >> 28 ) & 0xf );
2124         gx894pwbba_output( machine(), 4, ( data >> 28 ) & 0xf );
21162125      }
2117      COMBINE_DATA( &state->m_c );
2126      COMBINE_DATA( &m_c );
21182127      break;
21192128   case 0x3f:
21202129      if( ACCESSING_BITS_16_31 )
21212130      {
2122         gx894pwbba_output( space->machine(), 2, ( data >> 28 ) & 0xf );
2131         gx894pwbba_output( machine(), 2, ( data >> 28 ) & 0xf );
21232132      }
21242133      if( ACCESSING_BITS_0_15 )
21252134      {
2126         gx894pwbba_output( space->machine(), 5, ( data >> 12 ) & 0xf );
2135         gx894pwbba_output( machine(), 5, ( data >> 12 ) & 0xf );
21272136      }
2128      COMBINE_DATA( &state->m_d );
2137      COMBINE_DATA( &m_d );
21292138      break;
21302139   default:
21312140//      printf( "write offset %08x\n", offset );
21322141      break;
21332142   }
2134   if( state->m_a != olda || state->m_b != oldb || state->m_c != oldc || state->m_d != oldd )
2143   if( m_a != olda || m_b != oldb || m_c != oldc || m_d != oldd )
21352144   {
21362145//      printf( "%08x %08x %08x %08x\n", a, b, c, d );
21372146   }
r14896r14897
21442153
21452154   state->m_gx894pwbba_output_callback = output_callback_func;
21462155
2147   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f640000, 0x1f6400ff, FUNC(gx894pwbba_r), FUNC(gx894pwbba_w) );
2156   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx894pwbba_r),state), write32_delegate(FUNC(ksys573_state::gx894pwbba_w),state));
21482157
21492158   state->m_gx894_ram_write_offset = 0;
21502159   state->m_gx894_ram_read_offset = 0;
r14896r14897
21702179   DRIVER_INIT_CALL(konami573);
21712180
21722181   gx894pwbba_init( machine, NULL );
2173
2174   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f600000, 0x1f6000ff, FUNC(gtrfrks_io_r), FUNC(gtrfrks_io_w) );
2182   ksys573_state *state = machine.driver_data<ksys573_state>();
2183   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),state), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),state) );
21752184}
21762185
21772186/* ddr solo */
r14896r14897
24362445   }
24372446}
24382447
2439static WRITE32_HANDLER( dmx_io_w )
2448WRITE32_MEMBER(ksys573_state::dmx_io_w)
24402449{
2441   verboselog( space->machine(), 2, "dmx_io_w( %08x, %08x ) %08x\n", offset, mem_mask, data );
2450   verboselog( machine(), 2, "dmx_io_w( %08x, %08x ) %08x\n", offset, mem_mask, data );
24422451
24432452   switch( offset )
24442453   {
r14896r14897
24532462      break;
24542463
24552464   default:
2456      verboselog( space->machine(), 0, "dmx_io_w: unhandled offset %08x, %08x\n", offset, mem_mask );
2465      verboselog( machine(), 0, "dmx_io_w: unhandled offset %08x, %08x\n", offset, mem_mask );
24572466      break;
24582467   }
24592468}
r14896r14897
24632472   DRIVER_INIT_CALL(konami573);
24642473
24652474   gx894pwbba_init( machine, dmx_output_callback );
2466
2467   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x1f600000, 0x1f6000ff, FUNC(dmx_io_w) );
2475   ksys573_state *state = machine.driver_data<ksys573_state>();
2476   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::dmx_io_w),state) );
24682477}
24692478
24702479/* salary man champ */
r14896r14897
26002609   }
26012610}
26022611
2603static WRITE32_HANDLER( mamboagg_io_w )
2612WRITE32_MEMBER(ksys573_state::mamboagg_io_w)
26042613{
2605   verboselog( space->machine(), 2, "mamboagg_io_w( %08x, %08x ) %08x\n", offset, mem_mask, data );
2614   verboselog( machine(), 2, "mamboagg_io_w( %08x, %08x ) %08x\n", offset, mem_mask, data );
26062615
26072616   switch( offset )
26082617   {
r14896r14897
26132622      break;
26142623
26152624   default:
2616      verboselog( space->machine(), 0, "mamboagg_io_w: unhandled offset %08x, %08x\n", offset, mem_mask );
2625      verboselog( machine(), 0, "mamboagg_io_w: unhandled offset %08x, %08x\n", offset, mem_mask );
26172626      break;
26182627   }
26192628}
r14896r14897
26232632   DRIVER_INIT_CALL(konami573);
26242633
26252634   gx894pwbba_init( machine, mamboagg_output_callback );
2626
2627   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x1f600000, 0x1f6000ff, FUNC(mamboagg_io_w) );
2635   ksys573_state *state = machine.driver_data<ksys573_state>();
2636   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::mamboagg_io_w),state));
26282637}
26292638
26302639
r14896r14897
28062815
28072816/* GunMania */
28082817
2809static WRITE32_HANDLER( gunmania_w )
2818WRITE32_MEMBER(ksys573_state::gunmania_w)
28102819{
28112820   char s[ 1024 ] = "";
2812   ksys573_state *state = space->machine().driver_data<ksys573_state>();
2813   ds2401_device *ds2401 = space->machine().device<ds2401_device>("gunmania_id");
2821   ds2401_device *ds2401 = machine().device<ds2401_device>("gunmania_id");
28142822
28152823   switch( offset )
28162824   {
r14896r14897
28242832      case 0x20:
28252833         strcat( s, "cable holder motor release " );
28262834
2827         state->m_cable_holder_release = 1;
2835         m_cable_holder_release = 1;
28282836         break;
28292837
28302838      case 0x80:
28312839         strcat( s, "cable holder motor catch " );
28322840
2833         state->m_cable_holder_release = 0;
2841         m_cable_holder_release = 0;
28342842         break;
28352843
28362844      case 0xa0:
r14896r14897
28582866      case 0x02:
28592867         strcat( s, "tank shutter motor close " );
28602868
2861         if( state->m_tank_shutter_position > 0 )
2869         if( m_tank_shutter_position > 0 )
28622870         {
2863            state->m_tank_shutter_position--;
2871            m_tank_shutter_position--;
28642872         }
28652873
28662874         break;
r14896r14897
28682876      case 0x08:
28692877         strcat( s, "tank shutter motor open " );
28702878
2871         if( state->m_tank_shutter_position < 100 )
2879         if( m_tank_shutter_position < 100 )
28722880         {
2873            state->m_tank_shutter_position++;
2881            m_tank_shutter_position++;
28742882         }
28752883
28762884         break;
r14896r14897
28952903      break;
28962904   }
28972905
2898   verboselog( space->machine(), 2, "gunmania_w %08x %08x %08x\n", offset, mem_mask, data );
2906   verboselog( machine(), 2, "gunmania_w %08x %08x %08x\n", offset, mem_mask, data );
28992907}
29002908
29012909CUSTOM_INPUT_MEMBER(ksys573_state::gunmania_tank_shutter_sensor)
r14896r14897
29152923   return m_cable_holder_release;
29162924}
29172925
2918static READ32_HANDLER( gunmania_r )
2926READ32_MEMBER(ksys573_state::gunmania_r)
29192927{
29202928   UINT32 data = 0;
2921   ds2401_device *ds2401 = space->machine().device<ds2401_device>("gunmania_id");
2929   ds2401_device *ds2401 = machine().device<ds2401_device>("gunmania_id");
29222930
29232931   switch( offset )
29242932   {
29252933   case 0x20:
2926      data = input_port_read( space->machine(), "GUNX" ) | ds2401->read() << 7;
2934      data = input_port_read( machine(), "GUNX" ) | ds2401->read() << 7;
29272935      break;
29282936
29292937   case 0x22:
2930      data = input_port_read( space->machine(), "GUNY" ) | input_port_read( space->machine(), "SENSOR" );
2938      data = input_port_read( machine(), "GUNY" ) | input_port_read( machine(), "SENSOR" );
29312939      break;
29322940
29332941   case 0x34:
2934      data = input_port_read( space->machine(), "ENCODER" );
2942      data = input_port_read( machine(), "ENCODER" );
29352943      popmessage( "encoder %04x", data );
29362944      break;
29372945   }
29382946
2939   verboselog( space->machine(), 2, "gunmania_r %08x %08x %08x\n", offset, mem_mask, data );
2947   verboselog( machine(), 2, "gunmania_r %08x %08x %08x\n", offset, mem_mask, data );
29402948   return data;
29412949}
29422950
29432951static DRIVER_INIT( gunmania )
29442952{
29452953   DRIVER_INIT_CALL(konami573);
2946   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( 0x1f640000, 0x1f6400ff, FUNC(gunmania_r), FUNC(gunmania_w) );
2954   ksys573_state *state = machine.driver_data<ksys573_state>();
2955   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gunmania_r),state), write32_delegate(FUNC(ksys573_state::gunmania_w),state));
29472956}
29482957
29492958/* ADC0834 Interface */
src/mame/drivers/sbrkout.c
r14896r14897
4141{
4242public:
4343   sbrkout_state(const machine_config &mconfig, device_type type, const char *tag)
44      : driver_device(mconfig, type, tag) { }
44      : driver_device(mconfig, type, tag) ,
45      m_videoram(*this, "videoram"){ }
4546
46   UINT8 *m_videoram;
47   required_shared_ptr<UINT8> m_videoram;
4748   emu_timer *m_scanline_timer;
4849   emu_timer *m_pot_timer;
4950   tilemap_t *m_bg_tilemap;
r14896r14897
9798static MACHINE_START( sbrkout )
9899{
99100   sbrkout_state *state = machine.driver_data<sbrkout_state>();
100   UINT8 *videoram = state->m_videoram;
101   UINT8 *videoram = state->m_videoram.target();
101102   memory_set_bankptr(machine, "bank1", &videoram[0x380]);
102103   state->m_scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_callback));
103104   state->m_pot_timer = machine.scheduler().timer_alloc(FUNC(pot_trigger_callback));
r14896r14897
125126static TIMER_CALLBACK( scanline_callback )
126127{
127128   sbrkout_state *state = machine.driver_data<sbrkout_state>();
128   UINT8 *videoram = state->m_videoram;
129   UINT8 *videoram = state->m_videoram.target();
129130   int scanline = param;
130131
131132   /* force a partial update before anything happens */
r14896r14897
298299static TILE_GET_INFO( get_bg_tile_info )
299300{
300301   sbrkout_state *state = machine.driver_data<sbrkout_state>();
301   UINT8 *videoram = state->m_videoram;
302   UINT8 *videoram = state->m_videoram.target();
302303   int code = (videoram[tile_index] & 0x80) ? videoram[tile_index] : 0;
303304   SET_TILE_INFO(0, code, 0, 0);
304305}
r14896r14897
313314
314315WRITE8_MEMBER(sbrkout_state::sbrkout_videoram_w)
315316{
316   UINT8 *videoram = m_videoram;
317   UINT8 *videoram = m_videoram.target();
317318   videoram[offset] = data;
318319   m_bg_tilemap->mark_tile_dirty(offset);
319320}
r14896r14897
329330static SCREEN_UPDATE_IND16( sbrkout )
330331{
331332   sbrkout_state *state = screen.machine().driver_data<sbrkout_state>();
332   UINT8 *videoram = state->m_videoram;
333   UINT8 *videoram = state->m_videoram.target();
333334   int ball;
334335
335336   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
r14896r14897
357358static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, sbrkout_state )
358359   ADDRESS_MAP_GLOBAL_MASK(0x3fff)
359360   AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x380) AM_RAMBANK("bank1")
360   AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(sbrkout_videoram_w) AM_BASE(m_videoram)
361   AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(sbrkout_videoram_w) AM_SHARE("videoram")
361362   AM_RANGE(0x0800, 0x083f) AM_READ(switches_r)
362363   AM_RANGE(0x0840, 0x0840) AM_MIRROR(0x003f) AM_READ_PORT("COIN")
363364   AM_RANGE(0x0880, 0x0880) AM_MIRROR(0x003f) AM_READ_PORT("START")
src/mame/drivers/bladestl.c
r14896r14897
9090WRITE8_MEMBER(bladestl_state::bladestl_sh_irqtrigger_w)
9191{
9292
93   soundlatch_w(space, offset, data);
93   soundlatch_byte_w(space, offset, data);
9494   device_set_input_line(m_audiocpu, M6809_IRQ_LINE, HOLD_LINE);
9595   //logerror("(sound) write %02x\n", data);
9696}
r14896r14897
146146   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE_LEGACY("upd", bladestl_speech_ctrl_w)   /* UPD7759 */
147147   AM_RANGE(0x4000, 0x4000) AM_DEVREAD_LEGACY("upd", bladestl_speech_busy_r)   /* UPD7759 */
148148   AM_RANGE(0x5000, 0x5000) AM_WRITENOP                        /* ??? */
149   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)                  /* soundlatch_r */
149   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)                  /* soundlatch_byte_r */
150150   AM_RANGE(0x8000, 0xffff) AM_ROM
151151ADDRESS_MAP_END
152152
src/mame/drivers/srumbler.c
r14896r14897
8383   AM_RANGE(0x400b, 0x400b) AM_READ_PORT("DSW1")
8484   AM_RANGE(0x400c, 0x400c) AM_READ_PORT("DSW2")
8585   AM_RANGE(0x400a, 0x400d) AM_WRITE(srumbler_scroll_w)
86   AM_RANGE(0x400e, 0x400e) AM_WRITE(soundlatch_w)
86   AM_RANGE(0x400e, 0x400e) AM_WRITE(soundlatch_byte_w)
8787   AM_RANGE(0x5000, 0x5fff) AM_ROMBANK("5000")   AM_WRITE(srumbler_foreground_w) AM_BASE(m_foregroundram) /* Banked ROM */
8888   AM_RANGE(0x6000, 0x6fff) AM_ROMBANK("6000")   /* Banked ROM */
8989   AM_RANGE(0x6000, 0x6fff) AM_WRITENOP   /* Video RAM 2 ??? (not used) */
9090   AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("7000")   /* Banked ROM */
91   AM_RANGE(0x7000, 0x73ff) AM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_SHARE("paletteram")
91   AM_RANGE(0x7000, 0x73ff) AM_WRITE(paletteram_RRRRGGGGBBBBxxxx_byte_be_w) AM_SHARE("paletteram")
9292   AM_RANGE(0x8000, 0x8fff) AM_ROMBANK("8000")   /* Banked ROM */
9393   AM_RANGE(0x9000, 0x9fff) AM_ROMBANK("9000")   /* Banked ROM */
9494   AM_RANGE(0xa000, 0xafff) AM_ROMBANK("a000")   /* Banked ROM */
r14896r14897
104104   AM_RANGE(0x8000, 0x8001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
105105   AM_RANGE(0xa000, 0xa001) AM_DEVWRITE_LEGACY("ym2", ym2203_w)
106106   AM_RANGE(0xc000, 0xc7ff) AM_RAM
107   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
107   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
108108ADDRESS_MAP_END
109109
110110
src/mame/drivers/re900.c
r14896r14897
8686{
8787public:
8888   re900_state(const machine_config &mconfig, device_type type, const char *tag)
89      : driver_device(mconfig, type, tag) { }
89      : driver_device(mconfig, type, tag) ,
90      m_rom(*this, "rom"){ }
9091
91   UINT8 *m_rom;
92   required_shared_ptr<UINT8> m_rom;
9293   UINT8 m_psg_pa;
9394   UINT8 m_psg_pb;
9495   UINT8 m_mux_data;
r14896r14897
173174
174175READ8_MEMBER(re900_state::rom_r)
175176{
176   return m_rom[offset];
177   return m_rom.target()[offset];
177178}
178179
179180
r14896r14897
224225*******************************/
225226
226227static ADDRESS_MAP_START( mem_prg, AS_PROGRAM, 8, re900_state )
227   AM_RANGE(0x0000, 0xffff) AM_ROM AM_BASE(m_rom)
228   AM_RANGE(0x0000, 0xffff) AM_ROM AM_SHARE("rom")
228229ADDRESS_MAP_END
229230
230231static ADDRESS_MAP_START( mem_io, AS_IO, 8, re900_state )
src/mame/drivers/pbaction.c
r14896r14897
7272
7373WRITE8_MEMBER(pbaction_state::pbaction_sh_command_w)
7474{
75   soundlatch_w(space, offset, data);
75   soundlatch_byte_w(space, offset, data);
7676   device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0x00);
7777}
7878
r14896r14897
9191   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(pbaction_videoram_w) AM_BASE(m_videoram)
9292   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(pbaction_colorram_w) AM_BASE(m_colorram)
9393   AM_RANGE(0xe000, 0xe07f) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
94   AM_RANGE(0xe400, 0xe5ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_SHARE("paletteram")
94   AM_RANGE(0xe400, 0xe5ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
9595   AM_RANGE(0xe600, 0xe600) AM_READ_PORT("P1") AM_WRITE(nmi_mask_w)
9696   AM_RANGE(0xe601, 0xe601) AM_READ_PORT("P2")
9797   AM_RANGE(0xe602, 0xe602) AM_READ_PORT("SYSTEM")
r14896r14897
104104static ADDRESS_MAP_START( pbaction_sound_map, AS_PROGRAM, 8, pbaction_state )
105105   AM_RANGE(0x0000, 0x1fff) AM_ROM
106106   AM_RANGE(0x4000, 0x47ff) AM_RAM
107   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r)
107   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_byte_r)
108108   AM_RANGE(0xffff, 0xffff) AM_WRITENOP   /* watchdog? */
109109ADDRESS_MAP_END
110110
src/mame/drivers/mcr68.c
r14896r14897
5858#include "audio/mcr.h"
5959#include "audio/williams.h"
6060#include "machine/nvram.h"
61#include "includes/mcr.h"
6162#include "includes/mcr68.h"
6263
6364
r14896r14897
103104{
104105   COMBINE_DATA(&m_control_word);
105106/*  soundsgood_reset_w(~m_control_word & 0x0020);*/
106   soundsgood_data_w(&space, offset, ((m_control_word & 0x000f) << 1) | ((m_control_word & 0x0010) >> 4));
107   soundsgood_data_w(space, offset, ((m_control_word & 0x000f) << 1) | ((m_control_word & 0x0010) >> 4));
107108}
108109
109110
r14896r14897
118119{
119120   COMBINE_DATA(&m_control_word);
120121/*  soundsgood_reset_w(~m_control_word & 0x0020);*/
121   soundsgood_data_w(&space, offset, (m_control_word >> 8) & 0x1f);
122   soundsgood_data_w(space, offset, (m_control_word >> 8) & 0x1f);
122123}
123124
124125
r14896r14897
136137   int which = (m_control_word >> 3) & 3;
137138   int analog = input_port_read(machine(), portnames[which]);
138139
139   return result | ((soundsgood_status_r(&space, 0) & 1) << 5) | (analog << 8);
140   return result | ((soundsgood_status_r(space, 0) & 1) << 5) | (analog << 8);
140141}
141142
142143
143144READ16_MEMBER(mcr68_state::spyhunt2_port_1_r)
144145{
145146   int result = input_port_read(machine(), "IN1");
146   return result | ((turbocs_status_r(&space, 0) & 1) << 7);
147   return result | ((turbocs_status_r(space, 0) & 1) << 7);
147148}
148149
149150
r14896r14897
152153   COMBINE_DATA(&m_control_word);
153154
154155/*  turbocs_reset_w(~m_control_word & 0x0080);*/
155   turbocs_data_w(&space, offset, (m_control_word >> 8) & 0x001f);
156   turbocs_data_w(space, offset, (m_control_word >> 8) & 0x001f);
156157
157158   soundsgood_reset_w(machine(), ~m_control_word & 0x2000);
158   soundsgood_data_w(&space, offset, (m_control_word >> 8) & 0x001f);
159   soundsgood_data_w(space, offset, (m_control_word >> 8) & 0x001f);
159160}
160161
161162
src/mame/drivers/overdriv.c
r14896r14897
157157static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16, overdriv_state )
158158   AM_RANGE(0x000000, 0x03ffff) AM_ROM
159159   AM_RANGE(0x040000, 0x043fff) AM_RAM               /* work RAM */
160   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
160   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
161161   AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("INPUTS")
162162   AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("SYSTEM")
163163   AM_RANGE(0x0e0000, 0x0e0001) AM_WRITENOP         /* unknown (always 0x30) */
src/mame/drivers/jackpool.c
r14896r14897
2525{
2626public:
2727   jackpool_state(const machine_config &mconfig, device_type type, const char *tag)
28      : driver_device(mconfig, type, tag) { }
28      : driver_device(mconfig, type, tag) ,
29      m_vram(*this, "vram"),
30      m_io(*this, "io"){ }
2931
30   UINT16 *m_vram;
32   required_shared_ptr<UINT16> m_vram;
3133   UINT8 m_map_vreg;
32   UINT16 *m_io;
34   required_shared_ptr<UINT16> m_io;
3335   DECLARE_READ16_MEMBER(jackpool_ff_r);
3436   DECLARE_READ16_MEMBER(jackpool_io_r);
3537   DECLARE_WRITE16_MEMBER(jackpool_io_w);
r14896r14897
5456      {
5557         for (x=0;x<64;x++)
5658         {
57            int tile = (state->m_vram[count+(0x2000/2)] & 0x7fff);
58            int attr = (state->m_vram[count+(0x2000/2)+0x800] & 0x1f00)>>8;
59            int tile = (state->m_vram.target()[count+(0x2000/2)] & 0x7fff);
60            int attr = (state->m_vram.target()[count+(0x2000/2)+0x800] & 0x1f00)>>8;
5961
6062            drawgfx_opaque(bitmap,cliprect,gfx,tile,attr,0,0,x*8,y*8);
6163            count++;
r14896r14897
6769      {
6870         for (x=0;x<64;x++)
6971         {
70            int tile = (state->m_vram[count] & 0x7fff);
72            int tile = (state->m_vram.target()[count] & 0x7fff);
7173
7274            if(tile != 0)
7375            {
74               int attr = (state->m_vram[count+0x800] & 0x1f00)>>8;
75               int t_pen = (state->m_vram[count+0x800] & 0x1000);
76               int attr = (state->m_vram.target()[count+0x800] & 0x1f00)>>8;
77               int t_pen = (state->m_vram.target()[count+0x800] & 0x1000);
7678
7779               drawgfx_transpen(bitmap,cliprect,gfx,tile,attr,0,0,x*8,y*8,(t_pen) ? 0 : -1);
7880            }
r14896r14897
117119   }
118120
119121//  printf("R %02x\n",offset*2);
120   return m_io[offset];
122   return m_io.target()[offset];
121123}
122124
123125WRITE16_MEMBER(jackpool_state::jackpool_io_w)
124126{
125   COMBINE_DATA(&m_io[offset]);
127   COMBINE_DATA(&m_io.target()[offset]);
126128
127129   switch(offset*2)
128130   {
r14896r14897
171173   AM_RANGE(0x000000, 0x03ffff) AM_ROM
172174   AM_RANGE(0x100000, 0x10ffff) AM_RAM
173175   AM_RANGE(0x120000, 0x1200ff) AM_RAM
174   AM_RANGE(0x340000, 0x347fff) AM_RAM AM_BASE(m_vram)
176   AM_RANGE(0x340000, 0x347fff) AM_RAM AM_SHARE("vram")
175177   AM_RANGE(0x348000, 0x34ffff) AM_RAM //<- vram banks 2 & 3?
176178
177   AM_RANGE(0x360000, 0x3603ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
178   AM_RANGE(0x380000, 0x380061) AM_READWRITE(jackpool_io_r,jackpool_io_w) AM_BASE(m_io)//AM_READ(jackpool_io_r)
179   AM_RANGE(0x360000, 0x3603ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
180   AM_RANGE(0x380000, 0x380061) AM_READWRITE(jackpool_io_r,jackpool_io_w) AM_SHARE("io")//AM_READ(jackpool_io_r)
179181
180182   AM_RANGE(0x800000, 0x80000f) AM_READ(jackpool_ff_r) AM_WRITENOP //UART
181183   AM_RANGE(0xa00000, 0xa00001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
src/mame/drivers/spcforce.c
r14896r14897
8787static ADDRESS_MAP_START( spcforce_map, AS_PROGRAM, 8, spcforce_state )
8888   AM_RANGE(0x0000, 0x3fff) AM_ROM
8989   AM_RANGE(0x4000, 0x43ff) AM_RAM
90   AM_RANGE(0x7000, 0x7000) AM_READ_PORT("DSW") AM_WRITE(soundlatch_w)
90   AM_RANGE(0x7000, 0x7000) AM_READ_PORT("DSW") AM_WRITE(soundlatch_byte_w)
9191   AM_RANGE(0x7001, 0x7001) AM_READ_PORT("P1") AM_WRITE(spcforce_soundtrigger_w)
9292   AM_RANGE(0x7002, 0x7002) AM_READ_PORT("P2")
9393   AM_RANGE(0x700b, 0x700b) AM_WRITE(spcforce_flip_screen_w)
r14896r14897
103103ADDRESS_MAP_END
104104
105105static ADDRESS_MAP_START( spcforce_sound_io_map, AS_IO, 8, spcforce_state )
106   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(soundlatch_r)
106   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(soundlatch_byte_r)
107107   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(spcforce_SN76496_latch_w)
108108   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(spcforce_SN76496_select_r, spcforce_SN76496_select_w)
109109   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(spcforce_t0_r)
src/mame/drivers/gsword.c
r14896r14897
168168/* CPU 2 memory hack */
169169/* (402E) timeout upcount must be under 0AH                         */
170170/* (4004,4005) clear down counter , if (4004,4005)==0 then (402E)=0 */
171static READ8_HANDLER( gsword_hack_r )
171READ8_MEMBER(gsword_state::gsword_hack_r)
172172{
173   gsword_state *state = space->machine().driver_data<gsword_state>();
174   UINT8 data = state->m_cpu2_ram[offset + 4];
173   UINT8 data = m_cpu2_ram[offset + 4];
175174
176   /*if(offset==1)mame_printf_debug("CNT %02X%02X\n",state->m_cpu2_ram[5],state->m_cpu2_ram[4]); */
175   /*if(offset==1)mame_printf_debug("CNT %02X%02X\n",m_cpu2_ram[5],m_cpu2_ram[4]); */
177176
178177   /* speedup timeout cound down */
179   if(state->m_protect_hack)
178   if(m_protect_hack)
180179   {
181180      switch(offset)
182181      {
r14896r14897
324323   msm5205_vclk_w(device,(data>>4)&1);  /* bit 4    */
325324}
326325
327static WRITE8_HANDLER( adpcm_soundcommand_w )
326WRITE8_MEMBER(gsword_state::adpcm_soundcommand_w)
328327{
329   gsword_state *state = space->machine().driver_data<gsword_state>();
330   state->soundlatch_w(*space, 0, data);
331   cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
328   soundlatch_byte_w(*&space, 0, data);
329   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
332330}
333331
334332static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM , 8, gsword_state )
r14896r14897
337335   AM_RANGE(0xa000, 0xa37f) AM_RAM
338336   AM_RANGE(0xa380, 0xa3ff) AM_RAM AM_BASE(m_spritetile_ram)
339337   AM_RANGE(0xa400, 0xa77f) AM_RAM
340   AM_RANGE(0xa780, 0xa7ff) AM_RAM AM_BASE(m_spritexy_ram) AM_SIZE(m_spritexy_size)
338   AM_RANGE(0xa780, 0xa7ff) AM_RAM AM_BASE_SIZE(m_spritexy_ram,m_spritexy_size)
341339   AM_RANGE(0xa980, 0xa980) AM_WRITE(gsword_charbank_w)
342340   AM_RANGE(0xaa80, 0xaa80) AM_WRITE(gsword_videoctrl_w)   /* flip screen, char palette bank */
343341   AM_RANGE(0xab00, 0xab00) AM_WRITE(gsword_scroll_w)
r14896r14897
359357static ADDRESS_MAP_START( cpu2_map, AS_PROGRAM, 8, gsword_state )
360358   AM_RANGE(0x0000, 0x3fff) AM_ROM
361359   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(m_cpu2_ram)
362   AM_RANGE(0x6000, 0x6000) AM_WRITE_LEGACY(adpcm_soundcommand_w)
360   AM_RANGE(0x6000, 0x6000) AM_WRITE(adpcm_soundcommand_w)
363361ADDRESS_MAP_END
364362
365363static ADDRESS_MAP_START( cpu2_io_map, AS_IO, 8, gsword_state )
r14896r14897
382380static ADDRESS_MAP_START( cpu3_map, AS_PROGRAM, 8, gsword_state )
383381   AM_RANGE(0x0000, 0x7fff) AM_ROM
384382   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE_LEGACY("msm", gsword_adpcm_data_w)
385   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
383   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
386384ADDRESS_MAP_END
387385
388386
r14896r14897
395393   AM_RANGE(0x8001, 0x8001) AM_READ_PORT("IN2")   // 2PL / ACK
396394   AM_RANGE(0x8002, 0x8002) AM_READ_PORT("IN0")   // START
397395
398//  AM_RANGE(0x6000, 0x6000) AM_WRITE_LEGACY(adpcm_soundcommand_w)
396//  AM_RANGE(0x6000, 0x6000) AM_WRITE(adpcm_soundcommand_w)
399397   AM_RANGE(0xA000, 0xA001) AM_WRITE_LEGACY(josvolly_8741_1_w) AM_READ_LEGACY(josvolly_8741_1_r)
400398ADDRESS_MAP_END
401399
r14896r14897
913911#endif
914912#if 1
915913   /* hack for sound protection or time out function */
916   machine.device("sub")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4004, 0x4005, FUNC(gsword_hack_r));
914   gsword_state *state = machine.driver_data<gsword_state>();
915   machine.device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),state));
917916#endif
918917}
919918
r14896r14897
928927#endif
929928#if 1
930929   /* hack for sound protection or time out function */
931   machine.device("sub")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4004, 0x4005, FUNC(gsword_hack_r));
930   gsword_state *state = machine.driver_data<gsword_state>();
931   machine.device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),state));
932932#endif
933933}
934934
src/mame/drivers/nmg5.c
r14896r14897
230230{
231231public:
232232   nmg5_state(const machine_config &mconfig, device_type type, const char *tag)
233      : driver_device(mconfig, type, tag) { }
233      : driver_device(mconfig, type, tag) ,
234      m_spriteram(*this, "spriteram"),
235      m_scroll_ram(*this, "scroll_ram"),
236      m_bg_videoram(*this, "bg_videoram"),
237      m_fg_videoram(*this, "fg_videoram"),
238      m_bitmap(*this, "bitmap"){ }
234239
235240   /* memory pointers */
236   UINT16 *    m_fg_videoram;
237   UINT16 *    m_bg_videoram;
238   UINT16 *    m_scroll_ram;
239   UINT16 *    m_bitmap;
240   UINT16 *    m_spriteram;
241   required_shared_ptr<UINT16> m_spriteram;
242   required_shared_ptr<UINT16> m_scroll_ram;
243   required_shared_ptr<UINT16> m_bg_videoram;
244   required_shared_ptr<UINT16> m_fg_videoram;
245   required_shared_ptr<UINT16> m_bitmap;
241246//  UINT16 *  m_paletteram;    // currently this uses generic palette handling
242   size_t      m_spriteram_size;
243247
244248   /* video-related */
245249   tilemap_t  *m_bg_tilemap;
r14896r14897
267271
268272WRITE16_MEMBER(nmg5_state::fg_videoram_w)
269273{
270   COMBINE_DATA(&m_fg_videoram[offset]);
274   COMBINE_DATA(&m_fg_videoram.target()[offset]);
271275   m_fg_tilemap->mark_tile_dirty(offset);
272276}
273277
274278WRITE16_MEMBER(nmg5_state::bg_videoram_w)
275279{
276   COMBINE_DATA(&m_bg_videoram[offset]);
280   COMBINE_DATA(&m_bg_videoram.target()[offset]);
277281   m_bg_tilemap->mark_tile_dirty(offset);
278282}
279283
r14896r14897
282286
283287   if (ACCESSING_BITS_0_7)
284288   {
285      soundlatch_w(space, 0, data & 0xff);
289      soundlatch_byte_w(space, 0, data & 0xff);
286290      device_set_input_line(m_soundcpu, INPUT_LINE_NMI, PULSE_LINE);
287291   }
288292}
r14896r14897
330334static ADDRESS_MAP_START( nmg5_map, AS_PROGRAM, 16, nmg5_state )
331335   AM_RANGE(0x000000, 0x0fffff) AM_ROM
332336   AM_RANGE(0x120000, 0x12ffff) AM_RAM
333   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
334   AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
337   AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
338   AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_SHARE("spriteram")
335339   AM_RANGE(0x180000, 0x180001) AM_WRITE(nmg5_soundlatch_w)
336340   AM_RANGE(0x180002, 0x180003) AM_WRITENOP
337341   AM_RANGE(0x180004, 0x180005) AM_READWRITE(prot_r, prot_w)
r14896r14897
340344   AM_RANGE(0x18000a, 0x18000b) AM_READ_PORT("SYSTEM")
341345   AM_RANGE(0x18000c, 0x18000d) AM_READ_PORT("INPUTS")
342346   AM_RANGE(0x18000e, 0x18000f) AM_WRITE(priority_reg_w)
343   AM_RANGE(0x300002, 0x300009) AM_WRITEONLY AM_BASE(m_scroll_ram)
347   AM_RANGE(0x300002, 0x300009) AM_WRITEONLY AM_SHARE("scroll_ram")
344348   AM_RANGE(0x30000a, 0x30000f) AM_WRITENOP
345   AM_RANGE(0x320000, 0x321fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(m_bg_videoram)
346   AM_RANGE(0x322000, 0x323fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(m_fg_videoram)
347   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(m_bitmap)
349   AM_RANGE(0x320000, 0x321fff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram")
350   AM_RANGE(0x322000, 0x323fff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fg_videoram")
351   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_SHARE("bitmap")
348352ADDRESS_MAP_END
349353
350354static ADDRESS_MAP_START( pclubys_map, AS_PROGRAM, 16, nmg5_state )
351355   AM_RANGE(0x000000, 0x0fffff) AM_ROM
352356   AM_RANGE(0x200000, 0x20ffff) AM_RAM
353   AM_RANGE(0x440000, 0x4407ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
354   AM_RANGE(0x460000, 0x4607ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
357   AM_RANGE(0x440000, 0x4407ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
358   AM_RANGE(0x460000, 0x4607ff) AM_RAM AM_SHARE("spriteram")
355359   AM_RANGE(0x480000, 0x480001) AM_WRITE(nmg5_soundlatch_w)
356360   AM_RANGE(0x480002, 0x480003) AM_WRITENOP
357361   AM_RANGE(0x480004, 0x480005) AM_READWRITE(prot_r, prot_w)
r14896r14897
360364   AM_RANGE(0x48000a, 0x48000b) AM_READ_PORT("SYSTEM")
361365   AM_RANGE(0x48000c, 0x48000d) AM_READ_PORT("INPUTS")
362366   AM_RANGE(0x48000e, 0x48000f) AM_WRITE(priority_reg_w)
363   AM_RANGE(0x500002, 0x500009) AM_WRITEONLY AM_BASE(m_scroll_ram)
364   AM_RANGE(0x520000, 0x521fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(m_bg_videoram)
365   AM_RANGE(0x522000, 0x523fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(m_fg_videoram)
366   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(m_bitmap)
367   AM_RANGE(0x500002, 0x500009) AM_WRITEONLY AM_SHARE("scroll_ram")
368   AM_RANGE(0x520000, 0x521fff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram")
369   AM_RANGE(0x522000, 0x523fff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fg_videoram")
370   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_SHARE("bitmap")
367371ADDRESS_MAP_END
368372
369373/*******************************************************************
r14896r14897
386390   ADDRESS_MAP_GLOBAL_MASK(0xff)
387391   AM_RANGE(0x00, 0x00) AM_DEVWRITE_LEGACY("oki", oki_banking_w)
388392   AM_RANGE(0x10, 0x11) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)
389   AM_RANGE(0x18, 0x18) AM_READ(soundlatch_r)
393   AM_RANGE(0x18, 0x18) AM_READ(soundlatch_byte_r)
390394   AM_RANGE(0x1c, 0x1c) AM_DEVREADWRITE("oki", okim6295_device, read, write)
391395ADDRESS_MAP_END
392396
r14896r14897
862866   {
863867      for (x = 0; x < xxx; x++)
864868      {
865         pix = (state->m_bitmap[count] & 0xf000) >> 12;
869         pix = (state->m_bitmap.target()[count] & 0xf000) >> 12;
866870         if (pix) bitmap.pix16(y + yoff, x * 4 + 0 + xoff) = pix + 0x300;
867         pix = (state->m_bitmap[count] & 0x0f00) >> 8;
871         pix = (state->m_bitmap.target()[count] & 0x0f00) >> 8;
868872         if (pix) bitmap.pix16(y + yoff, x * 4 + 1 + xoff) = pix + 0x300;
869         pix = (state->m_bitmap[count] & 0x00f0) >> 4;
873         pix = (state->m_bitmap.target()[count] & 0x00f0) >> 4;
870874         if (pix) bitmap.pix16(y + yoff, x * 4 + 2 + xoff) = pix + 0x300;
871         pix = (state->m_bitmap[count] & 0x000f) >> 0;
875         pix = (state->m_bitmap.target()[count] & 0x000f) >> 0;
872876         if (pix) bitmap.pix16(y + yoff, x * 4 + 3 + xoff) = pix + 0x300;
873877
874878         count++;
r14896r14897
881885{
882886   nmg5_state *state = screen.machine().driver_data<nmg5_state>();
883887
884   state->m_bg_tilemap->set_scrolly(0, state->m_scroll_ram[3] + 9);
885   state->m_bg_tilemap->set_scrollx(0, state->m_scroll_ram[2] + 3);
886   state->m_fg_tilemap->set_scrolly(0, state->m_scroll_ram[1] + 9);
887   state->m_fg_tilemap->set_scrollx(0, state->m_scroll_ram[0] - 1);
888   state->m_bg_tilemap->set_scrolly(0, state->m_scroll_ram.target()[3] + 9);
889   state->m_bg_tilemap->set_scrollx(0, state->m_scroll_ram.target()[2] + 3);
890   state->m_fg_tilemap->set_scrolly(0, state->m_scroll_ram.target()[1] + 9);
891   state->m_fg_tilemap->set_scrollx(0, state->m_scroll_ram.target()[0] - 1);
888892
889893   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
890894
src/mame/drivers/mario.c
r14896r14897
145145   AM_RANGE(0x7e83, 0x7e83) AM_WRITE(mario_palettebank_w)
146146   AM_RANGE(0x7e84, 0x7e84) AM_WRITE(nmi_mask_w)
147147   AM_RANGE(0x7e85, 0x7e85) AM_DEVWRITE_LEGACY("z80dma", mario_z80dma_rdy_w)   /* ==> DMA Chip */
148   AM_RANGE(0x7f00, 0x7f07) AM_WRITE_LEGACY(mario_sh3_w) /* Sound port */
148   AM_RANGE(0x7f00, 0x7f07) AM_WRITE(mario_sh3_w) /* Sound port */
149149   AM_RANGE(0x7f80, 0x7f80) AM_READ_PORT("DSW")   /* DSW */
150   AM_RANGE(0x7e00, 0x7e00) AM_WRITE_LEGACY(mario_sh_tuneselect_w)
150   AM_RANGE(0x7e00, 0x7e00) AM_WRITE(mario_sh_tuneselect_w)
151151   AM_RANGE(0xf000, 0xffff) AM_ROM
152152ADDRESS_MAP_END
153153
r14896r14897
159159   AM_RANGE(0x7c00, 0x7c00) AM_READ_PORT("IN0")
160160   AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN1")
161161   AM_RANGE(0x7d00, 0x7d00) AM_WRITE(mario_scroll_w)
162   AM_RANGE(0x7e00, 0x7e00) AM_WRITE(soundlatch_w)
162   AM_RANGE(0x7e00, 0x7e00) AM_WRITE(soundlatch_byte_w)
163163   AM_RANGE(0x7e80, 0x7e80) AM_WRITE(mario_gfxbank_w)
164164   AM_RANGE(0x7e82, 0x7e82) AM_WRITE(mario_flip_w)
165165   AM_RANGE(0x7e83, 0x7e83) AM_WRITE(mario_palettebank_w)
166166   AM_RANGE(0x7e84, 0x7e84) AM_WRITE(nmi_mask_w)
167167   AM_RANGE(0x7e85, 0x7e85) AM_DEVWRITE_LEGACY("z80dma", mario_z80dma_rdy_w)   /* ==> DMA Chip */
168   AM_RANGE(0x7f00, 0x7f00) AM_WRITE_LEGACY(masao_sh_irqtrigger_w)
168   AM_RANGE(0x7f00, 0x7f00) AM_WRITE(masao_sh_irqtrigger_w)
169169   AM_RANGE(0x7f80, 0x7f80) AM_READ_PORT("DSW")   /* DSW */
170170   AM_RANGE(0xf000, 0xffff) AM_ROM
171171ADDRESS_MAP_END
src/mame/drivers/xmen.c
r14896r14897
6767
6868READ16_MEMBER(xmen_state::sound_status_r)
6969{
70   return soundlatch2_r(space, 0);
70   return soundlatch2_byte_r(space, 0);
7171}
7272
7373WRITE16_MEMBER(xmen_state::sound_cmd_w)
r14896r14897
7575   if (ACCESSING_BITS_0_7)
7676   {
7777      data &= 0xff;
78      soundlatch_w(space, 0, data);
78      soundlatch_byte_w(space, 0, data);
7979   }
8080}
8181
r14896r14897
112112   AM_RANGE(0x080000, 0x0fffff) AM_ROM
113113   AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE_LEGACY("k053246", k053247_word_r, k053247_word_w)
114114   AM_RANGE(0x101000, 0x101fff) AM_RAM
115   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
115   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
116116   AM_RANGE(0x108000, 0x108001) AM_WRITE(eeprom_w)
117117   AM_RANGE(0x108020, 0x108027) AM_DEVWRITE_LEGACY("k053246", k053246_word_w)
118118   AM_RANGE(0x10804c, 0x10804d) AM_WRITE(sound_cmd_w)
r14896r14897
134134   AM_RANGE(0xc000, 0xdfff) AM_RAM
135135   AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("k054539", k054539_device, read, write)
136136   AM_RANGE(0xe800, 0xe801) AM_MIRROR(0x0400) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
137   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch2_w)
138   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
137   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch2_byte_w)
138   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_byte_r)
139139   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
140140ADDRESS_MAP_END
141141
r14896r14897
147147   AM_RANGE(0x101000, 0x101fff) AM_RAM
148148   AM_RANGE(0x102000, 0x102fff) AM_RAM AM_BASE(m_xmen6p_spriteramright)   /* sprites (screen 2) */
149149   AM_RANGE(0x103000, 0x103fff) AM_RAM      /* 6p - a buffer? */
150   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
150   AM_RANGE(0x104000, 0x104fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
151151   AM_RANGE(0x108000, 0x108001) AM_WRITE(eeprom_w)
152152   AM_RANGE(0x108020, 0x108027) AM_DEVWRITE_LEGACY("k053246", k053246_word_w) /* sprites */
153153   AM_RANGE(0x10804c, 0x10804d) AM_WRITE(sound_cmd_w)
src/mame/drivers/wink.c
r14896r14897
2121{
2222public:
2323   wink_state(const machine_config &mconfig, device_type type, const char *tag)
24      : driver_device(mconfig, type, tag) { }
24      : driver_device(mconfig, type, tag) ,
25      m_videoram(*this, "videoram"){ }
2526
26   UINT8 *m_videoram;
27   required_shared_ptr<UINT8> m_videoram;
2728   tilemap_t *m_bg_tilemap;
2829   UINT8 m_sound_flag;
2930   UINT8 m_tile_bank;
r14896r14897
4243static TILE_GET_INFO( get_bg_tile_info )
4344{
4445   wink_state *state = machine.driver_data<wink_state>();
45   UINT8 *videoram = state->m_videoram;
46   UINT8 *videoram = state->m_videoram.target();
4647   int code = videoram[tile_index];
4748   code |= 0x200 * state->m_tile_bank;
4849
r14896r14897
7071
7172WRITE8_MEMBER(wink_state::bgram_w)
7273{
73   UINT8 *videoram = m_videoram;
74   UINT8 *videoram = m_videoram.target();
7475   videoram[offset] = data;
7576   m_bg_tilemap->mark_tile_dirty(offset);
7677}
r14896r14897
113114   AM_RANGE(0x0000, 0x7fff) AM_ROM
114115   AM_RANGE(0x8000, 0x87ff) AM_RAM
115116   AM_RANGE(0x9000, 0x97ff) AM_RAM   AM_SHARE("nvram")
116   AM_RANGE(0xa000, 0xa3ff) AM_RAM_WRITE(bgram_w) AM_BASE(m_videoram)
117   AM_RANGE(0xa000, 0xa3ff) AM_RAM_WRITE(bgram_w) AM_SHARE("videoram")
117118ADDRESS_MAP_END
118119
119120
r14896r14897
144145
145146static ADDRESS_MAP_START( wink_io, AS_IO, 8, wink_state )
146147   ADDRESS_MAP_GLOBAL_MASK(0xff)
147   AM_RANGE(0x00, 0x1f) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_le_w) AM_SHARE("paletteram") //0x10-0x1f is likely to be something else
148   AM_RANGE(0x00, 0x1f) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_le_w) AM_SHARE("paletteram") //0x10-0x1f is likely to be something else
148149//  AM_RANGE(0x20, 0x20) AM_WRITENOP                //??? seems unused..
149150   AM_RANGE(0x21, 0x21) AM_WRITE(player_mux_w)      //??? no mux on the pcb.
150151   AM_RANGE(0x22, 0x22) AM_WRITE(tile_banking_w)
151152//  AM_RANGE(0x23, 0x23) AM_WRITENOP                //?
152153//  AM_RANGE(0x24, 0x24) AM_WRITENOP                //cab Knocker like in q-bert!
153154   AM_RANGE(0x25, 0x27) AM_WRITE(wink_coin_counter_w)
154   AM_RANGE(0x40, 0x40) AM_WRITE(soundlatch_w)
155   AM_RANGE(0x40, 0x40) AM_WRITE(soundlatch_byte_w)
155156   AM_RANGE(0x60, 0x60) AM_WRITE(sound_irq_w)
156157   AM_RANGE(0x80, 0x80) AM_READ(analog_port_r)
157158   AM_RANGE(0xa0, 0xa0) AM_READ(player_inputs_r)
r14896r14897
168169static ADDRESS_MAP_START( wink_sound_map, AS_PROGRAM, 8, wink_state )
169170   AM_RANGE(0x0000, 0x1fff) AM_ROM
170171   AM_RANGE(0x4000, 0x43ff) AM_RAM
171   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r)
172   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_byte_r)
172173ADDRESS_MAP_END
173174
174175static ADDRESS_MAP_START( wink_sound_io, AS_IO, 8, wink_state )
src/mame/drivers/lethal.c
r14896r14897
213213
214214WRITE8_MEMBER(lethal_state::sound_cmd_w)
215215{
216   soundlatch_w(space, 0, data);
216   soundlatch_byte_w(space, 0, data);
217217}
218218
219219WRITE8_MEMBER(lethal_state::sound_irq_w)
r14896r14897
326326
327327   if (m_cur_control2 & 0x10)   // RAM enable
328328   {
329      paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset, data);
329      paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
330330   }
331331   else
332332   {
r14896r14897
417417// use one more palette entry for the BG color
418418WRITE8_MEMBER(lethal_state::le_bgcolor_w)
419419{
420   paletteram_xBBBBBGGGGGRRRRR_be_w(space, 0x3800 + offset, data);
420   paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, 0x3800 + offset, data);
421421}
422422
423423READ8_MEMBER(lethal_state::guns_r)
r14896r14897
479479   AM_RANGE(0x0000, 0xefff) AM_ROM
480480   AM_RANGE(0xf000, 0xf7ff) AM_RAM
481481   AM_RANGE(0xf800, 0xfa2f) AM_DEVREADWRITE("k054539", k054539_device, read, write)
482   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_w)
483   AM_RANGE(0xfc02, 0xfc02) AM_READ(soundlatch_r)
482   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_byte_w)
483   AM_RANGE(0xfc02, 0xfc02) AM_READ(soundlatch_byte_r)
484484   AM_RANGE(0xfc03, 0xfc03) AM_READNOP
485485ADDRESS_MAP_END
486486
src/mame/drivers/exprraid.c
r14896r14897
232232
233233WRITE8_MEMBER(exprraid_state::sound_cpu_command_w)
234234{
235   soundlatch_w(space, 0, data);
235   soundlatch_byte_w(space, 0, data);
236236   device_set_input_line(m_slave, INPUT_LINE_NMI, PULSE_LINE);
237237}
238238
r14896r14897
272272   AM_RANGE(0x0000, 0x1fff) AM_RAM
273273   AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE_LEGACY("ym1", ym2203_r, ym2203_w)
274274   AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE_LEGACY("ym2", ym3526_r, ym3526_w)
275   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
275   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
276276   AM_RANGE(0x8000, 0xffff) AM_ROM
277277ADDRESS_MAP_END
278278
src/mame/drivers/tecmo16.c
r14896r14897
3636{
3737   if (ACCESSING_BITS_0_7)
3838   {
39      soundlatch_w(space, 0x00, data & 0xff);
39      soundlatch_byte_w(space, 0x00, data & 0xff);
4040      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
4141   }
4242}
r14896r14897
5353   AM_RANGE(0x121800, 0x121fff) AM_RAM_WRITE(tecmo16_colorram2_w) AM_BASE(m_colorram2)
5454   AM_RANGE(0x122000, 0x127fff) AM_RAM   /* work area */
5555   AM_RANGE(0x130000, 0x130fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
56   AM_RANGE(0x140000, 0x141fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
56   AM_RANGE(0x140000, 0x141fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
5757   AM_RANGE(0x150000, 0x150001) AM_WRITE(tecmo16_flipscreen_w)
5858   AM_RANGE(0x150010, 0x150011) AM_WRITE(tecmo16_sound_command_w)
5959   AM_RANGE(0x150030, 0x150031) AM_READ_PORT("DSW2") AM_WRITENOP   /* ??? */
r14896r14897
7676   AM_RANGE(0x123000, 0x123fff) AM_RAM_WRITE(tecmo16_colorram2_w) AM_BASE(m_colorram2)
7777   AM_RANGE(0x124000, 0x124fff) AM_RAM   /* extra RAM for Riot */
7878   AM_RANGE(0x130000, 0x130fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
79   AM_RANGE(0x140000, 0x141fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
79   AM_RANGE(0x140000, 0x141fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
8080   AM_RANGE(0x150000, 0x150001) AM_WRITE(tecmo16_flipscreen_w)
8181   AM_RANGE(0x150010, 0x150011) AM_WRITE(tecmo16_sound_command_w)
8282   AM_RANGE(0x150020, 0x150021) AM_READ_PORT("EXTRA") AM_WRITENOP   /* ??? */
r14896r14897
9696   AM_RANGE(0xf000, 0xfbff) AM_RAM   /* Sound RAM */
9797   AM_RANGE(0xfc00, 0xfc00) AM_DEVREADWRITE("oki", okim6295_device, read, write)
9898   AM_RANGE(0xfc04, 0xfc05) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
99   AM_RANGE(0xfc08, 0xfc08) AM_READ(soundlatch_r)
99   AM_RANGE(0xfc08, 0xfc08) AM_READ(soundlatch_byte_r)
100100   AM_RANGE(0xfc0c, 0xfc0c) AM_NOP
101101   AM_RANGE(0xfffe, 0xffff) AM_RAM
102102ADDRESS_MAP_END
src/mame/drivers/2mindril.c
r14896r14897
207207   AM_RANGE(0x430000, 0x43ffff) AM_READWRITE(f3_pivot_r,f3_pivot_w)
208208   AM_RANGE(0x460000, 0x46000f) AM_WRITE(f3_control_0_w)
209209   AM_RANGE(0x460010, 0x46001f) AM_WRITE(f3_control_1_w)
210   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
210   AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
211211   AM_RANGE(0x502022, 0x502023) AM_WRITENOP //countinously switches between 0 and 2
212212   AM_RANGE(0x600000, 0x600007) AM_DEVREADWRITE8_LEGACY("ymsnd", ym2610_r, ym2610_w, 0x00ff)
213213   AM_RANGE(0x60000c, 0x60000d) AM_READWRITE(drill_irq_r,drill_irq_w)
src/mame/drivers/corona.c
r14896r14897
486486
487487WRITE8_MEMBER(corona_state::sound_latch_w)
488488{
489   soundlatch_w(space, 0, data & 0xff);
489   soundlatch_byte_w(space, 0, data & 0xff);
490490   cputag_set_input_line(machine(), "soundcpu", 0, ASSERT_LINE);
491491}
492492
493493READ8_MEMBER(corona_state::sound_latch_r)
494494{
495495   cputag_set_input_line(machine(), "soundcpu", 0, CLEAR_LINE);
496   return soundlatch_r(space, 0);
496   return soundlatch_byte_r(space, 0);
497497}
498498
499499
src/mame/drivers/taitowlf.c
r14896r14897
6060   device_t   *m_pic8259_2;
6161   device_t   *m_dma8237_1;
6262   device_t   *m_dma8237_2;
63   DECLARE_WRITE32_MEMBER(pnp_config_w);
64   DECLARE_WRITE32_MEMBER(pnp_data_w);
65   DECLARE_WRITE32_MEMBER(bios_ram_w);
66   DECLARE_READ8_MEMBER(at_page8_r);
67   DECLARE_WRITE8_MEMBER(at_page8_w);
68   DECLARE_READ8_MEMBER(pc_dma_read_byte);
69   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
6370};
6471
6572#if !ENABLE_VGA
r14896r14897
262269}
263270
264271// ISA Plug-n-Play
265static WRITE32_HANDLER( pnp_config_w )
272WRITE32_MEMBER(taitowlf_state::pnp_config_w)
266273{
267274   if (ACCESSING_BITS_8_15)
268275   {
r14896r14897
270277   }
271278}
272279
273static WRITE32_HANDLER( pnp_data_w )
280WRITE32_MEMBER(taitowlf_state::pnp_data_w)
274281{
275282   if (ACCESSING_BITS_8_15)
276283   {
r14896r14897
303310
304311
305312
306static WRITE32_HANDLER(bios_ram_w)
313WRITE32_MEMBER(taitowlf_state::bios_ram_w)
307314{
308   taitowlf_state *state = space->machine().driver_data<taitowlf_state>();
309   if (state->m_mxtc_config_reg[0x59] & 0x20)      // write to RAM if this region is write-enabled
315   if (m_mxtc_config_reg[0x59] & 0x20)      // write to RAM if this region is write-enabled
310316   {
311      COMBINE_DATA(state->m_bios_ram + offset);
317      COMBINE_DATA(m_bios_ram + offset);
312318   }
313319}
314320
r14896r14897
321327
322328
323329
324static READ8_HANDLER(at_page8_r)
330READ8_MEMBER(taitowlf_state::at_page8_r)
325331{
326   taitowlf_state *state = space->machine().driver_data<taitowlf_state>();
327   UINT8 data = state->m_at_pages[offset % 0x10];
332   UINT8 data = m_at_pages[offset % 0x10];
328333
329334   switch(offset % 8)
330335   {
331336   case 1:
332      data = state->m_dma_offset[(offset / 8) & 1][2];
337      data = m_dma_offset[(offset / 8) & 1][2];
333338      break;
334339   case 2:
335      data = state->m_dma_offset[(offset / 8) & 1][3];
340      data = m_dma_offset[(offset / 8) & 1][3];
336341      break;
337342   case 3:
338      data = state->m_dma_offset[(offset / 8) & 1][1];
343      data = m_dma_offset[(offset / 8) & 1][1];
339344      break;
340345   case 7:
341      data = state->m_dma_offset[(offset / 8) & 1][0];
346      data = m_dma_offset[(offset / 8) & 1][0];
342347      break;
343348   }
344349   return data;
345350}
346351
347352
348static WRITE8_HANDLER(at_page8_w)
353WRITE8_MEMBER(taitowlf_state::at_page8_w)
349354{
350   taitowlf_state *state = space->machine().driver_data<taitowlf_state>();
351   state->m_at_pages[offset % 0x10] = data;
355   m_at_pages[offset % 0x10] = data;
352356
353357   switch(offset % 8)
354358   {
355359   case 1:
356      state->m_dma_offset[(offset / 8) & 1][2] = data;
360      m_dma_offset[(offset / 8) & 1][2] = data;
357361      break;
358362   case 2:
359      state->m_dma_offset[(offset / 8) & 1][3] = data;
363      m_dma_offset[(offset / 8) & 1][3] = data;
360364      break;
361365   case 3:
362      state->m_dma_offset[(offset / 8) & 1][1] = data;
366      m_dma_offset[(offset / 8) & 1][1] = data;
363367      break;
364368   case 7:
365      state->m_dma_offset[(offset / 8) & 1][0] = data;
369      m_dma_offset[(offset / 8) & 1][0] = data;
366370      break;
367371   }
368372}
r14896r14897
377381}
378382
379383
380static READ8_HANDLER( pc_dma_read_byte )
384READ8_MEMBER(taitowlf_state::pc_dma_read_byte)
381385{
382   taitowlf_state *state = space->machine().driver_data<taitowlf_state>();
383   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
386   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
384387      & 0xFF0000;
385388
386   return space->read_byte(page_offset + offset);
389   return space.read_byte(page_offset + offset);
387390}
388391
389392
390static WRITE8_HANDLER( pc_dma_write_byte )
393WRITE8_MEMBER(taitowlf_state::pc_dma_write_byte)
391394{
392   taitowlf_state *state = space->machine().driver_data<taitowlf_state>();
393   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
395   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
394396      & 0xFF0000;
395397
396   space->write_byte(page_offset + offset, data);
398   space.write_byte(page_offset + offset, data);
397399}
398400
399401
r14896r14897
425427{
426428   DEVCB_LINE(pc_dma_hrq_changed),
427429   DEVCB_NULL,
428   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
429   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
430   DEVCB_DRIVER_MEMBER(taitowlf_state, pc_dma_read_byte),
431   DEVCB_DRIVER_MEMBER(taitowlf_state, pc_dma_write_byte),
430432   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
431433   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
432434   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
443445   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }
444446};
445447
446static READ32_HANDLER(at_page32_r)
447{
448   return read32le_with_read8_handler(at_page8_r, space, offset, mem_mask);
449}
450
451
452static WRITE32_HANDLER(at_page32_w)
453{
454   write32le_with_write8_handler(at_page8_w, space, offset, data, mem_mask);
455}
456
457
458448/*****************************************************************************/
459449
460450static ADDRESS_MAP_START( taitowlf_map, AS_PROGRAM, 32, taitowlf_state )
r14896r14897
467457   #endif
468458   AM_RANGE(0x000e0000, 0x000effff) AM_RAM
469459   AM_RANGE(0x000f0000, 0x000fffff) AM_ROMBANK("bank1")
470   AM_RANGE(0x000f0000, 0x000fffff) AM_WRITE_LEGACY(bios_ram_w)
460   AM_RANGE(0x000f0000, 0x000fffff) AM_WRITE(bios_ram_w)
471461   AM_RANGE(0x00100000, 0x01ffffff) AM_RAM
472462   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user1", 0)   /* System BIOS */
473463ADDRESS_MAP_END
r14896r14897
478468   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
479469   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
480470   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
481   AM_RANGE(0x0080, 0x009f) AM_READWRITE_LEGACY(at_page32_r,            at_page32_w)
471   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,            at_page8_w, 0xffffffff)
482472   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
483473   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
484474   AM_RANGE(0x00e8, 0x00eb) AM_NOP
485475   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
486476   AM_RANGE(0x0300, 0x03af) AM_NOP
487477   AM_RANGE(0x03b0, 0x03df) AM_NOP
488   AM_RANGE(0x0278, 0x027b) AM_WRITE_LEGACY(pnp_config_w)
478   AM_RANGE(0x0278, 0x027b) AM_WRITE(pnp_config_w)
489479   AM_RANGE(0x03f0, 0x03ff) AM_DEVREADWRITE_LEGACY("ide", fdc_r, fdc_w)
490   AM_RANGE(0x0a78, 0x0a7b) AM_WRITE_LEGACY(pnp_data_w)
480   AM_RANGE(0x0a78, 0x0a7b) AM_WRITE(pnp_data_w)
491481   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE_LEGACY("pcibus", pci_32le_r,   pci_32le_w)
492482ADDRESS_MAP_END
493483
src/mame/drivers/taitogn.c
r14896r14897
357357
358358   UINT32 m_coin_info;
359359   UINT32 m_mux_data;
360   DECLARE_WRITE32_MEMBER(rf5c296_io_w);
361   DECLARE_READ32_MEMBER(rf5c296_io_r);
362   DECLARE_READ32_MEMBER(rf5c296_mem_r);
363   DECLARE_WRITE32_MEMBER(rf5c296_mem_w);
364   DECLARE_READ32_MEMBER(flash_subbios_r);
365   DECLARE_WRITE32_MEMBER(flash_subbios_w);
366   DECLARE_READ32_MEMBER(flash_mn102_r);
367   DECLARE_WRITE32_MEMBER(flash_mn102_w);
368   DECLARE_READ32_MEMBER(flash_s1_r);
369   DECLARE_WRITE32_MEMBER(flash_s1_w);
370   DECLARE_READ32_MEMBER(flash_s2_r);
371   DECLARE_WRITE32_MEMBER(flash_s2_w);
372   DECLARE_READ32_MEMBER(flash_s3_r);
373   DECLARE_WRITE32_MEMBER(flash_s3_w);
374   DECLARE_READ32_MEMBER(control_r);
375   DECLARE_WRITE32_MEMBER(control_w);
376   DECLARE_WRITE32_MEMBER(control2_w);
377   DECLARE_READ32_MEMBER(control3_r);
378   DECLARE_WRITE32_MEMBER(control3_w);
379   DECLARE_READ32_MEMBER(gn_1fb70000_r);
380   DECLARE_WRITE32_MEMBER(gn_1fb70000_w);
381   DECLARE_READ32_MEMBER(hack1_r);
382   DECLARE_READ32_MEMBER(znsecsel_r);
383   DECLARE_WRITE32_MEMBER(znsecsel_w);
384   DECLARE_READ32_MEMBER(boardconfig_r);
385   DECLARE_WRITE32_MEMBER(coin_w);
386   DECLARE_READ32_MEMBER(coin_r);
387   DECLARE_READ32_MEMBER(gnet_mahjong_panel_r);
360388};
361389
362390
r14896r14897
390418   return 0x00;
391419}
392420
393static WRITE32_HANDLER(rf5c296_io_w)
421WRITE32_MEMBER(taitogn_state::rf5c296_io_w)
394422{
395   taitogn_state *state = space->machine().driver_data<taitogn_state>();
396423
397424   if(offset < 2) {
398      ide_controller32_pcmcia_w(space->machine().device(":card"), offset, data, mem_mask);
425      ide_controller32_pcmcia_w(machine().device(":card"), offset, data, mem_mask);
399426      return;
400427   }
401428
402429   if(offset == 0x3e0/4) {
403430      if(ACCESSING_BITS_0_7)
404         state->m_rf5c296_reg = data;
431         m_rf5c296_reg = data;
405432      if(ACCESSING_BITS_8_15)
406         rf5c296_reg_w(space->machine(), state->m_rf5c296_reg, data >> 8);
433         rf5c296_reg_w(machine(), m_rf5c296_reg, data >> 8);
407434   }
408435}
409436
410static READ32_HANDLER(rf5c296_io_r)
437READ32_MEMBER(taitogn_state::rf5c296_io_r)
411438{
412   taitogn_state *state = space->machine().driver_data<taitogn_state>();
413439
414440   if(offset < 2)
415      return ide_controller32_pcmcia_r(space->machine().device(":card"), offset, mem_mask);
441      return ide_controller32_pcmcia_r(machine().device(":card"), offset, mem_mask);
416442
417443   offset *= 4;
418444
419445   if(offset == 0x3e0/4) {
420446      UINT32 res = 0xffff0000;
421447      if(ACCESSING_BITS_0_7)
422         res |= state->m_rf5c296_reg;
448         res |= m_rf5c296_reg;
423449      if(ACCESSING_BITS_8_15)
424         res |= rf5c296_reg_r(space->machine(), state->m_rf5c296_reg) << 8;
450         res |= rf5c296_reg_r(machine(), m_rf5c296_reg) << 8;
425451      return res;
426452   }
427453
r14896r14897
430456
431457// Hardcoded to reach the pcmcia CIS
432458
433static READ32_HANDLER(rf5c296_mem_r)
459READ32_MEMBER(taitogn_state::rf5c296_mem_r)
434460{
435   taitogn_state *state = space->machine().driver_data<taitogn_state>();
436461
437462   if(offset < 0x80)
438      return (state->m_cis[offset*2+1] << 16) | state->m_cis[offset*2];
463      return (m_cis[offset*2+1] << 16) | m_cis[offset*2];
439464
440465   switch(offset) {
441466   case 0x080: return 0x00800041;
442467   case 0x081: return 0x0000002e;
443   case 0x100: return state->m_locked ? 0x00010000 : 0;
468   case 0x100: return m_locked ? 0x00010000 : 0;
444469   default:
445470      return 0;
446471   }
447472}
448473
449static WRITE32_HANDLER(rf5c296_mem_w)
474WRITE32_MEMBER(taitogn_state::rf5c296_mem_w)
450475{
451   taitogn_state *state = space->machine().driver_data<taitogn_state>();
452476
453477   if(offset >= 0x140 && offset <= 0x144) {
454478      dynamic_buffer key;
r14896r14897
460484         pos++;
461485      } else
462486         v = data;
463      get_disk_handle(space->machine(), ":drive_0")->read_metadata(HARD_DISK_KEY_METADATA_TAG, 0, key);
487      get_disk_handle(machine(), ":drive_0")->read_metadata(HARD_DISK_KEY_METADATA_TAG, 0, key);
464488      k = pos < key.count() ? key[pos] : 0;
465489      if(v == k)
466         state->m_locked &= ~(1 << pos);
490         m_locked &= ~(1 << pos);
467491      else
468         state->m_locked |= 1 << pos;
469      if (!state->m_locked) {
470         ide_set_gnet_readlock (space->machine().device(":card"), 0);
492         m_locked |= 1 << pos;
493      if (!m_locked) {
494         ide_set_gnet_readlock (machine().device(":card"), 0);
471495      }
472496   }
473497}
r14896r14897
496520}
497521
498522
499static READ32_HANDLER(flash_subbios_r)
523READ32_MEMBER(taitogn_state::flash_subbios_r)
500524{
501   taitogn_state *state = space->machine().driver_data<taitogn_state>();
502525
503   return gen_flash_r(state->m_biosflash, offset, mem_mask);
526   return gen_flash_r(m_biosflash, offset, mem_mask);
504527}
505528
506static WRITE32_HANDLER(flash_subbios_w)
529WRITE32_MEMBER(taitogn_state::flash_subbios_w)
507530{
508   taitogn_state *state = space->machine().driver_data<taitogn_state>();
509531
510   gen_flash_w(state->m_biosflash, offset, data, mem_mask);
532   gen_flash_w(m_biosflash, offset, data, mem_mask);
511533}
512534
513static READ32_HANDLER(flash_mn102_r)
535READ32_MEMBER(taitogn_state::flash_mn102_r)
514536{
515   taitogn_state *state = space->machine().driver_data<taitogn_state>();
516537
517   return gen_flash_r(state->m_pgmflash, offset, mem_mask);
538   return gen_flash_r(m_pgmflash, offset, mem_mask);
518539}
519540
520static WRITE32_HANDLER(flash_mn102_w)
541WRITE32_MEMBER(taitogn_state::flash_mn102_w)
521542{
522   taitogn_state *state = space->machine().driver_data<taitogn_state>();
523543
524   gen_flash_w(state->m_pgmflash, offset, data, mem_mask);
544   gen_flash_w(m_pgmflash, offset, data, mem_mask);
525545}
526546
527static READ32_HANDLER(flash_s1_r)
547READ32_MEMBER(taitogn_state::flash_s1_r)
528548{
529   taitogn_state *state = space->machine().driver_data<taitogn_state>();
530549
531   return gen_flash_r(state->m_sndflash[0], offset, mem_mask);
550   return gen_flash_r(m_sndflash[0], offset, mem_mask);
532551}
533552
534static WRITE32_HANDLER(flash_s1_w)
553WRITE32_MEMBER(taitogn_state::flash_s1_w)
535554{
536   taitogn_state *state = space->machine().driver_data<taitogn_state>();
537555
538   gen_flash_w(state->m_sndflash[0], offset, data, mem_mask);
556   gen_flash_w(m_sndflash[0], offset, data, mem_mask);
539557}
540558
541static READ32_HANDLER(flash_s2_r)
559READ32_MEMBER(taitogn_state::flash_s2_r)
542560{
543   taitogn_state *state = space->machine().driver_data<taitogn_state>();
544561
545   return gen_flash_r(state->m_sndflash[1], offset, mem_mask);
562   return gen_flash_r(m_sndflash[1], offset, mem_mask);
546563}
547564
548static WRITE32_HANDLER(flash_s2_w)
565WRITE32_MEMBER(taitogn_state::flash_s2_w)
549566{
550   taitogn_state *state = space->machine().driver_data<taitogn_state>();
551567
552   gen_flash_w(state->m_sndflash[1], offset, data, mem_mask);
568   gen_flash_w(m_sndflash[1], offset, data, mem_mask);
553569}
554570
555static READ32_HANDLER(flash_s3_r)
571READ32_MEMBER(taitogn_state::flash_s3_r)
556572{
557   taitogn_state *state = space->machine().driver_data<taitogn_state>();
558573
559   return gen_flash_r(state->m_sndflash[2], offset, mem_mask);
574   return gen_flash_r(m_sndflash[2], offset, mem_mask);
560575}
561576
562static WRITE32_HANDLER(flash_s3_w)
577WRITE32_MEMBER(taitogn_state::flash_s3_w)
563578{
564   taitogn_state *state = space->machine().driver_data<taitogn_state>();
565579
566   gen_flash_w(state->m_sndflash[2], offset, data, mem_mask);
580   gen_flash_w(m_sndflash[2], offset, data, mem_mask);
567581}
568582
569583static void install_handlers(running_machine &machine, int mode)
570584{
585   taitogn_state *state = machine.driver_data<taitogn_state>();
571586   address_space *a = machine.device("maincpu")->memory().space(AS_PROGRAM);
572587   if(mode == 0) {
573588      // Mode 0 has access to the subbios, the mn102 flash and the rf5c296 mem zone
574      a->install_legacy_readwrite_handler(0x1f000000, 0x1f1fffff, FUNC(flash_subbios_r), FUNC(flash_subbios_w));
575      a->install_legacy_readwrite_handler(0x1f200000, 0x1f2fffff, FUNC(rf5c296_mem_r), FUNC(rf5c296_mem_w));
576      a->install_legacy_readwrite_handler(0x1f300000, 0x1f37ffff, FUNC(flash_mn102_r), FUNC(flash_mn102_w));
589      a->install_readwrite_handler(0x1f000000, 0x1f1fffff, read32_delegate(FUNC(taitogn_state::flash_subbios_r),state), write32_delegate(FUNC(taitogn_state::flash_subbios_w),state));
590      a->install_readwrite_handler(0x1f200000, 0x1f2fffff, read32_delegate(FUNC(taitogn_state::rf5c296_mem_r),state), write32_delegate(FUNC(taitogn_state::rf5c296_mem_w),state));
591      a->install_readwrite_handler(0x1f300000, 0x1f37ffff, read32_delegate(FUNC(taitogn_state::flash_mn102_r),state), write32_delegate(FUNC(taitogn_state::flash_mn102_w),state));
577592      a->nop_readwrite(0x1f380000, 0x1f5fffff);
578593
579594   } else {
580595      // Mode 1 has access to the 3 samples flashes
581      a->install_legacy_readwrite_handler(0x1f000000, 0x1f1fffff, FUNC(flash_s1_r), FUNC(flash_s1_w));
582      a->install_legacy_readwrite_handler(0x1f200000, 0x1f3fffff, FUNC(flash_s2_r), FUNC(flash_s2_w));
583      a->install_legacy_readwrite_handler(0x1f400000, 0x1f5fffff, FUNC(flash_s3_r), FUNC(flash_s3_w));
596      a->install_readwrite_handler(0x1f000000, 0x1f1fffff, read32_delegate(FUNC(taitogn_state::flash_s1_r),state), write32_delegate(FUNC(taitogn_state::flash_s1_w),state));
597      a->install_readwrite_handler(0x1f200000, 0x1f3fffff, read32_delegate(FUNC(taitogn_state::flash_s2_r),state), write32_delegate(FUNC(taitogn_state::flash_s2_w),state));
598      a->install_readwrite_handler(0x1f400000, 0x1f5fffff, read32_delegate(FUNC(taitogn_state::flash_s3_r),state), write32_delegate(FUNC(taitogn_state::flash_s3_w),state));
584599   }
585600}
586601
587602// Misc. controls
588603
589static READ32_HANDLER(control_r)
604READ32_MEMBER(taitogn_state::control_r)
590605{
591   taitogn_state *state = space->machine().driver_data<taitogn_state>();
592606
593   //      fprintf(stderr, "gn_r %08x @ %08x (%s)\n", 0x1fb00000+4*offset, mem_mask, space->machine().describe_context());
594   return state->m_control;
607   //      fprintf(stderr, "gn_r %08x @ %08x (%s)\n", 0x1fb00000+4*offset, mem_mask, machine().describe_context());
608   return m_control;
595609}
596610
597static WRITE32_HANDLER(control_w)
611WRITE32_MEMBER(taitogn_state::control_w)
598612{
599   taitogn_state *state = space->machine().driver_data<taitogn_state>();
600613
601614   // 20 = watchdog
602615   // 04 = select bank
r14896r14897
604617   // According to the rom code, bits 1-0 may be part of the bank
605618   // selection too, but they're always 0.
606619
607   UINT32 p = state->m_control;
608   device_t *mb3773 = space->machine().device("mb3773");
620   UINT32 p = m_control;
621   device_t *mb3773 = machine().device("mb3773");
609622
610   COMBINE_DATA(&state->m_control);
623   COMBINE_DATA(&m_control);
611624
612   mb3773_set_ck(mb3773, (state->m_control & 0x20) >> 5);
625   mb3773_set_ck(mb3773, (m_control & 0x20) >> 5);
613626
614627#if 0
615628   if((p ^ control) & ~0x20)
r14896r14897
621634            control & 0x04 ? 'f' : '-',
622635            control & 0x02 ? '1' : '0',
623636            control & 0x01 ? '1' : '0',
624            space->machine().describe_context());
637            machine().describe_context());
625638#endif
626639
627   if((p ^ state->m_control) & 0x04)
628      install_handlers(space->machine(), state->m_control & 4 ? 1 : 0);
640   if((p ^ m_control) & 0x04)
641      install_handlers(machine(), m_control & 4 ? 1 : 0);
629642}
630643
631static WRITE32_HANDLER(control2_w)
644WRITE32_MEMBER(taitogn_state::control2_w)
632645{
633   taitogn_state *state = space->machine().driver_data<taitogn_state>();
634646
635   COMBINE_DATA(&state->m_control2);
647   COMBINE_DATA(&m_control2);
636648}
637649
638static READ32_HANDLER(control3_r)
650READ32_MEMBER(taitogn_state::control3_r)
639651{
640   taitogn_state *state = space->machine().driver_data<taitogn_state>();
641652
642   return state->m_control3;
653   return m_control3;
643654}
644655
645static WRITE32_HANDLER(control3_w)
656WRITE32_MEMBER(taitogn_state::control3_w)
646657{
647   taitogn_state *state = space->machine().driver_data<taitogn_state>();
648658
649   COMBINE_DATA(&state->m_control3);
659   COMBINE_DATA(&m_control3);
650660}
651661
652static READ32_HANDLER(gn_1fb70000_r)
662READ32_MEMBER(taitogn_state::gn_1fb70000_r)
653663{
654664   // (1328) 1348 tests mask 0002, 8 times.
655665   // Called by 1434, exit at 143c
r14896r14897
661671   return 2;
662672}
663673
664static WRITE32_HANDLER(gn_1fb70000_w)
674WRITE32_MEMBER(taitogn_state::gn_1fb70000_w)
665675{
666676   // Writes 0 or 1 all the time, it *may* have somthing to do with
667677   // i/o port width, but then maybe not
668678}
669679
670static READ32_HANDLER(hack1_r)
680READ32_MEMBER(taitogn_state::hack1_r)
671681{
672   taitogn_state *state = space->machine().driver_data<taitogn_state>();
673682
674   state->m_v = state->m_v ^ 8;
683   m_v = m_v ^ 8;
675684   // Probably something to do with sound
676   return state->m_v;
685   return m_v;
677686}
678687
679688
r14896r14897
683692static const UINT8 tt10[ 8 ] = { 0x80, 0x20, 0x38, 0x08, 0xf1, 0x03, 0xfe, 0xfc };
684693static const UINT8 tt16[ 8 ] = { 0xc0, 0x04, 0xf9, 0xe1, 0x60, 0x70, 0xf2, 0x02 };
685694
686static READ32_HANDLER( znsecsel_r )
695READ32_MEMBER(taitogn_state::znsecsel_r)
687696{
688   taitogn_state *state = space->machine().driver_data<taitogn_state>();
689697
690   return state->m_n_znsecsel;
698   return m_n_znsecsel;
691699}
692700
693701static void sio_znsec0_handler( running_machine &machine, int n_data )
r14896r14897
759767   }
760768}
761769
762static WRITE32_HANDLER( znsecsel_w )
770WRITE32_MEMBER(taitogn_state::znsecsel_w)
763771{
764   taitogn_state *state = space->machine().driver_data<taitogn_state>();
765772
766   COMBINE_DATA( &state->m_n_znsecsel );
773   COMBINE_DATA( &m_n_znsecsel );
767774
768   if( ( state->m_n_znsecsel & 0x80 ) == 0 )
775   if( ( m_n_znsecsel & 0x80 ) == 0 )
769776        {
770         psx_sio_install_handler( space->machine(), 0, sio_pad_handler );
771         psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
777         psx_sio_install_handler( machine(), 0, sio_pad_handler );
778         psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
772779        }
773   else if( ( state->m_n_znsecsel & 0x08 ) == 0 )
780   else if( ( m_n_znsecsel & 0x08 ) == 0 )
774781        {
775782         znsec_start( 1 );
776         psx_sio_install_handler( space->machine(), 0, sio_znsec1_handler );
777         psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
783         psx_sio_install_handler( machine(), 0, sio_znsec1_handler );
784         psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
778785        }
779   else if( ( state->m_n_znsecsel & 0x04 ) == 0 )
786   else if( ( m_n_znsecsel & 0x04 ) == 0 )
780787        {
781788         znsec_start( 0 );
782         psx_sio_install_handler( space->machine(), 0, sio_znsec0_handler );
783         psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
789         psx_sio_install_handler( machine(), 0, sio_znsec0_handler );
790         psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
784791        }
785792   else
786793        {
787         state->m_n_dip_bit = 0;
788         state->m_b_lastclock = 1;
794         m_n_dip_bit = 0;
795         m_b_lastclock = 1;
789796
790         psx_sio_install_handler( space->machine(), 0, sio_dip_handler );
791         psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
797         psx_sio_install_handler( machine(), 0, sio_dip_handler );
798         psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
792799
793         state->m_dip_timer->adjust( downcast<cpu_device *>(&space->device())->cycles_to_attotime( 100 ), 1 );
800         m_dip_timer->adjust( downcast<cpu_device *>(&space.device())->cycles_to_attotime( 100 ), 1 );
794801        }
795802}
796803
r14896r14897
807814}
808815
809816
810static READ32_HANDLER( boardconfig_r )
817READ32_MEMBER(taitogn_state::boardconfig_r)
811818{
812819   /*
813820    ------00 mem=4M
r14896r14897
832839}
833840
834841
835static WRITE32_HANDLER( coin_w )
842WRITE32_MEMBER(taitogn_state::coin_w)
836843{
837   taitogn_state *state = space->machine().driver_data<taitogn_state>();
838844
839845   /* 0x01=counter
840846       0x02=coin lock 1
r14896r14897
842848       0x20=coin lock 2
843849       0x80=??
844850    */
845   COMBINE_DATA (&state->m_coin_info);
851   COMBINE_DATA (&m_coin_info);
846852}
847853
848static READ32_HANDLER( coin_r )
854READ32_MEMBER(taitogn_state::coin_r)
849855{
850   taitogn_state *state = space->machine().driver_data<taitogn_state>();
851856
852   return state->m_coin_info;
857   return m_coin_info;
853858}
854859
855860/* mahjong panel handler (for Usagi & Mahjong Oh) */
856static READ32_HANDLER( gnet_mahjong_panel_r )
861READ32_MEMBER(taitogn_state::gnet_mahjong_panel_r)
857862{
858   taitogn_state *state = space->machine().driver_data<taitogn_state>();
859863
860   state->m_mux_data = state->m_coin_info;
861   state->m_mux_data &= 0xcc;
864   m_mux_data = m_coin_info;
865   m_mux_data &= 0xcc;
862866
863   switch(state->m_mux_data)
867   switch(m_mux_data)
864868   {
865      case 0x04: return input_port_read(space->machine(), "KEY0");
866      case 0x08: return input_port_read(space->machine(), "KEY1");
867      case 0x40: return input_port_read(space->machine(), "KEY2");
868      case 0x80: return input_port_read(space->machine(), "KEY3");
869      case 0x04: return input_port_read(machine(), "KEY0");
870      case 0x08: return input_port_read(machine(), "KEY1");
871      case 0x40: return input_port_read(machine(), "KEY2");
872      case 0x80: return input_port_read(machine(), "KEY3");
869873   }
870874
871875   /* mux disabled */
872   return input_port_read(space->machine(), "P4");
876   return input_port_read(machine(), "P4");
873877}
874878
875879// Init and reset
r14896r14897
899903static DRIVER_INIT( coh3002t_mp )
900904{
901905   DRIVER_INIT_CALL(coh3002t);
902   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1fa10100, 0x1fa10103, FUNC(gnet_mahjong_panel_r) );
906   taitogn_state *state = machine.driver_data<taitogn_state>();
907   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x1fa10100, 0x1fa10103, read32_delegate(FUNC(taitogn_state::gnet_mahjong_panel_r),state));
903908}
904909
905910static MACHINE_RESET( coh3002t )
r14896r14897
920925static ADDRESS_MAP_START( taitogn_map, AS_PROGRAM, 32, taitogn_state )
921926   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("share1") /* ram */
922927   AM_RANGE(0x00400000, 0x007fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
923   AM_RANGE(0x1f000000, 0x1f1fffff) AM_READWRITE_LEGACY(flash_s1_r, flash_s1_w)
924   AM_RANGE(0x1f200000, 0x1f3fffff) AM_READWRITE_LEGACY(flash_s2_r, flash_s2_w)
925   AM_RANGE(0x1f400000, 0x1f5fffff) AM_READWRITE_LEGACY(flash_s3_r, flash_s3_w)
928   AM_RANGE(0x1f000000, 0x1f1fffff) AM_READWRITE(flash_s1_r, flash_s1_w)
929   AM_RANGE(0x1f200000, 0x1f3fffff) AM_READWRITE(flash_s2_r, flash_s2_w)
930   AM_RANGE(0x1f400000, 0x1f5fffff) AM_READWRITE(flash_s3_r, flash_s3_w)
926931   AM_RANGE(0x1fa00000, 0x1fa00003) AM_READ_PORT("P1")
927932   AM_RANGE(0x1fa00100, 0x1fa00103) AM_READ_PORT("P2")
928933   AM_RANGE(0x1fa00200, 0x1fa00203) AM_READ_PORT("SERVICE")
929934   AM_RANGE(0x1fa00300, 0x1fa00303) AM_READ_PORT("SYSTEM")
930935   AM_RANGE(0x1fa10000, 0x1fa10003) AM_READ_PORT("P3")
931936   AM_RANGE(0x1fa10100, 0x1fa10103) AM_READ_PORT("P4")
932   AM_RANGE(0x1fa10200, 0x1fa10203) AM_READ_LEGACY(boardconfig_r)
933   AM_RANGE(0x1fa10300, 0x1fa10303) AM_READWRITE_LEGACY(znsecsel_r, znsecsel_w)
934   AM_RANGE(0x1fa20000, 0x1fa20003) AM_READWRITE_LEGACY(coin_r, coin_w)
935   AM_RANGE(0x1fa30000, 0x1fa30003) AM_READWRITE_LEGACY(control3_r, control3_w)
937   AM_RANGE(0x1fa10200, 0x1fa10203) AM_READ(boardconfig_r)
938   AM_RANGE(0x1fa10300, 0x1fa10303) AM_READWRITE(znsecsel_r, znsecsel_w)
939   AM_RANGE(0x1fa20000, 0x1fa20003) AM_READWRITE(coin_r, coin_w)
940   AM_RANGE(0x1fa30000, 0x1fa30003) AM_READWRITE(control3_r, control3_w)
936941   AM_RANGE(0x1fa51c00, 0x1fa51dff) AM_READWRITE16_LEGACY(spu_r, spu_w, 0xffffffff) // systematic read at spu_address + 250000, result dropped, maybe other accesses
937   AM_RANGE(0x1fa60000, 0x1fa60003) AM_READ_LEGACY(hack1_r)
942   AM_RANGE(0x1fa60000, 0x1fa60003) AM_READ(hack1_r)
938943   AM_RANGE(0x1faf0000, 0x1faf07ff) AM_DEVREADWRITE8_LEGACY("at28c16", at28c16_r, at28c16_w, 0xffffffff) /* eeprom */
939   AM_RANGE(0x1fb00000, 0x1fb0ffff) AM_READWRITE_LEGACY(rf5c296_io_r, rf5c296_io_w)
940   AM_RANGE(0x1fb40000, 0x1fb40003) AM_READWRITE_LEGACY(control_r, control_w)
941   AM_RANGE(0x1fb60000, 0x1fb60003) AM_WRITE_LEGACY(control2_w)
942   AM_RANGE(0x1fb70000, 0x1fb70003) AM_READWRITE_LEGACY(gn_1fb70000_r, gn_1fb70000_w)
944   AM_RANGE(0x1fb00000, 0x1fb0ffff) AM_READWRITE(rf5c296_io_r, rf5c296_io_w)
945   AM_RANGE(0x1fb40000, 0x1fb40003) AM_READWRITE(control_r, control_w)
946   AM_RANGE(0x1fb60000, 0x1fb60003) AM_WRITE(control2_w)
947   AM_RANGE(0x1fb70000, 0x1fb70003) AM_READWRITE(gn_1fb70000_r, gn_1fb70000_w)
943948   AM_RANGE(0x1fbe0000, 0x1fbe01ff) AM_RAM // 256 bytes com zone with the mn102, low bytes of words only, with additional comm at 1fb80000
944949   AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_SHARE("share2") AM_REGION("mainbios", 0) /* bios */
945950   AM_RANGE(0x80000000, 0x803fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
src/mame/drivers/scotrsht.c
r14896r14897
4343{
4444
4545   m_irq_enable = data & 0x02;
46   flip_screen_set(machine(), data & 0x08);
46   flip_screen_set(data & 0x08);
4747}
4848
4949static INTERRUPT_GEN( scotrsht_interrupt )
r14896r14897
5656
5757WRITE8_MEMBER(scotrsht_state::scotrsht_soundlatch_w)
5858{
59   soundlatch_w(space, 0, data);
59   soundlatch_byte_w(space, 0, data);
6060   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
6161}
6262
r14896r14897
8787static ADDRESS_MAP_START( scotrsht_sound_map, AS_PROGRAM, 8, scotrsht_state )
8888   AM_RANGE(0x0000, 0x3fff) AM_ROM
8989   AM_RANGE(0x4000, 0x43ff) AM_RAM
90   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r)
90   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_byte_r)
9191ADDRESS_MAP_END
9292
9393static ADDRESS_MAP_START( scotrsht_sound_port, AS_IO, 8, scotrsht_state )
src/mame/drivers/taito_z.c
r14896r14897
15861586   AM_RANGE(0x400000, 0x40000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0x00ff)
15871587   AM_RANGE(0x600000, 0x600001) AM_WRITE(cpua_ctrl_w)
15881588   AM_RANGE(0x800000, 0x800007) AM_READWRITE(bshark_stick_r, bshark_stick_w)
1589   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1589   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
15901590   AM_RANGE(0xc00000, 0xc00fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
15911591   AM_RANGE(0xd00000, 0xd0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
15921592   AM_RANGE(0xd20000, 0xd2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
r14896r14897
15991599   AM_RANGE(0x400000, 0x40000f) AM_DEVREADWRITE8_LEGACY("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0x00ff)
16001600   AM_RANGE(0x600000, 0x600001) AM_WRITE(cpua_ctrl_w)
16011601//  AM_RANGE(0x800000, 0x800007) AM_READWRITE(bshark_stick_r, bshark_stick_w) /* No analog stick, this is the Joystick version */
1602   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1602   AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
16031603   AM_RANGE(0xc00000, 0xc00fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
16041604   AM_RANGE(0xd00000, 0xd0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
16051605   AM_RANGE(0xd20000, 0xd2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
r14896r14897
16271627   AM_RANGE(0x200010, 0x20001f) AM_READ(sci_steer_input_r)
16281628//  AM_RANGE(0x400000, 0x400001) AM_WRITE(cpua_ctrl_w)  // ?? doesn't seem to fit what's written
16291629   AM_RANGE(0x420000, 0x420003) AM_READWRITE(taitoz_sound_r, taitoz_sound_w)
1630   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1630   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
16311631   AM_RANGE(0xa00000, 0xa0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)   /* tilemaps */
16321632   AM_RANGE(0xa20000, 0xa2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
16331633   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
r14896r14897
17211721   AM_RANGE(0x400010, 0x40001f) AM_READ(dblaxle_steer_input_r)
17221722   AM_RANGE(0x600000, 0x600001) AM_WRITE(cpua_ctrl_w)   /* could this be causing int6 ? */
17231723   AM_RANGE(0x620000, 0x620003) AM_READWRITE(taitoz_sound_r, taitoz_sound_w)
1724   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1724   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
17251725   AM_RANGE(0x900000, 0x90ffff) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_word_r, tc0480scp_word_w)     /* tilemap mirror */
17261726   AM_RANGE(0xa00000, 0xa0ffff) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_word_r, tc0480scp_word_w)     /* tilemaps */
17271727   AM_RANGE(0xa30000, 0xa3002f) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_ctrl_word_r, tc0480scp_ctrl_word_w)
r14896r14897
17461746   AM_RANGE(0x300010, 0x30001f) AM_READ(dblaxle_steer_input_r)
17471747   AM_RANGE(0x500002, 0x500003) AM_WRITE(cpua_ctrl_w)
17481748   AM_RANGE(0x520000, 0x520003) AM_READWRITE(taitoz_sound_r, taitoz_sound_w)
1749   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1749   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
17501750   AM_RANGE(0x900000, 0x90ffff) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_word_r, tc0480scp_word_w)     /* tilemaps */
17511751   AM_RANGE(0x930000, 0x93002f) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_ctrl_word_r, tc0480scp_ctrl_word_w)
17521752   AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size) /* mostly unused ? */
src/mame/drivers/msisaac.c
r14896r14897
3333
3434WRITE8_MEMBER(msisaac_state::sound_command_w)
3535{
36   soundlatch_w(space, 0, data);
36   soundlatch_byte_w(space, 0, data);
3737   machine().scheduler().synchronize(FUNC(nmi_callback), data);
3838}
3939
r14896r14897
5555#if 0
5656WRITE8_MEMBER(msisaac_state::flip_screen_w)
5757{
58   flip_screen_set(machine(), data);
58   flip_screen_set(data);
5959}
6060
6161WRITE8_MEMBER(msisaac_state::msisaac_coin_counter_w)
r14896r14897
174174static ADDRESS_MAP_START( msisaac_map, AS_PROGRAM, 8, msisaac_state )
175175   AM_RANGE(0x0000, 0xdfff) AM_ROM
176176   AM_RANGE(0xe000, 0xe7ff) AM_RAM
177   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_le_w) AM_SHARE("paletteram")
177   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_le_w) AM_SHARE("paletteram")
178178   AM_RANGE(0xf000, 0xf000) AM_WRITE(msisaac_bg2_textbank_w)
179179   AM_RANGE(0xf001, 0xf001) AM_WRITENOP               //???
180180   AM_RANGE(0xf002, 0xf002) AM_WRITENOP               //???
r14896r14897
267267   AM_RANGE(0x8010, 0x801d) AM_DEVWRITE_LEGACY("msm", msm5232_w)
268268   AM_RANGE(0x8020, 0x8020) AM_DEVWRITE_LEGACY("msm", sound_control_0_w)
269269   AM_RANGE(0x8030, 0x8030) AM_WRITE(sound_control_1_w)
270   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r)
270   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r)
271271   AM_RANGE(0xc001, 0xc001) AM_WRITE(nmi_enable_w)
272272   AM_RANGE(0xc002, 0xc002) AM_WRITE(nmi_disable_w)
273273   AM_RANGE(0xc003, 0xc003) AM_WRITENOP /*???*/ /* this is NOT mixer_enable */
src/mame/drivers/mappy.c
r14896r14897
690690         break;
691691
692692      case 0x04:   /* FLIP */
693         flip_screen_set(machine(), bit);
693         flip_screen_set(bit);
694694         break;
695695
696696      case 0x06:   /* SOUND ON */
src/mame/drivers/safarir.c
r14896r14897
5555{
5656public:
5757   safarir_state(const machine_config &mconfig, device_type type, const char *tag)
58      : driver_device(mconfig, type, tag) { }
58      : driver_device(mconfig, type, tag) ,
59      m_bg_scroll(*this, "bg_scroll"){ }
5960
6061   UINT8 *m_ram_1;
6162   UINT8 *m_ram_2;
r14896r14897
6364   UINT8 m_ram_bank;
6465   tilemap_t *m_bg_tilemap;
6566   tilemap_t *m_fg_tilemap;
66   UINT8 *m_bg_scroll;
67   required_shared_ptr<UINT8> m_bg_scroll;
6768   UINT8 m_port_last;
6869   UINT8 m_port_last2;
6970   samples_device *m_samples;
r14896r14897
200201{
201202   safarir_state *state = screen.machine().driver_data<safarir_state>();
202203
203   state->m_bg_tilemap->set_scrollx(0, *state->m_bg_scroll);
204   state->m_bg_tilemap->set_scrollx(0, *state->m_bg_scroll.target());
204205
205206   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
206207   state->m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
r14896r14897
341342   AM_RANGE(0x0000, 0x17ff) AM_ROM
342343   AM_RANGE(0x2000, 0x27ff) AM_READWRITE(ram_r, ram_w) AM_SIZE(m_ram_size)
343344   AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x03ff) AM_READNOP AM_WRITE(ram_bank_w)
344   AM_RANGE(0x2c00, 0x2cff) AM_MIRROR(0x03ff) AM_READNOP AM_WRITEONLY AM_BASE(m_bg_scroll)
345   AM_RANGE(0x2c00, 0x2cff) AM_MIRROR(0x03ff) AM_READNOP AM_WRITEONLY AM_SHARE("bg_scroll")
345346   AM_RANGE(0x3000, 0x30ff) AM_MIRROR(0x03ff) AM_WRITE(safarir_audio_w)   /* goes to SN76477 */
346347   AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_WRITENOP   /* cleared at the beginning */
347348   AM_RANGE(0x3800, 0x38ff) AM_MIRROR(0x03ff) AM_READ_PORT("INPUTS") AM_WRITENOP
src/mame/drivers/rastan.c
r14896r14897
205205static ADDRESS_MAP_START( rastan_map, AS_PROGRAM, 16, rastan_state )
206206   AM_RANGE(0x000000, 0x05ffff) AM_ROM
207207   AM_RANGE(0x10c000, 0x10ffff) AM_RAM
208   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
208   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
209209   AM_RANGE(0x350008, 0x350009) AM_WRITENOP   /* 0 only (often) ? */
210210   AM_RANGE(0x380000, 0x380001) AM_WRITE(rastan_spritectrl_w)   /* sprite palette bank, coin counters & lockout */
211211   AM_RANGE(0x390000, 0x390001) AM_READ_PORT("P1")
src/mame/drivers/pzletime.c
r14896r14897
2323{
2424public:
2525   pzletime_state(const machine_config &mconfig, device_type type, const char *tag)
26      : driver_device(mconfig, type, tag) { }
26      : driver_device(mconfig, type, tag) ,
27      m_video_regs(*this, "video_regs"),
28      m_tilemap_regs(*this, "tilemap_regs"),
29      m_bg_videoram(*this, "bg_videoram"),
30      m_mid_videoram(*this, "mid_videoram"),
31      m_txt_videoram(*this, "txt_videoram"),
32      m_spriteram(*this, "spriteram"){ }
2733
2834   /* memory pointers */
29   UINT16 *       m_bg_videoram;
30   UINT16 *       m_mid_videoram;
31   UINT16 *       m_txt_videoram;
32   UINT16 *       m_tilemap_regs;
33   UINT16 *       m_video_regs;
34   UINT16 *       m_spriteram;
35   required_shared_ptr<UINT16> m_video_regs;
36   required_shared_ptr<UINT16> m_tilemap_regs;
37   required_shared_ptr<UINT16> m_bg_videoram;
38   required_shared_ptr<UINT16> m_mid_videoram;
39   required_shared_ptr<UINT16> m_txt_videoram;
40   required_shared_ptr<UINT16> m_spriteram;
3541//  UINT16 *       m_paletteram;    // currently this uses generic palette handling
3642
3743   /* video-related */
r14896r14897
5157static TILE_GET_INFO( get_mid_tile_info )
5258{
5359   pzletime_state *state = machine.driver_data<pzletime_state>();
54   int tileno = state->m_mid_videoram[tile_index] & 0x0fff;
55   int colour = state->m_mid_videoram[tile_index] & 0xf000;
60   int tileno = state->m_mid_videoram.target()[tile_index] & 0x0fff;
61   int colour = state->m_mid_videoram.target()[tile_index] & 0xf000;
5662   colour = colour >> 12;
5763   SET_TILE_INFO(2, tileno, colour, 0);
5864}
r14896r14897
6066static TILE_GET_INFO( get_txt_tile_info )
6167{
6268   pzletime_state *state = machine.driver_data<pzletime_state>();
63   int tileno = state->m_txt_videoram[tile_index] & 0x0fff;
64   int colour = state->m_txt_videoram[tile_index] & 0xf000;
69   int tileno = state->m_txt_videoram.target()[tile_index] & 0x0fff;
70   int colour = state->m_txt_videoram.target()[tile_index] & 0xf000;
6571   colour = colour >> 12;
6672
6773   SET_TILE_INFO(0, tileno, colour, 0);
r14896r14897
8894
8995   bitmap.fill(screen.machine().pens[0], cliprect); //bg pen
9096
91   state->m_txt_tilemap->set_scrolly(0, state->m_tilemap_regs[0] - 3);
92   state->m_txt_tilemap->set_scrollx(0, state->m_tilemap_regs[1]);
97   state->m_txt_tilemap->set_scrolly(0, state->m_tilemap_regs.target()[0] - 3);
98   state->m_txt_tilemap->set_scrollx(0, state->m_tilemap_regs.target()[1]);
9399
94   state->m_mid_tilemap->set_scrolly(0, state->m_tilemap_regs[2] - 3);
95   state->m_mid_tilemap->set_scrollx(0, state->m_tilemap_regs[3] - 7);
100   state->m_mid_tilemap->set_scrolly(0, state->m_tilemap_regs.target()[2] - 3);
101   state->m_mid_tilemap->set_scrollx(0, state->m_tilemap_regs.target()[3] - 7);
96102
97   if (state->m_video_regs[2] & 1)
103   if (state->m_video_regs.target()[2] & 1)
98104   {
99105      count = 0;
100106
r14896r14897
102108      {
103109         for (x = 0; x < 512; x++)
104110         {
105            if (state->m_bg_videoram[count] & 0x8000)
106               bitmap.pix16((y - 18) & 0xff, (x - 32) & 0x1ff) = 0x300 + (state->m_bg_videoram[count] & 0x7fff);
111            if (state->m_bg_videoram.target()[count] & 0x8000)
112               bitmap.pix16((y - 18) & 0xff, (x - 32) & 0x1ff) = 0x300 + (state->m_bg_videoram.target()[count] & 0x7fff);
107113
108114            count++;
109115         }
r14896r14897
113119   state->m_mid_tilemap->draw(bitmap, cliprect, 0, 0);
114120
115121   {
116      UINT16 *spriteram = state->m_spriteram;
122      UINT16 *spriteram = state->m_spriteram.target();
117123      int offs, spr_offs, colour, sx, sy;
118124
119125      for(offs = 0; offs < 0x2000 / 2; offs += 4)
r14896r14897
141147
142148WRITE16_MEMBER(pzletime_state::mid_videoram_w)
143149{
144   COMBINE_DATA(&m_mid_videoram[offset]);
150   COMBINE_DATA(&m_mid_videoram.target()[offset]);
145151   m_mid_tilemap->mark_tile_dirty(offset);
146152}
147153
148154WRITE16_MEMBER(pzletime_state::txt_videoram_w)
149155{
150   COMBINE_DATA(&m_txt_videoram[offset]);
156   COMBINE_DATA(&m_txt_videoram.target()[offset]);
151157   m_txt_tilemap->mark_tile_dirty(offset);
152158}
153159
r14896r14897
173179{
174180   int i;
175181
176   COMBINE_DATA(&m_video_regs[offset]);
182   COMBINE_DATA(&m_video_regs.target()[offset]);
177183
178184   if (offset == 0)
179185   {
180      if (m_video_regs[0] > 0)
186      if (m_video_regs.target()[0] > 0)
181187      {
182188         for (i = 0; i < 0x300; i++)
183189         {
184            palette_set_pen_contrast(machine(), i, (double)0x8000/(double)m_video_regs[0]);
190            palette_set_pen_contrast(machine(), i, (double)0x8000/(double)m_video_regs.target()[0]);
185191         }
186192      }
187193   }
188194   else if (offset == 1)
189195   {
190      if (m_video_regs[1] > 0)
196      if (m_video_regs.target()[1] > 0)
191197      {
192198         for (i = 0x300; i < 32768 + 0x300; i++)
193199         {
194            palette_set_pen_contrast(machine(), i, (double)0x8000/(double)m_video_regs[1]);
200            palette_set_pen_contrast(machine(), i, (double)0x8000/(double)m_video_regs.target()[1]);
195201         }
196202      }
197203   }
r14896r14897
209215
210216static ADDRESS_MAP_START( pzletime_map, AS_PROGRAM, 16, pzletime_state )
211217   AM_RANGE(0x000000, 0x3fffff) AM_ROM
212   AM_RANGE(0x700000, 0x700005) AM_RAM_WRITE(video_regs_w) AM_BASE(m_video_regs)
218   AM_RANGE(0x700000, 0x700005) AM_RAM_WRITE(video_regs_w) AM_SHARE("video_regs")
213219   AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
214   AM_RANGE(0x900000, 0x9005ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
215   AM_RANGE(0xa00000, 0xa00007) AM_RAM AM_BASE(m_tilemap_regs)
216   AM_RANGE(0xb00000, 0xb3ffff) AM_RAM AM_BASE(m_bg_videoram)
217   AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(mid_videoram_w) AM_BASE(m_mid_videoram)
218   AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(txt_videoram_w) AM_BASE(m_txt_videoram)
219   AM_RANGE(0xd00000, 0xd01fff) AM_RAM AM_BASE(m_spriteram)
220   AM_RANGE(0x900000, 0x9005ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
221   AM_RANGE(0xa00000, 0xa00007) AM_RAM AM_SHARE("tilemap_regs")
222   AM_RANGE(0xb00000, 0xb3ffff) AM_RAM AM_SHARE("bg_videoram")
223   AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(mid_videoram_w) AM_SHARE("mid_videoram")
224   AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(txt_videoram_w) AM_SHARE("txt_videoram")
225   AM_RANGE(0xd00000, 0xd01fff) AM_RAM AM_SHARE("spriteram")
220226   AM_RANGE(0xe00000, 0xe00001) AM_READ_PORT("INPUT") AM_DEVWRITE_LEGACY("eeprom", eeprom_w)
221227   AM_RANGE(0xe00002, 0xe00003) AM_READ_PORT("SYSTEM") AM_WRITE(ticket_w)
222228   AM_RANGE(0xe00004, 0xe00005) AM_DEVWRITE_LEGACY("oki", oki_bank_w)
src/mame/drivers/pntnpuzl.c
r14896r14897
142142   int m_touchscr[5];
143143
144144   required_device<cpu_device> m_maincpu;
145   DECLARE_WRITE16_MEMBER(pntnpuzl_200000_w);
146   DECLARE_WRITE16_MEMBER(pntnpuzl_280018_w);
147   DECLARE_READ16_MEMBER(pntnpuzl_280014_r);
148   DECLARE_READ16_MEMBER(pntnpuzl_28001a_r);
149   DECLARE_READ16_MEMBER(irq1_ack_r);
150   DECLARE_READ16_MEMBER(irq2_ack_r);
151   DECLARE_READ16_MEMBER(irq4_ack_r);
145152};
146153
147154
r14896r14897
20421101 03 46 31 38 0d                    ---> 80 0c
205212*/
206213
207static WRITE16_HANDLER( pntnpuzl_200000_w )
214WRITE16_MEMBER(pntnpuzl_state::pntnpuzl_200000_w)
208215{
209   pntnpuzl_state *state = space->machine().driver_data<pntnpuzl_state>();
210216// logerror("200000: %04x\n",data);
211217   // bit 12: set to 1 when going to serial output to 280018
212   if ((state->m_pntpzl_200000 & 0x1000) && !(data & 0x1000))
218   if ((m_pntpzl_200000 & 0x1000) && !(data & 0x1000))
213219   {
214      state->m_serial_out = (state->m_serial>>1) & 0xff;
215      state->m_read_count = 0;
216      logerror("serial out: %02x\n",state->m_serial_out);
220      m_serial_out = (m_serial>>1) & 0xff;
221      m_read_count = 0;
222      logerror("serial out: %02x\n",m_serial_out);
217223   }
218224
219   state->m_pntpzl_200000 = data;
225   m_pntpzl_200000 = data;
220226}
221227
222static WRITE16_HANDLER( pntnpuzl_280018_w )
228WRITE16_MEMBER(pntnpuzl_state::pntnpuzl_280018_w)
223229{
224   pntnpuzl_state *state = space->machine().driver_data<pntnpuzl_state>();
225// logerror("%04x: 280018: %04x\n",cpu_get_pc(&space->device()),data);
226   state->m_serial >>= 1;
230// logerror("%04x: 280018: %04x\n",cpu_get_pc(&space.device()),data);
231   m_serial >>= 1;
227232   if (data & 0x2000)
228      state->m_serial |= 0x400;
233      m_serial |= 0x400;
229234}
230235
231static READ16_HANDLER( pntnpuzl_280014_r )
236READ16_MEMBER(pntnpuzl_state::pntnpuzl_280014_r)
232237{
233   pntnpuzl_state *state = space->machine().driver_data<pntnpuzl_state>();
234238   static const int startup[3] = { 0x80, 0x0c, 0x00 };
235239   int res;
236240
237   if (state->m_serial_out == 0x11)
241   if (m_serial_out == 0x11)
238242   {
239      if (input_port_read(space->machine(), "IN0") & 0x10)
243      if (input_port_read(machine(), "IN0") & 0x10)
240244      {
241         state->m_touchscr[0] = 0x1b;
242         state->m_touchscr[2] = BITSWAP8(input_port_read(space->machine(), "TOUCHX"),0,1,2,3,4,5,6,7);
243         state->m_touchscr[4] = BITSWAP8(input_port_read(space->machine(), "TOUCHY"),0,1,2,3,4,5,6,7);
245         m_touchscr[0] = 0x1b;
246         m_touchscr[2] = BITSWAP8(input_port_read(machine(), "TOUCHX"),0,1,2,3,4,5,6,7);
247         m_touchscr[4] = BITSWAP8(input_port_read(machine(), "TOUCHY"),0,1,2,3,4,5,6,7);
244248      }
245249      else
246         state->m_touchscr[0] = 0;
250         m_touchscr[0] = 0;
247251
248      if (state->m_read_count >= 10) state->m_read_count = 0;
249      res = state->m_touchscr[state->m_read_count/2];
250      state->m_read_count++;
252      if (m_read_count >= 10) m_read_count = 0;
253      res = m_touchscr[m_read_count/2];
254      m_read_count++;
251255   }
252256   else
253257   {
254      if (state->m_read_count >= 6) state->m_read_count = 0;
255      res = startup[state->m_read_count/2];
256      state->m_read_count++;
258      if (m_read_count >= 6) m_read_count = 0;
259      res = startup[m_read_count/2];
260      m_read_count++;
257261   }
258262   logerror("read 280014: %02x\n",res);
259263   return res << 8;
260264}
261265
262static READ16_HANDLER( pntnpuzl_28001a_r )
266READ16_MEMBER(pntnpuzl_state::pntnpuzl_28001a_r)
263267{
264268   return 0x4c00;
265269}
266270
267static READ16_HANDLER( irq1_ack_r )
271READ16_MEMBER(pntnpuzl_state::irq1_ack_r)
268272{
269//  pntnpuzl_state *state = space->machine().driver_data<pntnpuzl_state>();
270//  device_set_input_line(state->m_maincpu, 1, CLEAR_LINE);
273//  device_set_input_line(m_maincpu, 1, CLEAR_LINE);
271274   return 0;
272275}
273276
274static READ16_HANDLER( irq2_ack_r )
277READ16_MEMBER(pntnpuzl_state::irq2_ack_r)
275278{
276//  pntnpuzl_state *state = space->machine().driver_data<pntnpuzl_state>();
277//  device_set_input_line(state->m_maincpu, 2, CLEAR_LINE);
279//  device_set_input_line(m_maincpu, 2, CLEAR_LINE);
278280   return 0;
279281}
280282
281static READ16_HANDLER( irq4_ack_r )
283READ16_MEMBER(pntnpuzl_state::irq4_ack_r)
282284{
283//  pntnpuzl_state *state = space->machine().driver_data<pntnpuzl_state>();
284//  device_set_input_line(state->m_maincpu, 4, CLEAR_LINE);
285//  device_set_input_line(m_maincpu, 4, CLEAR_LINE);
285286   return 0;
286287}
287288
288289
289290static ADDRESS_MAP_START( pntnpuzl_map, AS_PROGRAM, 16, pntnpuzl_state )
290291   AM_RANGE(0x000000, 0x07ffff) AM_ROM
291   AM_RANGE(0x080000, 0x080001) AM_READ_LEGACY(irq1_ack_r)
292   AM_RANGE(0x100000, 0x100001) AM_READ_LEGACY(irq2_ack_r)
293   AM_RANGE(0x180000, 0x180001) AM_READ_LEGACY(irq4_ack_r)
294   AM_RANGE(0x200000, 0x200001) AM_WRITE_LEGACY(pntnpuzl_200000_w)
292   AM_RANGE(0x080000, 0x080001) AM_READ(irq1_ack_r)
293   AM_RANGE(0x100000, 0x100001) AM_READ(irq2_ack_r)
294   AM_RANGE(0x180000, 0x180001) AM_READ(irq4_ack_r)
295   AM_RANGE(0x200000, 0x200001) AM_WRITE(pntnpuzl_200000_w)
295296   AM_RANGE(0x280000, 0x280001) AM_DEVREAD_LEGACY("eeprom", pntnpuzl_eeprom_r)
296297   AM_RANGE(0x280002, 0x280003) AM_READ_PORT("IN2")
297298   AM_RANGE(0x280000, 0x280001) AM_DEVWRITE_LEGACY("eeprom", pntnpuzl_eeprom_w)
r14896r14897
299300   AM_RANGE(0x28000a, 0x28000b) AM_WRITENOP
300301   AM_RANGE(0x280010, 0x280011) AM_WRITENOP
301302   AM_RANGE(0x280012, 0x280013) AM_WRITENOP
302   AM_RANGE(0x280014, 0x280015) AM_READ_LEGACY(pntnpuzl_280014_r)
303   AM_RANGE(0x280014, 0x280015) AM_READ(pntnpuzl_280014_r)
303304   AM_RANGE(0x280016, 0x280017) AM_WRITENOP
304   AM_RANGE(0x280018, 0x280019) AM_WRITE_LEGACY(pntnpuzl_280018_w)
305   AM_RANGE(0x28001a, 0x28001b) AM_READ_LEGACY(pntnpuzl_28001a_r)
305   AM_RANGE(0x280018, 0x280019) AM_WRITE(pntnpuzl_280018_w)
306   AM_RANGE(0x28001a, 0x28001b) AM_READ(pntnpuzl_28001a_r)
306307   AM_RANGE(0x28001a, 0x28001b) AM_WRITENOP
307308
308309   /* standard VGA */
src/mame/drivers/funkball.c
r14896r14897
9494        m_dma8237_2(*this, "dma8237_2"),
9595        m_pic8259_1(*this, "pic8259_1"),
9696        m_pic8259_2(*this, "pic8259_2"),
97        m_voodoo(*this, "voodoo_0")
98        { }
97        m_voodoo(*this, "voodoo_0"),
98        m_unk_ram(*this, "unk_ram"){ }
9999
100100   int m_dma_channel;
101101   UINT8 m_dma_offset[2][4];
r14896r14897
105105   UINT8 m_funkball_config_regs[256];
106106   UINT32 m_cx5510_regs[256/4];
107107   UINT16 m_flash_addr;
108   UINT32 *m_unk_ram;
109108   UINT8 *m_bios_ram;
110109   UINT8 m_flash_cmd;
111110   UINT8 m_flash_data_cmd;
r14896r14897
121120   required_device<pic8259_device> m_pic8259_2;
122121   required_device<voodoo_device> m_voodoo;
123122
123   required_shared_ptr<UINT32> m_unk_ram;
124
124125   DECLARE_READ8_MEMBER( get_slave_ack );
125126   DECLARE_WRITE8_MEMBER( flash_w );
126127   DECLARE_READ8_MEMBER( flash_data_r );
r14896r14897
142143
143144      UINT32 init_enable;
144145   } m_voodoo_pci_regs;
146   DECLARE_READ8_MEMBER(at_page8_r);
147   DECLARE_WRITE8_MEMBER(at_page8_w);
148   DECLARE_READ8_MEMBER(pc_dma_read_byte);
149   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
150   DECLARE_READ32_MEMBER(biu_ctrl_r);
151   DECLARE_WRITE32_MEMBER(biu_ctrl_w);
152   DECLARE_WRITE8_MEMBER(bios_ram_w);
145153};
146154
147155void funkball_state::video_start()
r14896r14897
265273}
266274
267275
268static READ8_HANDLER(at_page8_r)
276READ8_MEMBER(funkball_state::at_page8_r)
269277{
270   funkball_state *state = space->machine().driver_data<funkball_state>();
271   UINT8 data = state->m_at_pages[offset % 0x10];
278   UINT8 data = m_at_pages[offset % 0x10];
272279
273280   switch(offset % 8) {
274281   case 1:
275      data = state->m_dma_offset[(offset / 8) & 1][2];
282      data = m_dma_offset[(offset / 8) & 1][2];
276283      break;
277284   case 2:
278      data = state->m_dma_offset[(offset / 8) & 1][3];
285      data = m_dma_offset[(offset / 8) & 1][3];
279286      break;
280287   case 3:
281      data = state->m_dma_offset[(offset / 8) & 1][1];
288      data = m_dma_offset[(offset / 8) & 1][1];
282289      break;
283290   case 7:
284      data = state->m_dma_offset[(offset / 8) & 1][0];
291      data = m_dma_offset[(offset / 8) & 1][0];
285292      break;
286293   }
287294   return data;
288295}
289296
290297
291static WRITE8_HANDLER(at_page8_w)
298WRITE8_MEMBER(funkball_state::at_page8_w)
292299{
293   funkball_state *state = space->machine().driver_data<funkball_state>();
294   state->m_at_pages[offset % 0x10] = data;
300   m_at_pages[offset % 0x10] = data;
295301
296302   switch(offset % 8) {
297303   case 1:
298      state->m_dma_offset[(offset / 8) & 1][2] = data;
304      m_dma_offset[(offset / 8) & 1][2] = data;
299305      break;
300306   case 2:
301      state->m_dma_offset[(offset / 8) & 1][3] = data;
307      m_dma_offset[(offset / 8) & 1][3] = data;
302308      break;
303309   case 3:
304      state->m_dma_offset[(offset / 8) & 1][1] = data;
310      m_dma_offset[(offset / 8) & 1][1] = data;
305311      break;
306312   case 7:
307      state->m_dma_offset[(offset / 8) & 1][0] = data;
313      m_dma_offset[(offset / 8) & 1][0] = data;
308314      break;
309315   }
310316}
311317
312static READ32_HANDLER(at_page32_r)
313{
314   return read32le_with_read8_handler(at_page8_r, space, offset, mem_mask);
315}
316318
317
318static WRITE32_HANDLER(at_page32_w)
319{
320   write32le_with_write8_handler(at_page8_w, space, offset, data, mem_mask);
321}
322
323319static READ8_DEVICE_HANDLER(at_dma8237_2_r)
324320{
325321   return i8237_r(device, offset / 2);
r14896r14897
352348}
353349
354350
355static READ8_HANDLER( pc_dma_read_byte )
351READ8_MEMBER(funkball_state::pc_dma_read_byte)
356352{
357   funkball_state *state = space->machine().driver_data<funkball_state>();
358   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
353   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
359354      & 0xFF0000;
360355
361   return space->read_byte(page_offset + offset);
356   return space.read_byte(page_offset + offset);
362357}
363358
364359
365static WRITE8_HANDLER( pc_dma_write_byte )
360WRITE8_MEMBER(funkball_state::pc_dma_write_byte)
366361{
367   funkball_state *state = space->machine().driver_data<funkball_state>();
368   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
362   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
369363      & 0xFF0000;
370364
371   space->write_byte(page_offset + offset, data);
365   space.write_byte(page_offset + offset, data);
372366}
373367
374368static void set_dma_channel(device_t *device, int channel, int state)
r14896r14897
386380{
387381   DEVCB_LINE(pc_dma_hrq_changed),
388382   DEVCB_NULL,
389   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
390   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
383   DEVCB_DRIVER_MEMBER(funkball_state, pc_dma_read_byte),
384   DEVCB_DRIVER_MEMBER(funkball_state, pc_dma_write_byte),
391385   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
392386   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
393387   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
516510      printf("%08x %02x FLASH DATA W %08x\n",offset,data,m_flash_addr << 16);
517511}
518512
519static READ32_HANDLER( biu_ctrl_r )
513READ32_MEMBER(funkball_state::biu_ctrl_r)
520514{
521   funkball_state *state = space->machine().driver_data<funkball_state>();
522515
523516   if (offset == 0)
524517   {
525518      return 0xffffff;
526519   }
527   return state->m_biu_ctrl_reg[offset];
520   return m_biu_ctrl_reg[offset];
528521}
529522
530static WRITE32_HANDLER( biu_ctrl_w )
523WRITE32_MEMBER(funkball_state::biu_ctrl_w)
531524{
532   funkball_state *state = space->machine().driver_data<funkball_state>();
533525
534526   //mame_printf_debug("biu_ctrl_w %08X, %08X, %08X\n", data, offset, mem_mask);
535   COMBINE_DATA(state->m_biu_ctrl_reg + offset);
527   COMBINE_DATA(m_biu_ctrl_reg + offset);
536528
537529   if (offset == 0x0c/4)      // BC_XMAP_3 register
538530   {
r14896r14897
542534      for(i=0;i<8;i++)
543535      {
544536         if (data & 0x1 << i*4)      // enable RAM access to region 0xe0000 - 0xfffff
545            memory_set_bankptr(space->machine(), banknames[i], state->m_bios_ram + (0x4000 * i));
537            memory_set_bankptr(machine(), banknames[i], m_bios_ram + (0x4000 * i));
546538         else               // disable RAM access (reads go to BIOS ROM)
547            memory_set_bankptr(space->machine(), banknames[i], space->machine().region("bios")->base() + (0x4000 * i));
539            memory_set_bankptr(machine(), banknames[i], machine().region("bios")->base() + (0x4000 * i));
548540      }
549541   }
550542}
551543
552static WRITE8_HANDLER( bios_ram_w )
544WRITE8_MEMBER(funkball_state::bios_ram_w)
553545{
554   funkball_state *state = space->machine().driver_data<funkball_state>();
555546
556   if(state->m_biu_ctrl_reg[0x0c/4] & (2 << ((offset & 0x4000)>>14)*4)) // memory is write-able
547   if(m_biu_ctrl_reg[0x0c/4] & (2 << ((offset & 0x4000)>>14)*4)) // memory is write-able
557548   {
558      state->m_bios_ram[offset] = data;
549      m_bios_ram[offset] = data;
559550   }
560551}
561552
r14896r14897
581572   AM_RANGE(0x000f4000, 0x000f7fff) AM_ROMBANK("bios_bank2")
582573   AM_RANGE(0x000f8000, 0x000fbfff) AM_ROMBANK("bios_bank3")
583574   AM_RANGE(0x000fc000, 0x000fffff) AM_ROMBANK("bios_bank4")
584   AM_RANGE(0x000e0000, 0x000fffff) AM_WRITE8_LEGACY(bios_ram_w,0xffffffff)
575   AM_RANGE(0x000e0000, 0x000fffff) AM_WRITE8(bios_ram_w,0xffffffff)
585576   AM_RANGE(0x00100000, 0x07ffffff) AM_RAM
586577//  AM_RANGE(0x08000000, 0x0fffffff) AM_NOP
587   AM_RANGE(0x40008000, 0x400080ff) AM_READWRITE_LEGACY(biu_ctrl_r, biu_ctrl_w)
588   AM_RANGE(0x40010e00, 0x40010eff) AM_RAM AM_BASE(m_unk_ram)
578   AM_RANGE(0x40008000, 0x400080ff) AM_READWRITE(biu_ctrl_r, biu_ctrl_w)
579   AM_RANGE(0x40010e00, 0x40010eff) AM_RAM AM_SHARE("unk_ram")
589580   AM_RANGE(0xff000000, 0xffffdfff) AM_DEVREADWRITE_LEGACY("voodoo_0", voodoo_r, voodoo_w)
590581   AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("bios", 0)   /* System BIOS */
591582ADDRESS_MAP_END
r14896r14897
596587   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
597588   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
598589   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
599   AM_RANGE(0x0080, 0x009f) AM_READWRITE_LEGACY(at_page32_r,            at_page32_w)
590   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,at_page8_w, 0xffffffff)
600591   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
601592   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
602593   AM_RANGE(0x00e8, 0x00ef) AM_NOP
r14896r14897
11201111   kbdc8042_init(machine, &at8042);
11211112
11221113   /* defaults, otherwise it won't boot */
1123   state->m_unk_ram[0x010/4] = 0x2f8d85ff;
1124   state->m_unk_ram[0x018/4] = 0x000018c5;
1114   state->m_unk_ram.target()[0x010/4] = 0x2f8d85ff;
1115   state->m_unk_ram.target()[0x018/4] = 0x000018c5;
11251116}
11261117
11271118static MACHINE_RESET( funkball )
src/mame/drivers/tmspoker.c
r14896r14897
218218{
219219public:
220220   tmspoker_state(const machine_config &mconfig, device_type type, const char *tag)
221      : driver_device(mconfig, type, tag) { }
221      : driver_device(mconfig, type, tag) ,
222      m_videoram(*this, "videoram"){ }
222223
223   UINT8 *m_videoram;
224   required_shared_ptr<UINT8> m_videoram;
224225   tilemap_t *m_bg_tilemap;
225226   DECLARE_WRITE8_MEMBER(tmspoker_videoram_w);
226227   //DECLARE_WRITE8_MEMBER(debug_w);
r14896r14897
234235
235236WRITE8_MEMBER(tmspoker_state::tmspoker_videoram_w)
236237{
237   m_videoram[offset] = data;
238   m_videoram.target()[offset] = data;
238239   m_bg_tilemap->mark_tile_dirty(offset);
239240}
240241
r14896r14897
248249    ---- ----   seems unused.
249250*/
250251   tmspoker_state *state = machine.driver_data<tmspoker_state>();
251   int code = state->m_videoram[tile_index];
252   int code = state->m_videoram.target()[tile_index];
252253
253254   SET_TILE_INFO( 0 /* bank */, code, 0 /* color */, 0);
254255}
r14896r14897
316317   AM_RANGE(0x0000, 0x0fff) AM_ROMBANK("bank1")
317318   AM_RANGE(0x2800, 0x2800) AM_DEVWRITE("crtc", mc6845_device, address_w)
318319   AM_RANGE(0x2801, 0x2801) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
319   AM_RANGE(0x3000, 0x33ff) AM_WRITE(tmspoker_videoram_w) AM_BASE(m_videoram)
320   AM_RANGE(0x3000, 0x33ff) AM_WRITE(tmspoker_videoram_w) AM_SHARE("videoram")
320321   AM_RANGE(0x3800, 0x3fff) AM_RAM //NVRAM?
321322   AM_RANGE(0x2000, 0x20ff) AM_RAM //color RAM?
322323ADDRESS_MAP_END
src/mame/drivers/darkhors.c
r14896r14897
275275
276276WRITE32_MEMBER(darkhors_state::paletteram32_xBBBBBGGGGGRRRRR_dword_w)
277277{
278   if (ACCESSING_BITS_16_31)   paletteram16_xBBBBBGGGGGRRRRR_word_w(space, offset*2, data >> 16, mem_mask >> 16);
279   if (ACCESSING_BITS_0_15)   paletteram16_xBBBBBGGGGGRRRRR_word_w(space, offset*2+1, data, mem_mask);
278   if (ACCESSING_BITS_16_31)   paletteram_xBBBBBGGGGGRRRRR_word_w(space, offset*2, data >> 16, mem_mask >> 16);
279   if (ACCESSING_BITS_0_15)   paletteram_xBBBBBGGGGGRRRRR_word_w(space, offset*2+1, data, mem_mask);
280280}
281281
282282WRITE32_MEMBER(darkhors_state::darkhors_input_sel_w)
r14896r14897
746746   //AM_RANGE(0xc0, 0xc0) AM_READ_LEGACY(cmd1_r)
747747   //AM_RANGE(0xc1, 0xc1) AM_READ_LEGACY(cmd2_r)
748748   //AM_RANGE(0xc2, 0xc2) AM_READ_LEGACY(cmd_stat8_r)
749   AM_RANGE(0xe1, 0xe1) AM_WRITE_LEGACY(st0016_rom_bank_w)
750   AM_RANGE(0xe7, 0xe7) AM_WRITE_LEGACY(st0016_rom_bank_w)
749   AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
750   AM_RANGE(0xe7, 0xe7) AM_WRITE(st0016_rom_bank_w)
751751   //AM_RANGE(0xf0, 0xf0) AM_READ_LEGACY(st0016_dma_r)
752752ADDRESS_MAP_END
753753
src/mame/drivers/equites.c
r14896r14897
435435
436436      case 1: // c0f9: RST75 trigger (written by NMI handler)
437437         // Note: solder pad CP3 on the pcb would allow to disable this
438         generic_pulse_irq_line(m_audio_cpu, I8085_RST75_LINE, 1);
438         generic_pulse_irq_line(m_audio_cpu->execute(), I8085_RST75_LINE, 1);
439439         break;
440440
441441      case 2: // c0fa: INTR trigger (written by NMI handler)
r14896r14897
466466
467467      case 7:   // c0ff: sound command latch clear
468468         // Note: solder pad CP1 on the pcb would allow to disable this
469         soundlatch_clear_w(space, 0, 0);
469         soundlatch_clear_byte_w(space, 0, 0);
470470         break;
471471   }
472472}
r14896r14897
750750
751751static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, equites_state )
752752   AM_RANGE(0x0000, 0xbfff) AM_ROM
753   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r)
753   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r)
754754   AM_RANGE(0xc080, 0xc08d) AM_DEVWRITE_LEGACY("msm", msm5232_w)
755755   AM_RANGE(0xc0a0, 0xc0a1) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_address_w)
756756   AM_RANGE(0xc0b0, 0xc0b0) AM_WRITENOP // n.c.
r14896r14897
12241224{
12251225   equites_state *state = machine.driver_data<equites_state>();
12261226
1227   flip_screen_set(machine, 0);
1227   state->flip_screen_set(0);
12281228
12291229   state->m_fg_char_bank = 0;
12301230   state->m_bgcolor = 0;
src/mame/drivers/mirax.c
r14896r14897
107107{
108108public:
109109   mirax_state(const machine_config &mconfig, device_type type, const char *tag)
110      : driver_device(mconfig, type, tag) { }
110      : driver_device(mconfig, type, tag) ,
111      m_videoram(*this, "videoram"),
112      m_spriteram(*this, "spriteram"),
113      m_colorram(*this, "colorram"){ }
111114
112   UINT8 *m_spriteram;
115   required_shared_ptr<UINT8> m_videoram;
116   required_shared_ptr<UINT8> m_spriteram;
117   required_shared_ptr<UINT8> m_colorram;
113118   UINT8 m_nAyCtrl;
114119   UINT8 m_nmi_mask;
115   UINT8 *m_videoram;
116   UINT8 *m_colorram;
117120   UINT8 m_flipscreen_x;
118121   UINT8 m_flipscreen_y;
119122   DECLARE_WRITE8_MEMBER(audio_w);
r14896r14897
164167   {
165168      for (x=0;x<32;x++)
166169      {
167         int tile = state->m_videoram[32*y+x];
168         int color = (state->m_colorram[x*2]<<8) | (state->m_colorram[(x*2)+1]);
170         int tile = state->m_videoram.target()[32*y+x];
171         int color = (state->m_colorram.target()[x*2]<<8) | (state->m_colorram.target()[(x*2)+1]);
169172         int x_scroll = (color & 0xff00)>>8;
170173         tile |= ((color & 0xe0)<<3);
171174
r14896r14897
186189static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
187190{
188191   mirax_state *state = machine.driver_data<mirax_state>();
189   UINT8 *spriteram = state->m_spriteram;
192   UINT8 *spriteram = state->m_spriteram.target();
190193   int count;
191194
192195   for(count=0;count<0x200;count+=4)
r14896r14897
248251
249252WRITE8_MEMBER(mirax_state::mirax_sound_cmd_w)
250253{
251   soundlatch_w(space, 0, data & 0xff);
254   soundlatch_byte_w(space, 0, data & 0xff);
252255   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
253256}
254257
r14896r14897
276279static ADDRESS_MAP_START( mirax_main_map, AS_PROGRAM, 8, mirax_state )
277280   AM_RANGE(0x0000, 0xbfff) AM_ROM
278281   AM_RANGE(0xc800, 0xd7ff) AM_RAM
279   AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE(m_videoram)
280   AM_RANGE(0xe800, 0xe9ff) AM_RAM AM_BASE(m_spriteram)
281   AM_RANGE(0xea00, 0xea3f) AM_RAM AM_BASE(m_colorram) //per-column color + bank bits for the videoram
282   AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_SHARE("videoram")
283   AM_RANGE(0xe800, 0xe9ff) AM_RAM AM_SHARE("spriteram")
284   AM_RANGE(0xea00, 0xea3f) AM_RAM AM_SHARE("colorram") //per-column color + bank bits for the videoram
282285   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("P1")
283286   AM_RANGE(0xf100, 0xf100) AM_READ_PORT("P2")
284287   AM_RANGE(0xf200, 0xf200) AM_READ_PORT("DSW1")
r14896r14897
295298static ADDRESS_MAP_START( mirax_sound_map, AS_PROGRAM, 8, mirax_state )
296299   AM_RANGE(0x0000, 0x1fff) AM_ROM
297300   AM_RANGE(0x8000, 0x8fff) AM_RAM
298   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
301   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
299302
300303   AM_RANGE(0xe000, 0xe000) AM_WRITENOP
301304   AM_RANGE(0xe001, 0xe001) AM_WRITENOP
src/mame/drivers/cardline.c
r14896r14897
2727{
2828public:
2929   cardline_state(const machine_config &mconfig, device_type type, const char *tag)
30      : driver_device(mconfig, type, tag) { }
30      : driver_device(mconfig, type, tag) ,
31      m_videoram(*this, "videoram"),
32      m_colorram(*this, "colorram"){ }
3133
3234   int m_video;
33   UINT8 *m_videoram;
34   UINT8 *m_colorram;
35   required_shared_ptr<UINT8> m_videoram;
36   required_shared_ptr<UINT8> m_colorram;
3537   int m_var;
3638   DECLARE_WRITE8_MEMBER(vram_w);
3739   DECLARE_WRITE8_MEMBER(attr_w);
r14896r14897
4345
4446
4547#define DRAW_TILE(machine, offset, transparency) drawgfx_transpen(bitmap, cliprect, (machine).gfx[0],\
46               (state->m_videoram[index+offset] | (state->m_colorram[index+offset]<<8))&0x3fff,\
47               (state->m_colorram[index+offset]&0x80)>>7,\
48               (state->m_videoram.target()[index+offset] | (state->m_colorram.target()[index+offset]<<8))&0x3fff,\
49               (state->m_colorram.target()[index+offset]&0x80)>>7,\
4850               0,0,\
4951               x<<3, y<<3,\
5052               transparency?transparency:(UINT32)-1);
r14896r14897
7880WRITE8_MEMBER(cardline_state::vram_w)
7981{
8082   offset+=0x1000*((m_video&2)>>1);
81   m_videoram[offset]=data;
83   m_videoram.target()[offset]=data;
8284}
8385
8486WRITE8_MEMBER(cardline_state::attr_w)
8587{
8688   offset+=0x1000*((m_video&2)>>1);
87   m_colorram[offset]=data;
89   m_colorram.target()[offset]=data;
8890}
8991
9092WRITE8_MEMBER(cardline_state::video_w)
r14896r14897
129131   AM_RANGE(0x2840, 0x2840) AM_NOP
130132   AM_RANGE(0x2880, 0x2880) AM_NOP
131133   AM_RANGE(0x3003, 0x3003) AM_NOP
132   AM_RANGE(0xc000, 0xdfff) AM_WRITE(vram_w) AM_BASE(m_videoram)
133   AM_RANGE(0xe000, 0xffff) AM_WRITE(attr_w) AM_BASE(m_colorram)
134   AM_RANGE(0xc000, 0xdfff) AM_WRITE(vram_w) AM_SHARE("videoram")
135   AM_RANGE(0xe000, 0xffff) AM_WRITE(attr_w) AM_SHARE("colorram")
134136   /* Ports */
135137   AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(unk_r, video_w)
136138ADDRESS_MAP_END
src/mame/drivers/gradius3.c
r14896r14897
134134WRITE16_MEMBER(gradius3_state::sound_command_w)
135135{
136136   if (ACCESSING_BITS_8_15)
137      soundlatch_w(space, 0, (data >> 8) & 0xff);
137      soundlatch_byte_w(space, 0, (data >> 8) & 0xff);
138138}
139139
140140WRITE16_MEMBER(gradius3_state::sound_irq_w)
r14896r14897
157157static ADDRESS_MAP_START( gradius3_map, AS_PROGRAM, 16, gradius3_state )
158158   AM_RANGE(0x000000, 0x03ffff) AM_ROM
159159   AM_RANGE(0x040000, 0x043fff) AM_RAM
160   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
160   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
161161   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(cpuA_ctrl_w)   /* halt cpu B, irq enable, priority, coin counters, other? */
162162   AM_RANGE(0x0c8000, 0x0c8001) AM_READ_PORT("SYSTEM")
163163   AM_RANGE(0x0c8002, 0x0c8003) AM_READ_PORT("P1")
r14896r14897
191191static ADDRESS_MAP_START( gradius3_s_map, AS_PROGRAM, 8, gradius3_state )
192192   AM_RANGE(0x0000, 0xefff) AM_ROM
193193   AM_RANGE(0xf000, 0xf000) AM_DEVWRITE_LEGACY("k007232", sound_bank_w)            /* 007232 bankswitch */
194   AM_RANGE(0xf010, 0xf010) AM_READ(soundlatch_r)
194   AM_RANGE(0xf010, 0xf010) AM_READ(soundlatch_byte_r)
195195   AM_RANGE(0xf020, 0xf02d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)
196196   AM_RANGE(0xf030, 0xf031) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
197197   AM_RANGE(0xf800, 0xffff) AM_RAM
src/mame/drivers/omegrace.c
r14896r14897
326326
327327WRITE8_MEMBER(omegrace_state::omegrace_soundlatch_w)
328328{
329   soundlatch_w (space, offset, data);
329   soundlatch_byte_w (space, offset, data);
330330   cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
331331}
332332
r14896r14897
378378
379379static ADDRESS_MAP_START( sound_port, AS_IO, 8, omegrace_state )
380380   ADDRESS_MAP_GLOBAL_MASK(0xff)
381   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)   /* likely ay8910 input port, not direct */
381   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r)   /* likely ay8910 input port, not direct */
382382   AM_RANGE(0x00, 0x01) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
383383   AM_RANGE(0x02, 0x03) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
384384ADDRESS_MAP_END
src/mame/drivers/mystwarr.c
r14896r14897
162162
163163WRITE16_MEMBER(mystwarr_state::sound_cmd1_w)
164164{
165   soundlatch_w(space, 0, data&0xff);
165   soundlatch_byte_w(space, 0, data&0xff);
166166}
167167
168168WRITE16_MEMBER(mystwarr_state::sound_cmd1_msb_w)
169169{
170   soundlatch_w(space, 0, data>>8);
170   soundlatch_byte_w(space, 0, data>>8);
171171}
172172
173173WRITE16_MEMBER(mystwarr_state::sound_cmd2_w)
174174{
175   soundlatch2_w(space, 0, data&0xff);
175   soundlatch2_byte_w(space, 0, data&0xff);
176176   return;
177177}
178178
179179WRITE16_MEMBER(mystwarr_state::sound_cmd2_msb_w)
180180{
181   soundlatch2_w(space, 0, data>>8);
181   soundlatch2_byte_w(space, 0, data>>8);
182182   return;
183183}
184184
r14896r14897
189189
190190READ16_MEMBER(mystwarr_state::sound_status_r)
191191{
192   int latch = soundlatch3_r(space,0);
192   int latch = soundlatch3_byte_r(space,0);
193193
194194   if ((latch & 0xf) == 0xe) latch |= 1;
195195
r14896r14897
198198
199199READ16_MEMBER(mystwarr_state::sound_status_msb_r)
200200{
201   int latch = soundlatch3_r(space,0);
201   int latch = soundlatch3_byte_r(space,0);
202202
203203   if ((latch & 0xf) == 0xe) latch |= 1;
204204
r14896r14897
274274   AM_RANGE(0x600000, 0x601fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w)
275275   AM_RANGE(0x602000, 0x603fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w)   // tilemap RAM mirror read(essential)
276276   AM_RANGE(0x680000, 0x683fff) AM_READ_LEGACY(K056832_mw_rom_word_r)
277   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")
277   AM_RANGE(0x700000, 0x701fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")
278278#if MW_DEBUG
279279   AM_RANGE(0x480000, 0x4800ff) AM_READ_LEGACY(K055555_word_r)
280280   AM_RANGE(0x482010, 0x48201f) AM_READ_LEGACY(K053247_reg_word_r)
r14896r14897
315315   AM_RANGE(0x302000, 0x303fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w)   // tilemap RAM mirror read/write (essential)
316316   AM_RANGE(0x310000, 0x311fff) AM_READ_LEGACY(K056832_mw_rom_word_r)
317317   AM_RANGE(0x320000, 0x321fff) AM_DEVREAD("k053250_1", k053250_t, rom_r)
318   AM_RANGE(0x330000, 0x331fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")
318   AM_RANGE(0x330000, 0x331fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")
319319#if MW_DEBUG
320320   AM_RANGE(0x240000, 0x240007) AM_READ_LEGACY(K053246_reg_word_r)
321321   AM_RANGE(0x244010, 0x24401f) AM_READ_LEGACY(K053247_reg_word_r)
r14896r14897
358358   AM_RANGE(0x302000, 0x303fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w) // tilemap RAM mirror read(essential)
359359   AM_RANGE(0x304000, 0x3041ff) AM_RAM
360360   AM_RANGE(0x310000, 0x311fff) AM_READ_LEGACY(K056832_mw_rom_word_r)
361   AM_RANGE(0x330000, 0x331fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")
361   AM_RANGE(0x330000, 0x331fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")
362362#if MW_DEBUG
363363   AM_RANGE(0x240000, 0x240007) AM_READ_LEGACY(K053246_reg_word_r)
364364   AM_RANGE(0x244010, 0x24401f) AM_READ_LEGACY(K053247_reg_word_r)
r14896r14897
445445   AM_RANGE(0x41c000, 0x41c01f) AM_DEVREADWRITE8_LEGACY("k053252",k053252_r,k053252_w,0x00ff)            // CCU
446446   AM_RANGE(0x41e000, 0x41e007) AM_WRITE_LEGACY(K056832_b_word_w)            // VSCCS
447447   AM_RANGE(0x480000, 0x483fff) AM_READWRITE(K053247_martchmp_word_r,K053247_martchmp_word_w) AM_BASE(m_spriteram)   // sprite RAM
448   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")                  // palette RAM
448   AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")                  // palette RAM
449449   AM_RANGE(0x680000, 0x681fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w)   // tilemap RAM
450450   AM_RANGE(0x682000, 0x683fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w)   // tilemap RAM mirror read/write (essential)
451451   AM_RANGE(0x700000, 0x703fff) AM_READ_LEGACY(K056832_mw_rom_word_r)         // tile ROM readback
r14896r14897
466466   AM_RANGE(0x400000, 0x40ffff) AM_READWRITE(K053247_scattered_word_r,K053247_scattered_word_w) AM_BASE(m_spriteram)
467467   AM_RANGE(0x410000, 0x411fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w)   // tilemap RAM
468468   AM_RANGE(0x412000, 0x413fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w)   // tilemap RAM mirror read/write (essential)
469   AM_RANGE(0x420000, 0x421fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")
469   AM_RANGE(0x420000, 0x421fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")
470470   AM_RANGE(0x430000, 0x430007) AM_WRITE_LEGACY(K053246_word_w)
471471   AM_RANGE(0x440000, 0x443fff) AM_READ_LEGACY(K056832_mw_rom_word_r)
472472   AM_RANGE(0x450000, 0x45000f) AM_READ_LEGACY(K055673_rom_word_r)
r14896r14897
513513   AM_RANGE(0x400000, 0x40ffff) AM_READWRITE(K053247_scattered_word_r,K053247_scattered_word_w) AM_BASE(m_spriteram)
514514   AM_RANGE(0x410000, 0x411fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w)      // tilemap RAM
515515   AM_RANGE(0x412000, 0x413fff) AM_READWRITE_LEGACY(K056832_ram_word_r,K056832_ram_word_w)      // tilemap RAM mirror read / write (essential)
516   AM_RANGE(0x420000, 0x421fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_SHARE("paletteram")
516   AM_RANGE(0x420000, 0x421fff) AM_RAM_WRITE(paletteram_xrgb_word_be_w) AM_SHARE("paletteram")
517517   AM_RANGE(0x430000, 0x430007) AM_WRITE_LEGACY(K053246_word_w)
518518   AM_RANGE(0x440000, 0x441fff) AM_READ_LEGACY(K056832_mw_rom_word_r)
519519   AM_RANGE(0x450000, 0x45000f) AM_READ_LEGACY(K055673_rom_word_r)
r14896r14897
583583   AM_RANGE(0xe230, 0xe3ff) AM_RAM
584584   AM_RANGE(0xe400, 0xe62f) AM_DEVREADWRITE("konami2", k054539_device, read, write)
585585   AM_RANGE(0xe630, 0xe7ff) AM_RAM
586   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
587   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
588   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
586   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_byte_w)
587   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_byte_r)
588   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_byte_r)
589589   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
590590   AM_RANGE(0xfff0, 0xfff3) AM_WRITENOP   // unknown write
591591ADDRESS_MAP_END
src/mame/drivers/dlair.c
r14896r14897
5252      : driver_device(mconfig, type, tag),
5353        m_ldv1000(*this, "ld_ldv1000"),
5454        m_pr7820(*this, "ld_pr7820"),
55        m_22vp932(*this, "ld_22vp932") { }
55        m_22vp932(*this, "ld_22vp932") ,
56      m_videoram(*this, "videoram"){ }
5657
5758   void laserdisc_data_w(UINT8 data)
5859   {
r14896r14897
9394      return CLEAR_LINE;
9495   }
9596
96   UINT8 *m_videoram;
9797   optional_device<pioneer_ldv1000_device> m_ldv1000;
9898   optional_device<pioneer_pr7820_device> m_pr7820;
9999   optional_device<phillips_22vp932_device> m_22vp932;
100   required_shared_ptr<UINT8> m_videoram;
100101   UINT8 m_last_misc;
101102   UINT8 m_laserdisc_data;
102103   DECLARE_WRITE8_MEMBER(misc_w);
r14896r14897
224225static SCREEN_UPDATE_IND16( dleuro )
225226{
226227   dlair_state *state = screen.machine().driver_data<dlair_state>();
227   UINT8 *videoram = state->m_videoram;
228   UINT8 *videoram = state->m_videoram.target();
228229   int x, y;
229230
230231   /* redraw the overlay */
r14896r14897
423424static ADDRESS_MAP_START( dleuro_map, AS_PROGRAM, 8, dlair_state )
424425   AM_RANGE(0x0000, 0x9fff) AM_ROM
425426   AM_RANGE(0xa000, 0xa7ff) AM_MIRROR(0x1800) AM_RAM
426   AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x1800) AM_RAM AM_BASE(m_videoram)
427   AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x1800) AM_RAM AM_SHARE("videoram")
427428   AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1f47) // WT LED 1
428429   AM_RANGE(0xe008, 0xe008) AM_MIRROR(0x1f47) // WT LED 2
429430   AM_RANGE(0xe010, 0xe010) AM_MIRROR(0x1f47) AM_WRITE(led_den1_w)         // WT EXT LED 1
src/mame/drivers/jollyjgr.c
r14896r14897
106106{
107107public:
108108   jollyjgr_state(const machine_config &mconfig, device_type type, const char *tag)
109      : driver_device(mconfig, type, tag) { }
109      : driver_device(mconfig, type, tag) ,
110      m_videoram(*this, "videoram"),
111      m_colorram(*this, "colorram"),
112      m_spriteram(*this, "spriteram"),
113      m_bitmap(*this, "bitmap"),
114      m_bulletram(*this, "bulletram"){ }
110115
111116   /* memory pointers */
112   UINT8 *  m_videoram;
113   UINT8 *  m_colorram;
114   UINT8 *  m_spriteram;
115   UINT8 *  m_bulletram;
116   UINT8 *  m_bitmap;
117   required_shared_ptr<UINT8> m_videoram;
118   required_shared_ptr<UINT8> m_colorram;
119   required_shared_ptr<UINT8> m_spriteram;
120   required_shared_ptr<UINT8> m_bitmap;
121   required_shared_ptr<UINT8> m_bulletram;
117122
118123   /* video-related */
119124   tilemap_t  *m_bg_tilemap;
r14896r14897
140145
141146WRITE8_MEMBER(jollyjgr_state::jollyjgr_videoram_w)
142147{
143   m_videoram[offset] = data;
148   m_videoram.target()[offset] = data;
144149   m_bg_tilemap->mark_tile_dirty(offset);
145150}
146151
r14896r14897
160165      m_bg_tilemap->set_scrolly(offset >> 1, data);
161166   }
162167
163   m_colorram[offset] = data;
168   m_colorram.target()[offset] = data;
164169}
165170
166171WRITE8_MEMBER(jollyjgr_state::jollyjgr_misc_w)
r14896r14897
204209   AM_RANGE(0x8ffc, 0x8ffc) AM_WRITE(jollyjgr_misc_w)
205210   AM_RANGE(0x8ffd, 0x8ffd) AM_WRITE(jollyjgr_coin_lookout_w)
206211   AM_RANGE(0x8fff, 0x8fff) AM_READ_PORT("DSW2")
207   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(jollyjgr_videoram_w) AM_BASE(m_videoram)
208   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(jollyjgr_attrram_w) AM_BASE(m_colorram)
209   AM_RANGE(0x9840, 0x987f) AM_RAM AM_BASE(m_spriteram)
212   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(jollyjgr_videoram_w) AM_SHARE("videoram")
213   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(jollyjgr_attrram_w) AM_SHARE("colorram")
214   AM_RANGE(0x9840, 0x987f) AM_RAM AM_SHARE("spriteram")
210215   AM_RANGE(0x9880, 0x9bff) AM_RAM
211   AM_RANGE(0xa000, 0xffff) AM_RAM AM_BASE(m_bitmap)
216   AM_RANGE(0xa000, 0xffff) AM_RAM AM_SHARE("bitmap")
212217ADDRESS_MAP_END
213218
214219static ADDRESS_MAP_START( fspider_map, AS_PROGRAM, 8, jollyjgr_state )
r14896r14897
221226   AM_RANGE(0x8ffc, 0x8ffc) AM_WRITE(jollyjgr_misc_w)
222227   AM_RANGE(0x8ffd, 0x8ffd) AM_WRITE(jollyjgr_coin_lookout_w)
223228   AM_RANGE(0x8fff, 0x8fff) AM_READ_PORT("DSW2")
224   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(jollyjgr_videoram_w) AM_BASE(m_videoram)
225   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(jollyjgr_attrram_w) AM_BASE(m_colorram)
226   AM_RANGE(0x9840, 0x987f) AM_RAM AM_BASE(m_spriteram)
229   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(jollyjgr_videoram_w) AM_SHARE("videoram")
230   AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(jollyjgr_attrram_w) AM_SHARE("colorram")
231   AM_RANGE(0x9840, 0x987f) AM_RAM AM_SHARE("spriteram")
227232   AM_RANGE(0x9880, 0x989f) AM_RAM // ?
228   AM_RANGE(0x98a0, 0x98af) AM_RAM AM_BASE(m_bulletram)
233   AM_RANGE(0x98a0, 0x98af) AM_RAM AM_SHARE("bulletram")
229234   AM_RANGE(0x98b0, 0x9bff) AM_RAM // ?
230   AM_RANGE(0xa000, 0xffff) AM_RAM AM_BASE(m_bitmap)
235   AM_RANGE(0xa000, 0xffff) AM_RAM AM_SHARE("bitmap")
231236ADDRESS_MAP_END
232237
233238
r14896r14897
432437static TILE_GET_INFO( get_bg_tile_info )
433438{
434439   jollyjgr_state *state = machine.driver_data<jollyjgr_state>();
435   int color = state->m_colorram[((tile_index & 0x1f) << 1) | 1] & 7;
440   int color = state->m_colorram.target()[((tile_index & 0x1f) << 1) | 1] & 7;
436441   int region = (state->m_tilemap_bank & 0x20) ? 2 : 0;
437   SET_TILE_INFO(region, state->m_videoram[tile_index], color, 0);
442   SET_TILE_INFO(region, state->m_videoram.target()[tile_index], color, 0);
438443}
439444
440445static VIDEO_START( jollyjgr )
r14896r14897
460465      {
461466         for(i = 0; i < 8; i++)
462467         {
463            bit0 = (state->m_bitmap[count] >> i) & 1;
464            bit1 = (state->m_bitmap[count + 0x2000] >> i) & 1;
465            bit2 = (state->m_bitmap[count + 0x4000] >> i) & 1;
468            bit0 = (state->m_bitmap.target()[count] >> i) & 1;
469            bit1 = (state->m_bitmap.target()[count + 0x2000] >> i) & 1;
470            bit2 = (state->m_bitmap.target()[count + 0x4000] >> i) & 1;
466471            color = bit0 | (bit1 << 1) | (bit2 << 2);
467472
468473            if(color)
r14896r14897
486491static SCREEN_UPDATE_IND16( jollyjgr )
487492{
488493   jollyjgr_state *state = screen.machine().driver_data<jollyjgr_state>();
489   UINT8 *spriteram = state->m_spriteram;
494   UINT8 *spriteram = state->m_spriteram.target();
490495   int offs;
491496
492497   bitmap.fill(32, cliprect);
r14896r14897
551556    Assume bullets to look the same as on Galaxian hw,
552557    that is, simply 4 pixels. Colours are unknown. */
553558   for (int offs=0;offs<0x10;offs+=2) {
554      UINT8 sy=~state->m_bulletram[offs];
555      UINT8 sx=~state->m_bulletram[offs|1];
559      UINT8 sy=~state->m_bulletram.target()[offs];
560      UINT8 sx=~state->m_bulletram.target()[offs|1];
556561      UINT16 bc=(offs<4)?
557562         32+7: // player, white
558563         32+3; // enemy, yellow
src/mame/drivers/klax.c
r14896r14897
4646}
4747
4848
49static WRITE16_HANDLER( interrupt_ack_w )
49WRITE16_MEMBER(klax_state::interrupt_ack_w)
5050{
51   atarigen_scanline_int_ack_w(space, offset, data, mem_mask);
52   atarigen_video_int_ack_w(space, offset, data, mem_mask);
51   atarigen_scanline_int_ack_w(&space, offset, data, mem_mask);
52   atarigen_video_int_ack_w(&space, offset, data, mem_mask);
5353}
5454
5555
r14896r14897
9191   AM_RANGE(0x260002, 0x260003) AM_READ_PORT("P2")
9292   AM_RANGE(0x270000, 0x270001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
9393   AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w)
94   AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(interrupt_ack_w)
94   AM_RANGE(0x360000, 0x360001) AM_WRITE(interrupt_ack_w)
9595   AM_RANGE(0x3e0000, 0x3e07ff) AM_RAM_WRITE_LEGACY(atarigen_expanded_666_paletteram_w) AM_SHARE("paletteram")
9696   AM_RANGE(0x3f0000, 0x3f0f7f) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_BASE(m_playfield)
9797   AM_RANGE(0x3f0f80, 0x3f0fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
src/mame/drivers/quizpani.c
r14896r14897
6262   AM_RANGE(0x100018, 0x100019) AM_WRITE(quizpani_tilesbank_w)
6363   AM_RANGE(0x104000, 0x104001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
6464   AM_RANGE(0x104020, 0x104027) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_lsb_w)
65   AM_RANGE(0x108000, 0x1083ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
65   AM_RANGE(0x108000, 0x1083ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
6666   AM_RANGE(0x108400, 0x1085ff) AM_WRITENOP
6767   AM_RANGE(0x10c000, 0x10c007) AM_RAM AM_BASE(m_scrollreg)
6868   AM_RANGE(0x10c008, 0x10c403) AM_WRITENOP
src/mame/drivers/ssfindo.c
r14896r14897
216216{
217217public:
218218   ssfindo_state(const machine_config &mconfig, device_type type, const char *tag)
219      : driver_device(mconfig, type, tag) { }
219      : driver_device(mconfig, type, tag) ,
220      m_vram(*this, "vram"){ }
220221
221222   UINT32 m_PS7500_IO[MAXIO];
222223   UINT32 m_PS7500_FIFO[256];
223   UINT32 *m_vram;
224   required_shared_ptr<UINT32> m_vram;
224225   UINT32 m_flashAdr;
225226   UINT32 m_flashOffset;
226227   UINT32 m_adrLatch;
r14896r14897
261262         for(y=0;y<256;y++)
262263            for(x=0;x<320;x+=4)
263264            {
264               bitmap.pix16(y, x+0) = state->m_vram[s]&0xff;
265               bitmap.pix16(y, x+1) = (state->m_vram[s]>>8)&0xff;
266               bitmap.pix16(y, x+2) = (state->m_vram[s]>>16)&0xff;
267               bitmap.pix16(y, x+3) = (state->m_vram[s]>>24)&0xff;
265               bitmap.pix16(y, x+0) = state->m_vram.target()[s]&0xff;
266               bitmap.pix16(y, x+1) = (state->m_vram.target()[s]>>8)&0xff;
267               bitmap.pix16(y, x+2) = (state->m_vram.target()[s]>>16)&0xff;
268               bitmap.pix16(y, x+3) = (state->m_vram.target()[s]>>24)&0xff;
268269               s++;
269270            }
270271      }
r14896r14897
565566   AM_RANGE(0x0324f000, 0x0324f003) AM_READ(SIMPLEIO_r)
566567   AM_RANGE(0x03245000, 0x03245003) AM_WRITENOP /* sound ? */
567568   AM_RANGE(0x03400000, 0x03400003) AM_WRITE(FIFO_w)
568   AM_RANGE(0x10000000, 0x11ffffff) AM_RAM AM_BASE(m_vram)
569   AM_RANGE(0x10000000, 0x11ffffff) AM_RAM AM_SHARE("vram")
569570ADDRESS_MAP_END
570571
571572static ADDRESS_MAP_START( ppcar_map, AS_PROGRAM, 32, ssfindo_state )
r14896r14897
580581   AM_RANGE(0x033c0000, 0x033c0003) AM_READ(io_r) AM_WRITE(io_w)
581582   AM_RANGE(0x03400000, 0x03400003) AM_WRITE(FIFO_w)
582583   AM_RANGE(0x08000000, 0x08ffffff) AM_RAM
583   AM_RANGE(0x10000000, 0x10ffffff) AM_RAM AM_BASE(m_vram)
584   AM_RANGE(0x10000000, 0x10ffffff) AM_RAM AM_SHARE("vram")
584585ADDRESS_MAP_END
585586
586587READ32_MEMBER(ssfindo_state::tetfight_unk_r)
r14896r14897
602603   AM_RANGE(0x03240004, 0x03240007) AM_READ_PORT("IN0")
603604   AM_RANGE(0x03240008, 0x0324000b) AM_READ_PORT("DSW2")
604605   AM_RANGE(0x03240020, 0x03240023) AM_READWRITE(tetfight_unk_r, tetfight_unk_w)
605   AM_RANGE(0x10000000, 0x14ffffff) AM_RAM AM_BASE(m_vram)
606   AM_RANGE(0x10000000, 0x14ffffff) AM_RAM AM_SHARE("vram")
606607ADDRESS_MAP_END
607608
608609static MACHINE_RESET( ssfindo )
src/mame/drivers/peplus.c
r14896r14897
180180public:
181181   peplus_state(const machine_config &mconfig, device_type type, const char *tag)
182182      : driver_device(mconfig, type, tag),
183        m_cmos_ram(*this, "cmos") { }
183        m_cmos_ram(*this, "cmos") ,
184      m_program_ram(*this, "prograram"),
185      m_s3000_ram(*this, "s3000_ram"),
186      m_s5000_ram(*this, "s5000_ram"),
187      m_videoram(*this, "videoram"),
188      m_s7000_ram(*this, "s7000_ram"),
189      m_sb000_ram(*this, "sb000_ram"),
190      m_sd000_ram(*this, "sd000_ram"),
191      m_sf000_ram(*this, "sf000_ram"),
192      m_io_port(*this, "io_port"){ }
184193
185   UINT8 *m_videoram;
186194   required_shared_ptr<UINT8> m_cmos_ram;
195   required_shared_ptr<UINT8> m_program_ram;
196   required_shared_ptr<UINT8> m_s3000_ram;
197   required_shared_ptr<UINT8> m_s5000_ram;
198   required_shared_ptr<UINT8> m_videoram;
199   required_shared_ptr<UINT8> m_s7000_ram;
200   required_shared_ptr<UINT8> m_sb000_ram;
201   required_shared_ptr<UINT8> m_sd000_ram;
202   required_shared_ptr<UINT8> m_sf000_ram;
203   required_shared_ptr<UINT8> m_io_port;
187204   UINT16 m_autohold_addr;
188205   tilemap_t *m_bg_tilemap;
189206   UINT8 m_wingboard;
190207   UINT8 m_jumper_e16_e17;
191   UINT8 *m_program_ram;
192   UINT8 *m_s3000_ram;
193   UINT8 *m_s5000_ram;
194   UINT8 *m_s7000_ram;
195   UINT8 *m_sb000_ram;
196   UINT8 *m_sd000_ram;
197   UINT8 *m_sf000_ram;
198208   UINT16 m_vid_address;
199209   UINT8 *m_palette_ram;
200210   UINT8 *m_palette_ram2;
201   UINT8 *m_io_port;
202211   UINT64 m_last_cycles;
203212   UINT8 m_coin_state;
204213   UINT64 m_last_door;
r14896r14897
362371
363372WRITE8_MEMBER(peplus_state::peplus_crtc_display_w)
364373{
365   UINT8 *videoram = m_videoram;
374   UINT8 *videoram = m_videoram.target();
366375   videoram[m_vid_address] = data;
367   m_palette_ram[m_vid_address] = m_io_port[1];
368   m_palette_ram2[m_vid_address] = m_io_port[3];
376   m_palette_ram[m_vid_address] = m_io_port.target()[1];
377   m_palette_ram2[m_vid_address] = m_io_port.target()[3];
369378
370379   m_bg_tilemap->mark_tile_dirty(m_vid_address);
371380
r14896r14897
375384
376385WRITE8_MEMBER(peplus_state::peplus_io_w)
377386{
378   m_io_port[offset] = data;
387   m_io_port.target()[offset] = data;
379388}
380389
381390WRITE8_MEMBER(peplus_state::peplus_duart_w)
r14896r14897
394403      peplus_load_superdata(machine(), bank_name);
395404   }
396405
397   m_cmos_ram[offset] = data;
406   m_cmos_ram.target()[offset] = data;
398407}
399408
400409WRITE8_MEMBER(peplus_state::peplus_s3000_w)
401410{
402   m_s3000_ram[offset] = data;
411   m_s3000_ram.target()[offset] = data;
403412}
404413
405414WRITE8_MEMBER(peplus_state::peplus_s5000_w)
406415{
407   m_s5000_ram[offset] = data;
416   m_s5000_ram.target()[offset] = data;
408417}
409418
410419WRITE8_MEMBER(peplus_state::peplus_s7000_w)
411420{
412   m_s7000_ram[offset] = data;
421   m_s7000_ram.target()[offset] = data;
413422}
414423
415424WRITE8_MEMBER(peplus_state::peplus_sb000_w)
416425{
417   m_sb000_ram[offset] = data;
426   m_sb000_ram.target()[offset] = data;
418427}
419428
420429WRITE8_MEMBER(peplus_state::peplus_sd000_w)
421430{
422   m_sd000_ram[offset] = data;
431   m_sd000_ram.target()[offset] = data;
423432}
424433
425434WRITE8_MEMBER(peplus_state::peplus_sf000_w)
426435{
427   m_sf000_ram[offset] = data;
436   m_sf000_ram.target()[offset] = data;
428437}
429438
430439WRITE8_MEMBER(peplus_state::peplus_output_bank_a_w)
r14896r14897
482491
483492READ8_MEMBER(peplus_state::peplus_io_r)
484493{
485    return m_io_port[offset];
494    return m_io_port.target()[offset];
486495}
487496
488497READ8_MEMBER(peplus_state::peplus_duart_r)
r14896r14897
493502
494503READ8_MEMBER(peplus_state::peplus_cmos_r)
495504{
496   return m_cmos_ram[offset];
505   return m_cmos_ram.target()[offset];
497506}
498507
499508READ8_MEMBER(peplus_state::peplus_s3000_r)
500509{
501   return m_s3000_ram[offset];
510   return m_s3000_ram.target()[offset];
502511}
503512
504513READ8_MEMBER(peplus_state::peplus_s5000_r)
505514{
506   return m_s5000_ram[offset];
515   return m_s5000_ram.target()[offset];
507516}
508517
509518READ8_MEMBER(peplus_state::peplus_s7000_r)
510519{
511   return m_s7000_ram[offset];
520   return m_s7000_ram.target()[offset];
512521}
513522
514523READ8_MEMBER(peplus_state::peplus_sb000_r)
515524{
516   return m_sb000_ram[offset];
525   return m_sb000_ram.target()[offset];
517526}
518527
519528READ8_MEMBER(peplus_state::peplus_sd000_r)
520529{
521   return m_sd000_ram[offset];
530   return m_sd000_ram.target()[offset];
522531}
523532
524533READ8_MEMBER(peplus_state::peplus_sf000_r)
525534{
526   return m_sf000_ram[offset];
535   return m_sf000_ram.target()[offset];
527536}
528537
529538/* Last Color in Every Palette is bgcolor */
r14896r14897
653662static TILE_GET_INFO( get_bg_tile_info )
654663{
655664   peplus_state *state = machine.driver_data<peplus_state>();
656   UINT8 *videoram = state->m_videoram;
665   UINT8 *videoram = state->m_videoram.target();
657666   int pr = state->m_palette_ram[tile_index];
658667   int pr2 = state->m_palette_ram2[tile_index];
659668   int vr = videoram[tile_index];
r14896r14897
740749*************************/
741750
742751static ADDRESS_MAP_START( peplus_map, AS_PROGRAM, 8, peplus_state )
743   AM_RANGE(0x0000, 0xffff) AM_ROM AM_BASE(m_program_ram)
752   AM_RANGE(0x0000, 0xffff) AM_ROM AM_SHARE("prograram")
744753ADDRESS_MAP_END
745754
746755static ADDRESS_MAP_START( peplus_iomap, AS_IO, 8, peplus_state )
r14896r14897
754763   AM_RANGE(0x2083, 0x2083) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(peplus_crtc_display_w)
755764
756765    // Superboard Data
757   AM_RANGE(0x3000, 0x3fff) AM_READWRITE(peplus_s3000_r, peplus_s3000_w) AM_BASE(m_s3000_ram)
766   AM_RANGE(0x3000, 0x3fff) AM_READWRITE(peplus_s3000_r, peplus_s3000_w) AM_SHARE("s3000_ram")
758767
759768   // Sound and Dipswitches
760769   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
761770   AM_RANGE(0x4004, 0x4004) AM_READ_PORT("SW1")/* likely ay8910 input port, not direct */ AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
762771
763772    // Superboard Data
764   AM_RANGE(0x5000, 0x5fff) AM_READWRITE(peplus_s5000_r, peplus_s5000_w) AM_BASE(m_s5000_ram)
773   AM_RANGE(0x5000, 0x5fff) AM_READWRITE(peplus_s5000_r, peplus_s5000_w) AM_SHARE("s5000_ram")
765774
766775   // Background Color Latch
767776   AM_RANGE(0x6000, 0x6000) AM_READ(peplus_bgcolor_r) AM_WRITE(peplus_bgcolor_w)
768777
769778    // Bogus Location for Video RAM
770   AM_RANGE(0x06001, 0x06400) AM_RAM AM_BASE(m_videoram)
779   AM_RANGE(0x06001, 0x06400) AM_RAM AM_SHARE("videoram")
771780
772781    // Superboard Data
773   AM_RANGE(0x7000, 0x7fff) AM_READWRITE(peplus_s7000_r, peplus_s7000_w) AM_BASE(m_s7000_ram)
782   AM_RANGE(0x7000, 0x7fff) AM_READWRITE(peplus_s7000_r, peplus_s7000_w) AM_SHARE("s7000_ram")
774783
775784   // Input Bank A, Output Bank C
776785   AM_RANGE(0x8000, 0x8000) AM_DEVREAD_LEGACY("i2cmem",peplus_input_bank_a_r) AM_WRITE(peplus_output_bank_c_w)
r14896r14897
782791   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") AM_WRITE(peplus_output_bank_b_w)
783792
784793    // Superboard Data
785   AM_RANGE(0xb000, 0xbfff) AM_READWRITE(peplus_sb000_r, peplus_sb000_w) AM_BASE(m_sb000_ram)
794   AM_RANGE(0xb000, 0xbfff) AM_READWRITE(peplus_sb000_r, peplus_sb000_w) AM_SHARE("sb000_ram")
786795
787796   // Output Bank A
788797   AM_RANGE(0xc000, 0xc000) AM_READ(peplus_watchdog_r) AM_WRITE(peplus_output_bank_a_w)
789798
790799    // Superboard Data
791   AM_RANGE(0xd000, 0xdfff) AM_READWRITE(peplus_sd000_r, peplus_sd000_w) AM_BASE(m_sd000_ram)
800   AM_RANGE(0xd000, 0xdfff) AM_READWRITE(peplus_sd000_r, peplus_sd000_w) AM_SHARE("sd000_ram")
792801
793802   // DUART
794803   AM_RANGE(0xe000, 0xe00f) AM_READWRITE(peplus_duart_r, peplus_duart_w)
795804
796805    // Superboard Data
797   AM_RANGE(0xf000, 0xffff) AM_READWRITE(peplus_sf000_r, peplus_sf000_w) AM_BASE(m_sf000_ram)
806   AM_RANGE(0xf000, 0xffff) AM_READWRITE(peplus_sf000_r, peplus_sf000_w) AM_SHARE("sf000_ram")
798807
799808   /* Ports start here */
800   AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(peplus_io_r) AM_WRITE(peplus_io_w) AM_BASE(m_io_port)
809   AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(peplus_io_r) AM_WRITE(peplus_io_w) AM_SHARE("io_port")
801810ADDRESS_MAP_END
802811
803812
r14896r14897
10101019   peplus_state *state = machine.driver_data<peplus_state>();
10111020
10121021   // pepp0158
1013   state->m_program_ram[0xa19f] = 0x22; // RET - Disable Memory Test
1014   state->m_program_ram[0xddea] = 0x22; // RET - Disable Program Checksum
1022   state->m_program_ram.target()[0xa19f] = 0x22; // RET - Disable Memory Test
1023   state->m_program_ram.target()[0xddea] = 0x22; // RET - Disable Program Checksum
10151024   state->m_autohold_addr = 0x5ffe; // AutoHold Address
10161025
10171026   // pepp0188
1018   state->m_program_ram[0x9a8d] = 0x22; // RET - Disable Memory Test
1019   state->m_program_ram[0xf429] = 0x22; // RET - Disable Program Checksum
1027   state->m_program_ram.target()[0x9a8d] = 0x22; // RET - Disable Memory Test
1028   state->m_program_ram.target()[0xf429] = 0x22; // RET - Disable Program Checksum
10201029   state->m_autohold_addr = 0x742f; // AutoHold Address
10211030
10221031   // pepp0516
1023   state->m_program_ram[0x9a24] = 0x22; // RET - Disable Memory Test
1024   state->m_program_ram[0xd61d] = 0x22; // RET - Disable Program Checksum
1032   state->m_program_ram.target()[0x9a24] = 0x22; // RET - Disable Memory Test
1033   state->m_program_ram.target()[0xd61d] = 0x22; // RET - Disable Program Checksum
10251034   state->m_autohold_addr = 0x5e7e; // AutoHold Address
10261035
10271036   if (state->m_autohold_addr)
1028      state->m_program_ram[state->m_autohold_addr] = input_port_read_safe(machine, "AUTOHOLD",0x00) & 0x01;
1037      state->m_program_ram.target()[state->m_autohold_addr] = input_port_read_safe(machine, "AUTOHOLD",0x00) & 0x01;
10291038#endif
10301039}
10311040
src/mame/drivers/ddayjlc.c
r14896r14897
6060{
6161public:
6262   ddayjlc_state(const machine_config &mconfig, device_type type, const char *tag)
63      : driver_device(mconfig, type, tag) { }
63      : driver_device(mconfig, type, tag) ,
64      m_mainram(*this, "mainram"),
65      m_spriteram(*this, "spriteram"),
66      m_videoram(*this, "videoram"),
67      m_bgram(*this, "bgram"){ }
6468
6569   /* memory pointers */
66   UINT8 *  m_bgram;
67   UINT8 *  m_mainram;
68   UINT8 *  m_videoram;
69   UINT8 *  m_spriteram;
70   required_shared_ptr<UINT8> m_mainram;
71   required_shared_ptr<UINT8> m_spriteram;
72   required_shared_ptr<UINT8> m_videoram;
73   required_shared_ptr<UINT8> m_bgram;
7074
7175   /* video-related */
7276   tilemap_t  *m_bg_tilemap;
r14896r14897
162166   if (!offset)
163167      m_bg_tilemap->set_scrollx(0, data + 8);
164168
165   m_bgram[offset] = data;
169   m_bgram.target()[offset] = data;
166170   m_bg_tilemap->mark_tile_dirty(offset & 0x3ff);
167171}
168172
169173WRITE8_MEMBER(ddayjlc_state::ddayjlc_videoram_w)
170174{
171   m_videoram[offset] = data;
175   m_videoram.target()[offset] = data;
172176}
173177
174178
r14896r14897
205209WRITE8_MEMBER(ddayjlc_state::sound_w)
206210{
207211
208   soundlatch_w(space, offset, data);
212   soundlatch_byte_w(space, offset, data);
209213   device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0xff);
210214}
211215
r14896r14897
242246
243247static ADDRESS_MAP_START( main_cpu, AS_PROGRAM, 8, ddayjlc_state )
244248   AM_RANGE(0x0000, 0x7fff) AM_ROM
245   AM_RANGE(0x8000, 0x8fff) AM_RAM AM_BASE(m_mainram)
246   AM_RANGE(0x9000, 0x93ff) AM_RAM AM_BASE(m_spriteram)
247   AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(ddayjlc_videoram_w) AM_BASE(m_videoram)
248   AM_RANGE(0x9800, 0x9fff) AM_RAM_WRITE(ddayjlc_bgram_w) AM_BASE(m_bgram) /* 9800-981f - videoregs */
249   AM_RANGE(0x8000, 0x8fff) AM_RAM AM_SHARE("mainram")
250   AM_RANGE(0x9000, 0x93ff) AM_RAM AM_SHARE("spriteram")
251   AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(ddayjlc_videoram_w) AM_SHARE("videoram")
252   AM_RANGE(0x9800, 0x9fff) AM_RAM_WRITE(ddayjlc_bgram_w) AM_SHARE("bgram") /* 9800-981f - videoregs */
249253   AM_RANGE(0xa000, 0xdfff) AM_ROMBANK("bank1") AM_WRITENOP
250254   AM_RANGE(0xe000, 0xe003) AM_WRITE(i8257_CH0_w)
251255   AM_RANGE(0xe008, 0xe008) AM_WRITENOP
r14896r14897
367371static TILE_GET_INFO( get_tile_info_bg )
368372{
369373   ddayjlc_state *state = machine.driver_data<ddayjlc_state>();
370   int code = state->m_bgram[tile_index] + ((state->m_bgram[tile_index + 0x400] & 0x08) << 5);
371   int color = (state->m_bgram[tile_index + 0x400] & 0x7);
372   color |= (state->m_bgram[tile_index + 0x400] & 0x40) >> 3;
374   int code = state->m_bgram.target()[tile_index] + ((state->m_bgram.target()[tile_index + 0x400] & 0x08) << 5);
375   int color = (state->m_bgram.target()[tile_index + 0x400] & 0x7);
376   color |= (state->m_bgram.target()[tile_index + 0x400] & 0x40) >> 3;
373377
374378   SET_TILE_INFO(2, code, color, 0);
375379}
r14896r14897
388392
389393   for (i = 0; i < 0x400; i += 4)
390394   {
391      UINT8  flags = state->m_spriteram[i + 2];
392      UINT8  y = 256 - state->m_spriteram[i + 0] - 8;
393      UINT16 code = state->m_spriteram[i + 1];
394      UINT8  x = state->m_spriteram[i + 3] - 16;
395      UINT8  flags = state->m_spriteram.target()[i + 2];
396      UINT8  y = 256 - state->m_spriteram.target()[i + 0] - 8;
397      UINT16 code = state->m_spriteram.target()[i + 1];
398      UINT8  x = state->m_spriteram.target()[i + 3] - 16;
395399      UINT8  xflip = flags & 0x80;
396400      UINT8  yflip = (code & 0x80);
397401      UINT8  color = flags & 0xf;
r14896r14897
407411      for (y = 0; y < 32; y++)
408412         for (x = 0; x < 32; x++)
409413         {
410            c = state->m_videoram[y * 32 + x];
414            c = state->m_videoram.target()[y * 32 + x];
411415            if (x > 1 && x < 30)
412416               drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[1], c + state->m_char_bank * 0x100, 2, 0, 0, x*8, y*8, 0);
413417            else
r14896r14897
421425{
422426   AY8910_LEGACY_OUTPUT,
423427   AY8910_DEFAULT_LOADS,
424   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_r),
428   DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_r),
425429   DEVCB_NULL,
426430   DEVCB_NULL,
427431   DEVCB_NULL
src/mame/drivers/dorachan.c
r14896r14897
1919{
2020public:
2121   dorachan_state(const machine_config &mconfig, device_type type, const char *tag)
22      : driver_device(mconfig, type, tag) { }
22      : driver_device(mconfig, type, tag) ,
23      m_videoram(*this, "videoram"){ }
2324
2425   /* memory pointers */
25   UINT8 *  m_videoram;
26   size_t   m_videoram_size;
26   required_shared_ptr<UINT8> m_videoram;
2727
2828   /* video-related */
2929   UINT8    m_flip_screen;
r14896r14897
9090
9191   color_map_base = screen.machine().region("proms")->base();
9292
93   for (offs = 0; offs < state->m_videoram_size; offs++)
93   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
9494   {
9595      int i;
9696      UINT8 fore_color;
r14896r14897
101101      /* the need for +1 is extremely unusual, but definetely correct */
102102      offs_t color_address = ((((offs << 2) & 0x03e0) | (offs >> 8)) + 1) & 0x03ff;
103103
104      UINT8 data = state->m_videoram[offs];
104      UINT8 data = state->m_videoram.target()[offs];
105105
106106      if (state->m_flip_screen)
107107         fore_color = (color_map_base[color_address] >> 3) & 0x07;
r14896r14897
151151   AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x03ff) AM_READ_PORT("SYSTEM")
152152   AM_RANGE(0x2c00, 0x2c00) AM_MIRROR(0x03ff) AM_READ_PORT("JOY")
153153   AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x03ff) AM_READ_PORT("V128")
154   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE_SIZE(m_videoram, m_videoram_size)
154   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videoram")
155155   AM_RANGE(0x6000, 0x77ff) AM_ROM
156156ADDRESS_MAP_END
157157
src/mame/drivers/thunderj.c
r14896r14897
6868 *
6969 *************************************/
7070
71static READ16_HANDLER( special_port2_r )
71READ16_MEMBER(thunderj_state::special_port2_r)
7272{
73   thunderj_state *state = space->machine().driver_data<thunderj_state>();
74   int result = input_port_read(space->machine(), "260012");
73   int result = input_port_read(machine(), "260012");
7574
76   if (state->m_sound_to_cpu_ready) result ^= 0x0004;
77   if (state->m_cpu_to_sound_ready) result ^= 0x0008;
75   if (m_sound_to_cpu_ready) result ^= 0x0004;
76   if (m_cpu_to_sound_ready) result ^= 0x0008;
7877   result ^= 0x0010;
7978
8079   return result;
8180}
8281
8382
84static WRITE16_HANDLER( latch_w )
83WRITE16_MEMBER(thunderj_state::latch_w)
8584{
86   thunderj_state *state = space->machine().driver_data<thunderj_state>();
8785
8886   /* reset extra CPU */
8987   if (ACCESSING_BITS_0_7)
9088   {
9189      /* 0 means hold CPU 2's reset low */
9290      if (data & 1)
93         cputag_set_input_line(space->machine(), "extra", INPUT_LINE_RESET, CLEAR_LINE);
91         cputag_set_input_line(machine(), "extra", INPUT_LINE_RESET, CLEAR_LINE);
9492      else
95         cputag_set_input_line(space->machine(), "extra", INPUT_LINE_RESET, ASSERT_LINE);
93         cputag_set_input_line(machine(), "extra", INPUT_LINE_RESET, ASSERT_LINE);
9694
9795      /* bits 2-5 are the alpha bank */
98      if (state->m_alpha_tile_bank != ((data >> 2) & 7))
96      if (m_alpha_tile_bank != ((data >> 2) & 7))
9997      {
100         space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos());
101         state->m_alpha_tilemap->mark_all_dirty();
102         state->m_alpha_tile_bank = (data >> 2) & 7;
98         machine().primary_screen->update_partial(machine().primary_screen->vpos());
99         m_alpha_tilemap->mark_all_dirty();
100         m_alpha_tile_bank = (data >> 2) & 7;
103101      }
104102   }
105103}
r14896r14897
112110 *
113111 *************************************/
114112
115static READ16_HANDLER( thunderj_atarivc_r )
113READ16_MEMBER(thunderj_state::thunderj_atarivc_r)
116114{
117115   /* Sigh. CPU #1 reads the video controller register twice per frame, once at
118116       the beginning of interrupt and once near the end. It stores these values in a
119117       table starting at $163484. CPU #2 periodically looks at this table to make
120118       sure that it is getting interrupts at the appropriate times, and that the
121       VBLANK bit is set appropriately. Unfortunately, due to all the device_yield(&space->device())
119       VBLANK bit is set appropriately. Unfortunately, due to all the device_yield(&space.device())
122120       calls we make to synchronize the two CPUs, we occasionally get out of time
123121       and generate the interrupt outside of the tight tolerances CPU #2 expects.
124122
r14896r14897
130128   /* Use these lines to detect when things go south: */
131129
132130#if 0
133   if (space->read_word(0x163482) > 0xfff)
131   if (read_word(0x163482) > 0xfff)
134132      mame_printf_debug("You're screwed!");
135133#endif
136134
137   return atarivc_r(*space->machine().primary_screen, offset);
135   return atarivc_r(*machine().primary_screen, offset);
138136}
139137
140138
141static WRITE16_HANDLER( thunderj_atarivc_w )
139WRITE16_MEMBER(thunderj_state::thunderj_atarivc_w)
142140{
143   atarivc_w(*space->machine().primary_screen, offset, data, mem_mask);
141   atarivc_w(*machine().primary_screen, offset, data, mem_mask);
144142}
145143
146144
r14896r14897
158156   AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
159157   AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000")
160158   AM_RANGE(0x260010, 0x260011) AM_READ_PORT("260010")
161   AM_RANGE(0x260012, 0x260013) AM_READ_LEGACY(special_port2_r)
159   AM_RANGE(0x260012, 0x260013) AM_READ(special_port2_r)
162160   AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
163161   AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w)
164   AM_RANGE(0x360010, 0x360011) AM_WRITE_LEGACY(latch_w)
162   AM_RANGE(0x360010, 0x360011) AM_WRITE(latch_w)
165163   AM_RANGE(0x360020, 0x360021) AM_WRITE_LEGACY(atarigen_sound_reset_w)
166164   AM_RANGE(0x360030, 0x360031) AM_WRITE_LEGACY(atarigen_sound_w)
167165   AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram_w) AM_SHARE("paletteram")
168   AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE_LEGACY(thunderj_atarivc_r, thunderj_atarivc_w) AM_BASE(m_atarivc_data)
166   AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(thunderj_atarivc_r, thunderj_atarivc_w) AM_BASE(m_atarivc_data)
169167   AM_RANGE(0x3f0000, 0x3f1fff) AM_RAM_WRITE_LEGACY(atarigen_playfield2_latched_msb_w) AM_BASE(m_playfield2)
170168   AM_RANGE(0x3f2000, 0x3f3fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_latched_lsb_w) AM_BASE(m_playfield)
171169   AM_RANGE(0x3f4000, 0x3f5fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_dual_upper_w) AM_BASE(m_playfield_upper)
r14896r14897
190188   AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1")
191189   AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000")
192190   AM_RANGE(0x260010, 0x260011) AM_READ_PORT("260010")
193   AM_RANGE(0x260012, 0x260013) AM_READ_LEGACY(special_port2_r)
191   AM_RANGE(0x260012, 0x260013) AM_READ(special_port2_r)
194192   AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
195193   AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
196   AM_RANGE(0x360010, 0x360011) AM_WRITE_LEGACY(latch_w)
194   AM_RANGE(0x360010, 0x360011) AM_WRITE(latch_w)
197195   AM_RANGE(0x360020, 0x360021) AM_WRITE_LEGACY(atarigen_sound_reset_w)
198196   AM_RANGE(0x360030, 0x360031) AM_WRITE_LEGACY(atarigen_sound_w)
199197ADDRESS_MAP_END
src/mame/drivers/parodius.c
r14896r14897
4646   if (m_videobank & 0x01)
4747   {
4848      if (m_videobank & 0x04)
49         paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset + 0x0800, data);
49         paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset + 0x0800, data);
5050      else
51         paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset, data);
51         paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
5252   }
5353   else
5454      m_ram[offset] = data;
src/mame/drivers/quantum.c
r14896r14897
337337 *
338338 *************************************/
339339
340GAME( 1982, quantum,  0,       quantum, quantum, 0, ROT270, "Atari", "Quantum (rev 2)", GAME_SUPPORTS_SAVE )
341GAME( 1982, quantum1, quantum, quantum, quantum, 0, ROT270, "Atari", "Quantum (rev 1)", GAME_SUPPORTS_SAVE )
342GAME( 1982, quantump, quantum, quantum, quantum, 0, ROT270, "Atari", "Quantum (prototype)", GAME_SUPPORTS_SAVE )
340GAME( 1982, quantum,  0,       quantum, quantum, 0, ROT270, "General Computer Corporation (Atari license)", "Quantum (rev 2)", GAME_SUPPORTS_SAVE )
341GAME( 1982, quantum1, quantum, quantum, quantum, 0, ROT270, "General Computer Corporation (Atari license)", "Quantum (rev 1)", GAME_SUPPORTS_SAVE )
342GAME( 1982, quantump, quantum, quantum, quantum, 0, ROT270, "General Computer Corporation (Atari license)", "Quantum (prototype)", GAME_SUPPORTS_SAVE )
src/mame/drivers/combatsc.c
r14896r14897
1101109000        uPD7759
111111b000        uPD7759
112112c000        uPD7759
113d000        soundlatch_r
113d000        soundlatch_byte_r
114114e000-e001   YM2203
115115
116116
r14896r14897
150150
151151WRITE8_MEMBER(combatsc_state::combatscb_sh_irqtrigger_w)
152152{
153   soundlatch_w(space, offset, data);
153   soundlatch_byte_w(space, offset, data);
154154   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
155155}
156156
r14896r14897
389389   AM_RANGE(0x0408, 0x0408) AM_WRITE(combatsc_coin_counter_w)   /* coin counters */
390390   AM_RANGE(0x040c, 0x040c) AM_WRITE(combatsc_vreg_w)
391391   AM_RANGE(0x0410, 0x0410) AM_WRITE(combatsc_bankselect_w)
392   AM_RANGE(0x0414, 0x0414) AM_WRITE(soundlatch_w)
392   AM_RANGE(0x0414, 0x0414) AM_WRITE(soundlatch_byte_w)
393393   AM_RANGE(0x0418, 0x0418) AM_WRITE(combatsc_sh_irqtrigger_w)
394394   AM_RANGE(0x041c, 0x041c) AM_WRITE(watchdog_reset_w)         /* watchdog reset? */
395395
r14896r14897
419419   AM_RANGE(0xb000, 0xb000) AM_DEVREAD_LEGACY("upd", combatsc_busy_r)               /* upd7759 busy? */
420420   AM_RANGE(0xc000, 0xc000) AM_DEVWRITE_LEGACY("upd", combatsc_voice_reset_w)         /* upd7759 reset? */
421421
422   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)                        /* soundlatch_r? */
422   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r)                        /* soundlatch_byte_r? */
423423   AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE_LEGACY("ymsnd", combatsc_ym2203_r, ym2203_w)   /* YM 2203 intercepted */
424424ADDRESS_MAP_END
425425
r14896r14897
440440   AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)   /* YM 2203 */
441441   AM_RANGE(0x9008, 0x9009) AM_DEVREAD_LEGACY("ymsnd", ym2203_r)               /* ??? */
442442   AM_RANGE(0x9800, 0x9800) AM_DEVWRITE_LEGACY("msm5205",combatscb_dac_w)
443   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)                  /* soundlatch_r? */
443   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)                  /* soundlatch_byte_r? */
444444ADDRESS_MAP_END
445445
446446/*************************************
src/mame/drivers/rockrage.c
r14896r14897
7878
7979WRITE8_MEMBER(rockrage_state::rockrage_sh_irqtrigger_w)
8080{
81   soundlatch_w(space, offset, data);
81   soundlatch_byte_w(space, offset, data);
8282   device_set_input_line(m_audiocpu, M6809_IRQ_LINE, HOLD_LINE);
8383}
8484
r14896r14897
118118   AM_RANGE(0x2000, 0x2000) AM_DEVWRITE_LEGACY("vlm", vlm5030_data_w)            /* VLM5030 */
119119   AM_RANGE(0x3000, 0x3000) AM_DEVREAD_LEGACY("vlm", rockrage_VLM5030_busy_r)         /* VLM5030 */
120120   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE_LEGACY("vlm", rockrage_speech_w)            /* VLM5030 */
121   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_r)                        /* soundlatch_r */
121   AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_byte_r)                        /* soundlatch_byte_r */
122122   AM_RANGE(0x6000, 0x6001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)         /* YM 2151 */
123123   AM_RANGE(0x7000, 0x77ff) AM_RAM                                    /* RAM */
124124   AM_RANGE(0x8000, 0xffff) AM_ROM                                    /* ROM */
src/mame/drivers/quizpun2.c
r14896r14897
9292{
9393public:
9494   quizpun2_state(const machine_config &mconfig, device_type type, const char *tag)
95      : driver_device(mconfig, type, tag) { }
95      : driver_device(mconfig, type, tag) ,
96      m_fg_ram(*this, "fg_ram"),
97      m_bg_ram(*this, "bg_ram"){ }
9698
9799   struct prot_t m_prot;
98   UINT8 *m_bg_ram;
99   UINT8 *m_fg_ram;
100   required_shared_ptr<UINT8> m_fg_ram;
101   required_shared_ptr<UINT8> m_bg_ram;
100102   tilemap_t *m_bg_tmap;
101103   tilemap_t *m_fg_tmap;
102104   DECLARE_WRITE8_MEMBER(bg_ram_w);
r14896r14897
118120static TILE_GET_INFO( get_bg_tile_info )
119121{
120122   quizpun2_state *state = machine.driver_data<quizpun2_state>();
121   UINT16 code = state->m_bg_ram[ tile_index * 2 ] + state->m_bg_ram[ tile_index * 2 + 1 ] * 256;
123   UINT16 code = state->m_bg_ram.target()[ tile_index * 2 ] + state->m_bg_ram.target()[ tile_index * 2 + 1 ] * 256;
122124   SET_TILE_INFO(0, code, 0, 0);
123125}
124126
125127static TILE_GET_INFO( get_fg_tile_info )
126128{
127129   quizpun2_state *state = machine.driver_data<quizpun2_state>();
128   UINT16 code  = state->m_fg_ram[ tile_index * 4 ] + state->m_fg_ram[ tile_index * 4 + 1 ] * 256;
129   UINT8  color = state->m_fg_ram[ tile_index * 4 + 2 ];
130   UINT16 code  = state->m_fg_ram.target()[ tile_index * 4 ] + state->m_fg_ram.target()[ tile_index * 4 + 1 ] * 256;
131   UINT8  color = state->m_fg_ram.target()[ tile_index * 4 + 2 ];
130132   SET_TILE_INFO(1, code, color & 0x0f, 0);
131133}
132134
133135WRITE8_MEMBER(quizpun2_state::bg_ram_w)
134136{
135   m_bg_ram[offset] = data;
137   m_bg_ram.target()[offset] = data;
136138   m_bg_tmap->mark_tile_dirty(offset/2);
137139}
138140
139141WRITE8_MEMBER(quizpun2_state::fg_ram_w)
140142{
141   m_fg_ram[offset] = data;
143   m_fg_ram.target()[offset] = data;
142144   m_fg_tmap->mark_tile_dirty(offset/4);
143145}
144146
r14896r14897
352354
353355WRITE8_MEMBER(quizpun2_state::quizpun2_soundlatch_w)
354356{
355   soundlatch_w(space, 0, data);
357   soundlatch_byte_w(space, 0, data);
356358   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
357359}
358360
r14896r14897
364366   AM_RANGE( 0xc000, 0xc7ff ) AM_RAM_WRITE(bg_ram_w ) AM_BASE(m_bg_ram )   // 4 * 400
365367   AM_RANGE( 0xc800, 0xcfff ) AM_RAM                              //
366368
367   AM_RANGE( 0xd000, 0xd3ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w )  AM_SHARE("paletteram")
369   AM_RANGE( 0xd000, 0xd3ff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w )  AM_SHARE("paletteram")
368370   AM_RANGE( 0xe000, 0xffff ) AM_RAM
369371ADDRESS_MAP_END
370372
r14896r14897
393395   ADDRESS_MAP_GLOBAL_MASK(0xff)
394396   AM_RANGE( 0x00, 0x00 ) AM_WRITENOP   // IRQ end
395397   AM_RANGE( 0x20, 0x20 ) AM_WRITENOP   // NMI end
396   AM_RANGE( 0x40, 0x40 ) AM_READ(soundlatch_r )
398   AM_RANGE( 0x40, 0x40 ) AM_READ(soundlatch_byte_r )
397399   AM_RANGE( 0x60, 0x61 ) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w )
398400ADDRESS_MAP_END
399401
src/mame/drivers/egghunt.c
r14896r14897
4949{
5050public:
5151   egghunt_state(const machine_config &mconfig, device_type type, const char *tag)
52      : driver_device(mconfig, type, tag) { }
52      : driver_device(mconfig, type, tag) ,
53      m_atram(*this, "atram"){ }
5354
5455   /* video-related */
5556   tilemap_t   *m_bg_tilemap;
r14896r14897
6364   device_t *m_audiocpu;
6465
6566   /* memory */
66   UINT8 *  m_atram;
67   required_shared_ptr<UINT8> m_atram;
6768   UINT8     m_bgram[0x1000];
6869   UINT8     m_spram[0x1000];
6970   DECLARE_READ8_MEMBER(egghunt_bgram_r);
r14896r14897
118119{
119120   egghunt_state *state = machine.driver_data<egghunt_state>();
120121   int code = ((state->m_bgram[tile_index * 2 + 1] << 8) | state->m_bgram[tile_index * 2]) & 0x3fff;
121   int colour = state->m_atram[tile_index] & 0x3f;
122   int colour = state->m_atram.target()[tile_index] & 0x3f;
122123
123124   if(code & 0x2000)
124125   {
r14896r14897
160161
161162WRITE8_MEMBER(egghunt_state::egghunt_atram_w)
162163{
163   m_atram[offset] = data;
164   m_atram.target()[offset] = data;
164165   m_bg_tilemap->mark_tile_dirty(offset);
165166}
166167
r14896r14897
199200
200201WRITE8_MEMBER(egghunt_state::egghunt_soundlatch_w)
201202{
202   soundlatch_w(space, 0, data);
203   soundlatch_byte_w(space, 0, data);
203204   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
204205}
205206
r14896r14897
219220
220221static ADDRESS_MAP_START( egghunt_map, AS_PROGRAM, 8, egghunt_state )
221222   AM_RANGE(0x0000, 0x7fff) AM_ROM
222   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_SHARE("paletteram")
223   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(egghunt_atram_w) AM_BASE(m_atram)
223   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_le_w) AM_SHARE("paletteram")
224   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(egghunt_atram_w) AM_SHARE("atram")
224225   AM_RANGE(0xd000, 0xdfff) AM_READWRITE(egghunt_bgram_r, egghunt_bgram_w)
225226   AM_RANGE(0xe000, 0xffff) AM_RAM
226227ADDRESS_MAP_END
r14896r14897
239240
240241static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, egghunt_state )
241242   AM_RANGE(0x0000, 0x7fff) AM_ROM
242   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
243   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
243244   AM_RANGE(0xe001, 0xe001) AM_DEVREADWRITE_LEGACY("oki", egghunt_okibanking_r, egghunt_okibanking_w)
244245   AM_RANGE(0xe004, 0xe004) AM_DEVREADWRITE("oki", okim6295_device, read, write)
245246   AM_RANGE(0xf000, 0xffff) AM_RAM
src/mame/drivers/splus.c
r14896r14897
3333public:
3434   splus_state(const machine_config &mconfig, device_type type, const char *tag)
3535      : driver_device(mconfig, type, tag),
36      m_cmosl_ram(*this, "cmosl"), m_cmosh_ram(*this, "cmosh")
36      m_cmosl_ram(*this, "cmosl"),
37      m_cmosh_ram(*this, "cmosh"),
38      m_program_ram(*this, "program_ram"),
39      m_reel_ram(*this, "reel_ram"),
40      m_io_port(*this, "io_port")
3741   {
3842      m_sda_dir = 0;
3943      m_coin_state = 0;
r14896r14897
5862   required_shared_ptr<UINT8> m_cmosh_ram;
5963
6064   // Program and Reel Data
61   UINT8 *m_program_ram;
62   UINT8 *m_reel_ram;
65   required_shared_ptr<UINT8> m_program_ram;
66   required_shared_ptr<UINT8> m_reel_ram;
6367
6468   // IO Ports
65   UINT8 *m_io_port;
69   required_shared_ptr<UINT8> m_io_port;
6670
6771   // EEPROM States
6872   int m_sda_dir;
r14896r14897
179183#endif
180184   }
181185
182   m_io_port[offset] = data;
186   m_io_port.target()[offset] = data;
183187}
184188
185189WRITE8_MEMBER(splus_state::splus_load_pulse_w)
186190{
187191
188192//  UINT8 out = 0;
189//    out = ((~m_io_port[1] & 0xf0)>>4); // Output Bank
193//    out = ((~m_io_port.target()[1] & 0xf0)>>4); // Output Bank
190194}
191195
192196WRITE8_MEMBER(splus_state::splus_serial_w)
193197{
194198
195199    UINT8 out = 0;
196    out = ((~m_io_port[1] & 0xe0)>>5); // Output Bank
200    out = ((~m_io_port.target()[1] & 0xe0)>>5); // Output Bank
197201
198202   switch (out)
199203   {
r14896r14897
342346    seg = ((~data & 0xf0)>>4); // Segment Number
343347    val = (~data & 0x0f); // Digit Value
344348
345    // Need to add ~m_io_port[1]-1 to seg value
346    if (seg < 0x0a && (m_io_port[1] & 0xe0) == 0xe0)
349    // Need to add ~m_io_port.target()[1]-1 to seg value
350    if (seg < 0x0a && (m_io_port.target()[1] & 0xe0) == 0xe0)
347351        output_set_digit_value(seg, ls48_map[val]);
348352}
349353
r14896r14897
374378
375379    UINT8 in = 0x00;
376380    UINT8 val = 0x00;
377    in = ((~m_io_port[1] & 0xe0)>>5); // Input Bank
381    in = ((~m_io_port.target()[1] & 0xe0)>>5); // Input Bank
378382
379383   switch (in)
380384   {
r14896r14897
508512
509513READ8_MEMBER(splus_state::splus_m_reel_ram_r)
510514{
511   return m_reel_ram[offset];
515   return m_reel_ram.target()[offset];
512516}
513517
514518READ8_MEMBER(splus_state::splus_io_r)
515519{
516520
517521    if (offset == 3)
518        return m_io_port[offset] & 0xf3; // Ignore Int0 and Int1, or machine will loop forever waiting
522        return m_io_port.target()[offset] & 0xf3; // Ignore Int0 and Int1, or machine will loop forever waiting
519523    else
520       return m_io_port[offset];
524       return m_io_port.target()[offset];
521525}
522526
523527READ8_MEMBER(splus_state::splus_duart_r)
r14896r14897
586590*************************/
587591
588592static ADDRESS_MAP_START( splus_map, AS_PROGRAM, 8, splus_state )
589   AM_RANGE(0x0000, 0xffff) AM_ROM AM_BASE(m_program_ram)
593   AM_RANGE(0x0000, 0xffff) AM_ROM AM_SHARE("prograram")
590594ADDRESS_MAP_END
591595
592596static ADDRESS_MAP_START( splus_iomap, AS_IO, 8, splus_state )
r14896r14897
616620   AM_RANGE(0x7000, 0x7fff) AM_RAM AM_SHARE("cmosh")
617621
618622    // SSxxxx Reel Chip
619    AM_RANGE(0x8000, 0x9fff) AM_READ(splus_m_reel_ram_r) AM_BASE(m_reel_ram)
623    AM_RANGE(0x8000, 0x9fff) AM_READ(splus_m_reel_ram_r) AM_SHARE("reel_ram")
620624
621625   // Ports start here
622   AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(splus_io_r) AM_WRITE(splus_io_w) AM_BASE(m_io_port)
626   AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(splus_io_r) AM_WRITE(splus_io_w) AM_SHARE("io_port")
623627ADDRESS_MAP_END
624628
625629/*************************
src/mame/drivers/bigstrkb.c
r14896r14897
5353   AM_RANGE(0x0ec000, 0x0effff) AM_RAM_WRITE(bsb_videoram_w) AM_BASE(m_videoram)
5454
5555   AM_RANGE(0x0f0000, 0x0f7fff) AM_RAM
56   AM_RANGE(0x0f8000, 0x0f87ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
56   AM_RANGE(0x0f8000, 0x0f87ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
5757   AM_RANGE(0x0f8800, 0x0fffff) AM_RAM
5858
5959   AM_RANGE(0x1f0000, 0x1f7fff) AM_RAM
src/mame/drivers/gberet.c
r14896r14897
140140   m_interrupt_mask = data & 7;
141141
142142   /* bit 3 = flip screen */
143   flip_screen_set(machine(), data & 8);
143   flip_screen_set(data & 8);
144144}
145145
146146WRITE8_MEMBER(gberet_state::gberet_sound_w)
r14896r14897
192192
193193WRITE8_MEMBER(gberet_state::gberetb_flipscreen_w)
194194{
195   flip_screen_set(machine(), data & 8);
195   flip_screen_set(data & 8);
196196}
197197
198198READ8_MEMBER(gberet_state::gberetb_irq_ack_r)
src/mame/drivers/sandscrp.c
r14896r14897
222222{
223223
224224   m_latch2_full = 0;
225   return soundlatch2_r(space,0);
225   return soundlatch2_byte_r(space,0);
226226}
227227
228228WRITE16_MEMBER(sandscrp_state::sandscrp_soundlatch_word_w)
r14896r14897
231231   if (ACCESSING_BITS_0_7)
232232   {
233233      m_latch1_full = 1;
234      soundlatch_w(space, 0, data & 0xff);
234      soundlatch_byte_w(space, 0, data & 0xff);
235235      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
236236      device_spin_until_time(&space.device(), attotime::from_usec(100));   // Allow the other cpu to reply
237237   }
r14896r14897
249249   AM_RANGE(0x402000, 0x402fff) AM_RAM AM_BASE(m_vscroll[1])                           //
250250   AM_RANGE(0x403000, 0x403fff) AM_RAM AM_BASE(m_vscroll[0])                           //
251251   AM_RANGE(0x500000, 0x501fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w ) // sprites
252   AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
252   AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(paletteram_xGGGGGRRRRRBBBBB_word_w) AM_SHARE("paletteram")   // Palette
253253   AM_RANGE(0xa00000, 0xa00001) AM_WRITE(sandscrp_coin_counter_w)   // Coin Counters (Lockout unused)
254254   AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")
255255   AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")
r14896r14897
291291{
292292
293293   m_latch1_full = 0;
294   return soundlatch_r(space,0);
294   return soundlatch_byte_r(space,0);
295295}
296296
297297WRITE8_MEMBER(sandscrp_state::sandscrp_soundlatch_w)
298298{
299299
300300   m_latch2_full = 1;
301   soundlatch2_w(space,0,data);
301   soundlatch2_byte_w(space,0,data);
302302}
303303
304304static ADDRESS_MAP_START( sandscrp_soundmem, AS_PROGRAM, 8, sandscrp_state )
src/mame/drivers/gpworld.c
r14896r14897
4949public:
5050   gpworld_state(const machine_config &mconfig, device_type type, const char *tag)
5151      : driver_device(mconfig, type, tag),
52        m_laserdisc(*this, "laserdisc") { }
52        m_laserdisc(*this, "laserdisc") ,
53      m_sprite_RAM(*this, "sprite_RAM"),
54      m_palette_RAM(*this, "palette_RAM"),
55      m_tile_RAM(*this, "tile_RAM"){ }
5356
5457   UINT8 m_nmi_enable;
5558   UINT8 m_start_lamp;
5659   UINT8 m_ldp_read_latch;
5760   UINT8 m_ldp_write_latch;
5861   UINT8 m_brake_gas;
59   UINT8* m_tile_RAM;
60   UINT8* m_sprite_RAM;
61   UINT8* m_palette_RAM;
6262   required_device<pioneer_ldv1000_device> m_laserdisc;
63   required_shared_ptr<UINT8> m_sprite_RAM;
64   required_shared_ptr<UINT8> m_palette_RAM;
65   required_shared_ptr<UINT8> m_tile_RAM;
6366   DECLARE_READ8_MEMBER(ldp_read);
6467   DECLARE_READ8_MEMBER(pedal_in);
6568   DECLARE_WRITE8_MEMBER(ldp_write);
r14896r14897
8992      {
9093         int current_screen_character = (characterY*64) + characterX;
9194
92         drawgfx_transpen(bitmap, cliprect, machine.gfx[0], state->m_tile_RAM[current_screen_character],
95         drawgfx_transpen(bitmap, cliprect, machine.gfx[0], state->m_tile_RAM.target()[current_screen_character],
9396               characterY, 0, 0, characterX*8, characterY*8, 0);
9497      }
9598   }
r14896r14897
118121   const int SPR_SKIP_HI   = 5;
119122   const int SPR_GFXOFS_LO = 6;
120123   const int SPR_GFXOFS_HI = 7;
121   int flip = flip_screen_get(machine);
124   int flip = state->flip_screen();
122125
123126   int i;
124127
r14896r14897
275278   /* This is all just a (bad) guess */
276279   int pal_index, r, g, b, a;
277280
278   m_palette_RAM[offset] = data;
281   m_palette_RAM.target()[offset] = data;
279282
280283   /* "Round down" to the nearest palette entry */
281284   pal_index = offset & 0xffe;
282285
283   g = (m_palette_RAM[pal_index]   & 0xf0) << 0;
284   b = (m_palette_RAM[pal_index]   & 0x0f) << 4;
285   r = (m_palette_RAM[pal_index+1] & 0x0f) << 4;
286   a = (m_palette_RAM[pal_index+1] & 0x80) ? 0 : 255;   /* guess */
286   g = (m_palette_RAM.target()[pal_index]   & 0xf0) << 0;
287   b = (m_palette_RAM.target()[pal_index]   & 0x0f) << 4;
288   r = (m_palette_RAM.target()[pal_index+1] & 0x0f) << 4;
289   a = (m_palette_RAM.target()[pal_index+1] & 0x80) ? 0 : 255;   /* guess */
287290
288291   /* logerror("PAL WRITE index : %x  rgb : %d %d %d (real %x) at %x\n", pal_index, r,g,b, data, offset); */
289292
r14896r14897
293296/* PROGRAM MAP */
294297static ADDRESS_MAP_START( mainmem, AS_PROGRAM, 8, gpworld_state )
295298   AM_RANGE(0x0000,0xbfff) AM_ROM
296   AM_RANGE(0xc000,0xc7ff) AM_RAM AM_BASE(m_sprite_RAM)
297   AM_RANGE(0xc800,0xcfff) AM_WRITE(palette_write) AM_BASE(m_palette_RAM)   /* The memory test reads at 0xc800 */
298   AM_RANGE(0xd000,0xd7ff) AM_RAM AM_BASE(m_tile_RAM)
299   AM_RANGE(0xc000,0xc7ff) AM_RAM AM_SHARE("sprite_RAM")
300   AM_RANGE(0xc800,0xcfff) AM_WRITE(palette_write) AM_SHARE("palette_RAM")   /* The memory test reads at 0xc800 */
301   AM_RANGE(0xd000,0xd7ff) AM_RAM AM_SHARE("tile_RAM")
299302   AM_RANGE(0xd800,0xd800) AM_READWRITE(ldp_read,ldp_write)
300303/*  AM_RANGE(0xd801,0xd801) AM_READ_LEGACY(???) */
301304   AM_RANGE(0xda00,0xda00) AM_READ_PORT("INWHEEL")   //8255 here....
src/mame/drivers/homedata.c
r14896r14897
289289READ8_MEMBER(homedata_state::mrokumei_sound_io_r)
290290{
291291   if (m_sndbank & 4)
292      return(soundlatch_r(space, 0));
292      return(soundlatch_byte_r(space, 0));
293293   else
294294      return machine().region("audiocpu")->base()[0x10000 + offset + (m_sndbank & 1) * 0x10000];
295295}
r14896r14897
317317
318318WRITE8_MEMBER(homedata_state::mrokumei_sound_cmd_w)
319319{
320   soundlatch_w(space, offset, data);
320   soundlatch_byte_w(space, offset, data);
321321   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
322322}
323323
src/mame/drivers/mugsmash.c
r14896r14897
5555   switch (offset)
5656   {
5757   case 1:
58      soundlatch_w(space, 1, data & 0xff);
58      soundlatch_byte_w(space, 1, data & 0xff);
5959      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE );
6060      break;
6161
r14896r14897
176176   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(mugsmash_videoram1_w) AM_BASE(m_videoram1)
177177   AM_RANGE(0x082000, 0x082fff) AM_RAM_WRITE(mugsmash_videoram2_w) AM_BASE(m_videoram2)
178178   AM_RANGE(0x0c0000, 0x0c0007) AM_WRITE(mugsmash_reg_w) AM_BASE(m_regs1)   /* video registers*/
179   AM_RANGE(0x100000, 0x1005ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
179   AM_RANGE(0x100000, 0x1005ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
180180   AM_RANGE(0x140000, 0x140007) AM_WRITE(mugsmash_reg2_w) AM_BASE(m_regs2) /* sound + ? */
181181   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM /* main ram? */
182182   AM_RANGE(0x1c4000, 0x1cffff) AM_RAM
r14896r14897
196196   AM_RANGE(0x8000, 0x87ff) AM_RAM
197197   AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)
198198   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
199   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
199   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
200200ADDRESS_MAP_END
201201
202202
src/mame/drivers/pcktgal.c
r14896r14897
4040
4141WRITE8_MEMBER(pcktgal_state::pcktgal_sound_w)
4242{
43   soundlatch_w(space, 0, data);
43   soundlatch_byte_w(space, 0, data);
4444   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
4545}
4646
r14896r14897
9494   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym2", ym3812_w)
9595   AM_RANGE(0x1800, 0x1800) AM_WRITE(pcktgal_adpcm_data_w)   /* ADPCM data for the MSM5205 chip */
9696   AM_RANGE(0x2000, 0x2000) AM_WRITE(pcktgal_sound_bank_w)
97   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
97   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
9898   AM_RANGE(0x3400, 0x3400) AM_DEVREAD_LEGACY("msm", pcktgal_adpcm_reset_r)   /* ? not sure */
9999   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank3")
100100   AM_RANGE(0x8000, 0xffff) AM_ROM
src/mame/drivers/jokrwild.c
r14896r14897
101101{
102102public:
103103   jokrwild_state(const machine_config &mconfig, device_type type, const char *tag)
104      : driver_device(mconfig, type, tag) { }
104      : driver_device(mconfig, type, tag) ,
105      m_videoram(*this, "videoram"),
106      m_colorram(*this, "colorram"){ }
105107
106   UINT8 *m_videoram;
107   UINT8 *m_colorram;
108   required_shared_ptr<UINT8> m_videoram;
109   required_shared_ptr<UINT8> m_colorram;
108110   tilemap_t *m_bg_tilemap;
109111   DECLARE_WRITE8_MEMBER(jokrwild_videoram_w);
110112   DECLARE_WRITE8_MEMBER(jokrwild_colorram_w);
r14896r14897
119121
120122WRITE8_MEMBER(jokrwild_state::jokrwild_videoram_w)
121123{
122   m_videoram[offset] = data;
124   m_videoram.target()[offset] = data;
123125   m_bg_tilemap->mark_tile_dirty(offset);
124126}
125127
126128
127129WRITE8_MEMBER(jokrwild_state::jokrwild_colorram_w)
128130{
129   m_colorram[offset] = data;
131   m_colorram.target()[offset] = data;
130132   m_bg_tilemap->mark_tile_dirty(offset);
131133}
132134
r14896r14897
139141    xx-- ----   bank select.
140142    ---- xxxx   color code.
141143*/
142   int attr = state->m_colorram[tile_index];
143   int code = state->m_videoram[tile_index] | ((attr & 0xc0) << 2);
144   int attr = state->m_colorram.target()[tile_index];
145   int code = state->m_videoram.target()[tile_index] | ((attr & 0xc0) << 2);
144146   int color = (attr & 0x0f);
145147
146148   SET_TILE_INFO( 0, code , color , 0);
r14896r14897
193195*************************/
194196
195197static ADDRESS_MAP_START( jokrwild_map, AS_PROGRAM, 8, jokrwild_state )
196   AM_RANGE(0x0000, 0x03ff) AM_RAM_WRITE(jokrwild_videoram_w) AM_BASE(m_videoram)
198   AM_RANGE(0x0000, 0x03ff) AM_RAM_WRITE(jokrwild_videoram_w) AM_SHARE("videoram")
197199   AM_RANGE(0x0400, 0x07ff) AM_RAM //FIXME: backup RAM
198   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(jokrwild_colorram_w) AM_BASE(m_colorram)
200   AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(jokrwild_colorram_w) AM_SHARE("colorram")
199201   AM_RANGE(0x2400, 0x27ff) AM_RAM //stack RAM
200202   AM_RANGE(0x4004, 0x4007) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
201203   AM_RANGE(0x4008, 0x400b) AM_DEVREADWRITE("pia1", pia6821_device, read, write) //optical sensor is here
src/mame/drivers/solomon.c
r14896r14897
1313
1414WRITE8_MEMBER(solomon_state::solomon_sh_command_w)
1515{
16   soundlatch_w(space, offset, data);
16   soundlatch_byte_w(space, offset, data);
1717   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
1818}
1919
r14896r14897
5252   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(solomon_colorram2_w) AM_BASE(m_colorram2)
5353   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(solomon_videoram2_w) AM_BASE(m_videoram2)
5454   AM_RANGE(0xe000, 0xe07f) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
55   AM_RANGE(0xe400, 0xe5ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_SHARE("paletteram")
55   AM_RANGE(0xe400, 0xe5ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
5656   AM_RANGE(0xe600, 0xe600) AM_READ_PORT("P1")
5757   AM_RANGE(0xe601, 0xe601) AM_READ_PORT("P2")
5858   AM_RANGE(0xe602, 0xe602) AM_READ_PORT("SYSTEM")
r14896r14897
6969static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, solomon_state )
7070   AM_RANGE(0x0000, 0x3fff) AM_ROM
7171   AM_RANGE(0x4000, 0x47ff) AM_RAM
72   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r)
72   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_byte_r)
7373   AM_RANGE(0xffff, 0xffff) AM_WRITENOP   /* watchdog? */
7474ADDRESS_MAP_END
7575
src/mame/drivers/gladiatr.c
r14896r14897
192192
193193
194194/*Rom bankswitching*/
195static WRITE8_HANDLER( gladiatr_bankswitch_w )
195WRITE8_MEMBER(gladiatr_state::gladiatr_bankswitch_w)
196196{
197   UINT8 *rom = space->machine().region("maincpu")->base() + 0x10000;
197   UINT8 *rom = machine().region("maincpu")->base() + 0x10000;
198198
199   memory_set_bankptr(space->machine(), "bank1", rom + 0x6000 * (data & 0x01));
199   memory_set_bankptr(machine(), "bank1", rom + 0x6000 * (data & 0x01));
200200}
201201
202202
r14896r14897
289289   msm5205_vclk_w (device,(data>>4)&1); /* bit4     */
290290}
291291
292static WRITE8_HANDLER( glad_cpu_sound_command_w )
292WRITE8_MEMBER(gladiatr_state::glad_cpu_sound_command_w)
293293{
294   gladiatr_state *state = space->machine().driver_data<gladiatr_state>();
295   state->soundlatch_w(*space,0,data);
296   cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, ASSERT_LINE);
294   soundlatch_byte_w(*&space,0,data);
295   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, ASSERT_LINE);
297296}
298297
299static READ8_HANDLER( glad_cpu_sound_command_r )
298READ8_MEMBER(gladiatr_state::glad_cpu_sound_command_r)
300299{
301   gladiatr_state *state = space->machine().driver_data<gladiatr_state>();
302   cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, CLEAR_LINE);
303   return state->soundlatch_r(*space,0);
300   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, CLEAR_LINE);
301   return soundlatch_byte_r(*&space,0);
304302}
305303
306static WRITE8_HANDLER( gladiatr_flipscreen_w )
304WRITE8_MEMBER(gladiatr_state::gladiatr_flipscreen_w)
307305{
308   flip_screen_set(space->machine(), data & 1);
306   flip_screen_set(data & 1);
309307}
310308
311309
312310#if 1
313311/* !!!!! patch to IRQ timming for 2nd CPU !!!!! */
314static WRITE8_HANDLER( gladiatr_irq_patch_w )
312WRITE8_MEMBER(gladiatr_state::gladiatr_irq_patch_w)
315313{
316   cputag_set_input_line(space->machine(), "sub", 0, HOLD_LINE);
314   cputag_set_input_line(machine(), "sub", 0, HOLD_LINE);
317315}
318316#endif
319317
r14896r14897
323321
324322
325323
326static WRITE8_HANDLER(qx0_w)
324WRITE8_MEMBER(gladiatr_state::qx0_w)
327325{
328   gladiatr_state *state = space->machine().driver_data<gladiatr_state>();
329326   if(!offset)
330327   {
331      state->m_data2=data;
332      state->m_flag2=1;
328      m_data2=data;
329      m_flag2=1;
333330   }
334331}
335332
336static WRITE8_HANDLER(qx1_w)
333WRITE8_MEMBER(gladiatr_state::qx1_w)
337334{
338   gladiatr_state *state = space->machine().driver_data<gladiatr_state>();
339335   if(!offset)
340336   {
341      state->m_data1=data;
342      state->m_flag1=1;
337      m_data1=data;
338      m_flag1=1;
343339   }
344340}
345341
346static WRITE8_HANDLER(qx2_w){ }
342WRITE8_MEMBER(gladiatr_state::qx2_w){ }
347343
348static WRITE8_HANDLER(qx3_w){ }
344WRITE8_MEMBER(gladiatr_state::qx3_w){ }
349345
350static READ8_HANDLER(qx2_r){ return space->machine().rand(); }
346READ8_MEMBER(gladiatr_state::qx2_r){ return machine().rand(); }
351347
352static READ8_HANDLER(qx3_r){ return space->machine().rand()&0xf; }
348READ8_MEMBER(gladiatr_state::qx3_r){ return machine().rand()&0xf; }
353349
354static READ8_HANDLER(qx0_r)
350READ8_MEMBER(gladiatr_state::qx0_r)
355351{
356   gladiatr_state *state = space->machine().driver_data<gladiatr_state>();
357352   if(!offset)
358       return state->m_data1;
353       return m_data1;
359354   else
360      return state->m_flag2;
355      return m_flag2;
361356}
362357
363static READ8_HANDLER(qx1_r)
358READ8_MEMBER(gladiatr_state::qx1_r)
364359{
365   gladiatr_state *state = space->machine().driver_data<gladiatr_state>();
366360   if(!offset)
367      return state->m_data2;
361      return m_data2;
368362   else
369      return state->m_flag1;
363      return m_flag1;
370364}
371365
372366static MACHINE_RESET( ppking )
r14896r14897
397391//  ADDRESS_MAP_GLOBAL_MASK(0xff)
398392   AM_RANGE(0xc000, 0xc000) AM_WRITE(gladiatr_spritebuffer_w)
399393   AM_RANGE(0xc004, 0xc004) AM_NOP   // WRITE(ppking_irq_patch_w)
400   AM_RANGE(0xc09e, 0xc09f) AM_READ_LEGACY(qx0_r) AM_WRITE_LEGACY(qx0_w)
394   AM_RANGE(0xc09e, 0xc09f) AM_READ(qx0_r) AM_WRITE(qx0_w)
401395   AM_RANGE(0xc0bf, 0xc0bf) AM_NOP
402396ADDRESS_MAP_END
403397
404398static ADDRESS_MAP_START( ppking_cpu2_io, AS_IO, 8, gladiatr_state )
405399   ADDRESS_MAP_GLOBAL_MASK(0xff)
406400   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
407   AM_RANGE(0x20, 0x21) AM_READ_LEGACY(qx1_r) AM_WRITE_LEGACY(qx1_w)
401   AM_RANGE(0x20, 0x21) AM_READ(qx1_r) AM_WRITE(qx1_w)
408402   AM_RANGE(0x40, 0x40) AM_READNOP
409   AM_RANGE(0x60, 0x61) AM_READ_LEGACY(qx2_r) AM_WRITE_LEGACY(qx2_w)
410   AM_RANGE(0x80, 0x81) AM_READ_LEGACY(qx3_r) AM_WRITE_LEGACY(qx3_w)
403   AM_RANGE(0x60, 0x61) AM_READWRITE(qx2_r,qx2_w)
404   AM_RANGE(0x80, 0x81) AM_READWRITE(qx3_r,qx3_w)
411405ADDRESS_MAP_END
412406
413407
r14896r14897
432426
433427static ADDRESS_MAP_START( gladiatr_cpu3_map, AS_PROGRAM, 8, gladiatr_state )
434428   AM_RANGE(0x1000, 0x1fff) AM_DEVWRITE_LEGACY("msm", glad_adpcm_w)
435   AM_RANGE(0x2000, 0x2fff) AM_READ_LEGACY(glad_cpu_sound_command_r)
429   AM_RANGE(0x2000, 0x2fff) AM_READ(glad_cpu_sound_command_r)
436430   AM_RANGE(0x4000, 0xffff) AM_ROMBANK("bank2")
437431ADDRESS_MAP_END
438432
r14896r14897
441435//  ADDRESS_MAP_GLOBAL_MASK(0xff)
442436   AM_RANGE(0xc000, 0xc000) AM_WRITE(gladiatr_spritebuffer_w)
443437   AM_RANGE(0xc001, 0xc001) AM_WRITE(gladiatr_spritebank_w)
444   AM_RANGE(0xc002, 0xc002) AM_WRITE_LEGACY(gladiatr_bankswitch_w)
445   AM_RANGE(0xc004, 0xc004) AM_WRITE_LEGACY(gladiatr_irq_patch_w) /* !!! patch to 2nd CPU IRQ !!! */
446   AM_RANGE(0xc007, 0xc007) AM_WRITE_LEGACY(gladiatr_flipscreen_w)
438   AM_RANGE(0xc002, 0xc002) AM_WRITE(gladiatr_bankswitch_w)
439   AM_RANGE(0xc004, 0xc004) AM_WRITE(gladiatr_irq_patch_w) /* !!! patch to 2nd CPU IRQ !!! */
440   AM_RANGE(0xc007, 0xc007) AM_WRITE(gladiatr_flipscreen_w)
447441   AM_RANGE(0xc09e, 0xc09f) AM_READWRITE_LEGACY(TAITO8741_0_r, TAITO8741_0_w)
448442   AM_RANGE(0xc0bf, 0xc0bf) AM_NOP   // watchdog_reset_w doesn't work
449443ADDRESS_MAP_END
r14896r14897
456450   AM_RANGE(0x60, 0x61) AM_READWRITE_LEGACY(TAITO8741_2_r, TAITO8741_2_w)
457451   AM_RANGE(0x80, 0x81) AM_READWRITE_LEGACY(TAITO8741_3_r, TAITO8741_3_w)
458452   AM_RANGE(0xa0, 0xa7) AM_NOP   // filters on sound output
459   AM_RANGE(0xe0, 0xe0) AM_WRITE_LEGACY(glad_cpu_sound_command_w)
453   AM_RANGE(0xe0, 0xe0) AM_WRITE(glad_cpu_sound_command_w)
460454ADDRESS_MAP_END
461455
462456
r14896r14897
998992}
999993
1000994
1001static READ8_HANDLER(f6a3_r)
995READ8_MEMBER(gladiatr_state::f6a3_r)
1002996{
1003   gladiatr_state *state = space->machine().driver_data<gladiatr_state>();
1004   if(cpu_get_previouspc(&space->device())==0x8e)
1005      state->m_nvram[0x6a3]=1;
997   if(cpu_get_previouspc(&space.device())==0x8e)
998      m_nvram[0x6a3]=1;
1006999
1007   return state->m_nvram[0x6a3];
1000   return m_nvram[0x6a3];
10081001}
10091002
10101003static DRIVER_INIT(ppking)
r14896r14897
10291022         rom[i+2*j*0x2000] = rom[i+j*0x2000];
10301023      }
10311024   }
1032
1033   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xf6a3,0xf6a3,FUNC(f6a3_r) );
1025   gladiatr_state *state = machine.driver_data<gladiatr_state>();
1026   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf6a3,0xf6a3,read8_delegate(FUNC(gladiatr_state::f6a3_r),state));
10341027}
10351028
10361029
src/mame/drivers/imolagp.c
r14896r14897
8787public:
8888   imolagp_state(const machine_config &mconfig, device_type type, const char *tag)
8989      : driver_device(mconfig, type, tag),
90      m_maincpu(*this,"maincpu")
91      { }
90      m_maincpu(*this,"maincpu"),
91      m_slave_workram(*this, "slave_workram"){ }
9292
93   UINT8 *m_slave_workram; // used only ifdef HLE_COM
93   required_device<cpu_device> m_maincpu;
94   required_shared_ptr<UINT8> m_slave_workram; // used only ifdef HLE_COM
9495
9596#ifdef HLE_COM
9697   UINT8 m_mComData[0x100];
r14896r14897
112113   /* memory */
113114   UINT8  m_videoram[3][0x4000];
114115
115   required_device<cpu_device> m_maincpu;
116116   DECLARE_WRITE8_MEMBER(transmit_data_w);
117117   DECLARE_READ8_MEMBER(trigger_slave_nmi_r);
118118   DECLARE_READ8_MEMBER(receive_data_r);
r14896r14897
387387   AM_RANGE(0x0800, 0x0bff) AM_ROM
388388   AM_RANGE(0x1000, 0x13ff) AM_ROM
389389   AM_RANGE(0x1c00, 0x3fff) AM_ROM
390   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(m_slave_workram)
390   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_SHARE("slave_workram")
391391   AM_RANGE(0x9fff, 0xa000) AM_READ(receive_data_r)
392392   AM_RANGE(0xc000, 0xffff) AM_WRITE(screenram_w)
393393ADDRESS_MAP_END
r14896r14897
496496   imolagp_state *state = device->machine().driver_data<imolagp_state>();
497497
498498#ifdef HLE_COM
499   memcpy(&state->m_slave_workram[0x80], state->m_mComData, state->m_mComCount);
499   memcpy(&state->m_slave_workram.target()[0x80], state->m_mComData, state->m_mComCount);
500500   state->m_mComCount = 0;
501501#endif
502502   device_set_input_line(device, 0, HOLD_LINE);
src/mame/drivers/poker72.c
r14896r14897
1919{
2020public:
2121   poker72_state(const machine_config &mconfig, device_type type, const char *tag)
22      : driver_device(mconfig, type, tag) { }
22      : driver_device(mconfig, type, tag) ,
23      m_vram(*this, "vram"),
24      m_pal(*this, "pal"){ }
2325
24   UINT8 *m_vram;
25   UINT8 *m_pal;
26   required_shared_ptr<UINT8> m_vram;
27   required_shared_ptr<UINT8> m_pal;
2628   UINT8 m_tile_bank;
2729   DECLARE_WRITE8_MEMBER(poker72_paletteram_w);
2830   DECLARE_WRITE8_MEMBER(output_w);
r14896r14897
4547   {
4648      for (x=0;x<64;x++)
4749      {
48         int tile = ((state->m_vram[count+1] & 0x0f) << 8 ) | (state->m_vram[count+0] & 0xff); //TODO: tile bank
49         int fx = (state->m_vram[count+1] & 0x10);
50         int fy = (state->m_vram[count+1] & 0x20);
51         int color = (state->m_vram[count+1] & 0xc0) >> 6;
50         int tile = ((state->m_vram.target()[count+1] & 0x0f) << 8 ) | (state->m_vram.target()[count+0] & 0xff); //TODO: tile bank
51         int fx = (state->m_vram.target()[count+1] & 0x10);
52         int fy = (state->m_vram.target()[count+1] & 0x20);
53         int color = (state->m_vram.target()[count+1] & 0xc0) >> 6;
5254
5355         tile|= state->m_tile_bank << 12;
5456
r14896r14897
6466WRITE8_MEMBER(poker72_state::poker72_paletteram_w)
6567{
6668   int r,g,b;
67   m_pal[offset] = data;
69   m_pal.target()[offset] = data;
6870
69   r = m_pal[(offset & 0x3ff)+0x000] & 0x3f;
70   g = m_pal[(offset & 0x3ff)+0x400] & 0x3f;
71   b = m_pal[(offset & 0x3ff)+0x800] & 0x3f;
71   r = m_pal.target()[(offset & 0x3ff)+0x000] & 0x3f;
72   g = m_pal.target()[(offset & 0x3ff)+0x400] & 0x3f;
73   b = m_pal.target()[(offset & 0x3ff)+0x800] & 0x3f;
7274
7375   palette_set_color_rgb( machine(), offset & 0x3ff, pal6bit(r), pal6bit(g), pal6bit(b));
7476}
r14896r14897
9698static ADDRESS_MAP_START( poker72_map, AS_PROGRAM, 8, poker72_state )
9799   AM_RANGE(0x0000, 0xbfff) AM_ROMBANK("bank1")
98100   AM_RANGE(0xc000, 0xdfff) AM_RAM //work ram
99   AM_RANGE(0xe000, 0xefff) AM_RAM AM_BASE(m_vram)
100   AM_RANGE(0xf000, 0xfbff) AM_RAM_WRITE(poker72_paletteram_w) AM_BASE(m_pal)
101   AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("vram")
102   AM_RANGE(0xf000, 0xfbff) AM_RAM_WRITE(poker72_paletteram_w) AM_SHARE("pal")
101103   AM_RANGE(0xfc00, 0xfdff) AM_RAM //???
102104   AM_RANGE(0xfe08, 0xfe08) AM_READ_PORT("IN0")
103105   AM_RANGE(0xfe09, 0xfe09) AM_READ_PORT("IN1")
src/mame/drivers/goindol.c
r14896r14897
3434      machine().tilemap().mark_all_dirty();
3535   }
3636
37   flip_screen_set(machine(), data & 0x20);
37   flip_screen_set(data & 0x20);
3838}
3939
4040
r14896r14897
8585   AM_RANGE(0x0000, 0x7fff) AM_ROM
8686   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
8787   AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_BASE(m_ram)
88   AM_RANGE(0xc800, 0xc800) AM_READNOP AM_WRITE(soundlatch_w) // watchdog?
88   AM_RANGE(0xc800, 0xc800) AM_READNOP AM_WRITE(soundlatch_byte_w) // watchdog?
8989   AM_RANGE(0xc810, 0xc810) AM_WRITE(goindol_bankswitch_w)
9090   AM_RANGE(0xc820, 0xc820) AM_READ_PORT("DIAL")
9191   AM_RANGE(0xc820, 0xd820) AM_WRITEONLY AM_BASE(m_fg_scrolly)
r14896r14897
111111   AM_RANGE(0x0000, 0x7fff) AM_ROM
112112   AM_RANGE(0xa000, 0xa001) AM_DEVWRITE_LEGACY("ymsnd", ym2203_w)
113113   AM_RANGE(0xc000, 0xc7ff) AM_RAM
114   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_r)
114   AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r)
115115ADDRESS_MAP_END
116116
117117
src/mame/drivers/umipoker.c
r14896r14897
2626{
2727public:
2828   umipoker_state(const machine_config &mconfig, device_type type, const char *tag)
29      : driver_device(mconfig, type, tag) { }
29      : driver_device(mconfig, type, tag) ,
30      m_vram_0(*this, "vra0"),
31      m_vram_1(*this, "vra1"),
32      m_vram_2(*this, "vra2"),
33      m_vram_3(*this, "vra3"),
34      m_z80_wram(*this, "z80_wram"){ }
3035
31   UINT16 *m_vram_0;
32   UINT16 *m_vram_1;
33   UINT16 *m_vram_2;
34   UINT16 *m_vram_3;
36   required_shared_ptr<UINT16> m_vram_0;
37   required_shared_ptr<UINT16> m_vram_1;
38   required_shared_ptr<UINT16> m_vram_2;
39   required_shared_ptr<UINT16> m_vram_3;
3540   tilemap_t *m_tilemap_0;
3641   tilemap_t *m_tilemap_1;
3742   tilemap_t *m_tilemap_2;
3843   tilemap_t *m_tilemap_3;
39   UINT8 *m_z80_wram;
44   required_shared_ptr<UINT8> m_z80_wram;
4045   int m_umipoker_scrolly[4];
4146   DECLARE_READ8_MEMBER(z80_rom_readback_r);
4247   DECLARE_READ8_MEMBER(z80_shared_ram_r);
r14896r14897
5863static TILE_GET_INFO( get_tile_info_0 )
5964{
6065   umipoker_state *state = machine.driver_data<umipoker_state>();
61   int tile = state->m_vram_0[tile_index*2+0];
62   int color = state->m_vram_0[tile_index*2+1] & 0x3f;
66   int tile = state->m_vram_0.target()[tile_index*2+0];
67   int color = state->m_vram_0.target()[tile_index*2+1] & 0x3f;
6368
6469   SET_TILE_INFO(
6570         0,
r14896r14897
7176static TILE_GET_INFO( get_tile_info_1 )
7277{
7378   umipoker_state *state = machine.driver_data<umipoker_state>();
74   int tile = state->m_vram_1[tile_index*2+0];
75   int color = state->m_vram_1[tile_index*2+1] & 0x3f;
79   int tile = state->m_vram_1.target()[tile_index*2+0];
80   int color = state->m_vram_1.target()[tile_index*2+1] & 0x3f;
7681
7782   SET_TILE_INFO(
7883         0,
r14896r14897
8489static TILE_GET_INFO( get_tile_info_2 )
8590{
8691   umipoker_state *state = machine.driver_data<umipoker_state>();
87   int tile = state->m_vram_2[tile_index*2+0];
88   int color = state->m_vram_2[tile_index*2+1] & 0x3f;
92   int tile = state->m_vram_2.target()[tile_index*2+0];
93   int color = state->m_vram_2.target()[tile_index*2+1] & 0x3f;
8994
9095   SET_TILE_INFO(
9196         0,
r14896r14897
97102static TILE_GET_INFO( get_tile_info_3 )
98103{
99104   umipoker_state *state = machine.driver_data<umipoker_state>();
100   int tile = state->m_vram_3[tile_index*2+0];
101   int color = state->m_vram_3[tile_index*2+1] & 0x3f;
105   int tile = state->m_vram_3.target()[tile_index*2+0];
106   int color = state->m_vram_3.target()[tile_index*2+1] & 0x3f;
102107
103108   SET_TILE_INFO(
104109         0,
r14896r14897
154159
155160   machine().scheduler().synchronize(); // force resync
156161
157   return m_z80_wram[offset];
162   return m_z80_wram.target()[offset];
158163}
159164
160165WRITE8_MEMBER(umipoker_state::z80_shared_ram_w)
r14896r14897
162167
163168   machine().scheduler().synchronize(); // force resync
164169
165   m_z80_wram[offset] = data;
170   m_z80_wram.target()[offset] = data;
166171}
167172
168173WRITE16_MEMBER(umipoker_state::umipoker_irq_ack_w)
r14896r14897
182187WRITE16_MEMBER(umipoker_state::umipoker_vram_0_w)
183188{
184189
185   COMBINE_DATA(&m_vram_0[offset]);
190   COMBINE_DATA(&m_vram_0.target()[offset]);
186191   m_tilemap_0->mark_tile_dirty(offset >> 1);
187192}
188193
189194WRITE16_MEMBER(umipoker_state::umipoker_vram_1_w)
190195{
191196
192   COMBINE_DATA(&m_vram_1[offset]);
197   COMBINE_DATA(&m_vram_1.target()[offset]);
193198   m_tilemap_1->mark_tile_dirty(offset >> 1);
194199}
195200
r14896r14897
197202WRITE16_MEMBER(umipoker_state::umipoker_vram_2_w)
198203{
199204
200   COMBINE_DATA(&m_vram_2[offset]);
205   COMBINE_DATA(&m_vram_2.target()[offset]);
201206   m_tilemap_2->mark_tile_dirty(offset >> 1);
202207}
203208
204209WRITE16_MEMBER(umipoker_state::umipoker_vram_3_w)
205210{
206211
207   COMBINE_DATA(&m_vram_3[offset]);
212   COMBINE_DATA(&m_vram_3.target()[offset]);
208213   m_tilemap_3->mark_tile_dirty(offset >> 1);
209214}
210215
r14896r14897
305310   ADDRESS_MAP_UNMAP_LOW
306311   AM_RANGE(0x000000, 0x03ffff) AM_ROM
307312   AM_RANGE(0x400000, 0x403fff) AM_RAM AM_SHARE("nvram")
308   AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
309   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(umipoker_vram_0_w) AM_BASE(m_vram_0)
310   AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(umipoker_vram_1_w) AM_BASE(m_vram_1)
311   AM_RANGE(0x804000, 0x805fff) AM_RAM_WRITE(umipoker_vram_2_w) AM_BASE(m_vram_2)
312   AM_RANGE(0x806000, 0x807fff) AM_RAM_WRITE(umipoker_vram_3_w) AM_BASE(m_vram_3)
313   AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // Palette
314   AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(umipoker_vram_0_w) AM_SHARE("vra0")
315   AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(umipoker_vram_1_w) AM_SHARE("vra1")
316   AM_RANGE(0x804000, 0x805fff) AM_RAM_WRITE(umipoker_vram_2_w) AM_SHARE("vra2")
317   AM_RANGE(0x806000, 0x807fff) AM_RAM_WRITE(umipoker_vram_3_w) AM_SHARE("vra3")
313318   AM_RANGE(0xc00000, 0xc0ffff) AM_READ8(z80_rom_readback_r,0x00ff)
314319   AM_RANGE(0xc1f000, 0xc1ffff) AM_READWRITE8(z80_shared_ram_r,z80_shared_ram_w,0x00ff)
315320   AM_RANGE(0xe00000, 0xe00001) AM_READ_PORT("IN0")
r14896r14897
329334
330335static ADDRESS_MAP_START( umipoker_audio_map, AS_PROGRAM, 8, umipoker_state )
331336   AM_RANGE(0x0000, 0x7fff) AM_ROM
332   AM_RANGE(0xf800, 0xffff) AM_READWRITE(z80_shared_ram_r,z80_shared_ram_w) AM_BASE(m_z80_wram)
337   AM_RANGE(0xf800, 0xffff) AM_READWRITE(z80_shared_ram_r,z80_shared_ram_w) AM_SHARE("z80_wram")
333338ADDRESS_MAP_END
334339
335340static ADDRESS_MAP_START( umipoker_audio_io_map, AS_IO, 8, umipoker_state )
src/mame/drivers/gyruss.c
r14896r14897
164164   AM_RANGE(0xc0a0, 0xc0a0) AM_READ_PORT("P1")
165165   AM_RANGE(0xc0c0, 0xc0c0) AM_READ_PORT("P2")
166166   AM_RANGE(0xc0e0, 0xc0e0) AM_READ_PORT("DSW1")
167   AM_RANGE(0xc100, 0xc100) AM_READ_PORT("DSW3") AM_WRITE(soundlatch_w)
167   AM_RANGE(0xc100, 0xc100) AM_READ_PORT("DSW3") AM_WRITE(soundlatch_byte_w)
168168   AM_RANGE(0xc180, 0xc180) AM_WRITE(master_nmi_mask_w)
169169   AM_RANGE(0xc185, 0xc185) AM_WRITEONLY AM_BASE(m_flipscreen)
170170ADDRESS_MAP_END
r14896r14897
182182static ADDRESS_MAP_START( audio_cpu1_map, AS_PROGRAM, 8, gyruss_state )
183183   AM_RANGE(0x0000, 0x5fff) AM_ROM
184184   AM_RANGE(0x6000, 0x63ff) AM_RAM
185   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r)
185   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_byte_r)
186186ADDRESS_MAP_END
187187
188188static ADDRESS_MAP_START( audio_cpu1_io_map, AS_IO, 8, gyruss_state )
r14896r14897
203203   AM_RANGE(0x11, 0x11) AM_DEVREAD_LEGACY("ay5", ay8910_r)
204204   AM_RANGE(0x12, 0x12) AM_DEVWRITE_LEGACY("ay5", ay8910_data_w)
205205   AM_RANGE(0x14, 0x14) AM_WRITE(gyruss_i8039_irq_w)
206   AM_RANGE(0x18, 0x18) AM_WRITE(soundlatch2_w)
206   AM_RANGE(0x18, 0x18) AM_WRITE(soundlatch2_byte_w)
207207ADDRESS_MAP_END
208208
209209static ADDRESS_MAP_START( audio_cpu2_map, AS_PROGRAM, 8, gyruss_state )
r14896r14897
211211ADDRESS_MAP_END
212212
213213static ADDRESS_MAP_START( audio_cpu2_io_map, AS_IO, 8, gyruss_state )
214   AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_r)
214   AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_byte_r)
215215   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE_LEGACY("discrete", gyruss_dac_w)
216216   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(gyruss_irq_clear_w)
217217ADDRESS_MAP_END
src/mame/drivers/gamecstl.c
r14896r14897
8181{
8282public:
8383   gamecstl_state(const machine_config &mconfig, device_type type, const char *tag)
84      : driver_device(mconfig, type, tag) { }
84      : driver_device(mconfig, type, tag) ,
85      m_cga_ram(*this, "cga_ram"){ }
8586
86   UINT32 *m_cga_ram;
87   required_shared_ptr<UINT32> m_cga_ram;
8788   UINT32 *m_bios_ram;
8889   UINT8 m_mxtc_config_reg[256];
8990   UINT8 m_piix4_config_reg[4][256];
r14896r14897
9697   device_t   *m_pic8259_2;
9798   device_t   *m_dma8237_1;
9899   device_t   *m_dma8237_2;
100   DECLARE_WRITE32_MEMBER(pnp_config_w);
101   DECLARE_WRITE32_MEMBER(pnp_data_w);
102   DECLARE_WRITE32_MEMBER(bios_ram_w);
103   DECLARE_READ8_MEMBER(at_page8_r);
104   DECLARE_WRITE8_MEMBER(at_page8_w);
105   DECLARE_READ8_MEMBER(pc_dma_read_byte);
106   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
99107};
100108
101109
r14896r14897
144152   gamecstl_state *state = screen.machine().driver_data<gamecstl_state>();
145153   int i, j;
146154   const gfx_element *gfx = screen.machine().gfx[0];
147   UINT32 *cga = state->m_cga_ram;
155   UINT32 *cga = state->m_cga_ram.target();
148156   int index = 0;
149157
150158   bitmap.fill(0, cliprect);
r14896r14897
333341}
334342
335343// ISA Plug-n-Play
336static WRITE32_HANDLER( pnp_config_w )
344WRITE32_MEMBER(gamecstl_state::pnp_config_w)
337345{
338346   if (ACCESSING_BITS_8_15)
339347   {
r14896r14897
341349   }
342350}
343351
344static WRITE32_HANDLER( pnp_data_w )
352WRITE32_MEMBER(gamecstl_state::pnp_data_w)
345353{
346354   if (ACCESSING_BITS_8_15)
347355   {
r14896r14897
374382
375383
376384
377static WRITE32_HANDLER(bios_ram_w)
385WRITE32_MEMBER(gamecstl_state::bios_ram_w)
378386{
379   gamecstl_state *state = space->machine().driver_data<gamecstl_state>();
380   if (state->m_mxtc_config_reg[0x59] & 0x20)      // write to RAM if this region is write-enabled
387   if (m_mxtc_config_reg[0x59] & 0x20)      // write to RAM if this region is write-enabled
381388   {
382      COMBINE_DATA(state->m_bios_ram + offset);
389      COMBINE_DATA(m_bios_ram + offset);
383390   }
384391}
385392
r14896r14897
392399
393400
394401
395static READ8_HANDLER(at_page8_r)
402READ8_MEMBER(gamecstl_state::at_page8_r)
396403{
397   gamecstl_state *state = space->machine().driver_data<gamecstl_state>();
398   UINT8 data = state->m_at_pages[offset % 0x10];
404   UINT8 data = m_at_pages[offset % 0x10];
399405
400406   switch(offset % 8)
401407   {
402408   case 1:
403      data = state->m_dma_offset[(offset / 8) & 1][2];
409      data = m_dma_offset[(offset / 8) & 1][2];
404410      break;
405411   case 2:
406      data = state->m_dma_offset[(offset / 8) & 1][3];
412      data = m_dma_offset[(offset / 8) & 1][3];
407413      break;
408414   case 3:
409      data = state->m_dma_offset[(offset / 8) & 1][1];
415      data = m_dma_offset[(offset / 8) & 1][1];
410416      break;
411417   case 7:
412      data = state->m_dma_offset[(offset / 8) & 1][0];
418      data = m_dma_offset[(offset / 8) & 1][0];
413419      break;
414420   }
415421   return data;
416422}
417423
418424
419static WRITE8_HANDLER(at_page8_w)
425WRITE8_MEMBER(gamecstl_state::at_page8_w)
420426{
421   gamecstl_state *state = space->machine().driver_data<gamecstl_state>();
422   state->m_at_pages[offset % 0x10] = data;
427   m_at_pages[offset % 0x10] = data;
423428
424429   switch(offset % 8)
425430   {
426431   case 1:
427      state->m_dma_offset[(offset / 8) & 1][2] = data;
432      m_dma_offset[(offset / 8) & 1][2] = data;
428433      break;
429434   case 2:
430      state->m_dma_offset[(offset / 8) & 1][3] = data;
435      m_dma_offset[(offset / 8) & 1][3] = data;
431436      break;
432437   case 3:
433      state->m_dma_offset[(offset / 8) & 1][1] = data;
438      m_dma_offset[(offset / 8) & 1][1] = data;
434439      break;
435440   case 7:
436      state->m_dma_offset[(offset / 8) & 1][0] = data;
441      m_dma_offset[(offset / 8) & 1][0] = data;
437442      break;
438443   }
439444}
r14896r14897
448453}
449454
450455
451static READ8_HANDLER( pc_dma_read_byte )
456READ8_MEMBER(gamecstl_state::pc_dma_read_byte)
452457{
453   gamecstl_state *state = space->machine().driver_data<gamecstl_state>();
454   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
458   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
455459      & 0xFF0000;
456460
457   return space->read_byte(page_offset + offset);
461   return space.read_byte(page_offset + offset);
458462}
459463
460464
461static WRITE8_HANDLER( pc_dma_write_byte )
465WRITE8_MEMBER(gamecstl_state::pc_dma_write_byte)
462466{
463   gamecstl_state *state = space->machine().driver_data<gamecstl_state>();
464   offs_t page_offset = (((offs_t) state->m_dma_offset[0][state->m_dma_channel]) << 16)
467   offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16)
465468      & 0xFF0000;
466469
467   space->write_byte(page_offset + offset, data);
470   space.write_byte(page_offset + offset, data);
468471}
469472
470473static void set_dma_channel(device_t *device, int channel, int state)
r14896r14897
482485{
483486   DEVCB_LINE(pc_dma_hrq_changed),
484487   DEVCB_NULL,
485   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
486   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
488   DEVCB_DRIVER_MEMBER(gamecstl_state, pc_dma_read_byte),
489   DEVCB_DRIVER_MEMBER(gamecstl_state, pc_dma_write_byte),
487490   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
488491   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
489492   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
r14896r14897
500503   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }
501504};
502505
503static READ32_HANDLER(at_page32_r)
504{
505   return read32le_with_read8_handler(at_page8_r, space, offset, mem_mask);
506}
507506
508507
509static WRITE32_HANDLER(at_page32_w)
510{
511   write32le_with_write8_handler(at_page8_w, space, offset, data, mem_mask);
512}
513
514
515508/*****************************************************************************/
516509
517510static ADDRESS_MAP_START( gamecstl_map, AS_PROGRAM, 32, gamecstl_state )
518511   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
519512   AM_RANGE(0x000a0000, 0x000affff) AM_RAM
520   AM_RANGE(0x000b0000, 0x000b7fff) AM_RAM AM_BASE(m_cga_ram)
513   AM_RANGE(0x000b0000, 0x000b7fff) AM_RAM AM_SHARE("cga_ram")
521514   AM_RANGE(0x000e0000, 0x000effff) AM_RAM
522515   AM_RANGE(0x000f0000, 0x000fffff) AM_ROMBANK("bank1")
523   AM_RANGE(0x000f0000, 0x000fffff) AM_WRITE_LEGACY(bios_ram_w)
516   AM_RANGE(0x000f0000, 0x000fffff) AM_WRITE(bios_ram_w)
524517   AM_RANGE(0x00100000, 0x01ffffff) AM_RAM
525518   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("bios", 0)   /* System BIOS */
526519ADDRESS_MAP_END
r14896r14897
531524   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
532525   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
533526   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
534   AM_RANGE(0x0080, 0x009f) AM_READWRITE_LEGACY(at_page32_r,            at_page32_w)
527   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,at_page8_w, 0xffffffff)
535528   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
536529   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
537530   AM_RANGE(0x00e8, 0x00eb) AM_NOP
r14896r14897
539532   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
540533   AM_RANGE(0x0300, 0x03af) AM_NOP
541534   AM_RANGE(0x03b0, 0x03df) AM_NOP
542   AM_RANGE(0x0278, 0x027b) AM_WRITE_LEGACY(pnp_config_w)
535   AM_RANGE(0x0278, 0x027b) AM_WRITE(pnp_config_w)
543536   AM_RANGE(0x03f0, 0x03ff) AM_DEVREADWRITE_LEGACY("ide", fdc_r, fdc_w)
544   AM_RANGE(0x0a78, 0x0a7b) AM_WRITE_LEGACY(pnp_data_w)
537   AM_RANGE(0x0a78, 0x0a7b) AM_WRITE(pnp_data_w)
545538   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE_LEGACY("pcibus", pci_32le_r,   pci_32le_w)
546539ADDRESS_MAP_END
547540
src/mame/drivers/kangaroo.c
r14896r14897
258258   AM_RANGE(0xe000, 0xe3ff) AM_RAM
259259   AM_RANGE(0xe400, 0xe400) AM_MIRROR(0x03ff) AM_READ_PORT("DSW0")
260260   AM_RANGE(0xe800, 0xe80a) AM_MIRROR(0x03f0) AM_WRITE(kangaroo_video_control_w) AM_BASE(m_video_control)
261   AM_RANGE(0xec00, 0xec00) AM_MIRROR(0x00ff) AM_READ_PORT("IN0") AM_WRITE(soundlatch_w)
261   AM_RANGE(0xec00, 0xec00) AM_MIRROR(0x00ff) AM_READ_PORT("IN0") AM_WRITE(soundlatch_byte_w)
262262   AM_RANGE(0xed00, 0xed00) AM_MIRROR(0x00ff) AM_READ_PORT("IN1") AM_WRITE(kangaroo_coin_counter_w)
263263   AM_RANGE(0xee00, 0xee00) AM_MIRROR(0x00ff) AM_READ_PORT("IN2")
264264ADDRESS_MAP_END
r14896r14897
274274static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, kangaroo_state )
275275   AM_RANGE(0x0000, 0x0fff) AM_ROM
276276   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM
277   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ(soundlatch_r)
277   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ(soundlatch_byte_r)
278278   AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
279279   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
280280ADDRESS_MAP_END
r14896r14897
284284static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, kangaroo_state )
285285   AM_RANGE(0x0000, 0x0fff) AM_ROM
286286   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM
287   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ(soundlatch_r)
287   AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ(soundlatch_byte_r)
288288   AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
289289   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
290290ADDRESS_MAP_END
src/mame/drivers/wldarrow.c
r14896r14897
3636{
3737public:
3838   wldarrow_state(const machine_config &mconfig, device_type type, const char *tag)
39      : driver_device(mconfig, type, tag) { }
39      : driver_device(mconfig, type, tag) ,
40      m_videoram_0(*this, "videoram_0"),
41      m_videoram_1(*this, "videora1"),
42      m_videoram_2(*this, "videora2"){ }
4043
41   UINT8 *m_videoram_0;
42   UINT8 *m_videoram_1;
43   UINT8 *m_videoram_2;
44   size_t m_videoram_size;
44   required_shared_ptr<UINT8> m_videoram_0;
45   required_shared_ptr<UINT8> m_videoram_1;
46   required_shared_ptr<UINT8> m_videoram_2;
4547   DECLARE_WRITE8_MEMBER(lights_1_w);
4648   DECLARE_WRITE8_MEMBER(lights_2_w);
4749   DECLARE_WRITE8_MEMBER(counter_w);
r14896r14897
7678
7779   get_pens(pens);
7880
79   for (offs = 0; offs < state->m_videoram_size; offs++)
81   for (offs = 0; offs < state->m_videoram_0.bytes(); offs++)
8082   {
8183      int i;
8284
8385      UINT8 y = offs >> 5;
8486      UINT8 x = offs << 3;
8587
86      UINT8 data0 = state->m_videoram_0[offs];
87      UINT8 data1 = state->m_videoram_1[offs];
88      UINT8 data2 = state->m_videoram_2[offs];
88      UINT8 data0 = state->m_videoram_0.target()[offs];
89      UINT8 data1 = state->m_videoram_1.target()[offs];
90      UINT8 data2 = state->m_videoram_2.target()[offs];
8991
9092      /* weird equations, but it matches every flyer screenshot -
9193           perhaphs they used a look-up PROM? */
r14896r14897
184186static ADDRESS_MAP_START( wldarrow_map, AS_PROGRAM, 8, wldarrow_state )
185187   AM_RANGE(0x0000, 0x37ff) AM_ROM
186188   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("IN0")
187   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(m_videoram_0) AM_SIZE(m_videoram_size)
188   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_BASE(m_videoram_1)
189   AM_RANGE(0x8000, 0x9fff) AM_RAM AM_BASE(m_videoram_2)
189   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_SHARE("videora0")
190   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE("videora1")
191   AM_RANGE(0x8000, 0x9fff) AM_RAM AM_SHARE("videora2")
190192   AM_RANGE(0xcd00, 0xcdff) AM_RAM AM_SHARE("nvram")
191193   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("BITSW") AM_DEVWRITE_LEGACY("dac", wldarrow_dac_1_w)
192194   AM_RANGE(0xf004, 0xf004) AM_READ_PORT("IN1") AM_WRITE(lights_1_w)
src/mame/drivers/cabal.c
r14896r14897
130130   AM_RANGE(0xc0000, 0xc0001) AM_WRITE(track_reset_w)
131131   AM_RANGE(0xc0040, 0xc0041) AM_WRITENOP /* ??? */
132132   AM_RANGE(0xc0080, 0xc0081) AM_WRITE(cabal_flipscreen_w)
133   AM_RANGE(0xe0000, 0xe07ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
133   AM_RANGE(0xe0000, 0xe07ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
134134   AM_RANGE(0xe8008, 0xe8009) AM_WRITE(cabal_sound_irq_trigger_word_w)   // fix coin insertion
135135   AM_RANGE(0xe8000, 0xe800d) AM_READWRITE_LEGACY(seibu_main_word_r, seibu_main_word_w)
136136ADDRESS_MAP_END
r14896r14897
148148   AM_RANGE(0xa0010, 0xa0011) AM_READ_PORT("INPUTS")
149149   AM_RANGE(0xc0040, 0xc0041) AM_WRITENOP /* ??? */
150150   AM_RANGE(0xc0080, 0xc0081) AM_WRITE(cabal_flipscreen_w)
151   AM_RANGE(0xe0000, 0xe07ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
151   AM_RANGE(0xe0000, 0xe07ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
152152   AM_RANGE(0xe8000, 0xe8003) AM_WRITE(cabalbl_sndcmd_w)
153153   AM_RANGE(0xe8004, 0xe8005) AM_READ(soundlatch2_word_r)
154154   AM_RANGE(0xe8008, 0xe8009) AM_WRITE(cabalbl_sound_irq_trigger_word_w)
r14896r14897
199199static ADDRESS_MAP_START( cabalbl_sound_map, AS_PROGRAM, 8, cabal_state )
200200   AM_RANGE(0x0000, 0x1fff) AM_ROM
201201   AM_RANGE(0x2000, 0x2fff) AM_RAM
202   AM_RANGE(0x4000, 0x4000) AM_WRITE(soundlatch3_w)
203   AM_RANGE(0x4002, 0x4002) AM_WRITE(soundlatch4_w)
202   AM_RANGE(0x4000, 0x4000) AM_WRITE(soundlatch3_byte_w)
203   AM_RANGE(0x4002, 0x4002) AM_WRITE(soundlatch4_byte_w)
204204   AM_RANGE(0x4004, 0x4004) AM_WRITE(cabalbl_coin_w)
205205   AM_RANGE(0x4006, 0x4006) AM_READ_PORT("COIN")
206206   AM_RANGE(0x4008, 0x4008) AM_READ(cabalbl_snd2_r)
207207   AM_RANGE(0x400a, 0x400a) AM_READ(cabalbl_snd1_r)
208   AM_RANGE(0x400c, 0x400c) AM_WRITE(soundlatch2_w)
208   AM_RANGE(0x400c, 0x400c) AM_WRITE(soundlatch2_byte_w)
209209   AM_RANGE(0x400e, 0x400f) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
210210   AM_RANGE(0x6000, 0x6000) AM_WRITENOP  /* ??? */
211211   AM_RANGE(0x8000, 0xffff) AM_ROM
r14896r14897
228228
229229static ADDRESS_MAP_START( cabalbl_talk1_portmap, AS_IO, 8, cabal_state )
230230   ADDRESS_MAP_GLOBAL_MASK(0xff)
231   AM_RANGE(0x00, 0x00) AM_READ(soundlatch3_r)
231   AM_RANGE(0x00, 0x00) AM_READ(soundlatch3_byte_r)
232232   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("msm1", cabalbl_adpcm_w)
233233ADDRESS_MAP_END
234234
r14896r14897
238238
239239static ADDRESS_MAP_START( cabalbl_talk2_portmap, AS_IO, 8, cabal_state )
240240   ADDRESS_MAP_GLOBAL_MASK(0xff)
241   AM_RANGE(0x00, 0x00) AM_READ(soundlatch4_r)
241   AM_RANGE(0x00, 0x00) AM_READ(soundlatch4_byte_r)
242242   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("msm2", cabalbl_adpcm_w)
243243ADDRESS_MAP_END
244244
src/mame/drivers/hotblock.c
r14896r14897
4949{
5050public:
5151   hotblock_state(const machine_config &mconfig, device_type type, const char *tag)
52      : driver_device(mconfig, type, tag) { }
52      : driver_device(mconfig, type, tag) ,
53      m_vram(*this, "vram"){ }
5354
5455   /* memory pointers */
55   UINT8 * m_vram;
56   required_shared_ptr<UINT8> m_vram;
5657
5758   /* misc */
5859   int      m_port0;
r14896r14897
7879   }
7980   else // port 0 = 88 c8
8081   {
81      return m_vram[offset];
82      return m_vram.target()[offset];
8283   }
8384}
8485
r14896r14897
116117   }
117118   else // port 0 = 88 c8
118119   {
119      m_vram[offset] = data;
120      m_vram.target()[offset] = data;
120121   }
121122}
122123
123124static ADDRESS_MAP_START( hotblock_map, AS_PROGRAM, 8, hotblock_state )
124125   AM_RANGE(0x00000, 0x0ffff) AM_RAM
125   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(hotblock_video_read, hotblock_video_write) AM_BASE(m_vram)
126   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(hotblock_video_read, hotblock_video_write) AM_SHARE("vram")
126127   AM_RANGE(0x20000, 0xfffff) AM_ROM
127128ADDRESS_MAP_END
128129
r14896r14897
162163      for(x = 0; x < xxx; x++)
163164      {
164165         if (state->m_port0 & 0x40)
165            bitmap.pix16(y, x) = state->m_vram[count];
166            bitmap.pix16(y, x) = state->m_vram.target()[count];
166167         count++;
167168      }
168169   }
src/mame/drivers/vendetta.c
r14896r14897
169169   if (select & 1)
170170   {
171171      space->install_read_bank(state->m_video_banking_base + 0x2000, state->m_video_banking_base + 0x2fff, "bank4" );
172      space->install_write_handler(state->m_video_banking_base + 0x2000, state->m_video_banking_base + 0x2fff, write8_delegate(FUNC(vendetta_state::paletteram_xBBBBBGGGGGRRRRR_be_w), state) );
172      space->install_write_handler(state->m_video_banking_base + 0x2000, state->m_video_banking_base + 0x2fff, write8_delegate(FUNC(vendetta_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state) );
173173      space->install_legacy_readwrite_handler(*state->m_k053246, state->m_video_banking_base + 0x0000, state->m_video_banking_base + 0x0fff, FUNC(k053247_r), FUNC(k053247_w) );
174174      memory_set_bankptr(machine, "bank4", state->m_generic_paletteram_8);
175175   }
src/mame/drivers/segas16b.c
r14896r14897
10301030   if (state->m_soundcpu != NULL)
10311031   {
10321032      address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
1033      state->soundlatch_w(*space, 0, data & 0xff);
1033      state->soundlatch_byte_w(*space, 0, data & 0xff);
10341034      device_set_input_line(state->m_soundcpu, 0, HOLD_LINE);
10351035   }
10361036}
r14896r14897
18541854   ADDRESS_MAP_UNMAP_HIGH
18551855   AM_RANGE(0x0000, 0x7fff) AM_ROM
18561856   AM_RANGE(0x8000, 0xdfff) AM_ROMBANK("bank1")
1857   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_r)
1857   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r)
18581858   AM_RANGE(0xf800, 0xffff) AM_RAM
18591859ADDRESS_MAP_END
18601860
r14896r14897
18641864   AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
18651865   AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE_LEGACY("upd", upd7759_control_w)
18661866   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3f) AM_DEVREADWRITE_LEGACY("upd", upd7759_status_r, upd7759_port_w)
1867   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3f) AM_READ(soundlatch_r)
1867   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3f) AM_READ(soundlatch_byte_r)
18681868ADDRESS_MAP_END
18691869
18701870
src/mame/drivers/thoop2.c
r14896r14897
8989   AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(thoop2_vram_w) AM_BASE(m_videoram)   /* Video RAM */
9090   AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE(m_vregs)               /* Video Registers */
9191   AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset16_w)                     /* INT 6 ACK/Watchdog timer */
92   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")/* Palette */
92   AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")/* Palette */
9393   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(m_spriteram)                  /* Sprite RAM */
9494   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2")
9595   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
src/mame/drivers/pktgaldx.c
r14896r14897
151151
152152   AM_RANGE(0x300000, 0x30000f) AM_RAM // ??
153153
154   AM_RANGE(0x330000, 0x330bff) AM_RAM_WRITE(paletteram16_xbgr_word_be_w) AM_SHARE("paletteram") // extra colours?
154   AM_RANGE(0x330000, 0x330bff) AM_RAM_WRITE(paletteram_xbgr_word_be_w) AM_SHARE("paletteram") // extra colours?
155155ADDRESS_MAP_END
156156
157157
src/mame/drivers/timeplt.c
r14896r14897
120120   AM_RANGE(0xa800, 0xafff) AM_RAM
121121   AM_RANGE(0xb000, 0xb0ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE(m_spriteram)
122122   AM_RANGE(0xb400, 0xb4ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE(m_spriteram2)
123   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0cff) AM_WRITE(soundlatch_w)
123   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0cff) AM_WRITE(soundlatch_byte_w)
124124   AM_RANGE(0xc200, 0xc200) AM_MIRROR(0x0cff) AM_WRITE(watchdog_reset_w)
125125   AM_RANGE(0xc300, 0xc300) AM_MIRROR(0x0cf1) AM_WRITE(timeplt_nmi_enable_w)
126126   AM_RANGE(0xc302, 0xc302) AM_MIRROR(0x0cf1) AM_WRITE(timeplt_flipscreen_w)
r14896r14897
144144   AM_RANGE(0xa800, 0xafff) AM_RAM
145145   AM_RANGE(0xb000, 0xb0ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE(m_spriteram)
146146   AM_RANGE(0xb400, 0xb4ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE(m_spriteram2)
147   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0cff) AM_WRITE(soundlatch_w)
147   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0cff) AM_WRITE(soundlatch_byte_w)
148148   AM_RANGE(0xc200, 0xc200) AM_MIRROR(0x0cff) AM_WRITE(watchdog_reset_w)
149149   AM_RANGE(0xc302, 0xc302) AM_MIRROR(0x0cf1) AM_WRITE(timeplt_flipscreen_w)
150150   AM_RANGE(0xc304, 0xc304) AM_MIRROR(0x0cf1) AM_WRITE_LEGACY(timeplt_sh_irqtrigger_w)
r14896r14897
166166   AM_RANGE(0xa800, 0xafff) AM_RAM
167167   AM_RANGE(0xb000, 0xb0ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE(m_spriteram)
168168   AM_RANGE(0xb400, 0xb4ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE(m_spriteram2)
169   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0cff) AM_WRITE(soundlatch_w)
169   AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0cff) AM_WRITE(soundlatch_byte_w)
170170   AM_RANGE(0xc200, 0xc200) AM_MIRROR(0x0cff) AM_WRITE(watchdog_reset_w)
171171   AM_RANGE(0xc300, 0xc300) AM_MIRROR(0x0cf1) AM_WRITE(timeplt_nmi_enable_w)
172172   AM_RANGE(0xc302, 0xc302) AM_MIRROR(0x0cf1) AM_WRITE(timeplt_flipscreen_w)
src/mame/drivers/atarigx2.c
r14896r14897
6565 *
6666 *************************************/
6767
68static READ32_HANDLER( special_port2_r )
68READ32_MEMBER(atarigx2_state::special_port2_r)
6969{
70   atarigx2_state *state = space->machine().driver_data<atarigx2_state>();
71   int temp = input_port_read(space->machine(), "SERVICE");
72   if (state->m_cpu_to_sound_ready) temp ^= 0x0020;
73   if (state->m_sound_to_cpu_ready) temp ^= 0x0010;
70   int temp = input_port_read(machine(), "SERVICE");
71   if (m_cpu_to_sound_ready) temp ^= 0x0020;
72   if (m_sound_to_cpu_ready) temp ^= 0x0010;
7473   temp ^= 0x0008;      /* A2D.EOC always high for now */
7574   return (temp << 16) | temp;
7675}
7776
7877
79static READ32_HANDLER( special_port3_r )
78READ32_MEMBER(atarigx2_state::special_port3_r)
8079{
81   int temp = input_port_read(space->machine(), "SPECIAL");
80   int temp = input_port_read(machine(), "SPECIAL");
8281   return (temp << 16) | temp;
8382}
8483
8584
8685
87static READ32_HANDLER( a2d_data_r )
86READ32_MEMBER(atarigx2_state::a2d_data_r)
8887{
8988   /* otherwise, assume it's hydra */
9089   switch (offset)
9190   {
9291      case 0:
93         return (input_port_read(space->machine(), "A2D0") << 24) | (input_port_read(space->machine(), "A2D1") << 8);
92         return (input_port_read(machine(), "A2D0") << 24) | (input_port_read(machine(), "A2D1") << 8);
9493      case 1:
95         return (input_port_read(space->machine(), "A2D2") << 24) | (input_port_read(space->machine(), "A2D3") << 8);
94         return (input_port_read(machine(), "A2D2") << 24) | (input_port_read(machine(), "A2D3") << 8);
9695   }
9796
9897   return 0;
9998}
10099
101100
102static WRITE32_HANDLER( latch_w )
101WRITE32_MEMBER(atarigx2_state::latch_w)
103102{
104103   /*
105104        D13 = 68.DISA
r14896r14897
117116   /* upper byte */
118117   if (ACCESSING_BITS_24_31)
119118   {
120      atarigx2_state *state = space->machine().driver_data<atarigx2_state>();
121119
122120      /* bits 13-11 are the MO control bits */
123      atarirle_control_w(state->m_rle, (data >> 27) & 7);
121      atarirle_control_w(m_rle, (data >> 27) & 7);
124122   }
125123
126124   /* lower byte */
127125   if (ACCESSING_BITS_16_23)
128      cputag_set_input_line(space->machine(), "jsa", INPUT_LINE_RESET, (data & 0x100000) ? CLEAR_LINE : ASSERT_LINE);
126      cputag_set_input_line(machine(), "jsa", INPUT_LINE_RESET, (data & 0x100000) ? CLEAR_LINE : ASSERT_LINE);
129127}
130128
131129
132static WRITE32_HANDLER( mo_command_w )
130WRITE32_MEMBER(atarigx2_state::mo_command_w)
133131{
134   atarigx2_state *state = space->machine().driver_data<atarigx2_state>();
135   COMBINE_DATA(state->m_mo_command);
132   COMBINE_DATA(m_mo_command);
136133   if (ACCESSING_BITS_0_15)
137      atarirle_command_w(state->m_rle, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
134      atarirle_command_w(m_rle, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
138135}
139136
140137
r14896r14897
146143 *************************************/
147144
148145
149static WRITE32_HANDLER( atarigx2_protection_w )
146WRITE32_MEMBER(atarigx2_state::atarigx2_protection_w)
150147{
151   atarigx2_state *state = space->machine().driver_data<atarigx2_state>();
152148   {
153      int pc = cpu_get_previouspc(&space->device());
149      int pc = cpu_get_previouspc(&space.device());
154150//      if (pc == 0x11cbe || pc == 0x11c30)
155//          logerror("%06X:Protection W@%04X = %04X  (result to %06X)\n", pc, offset, data, cpu_get_reg(&space->device(), M68K_A2));
151//          logerror("%06X:Protection W@%04X = %04X  (result to %06X)\n", pc, offset, data, cpu_get_reg(&space.device(), M68K_A2));
156152//      else
157153      if (ACCESSING_BITS_16_31)
158154         logerror("%06X:Protection W@%04X = %04X\n", pc, offset * 4, data >> 16);
r14896r14897
160156         logerror("%06X:Protection W@%04X = %04X\n", pc, offset * 4 + 2, data);
161157   }
162158
163   COMBINE_DATA(&state->m_protection_base[offset]);
159   COMBINE_DATA(&m_protection_base[offset]);
164160
165161   if (ACCESSING_BITS_16_31)
166162   {
167      state->m_last_write = state->m_protection_base[offset] >> 16;
168      state->m_last_write_offset = offset*2;
163      m_last_write = m_protection_base[offset] >> 16;
164      m_last_write_offset = offset*2;
169165   }
170166   if (ACCESSING_BITS_0_15)
171167   {
172      state->m_last_write = state->m_protection_base[offset] & 0xffff;
173      state->m_last_write_offset = offset*2+1;
168      m_last_write = m_protection_base[offset] & 0xffff;
169      m_last_write_offset = offset*2+1;
174170   }
175171}
176172
177static READ32_HANDLER( atarigx2_protection_r )
173READ32_MEMBER(atarigx2_state::atarigx2_protection_r)
178174{
179175   static const UINT32 lookup_table[][2] =
180176   {
r14896r14897
11051101      { 0xffffffff, 0xffff }
11061102   };
11071103
1108   atarigx2_state *state = space->machine().driver_data<atarigx2_state>();
1109   UINT32 result = state->m_protection_base[offset];
1104   UINT32 result = m_protection_base[offset];
11101105
11111106   if (offset == 0x300)
11121107      result |= 0x80000000;
11131108   if (offset == 0x3f0)
11141109   {
1115      UINT32 tag = (state->m_last_write_offset << 17) | state->m_last_write;
1110      UINT32 tag = (m_last_write_offset << 17) | m_last_write;
11161111      int i = 0;
11171112
11181113      while (lookup_table[i][0] != 0xffffffff)
r14896r14897
11271122
11281123      if (lookup_table[i][0] == 0xffffffff)
11291124      {
1130         if (state->m_last_write_offset*2 >= 0x700 && state->m_last_write_offset*2 < 0x720)
1131            result = space->machine().rand() << 16;
1125         if (m_last_write_offset*2 >= 0x700 && m_last_write_offset*2 < 0x720)
1126            result = machine().rand() << 16;
11321127         else
11331128            result = 0xffff << 16;
1134         logerror("%06X:Unhandled protection R@%04X = %04X\n", cpu_get_previouspc(&space->device()), offset, result);
1129         logerror("%06X:Unhandled protection R@%04X = %04X\n", cpu_get_previouspc(&space.device()), offset, result);
11351130      }
11361131   }
11371132
11381133   if (ACCESSING_BITS_16_31)
1139      logerror("%06X:Protection R@%04X = %04X\n", cpu_get_previouspc(&space->device()), offset * 4, result >> 16);
1134      logerror("%06X:Protection R@%04X = %04X\n", cpu_get_previouspc(&space.device()), offset * 4, result >> 16);
11401135   else
1141      logerror("%06X:Protection R@%04X = %04X\n", cpu_get_previouspc(&space->device()), offset * 4 + 2, result);
1136      logerror("%06X:Protection R@%04X = %04X\n", cpu_get_previouspc(&space.device()), offset * 4 + 2, result);
11421137   return result;
11431138}
11441139
r14896r14897
11531148   ADDRESS_MAP_UNMAP_HIGH
11541149   AM_RANGE(0x000000, 0x07ffff) AM_ROM
11551150   AM_RANGE(0xc80000, 0xc80fff) AM_RAM
1156   AM_RANGE(0xca0000, 0xca0fff) AM_READWRITE_LEGACY(atarigx2_protection_r, atarigx2_protection_w) AM_BASE(m_protection_base)
1157   AM_RANGE(0xd00000, 0xd1ffff) AM_READ_LEGACY(a2d_data_r)
1151   AM_RANGE(0xca0000, 0xca0fff) AM_READWRITE(atarigx2_protection_r, atarigx2_protection_w) AM_BASE(m_protection_base)
1152   AM_RANGE(0xd00000, 0xd1ffff) AM_READ(a2d_data_r)
11581153   AM_RANGE(0xd20000, 0xd20fff) AM_READWRITE_LEGACY(atarigen_eeprom_upper32_r, atarigen_eeprom32_w) AM_SHARE("eeprom")
11591154   AM_RANGE(0xd40000, 0xd40fff) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram32_w) AM_SHARE("paletteram")
11601155   AM_RANGE(0xd72000, 0xd75fff) AM_WRITE_LEGACY(atarigen_playfield32_w) AM_BASE(m_playfield32)
11611156   AM_RANGE(0xd76000, 0xd76fff) AM_WRITE_LEGACY(atarigen_alpha32_w) AM_BASE(m_alpha32)
11621157   AM_RANGE(0xd78000, 0xd78fff) AM_DEVREADWRITE_LEGACY("rle", atarirle_spriteram32_r, atarirle_spriteram32_w)
1163   AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE_LEGACY(mo_command_w) AM_BASE(m_mo_command)
1158   AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_BASE(m_mo_command)
11641159   AM_RANGE(0xd70000, 0xd7ffff) AM_RAM
11651160   AM_RANGE(0xd80000, 0xd9ffff) AM_WRITE_LEGACY(atarigen_eeprom_enable32_w)
11661161   AM_RANGE(0xe06000, 0xe06003) AM_WRITE_LEGACY(atarigen_sound_upper32_w)
1167   AM_RANGE(0xe08000, 0xe08003) AM_WRITE_LEGACY(latch_w)
1162   AM_RANGE(0xe08000, 0xe08003) AM_WRITE(latch_w)
11681163   AM_RANGE(0xe0c000, 0xe0c003) AM_WRITE_LEGACY(atarigen_video_int_ack32_w)
11691164   AM_RANGE(0xe0e000, 0xe0e003) AM_WRITENOP//watchdog_reset_w },
11701165   AM_RANGE(0xe80000, 0xe80003) AM_READ_PORT("P1_P2")
1171   AM_RANGE(0xe82000, 0xe82003) AM_READ_LEGACY(special_port2_r)
1172   AM_RANGE(0xe82004, 0xe82007) AM_READ_LEGACY(special_port3_r)
1166   AM_RANGE(0xe82000, 0xe82003) AM_READ(special_port2_r)
1167   AM_RANGE(0xe82004, 0xe82007) AM_READ(special_port3_r)
11731168   AM_RANGE(0xe86000, 0xe86003) AM_READ_LEGACY(atarigen_sound_upper32_r)
11741169   AM_RANGE(0xff8000, 0xffffff) AM_RAM
11751170ADDRESS_MAP_END
r14896r14897
22322227*/
22332228}
22342229
2235static READ32_HANDLER( rrreveng_prot_r )
2230READ32_MEMBER(atarigx2_state::rrreveng_prot_r)
22362231{
22372232   return 0;
22382233}
r14896r14897
22452240
22462241   state->m_playfield_base = 0x000;
22472242
2248   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xca0fc0, 0xca0fc3, FUNC(rrreveng_prot_r));
2243   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xca0fc0, 0xca0fc3, read32_delegate(FUNC(atarigx2_state::rrreveng_prot_r),state));
22492244}
22502245
22512246
src/mame/drivers/nwk-tr.c
r14896r14897
230230{
231231public:
232232   nwktr_state(const machine_config &mconfig, device_type type, const char *tag)
233      : driver_device(mconfig, type, tag) { }
233      : driver_device(mconfig, type, tag) ,
234      m_work_ram(*this, "work_ram"){ }
234235
235236   UINT8 m_led_reg0;
236237   UINT8 m_led_reg1;
237   UINT32 *m_work_ram;
238   required_shared_ptr<UINT32> m_work_ram;
238239   int m_fpga_uploaded;
239240   int m_lanc2_ram_r;
240241   int m_lanc2_ram_w;
r14896r14897
466467   {
467468      if (mame_stricmp(machine().system().name, "thrilld") == 0)
468469      {
469         m_work_ram[(0x3ffed0/4) + 0] = 0x472a3731;
470         m_work_ram[(0x3ffed0/4) + 1] = 0x33202020;
471         m_work_ram[(0x3ffed0/4) + 2] = 0x2d2d2a2a;
472         m_work_ram[(0x3ffed0/4) + 3] = 0x2a207878;
470         m_work_ram.target()[(0x3ffed0/4) + 0] = 0x472a3731;
471         m_work_ram.target()[(0x3ffed0/4) + 1] = 0x33202020;
472         m_work_ram.target()[(0x3ffed0/4) + 2] = 0x2d2d2a2a;
473         m_work_ram.target()[(0x3ffed0/4) + 3] = 0x2a207878;
473474
474         m_work_ram[(0x3fff40/4) + 0] = 0x47433731;
475         m_work_ram[(0x3fff40/4) + 1] = 0x33000000;
476         m_work_ram[(0x3fff40/4) + 2] = 0x19994a41;
477         m_work_ram[(0x3fff40/4) + 3] = 0x4100a9b1;
475         m_work_ram.target()[(0x3fff40/4) + 0] = 0x47433731;
476         m_work_ram.target()[(0x3fff40/4) + 1] = 0x33000000;
477         m_work_ram.target()[(0x3fff40/4) + 2] = 0x19994a41;
478         m_work_ram.target()[(0x3fff40/4) + 3] = 0x4100a9b1;
478479      }
479480   }
480481
r14896r14897
490491   ppcdrc_set_options(machine.device("maincpu"), PPCDRC_COMPATIBLE_OPTIONS);
491492
492493   /* configure fast RAM regions for DRC */
493   ppcdrc_add_fastram(machine.device("maincpu"), 0x00000000, 0x003fffff, FALSE, state->m_work_ram);
494   ppcdrc_add_fastram(machine.device("maincpu"), 0x00000000, 0x003fffff, FALSE, state->m_work_ram.target());
494495}
495496
496497static ADDRESS_MAP_START( nwktr_map, AS_PROGRAM, 32, nwktr_state )
497   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_BASE(m_work_ram)      /* Work RAM */
498   AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("work_ram")      /* Work RAM */
498499   AM_RANGE(0x74000000, 0x740000ff) AM_DEVREADWRITE_LEGACY("k001604", k001604_reg_r, k001604_reg_w)
499500   AM_RANGE(0x74010000, 0x74017fff) AM_RAM_WRITE(paletteram32_w) AM_SHARE("paletteram")
500501   AM_RANGE(0x74020000, 0x7403ffff) AM_DEVREADWRITE_LEGACY("k001604", k001604_tile_r, k001604_tile_w)
src/mame/drivers/circus.c
r14896r14897
6363   AM_RANGE(0x2000, 0x2000) AM_WRITE(circus_clown_x_w)
6464   AM_RANGE(0x3000, 0x3000) AM_WRITE(circus_clown_y_w)
6565   AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(circus_videoram_w) AM_BASE(m_videoram)
66   AM_RANGE(0x8000, 0x8000) AM_RAM_WRITE_LEGACY(circus_clown_z_w)
66   AM_RANGE(0x8000, 0x8000) AM_RAM_WRITE(circus_clown_z_w)
6767   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("INPUTS")
6868   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSW")
6969   AM_RANGE(0xd000, 0xd000) AM_READ(circus_paddle_r)
src/mame/drivers/taotaido.c
r14896r14897
8383   if (ACCESSING_BITS_0_7)
8484   {
8585      m_pending_command = 1;
86      soundlatch_w(space, offset, data & 0xff);
86      soundlatch_byte_w(space, offset, data & 0xff);
8787      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
8888   }
8989}
r14896r14897
9393   AM_RANGE(0xa00000, 0xa01fff) AM_RAM AM_BASE(m_spriteram)      // sprite ram
9494   AM_RANGE(0xc00000, 0xc0ffff) AM_RAM AM_BASE(m_spriteram2)      // sprite tile lookup ram
9595   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                              // main ram
96   AM_RANGE(0xffc000, 0xffcfff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // palette ram
96   AM_RANGE(0xffc000, 0xffcfff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")   // palette ram
9797   AM_RANGE(0xffe000, 0xffe3ff) AM_RAM AM_BASE(m_scrollram)      // rowscroll / rowselect / scroll ram
9898   AM_RANGE(0xffff80, 0xffff81) AM_READ_PORT("P1")
9999   AM_RANGE(0xffff82, 0xffff83) AM_READ_PORT("P2")
r14896r14897
139139   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
140140   AM_RANGE(0x04, 0x04) AM_WRITE(taotaido_sh_bankswitch_w)
141141   AM_RANGE(0x08, 0x08) AM_WRITE(pending_command_clear_w)
142   AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_r)
142   AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_byte_r)
143143ADDRESS_MAP_END
144144
145145
src/mame/drivers/relief.c
r14896r14897
4646 *
4747 *************************************/
4848
49static READ16_HANDLER( relief_atarivc_r )
49READ16_MEMBER(relief_state::relief_atarivc_r)
5050{
51   return atarivc_r(*space->machine().primary_screen, offset);
51   return atarivc_r(*machine().primary_screen, offset);
5252}
5353
5454
55static WRITE16_HANDLER( relief_atarivc_w )
55WRITE16_MEMBER(relief_state::relief_atarivc_w)
5656{
57   atarivc_w(*space->machine().primary_screen, offset, data, mem_mask);
57   atarivc_w(*machine().primary_screen, offset, data, mem_mask);
5858}
5959
6060
r14896r14897
9393 *
9494 *************************************/
9595
96static READ16_HANDLER( special_port2_r )
96READ16_MEMBER(relief_state::special_port2_r)
9797{
98   relief_state *state = space->machine().driver_data<relief_state>();
99   int result = input_port_read(space->machine(), "260010");
100   if (state->m_cpu_to_sound_ready) result ^= 0x0020;
101   if (!(result & 0x0080) || atarigen_get_hblank(*space->machine().primary_screen)) result ^= 0x0001;
98   int result = input_port_read(machine(), "260010");
99   if (m_cpu_to_sound_ready) result ^= 0x0020;
100   if (!(result & 0x0080) || atarigen_get_hblank(*machine().primary_screen)) result ^= 0x0001;
102101   return result;
103102}
104103
r14896r14897
110109 *
111110 *************************************/
112111
113static WRITE16_HANDLER( audio_control_w )
112WRITE16_MEMBER(relief_state::audio_control_w)
114113{
115   relief_state *state = space->machine().driver_data<relief_state>();
116114   if (ACCESSING_BITS_0_7)
117115   {
118      state->m_ym2413_volume = (data >> 1) & 15;
119      atarigen_set_ym2413_vol(space->machine(), (state->m_ym2413_volume * state->m_overall_volume * 100) / (127 * 15));
120      state->m_adpcm_bank_base = (0x040000 * ((data >> 6) & 3)) | (state->m_adpcm_bank_base & 0x100000);
116      m_ym2413_volume = (data >> 1) & 15;
117      atarigen_set_ym2413_vol(machine(), (m_ym2413_volume * m_overall_volume * 100) / (127 * 15));
118      m_adpcm_bank_base = (0x040000 * ((data >> 6) & 3)) | (m_adpcm_bank_base & 0x100000);
121119   }
122120   if (ACCESSING_BITS_8_15)
123      state->m_adpcm_bank_base = (0x100000 * ((data >> 8) & 1)) | (state->m_adpcm_bank_base & 0x0c0000);
121      m_adpcm_bank_base = (0x100000 * ((data >> 8) & 1)) | (m_adpcm_bank_base & 0x0c0000);
124122
125   okim6295_device *oki = space->machine().device<okim6295_device>("oki");
126   oki->set_bank_base(state->m_adpcm_bank_base);
123   okim6295_device *oki = machine().device<okim6295_device>("oki");
124   oki->set_bank_base(m_adpcm_bank_base);
127125}
128126
129127
130static WRITE16_HANDLER( audio_volume_w )
128WRITE16_MEMBER(relief_state::audio_volume_w)
131129{
132   relief_state *state = space->machine().driver_data<relief_state>();
133130   if (ACCESSING_BITS_0_7)
134131   {
135      state->m_overall_volume = data & 127;
136      atarigen_set_ym2413_vol(space->machine(), (state->m_ym2413_volume * state->m_overall_volume * 100) / (127 * 15));
137      atarigen_set_oki6295_vol(space->machine(), state->m_overall_volume * 100 / 127);
132      m_overall_volume = data & 127;
133      atarigen_set_ym2413_vol(machine(), (m_ym2413_volume * m_overall_volume * 100) / (127 * 15));
134      atarigen_set_oki6295_vol(machine(), m_overall_volume * 100 / 127);
138135   }
139136}
140137
r14896r14897
152149   AM_RANGE(0x000000, 0x07ffff) AM_ROM
153150   AM_RANGE(0x140000, 0x140003) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0x00ff)
154151   AM_RANGE(0x140010, 0x140011) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
155   AM_RANGE(0x140020, 0x140021) AM_WRITE_LEGACY(audio_volume_w)
156   AM_RANGE(0x140030, 0x140031) AM_WRITE_LEGACY(audio_control_w)
152   AM_RANGE(0x140020, 0x140021) AM_WRITE(audio_volume_w)
153   AM_RANGE(0x140030, 0x140031) AM_WRITE(audio_control_w)
157154   AM_RANGE(0x180000, 0x180fff) AM_READWRITE_LEGACY(atarigen_eeprom_upper_r, atarigen_eeprom_w) AM_SHARE("eeprom")
158155   AM_RANGE(0x1c0030, 0x1c0031) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
159156   AM_RANGE(0x260000, 0x260001) AM_READ_PORT("260000")
160157   AM_RANGE(0x260002, 0x260003) AM_READ_PORT("260002")
161   AM_RANGE(0x260010, 0x260011) AM_READ_LEGACY(special_port2_r)
158   AM_RANGE(0x260010, 0x260011) AM_READ(special_port2_r)
162159   AM_RANGE(0x260012, 0x260013) AM_READ_PORT("260012")
163160   AM_RANGE(0x2a0000, 0x2a0001) AM_WRITE(watchdog_reset16_w)
164161   AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram_w) AM_SHARE("paletteram")
165   AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE_LEGACY(relief_atarivc_r, relief_atarivc_w) AM_BASE(m_atarivc_data)
162   AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(relief_atarivc_r, relief_atarivc_w) AM_BASE(m_atarivc_data)
166163   AM_RANGE(0x3f0000, 0x3f1fff) AM_RAM_WRITE_LEGACY(atarigen_playfield2_latched_msb_w) AM_BASE(m_playfield2)
167164   AM_RANGE(0x3f2000, 0x3f3fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_latched_lsb_w) AM_BASE(m_playfield)
168165   AM_RANGE(0x3f4000, 0x3f5fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_dual_upper_w) AM_BASE(m_playfield_upper)
src/mame/drivers/champbas.c
r14896r14897
264264   AM_RANGE(0xa007, 0xa007) AM_WRITE(champbas_mcu_switch_w)   // MCU not present/not used in champbas
265265
266266   AM_RANGE(0xa060, 0xa06f) AM_RAM AM_BASE(m_spriteram_2)
267   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_w)
267   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_byte_w)
268268/*  AM_RANGE(0xa0a0, 0xa0a0)    ???? */
269269   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(champbas_watchdog_reset_w)
270270
r14896r14897
293293   AM_RANGE(0xa007, 0xa007) AM_WRITENOP   /* MCU is not used, but some leftover code still writes here */
294294
295295   AM_RANGE(0xa040, 0xa06f) AM_WRITEONLY AM_BASE(m_spriteram) /* Sprite Pos */
296   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_w)
296   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_byte_w)
297297   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(watchdog_reset_w)
298298ADDRESS_MAP_END
299299
r14896r14897
318318   AM_RANGE(0xa007, 0xa007) AM_WRITENOP /* This is also MCU control, but i dont need it */
319319
320320   AM_RANGE(0xa040, 0xa06f) AM_WRITEONLY AM_BASE(m_spriteram) /* Sprite pos */
321   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_w)
321   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_byte_w)
322322   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(watchdog_reset_w)
323323ADDRESS_MAP_END
324324
r14896r14897
326326
327327static ADDRESS_MAP_START( champbas_sub_map, AS_PROGRAM, 8, champbas_state )
328328   AM_RANGE(0x0000, 0x5fff) AM_ROM
329   AM_RANGE(0x6000, 0x7fff) AM_READ(soundlatch_r)
329   AM_RANGE(0x6000, 0x7fff) AM_READ(soundlatch_byte_r)
330330   AM_RANGE(0x8000, 0x9fff) AM_WRITENOP   // 4-bit return code to main CPU (not used)
331   AM_RANGE(0xa000, 0xbfff) AM_WRITE(soundlatch_clear_w)
331   AM_RANGE(0xa000, 0xbfff) AM_WRITE(soundlatch_clear_byte_w)
332332   AM_RANGE(0xc000, 0xdfff) AM_DEVWRITE_LEGACY("dac", champbas_dac_w)
333333   AM_RANGE(0xe000, 0xe3ff) AM_MIRROR(0x1c00) AM_RAM
334334ADDRESS_MAP_END
r14896r14897
339339   AM_RANGE(0xa000, 0xa7ff) AM_RAM
340340   AM_RANGE(0xc008, 0xc008) AM_DEVWRITE_LEGACY("dac1", champbas_dac_w)
341341   AM_RANGE(0xc009, 0xc009) AM_DEVWRITE_LEGACY("dac2", champbas_dac_w)
342   AM_RANGE(0xc00c, 0xc00c) AM_WRITE(soundlatch_clear_w)
343   AM_RANGE(0xc00d, 0xc00d) AM_READ(soundlatch_r)
342   AM_RANGE(0xc00c, 0xc00c) AM_WRITE(soundlatch_clear_byte_w)
343   AM_RANGE(0xc00d, 0xc00d) AM_READ(soundlatch_byte_r)
344344//  AM_RANGE(0xc00f, 0xc00f) AM_WRITENOP /* ??? */
345345ADDRESS_MAP_END
346346
src/mame/drivers/ssozumo.c
r14896r14897
1616
1717WRITE8_MEMBER(ssozumo_state::ssozumo_sh_command_w)
1818{
19   soundlatch_w(space, 0, data);
19   soundlatch_byte_w(space, 0, data);
2020   cputag_set_input_line(machine(), "audiocpu", M6502_IRQ_LINE, HOLD_LINE);
2121}
2222
r14896r14897
5353   AM_RANGE(0x2002, 0x2003) AM_DEVWRITE_LEGACY("ay2", ay8910_data_address_w)
5454   AM_RANGE(0x2004, 0x2004) AM_DEVWRITE_LEGACY("dac", dac_signed_w)
5555   AM_RANGE(0x2005, 0x2005) AM_WRITE(sound_nmi_mask_w)
56   AM_RANGE(0x2007, 0x2007) AM_READ(soundlatch_r)
56   AM_RANGE(0x2007, 0x2007) AM_READ(soundlatch_byte_r)
5757   AM_RANGE(0x4000, 0xffff) AM_ROM
5858ADDRESS_MAP_END
5959
src/mame/drivers/m107.c
r14896r14897
9292WRITE16_MEMBER(m107_state::m107_soundlatch_w)
9393{
9494   cputag_set_input_line(machine(), "soundcpu", NEC_INPUT_LINE_INTP1, ASSERT_LINE);
95   soundlatch_w(space, 0, data & 0xff);
96//      logerror("soundlatch_w %02x\n",data);
95   soundlatch_byte_w(space, 0, data & 0xff);
96//      logerror("soundlatch_byte_w %02x\n",data);
9797}
9898
9999READ16_MEMBER(m107_state::m107_sound_status_r)
r14896r14897
104104READ16_MEMBER(m107_state::m107_soundlatch_r)
105105{
106106   cputag_set_input_line(machine(), "soundcpu", NEC_INPUT_LINE_INTP1, CLEAR_LINE);
107   return soundlatch_r(space, offset) | 0xff00;
107   return soundlatch_byte_r(space, offset) | 0xff00;
108108}
109109
110110WRITE16_MEMBER(m107_state::m107_sound_irq_ack_w)
r14896r14897
131131   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m107_vram_w) AM_BASE(m_vram_data)
132132   AM_RANGE(0xe0000, 0xeffff) AM_RAM /* System ram */
133133   AM_RANGE(0xf8000, 0xf8fff) AM_RAM AM_BASE(m_spriteram)
134   AM_RANGE(0xf9000, 0xf9fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
134   AM_RANGE(0xf9000, 0xf9fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
135135   AM_RANGE(0xffff0, 0xfffff) AM_ROM AM_REGION("maincpu", 0x7fff0)
136136ADDRESS_MAP_END
137137
src/mame/drivers/twin16.c
r14896r14897
104104WRITE16_MEMBER(twin16_state::sound_command_w)
105105{
106106   COMBINE_DATA(&m_sound_command);
107   soundlatch_w(space, 0, m_sound_command&0xff );
107   soundlatch_byte_w(space, 0, m_sound_command&0xff );
108108}
109109
110110WRITE16_MEMBER(twin16_state::twin16_CPUA_register_w)
r14896r14897
224224   AM_RANGE(0x0000, 0x7fff) AM_ROM
225225   AM_RANGE(0x8000, 0x8fff) AM_RAM
226226   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("upd", twin16_upd_reset_w)
227   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
227   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
228228   AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE_LEGACY("konami", k007232_r, k007232_w)
229229   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
230230   AM_RANGE(0xd000, 0xd000) AM_DEVWRITE_LEGACY("upd", upd7759_port_w)
src/mame/drivers/megasys1.c
r14896r14897
180180   AM_RANGE(0x080006, 0x080007) AM_READ_PORT("DSW")
181181   AM_RANGE(0x080008, 0x080009) AM_READ(soundlatch2_word_r)   /* from sound cpu */
182182   AM_RANGE(0x084000, 0x0843ff) AM_RAM_WRITE(megasys1_vregs_A_w) AM_BASE(m_vregs)
183   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
183   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
184184   AM_RANGE(0x08e000, 0x08ffff) AM_RAM AM_BASE(m_objectram)
185185   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE(m_scrollram[0])
186186   AM_RANGE(0x094000, 0x097fff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE(m_scrollram[1])
r14896r14897
257257   ADDRESS_MAP_GLOBAL_MASK(0xfffff)
258258   AM_RANGE(0x000000, 0x03ffff) AM_ROM
259259   AM_RANGE(0x044000, 0x0443ff) AM_RAM_WRITE(megasys1_vregs_A_w) AM_BASE(m_vregs)
260   AM_RANGE(0x048000, 0x0487ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
260   AM_RANGE(0x048000, 0x0487ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
261261   AM_RANGE(0x04e000, 0x04ffff) AM_RAM AM_BASE(m_objectram)
262262   AM_RANGE(0x050000, 0x053fff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE(m_scrollram[0])
263263   AM_RANGE(0x054000, 0x057fff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE(m_scrollram[1])
r14896r14897
284284   AM_RANGE(0x0e0000, 0x0e3fff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE(m_scrollram[0])
285285   AM_RANGE(0x0e8000, 0x0ebfff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE(m_scrollram[1])
286286   AM_RANGE(0x0f0000, 0x0f3fff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE(m_scrollram[2])
287   AM_RANGE(0x0f8000, 0x0f87ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
287   AM_RANGE(0x0f8000, 0x0f87ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
288288   AM_RANGE(0x0d8000, 0x0d8001) AM_READWRITE(ip_select_r,ip_select_w)
289289   AM_RANGE(0x1c0000, 0x1cffff) AM_MIRROR(0x30000) AM_RAM AM_BASE(m_ram) //0x1f****, Cybattler reads attract mode inputs at 0x1d****
290290ADDRESS_MAP_END
r14896r14897
305305   AM_RANGE(0x0ca000, 0x0cbfff) AM_RAM AM_BASE(m_objectram)
306306   AM_RANGE(0x0d0000, 0x0d3fff) AM_RAM_WRITE(megasys1_scrollram_1_w) AM_BASE(m_scrollram[1])
307307   AM_RANGE(0x0d4000, 0x0d7fff) AM_RAM_WRITE(megasys1_scrollram_2_w) AM_BASE(m_scrollram[2])
308   AM_RANGE(0x0d8000, 0x0d87ff) AM_MIRROR(0x3000) AM_RAM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
308   AM_RANGE(0x0d8000, 0x0d87ff) AM_MIRROR(0x3000) AM_RAM_WRITE(paletteram_RRRRRGGGGGBBBBBx_word_w) AM_SHARE("paletteram")
309309   AM_RANGE(0x0e0000, 0x0e0001) AM_READ_PORT("DSW")
310310   AM_RANGE(0x0e8000, 0x0ebfff) AM_RAM_WRITE(megasys1_scrollram_0_w) AM_BASE(m_scrollram[0])
311311   AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("SYSTEM")
r14896r14897
433433static ADDRESS_MAP_START( z80_sound_map, AS_PROGRAM, 8, megasys1_state )
434434   AM_RANGE(0x0000, 0x3fff) AM_ROM
435435   AM_RANGE(0xc000, 0xc7ff) AM_RAM
436   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
436   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
437437   AM_RANGE(0xf000, 0xf000) AM_WRITENOP /* ?? */
438438ADDRESS_MAP_END
439439
r14896r14897
38113811   //device_t *oki1 = machine.device("oki1");
38123812   megasys1_state *state = machine.driver_data<megasys1_state>();
38133813   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xe0000, 0xe000f, read16_delegate(FUNC(megasys1_state::edfbl_input_r),state));
3814   //machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(*oki1, 0xe000e, 0xe000f, FUNC(soundlatch_w));
3814   //machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(*oki1, 0xe000e, 0xe000f, FUNC(soundlatch_byte_w));
38153815}
38163816
38173817static DRIVER_INIT( hayaosi1 )
src/mame/drivers/crshrace.c
r14896r14897
165165   if (ACCESSING_BITS_0_7)
166166   {
167167      m_pending_command = 1;
168      soundlatch_w(space, offset, data & 0xff);
168      soundlatch_byte_w(space, offset, data & 0xff);
169169      m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
170170   }
171171}
r14896r14897
193193   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM
194194   AM_RANGE(0xffc000, 0xffc001) AM_WRITE(crshrace_roz_bank_w)
195195   AM_RANGE(0xffd000, 0xffdfff) AM_RAM_WRITE(crshrace_videoram2_w) AM_BASE(m_videoram2)
196   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram16_xGGGGGBBBBBRRRRR_word_w) AM_SHARE("paletteram")
196   AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xGGGGGBBBBBRRRRR_word_w) AM_SHARE("paletteram")
197197   AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("P1") AM_WRITE(crshrace_gfxctrl_w)
198198   AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("P2")
199199   AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW0")
r14896r14897
214214static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, crshrace_state )
215215   ADDRESS_MAP_GLOBAL_MASK(0xff)
216216   AM_RANGE(0x00, 0x00) AM_WRITE(crshrace_sh_bankswitch_w)
217   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r) AM_WRITE(pending_command_clear_w)
217   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_byte_r) AM_WRITE(pending_command_clear_w)
218218   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE_LEGACY("ymsnd", ym2610_r, ym2610_w)
219219ADDRESS_MAP_END
220220
src/mame/drivers/airbustr.c
r14896r14897
274274
275275   memory_set_bank(machine(), "bank2", data & 0x07);
276276
277   flip_screen_set(machine(), data & 0x10);
277   flip_screen_set(data & 0x10);
278278
279279   // used at the end of levels, after defeating the boss, to leave trails
280280   pandora_set_clear_bitmap(m_pandora, data & 0x20);
r14896r14897
295295READ8_MEMBER(airbustr_state::soundcommand_r)
296296{
297297   m_soundlatch_status = 0;   // soundlatch has been read
298   return soundlatch_r(space, 0);
298   return soundlatch_byte_r(space, 0);
299299}
300300
301301READ8_MEMBER(airbustr_state::soundcommand2_r)
302302{
303303   m_soundlatch2_status = 0;   // soundlatch2 has been read
304   return soundlatch2_r(space, 0);
304   return soundlatch2_byte_r(space, 0);
305305}
306306
307307WRITE8_MEMBER(airbustr_state::soundcommand_w)
308308{
309   soundlatch_w(space, 0, data);
309   soundlatch_byte_w(space, 0, data);
310310   m_soundlatch_status = 1;   // soundlatch has been written
311311   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);   // cause a nmi to sub cpu
312312}
313313
314314WRITE8_MEMBER(airbustr_state::soundcommand2_w)
315315{
316   soundlatch2_w(space, 0, data);
316   soundlatch2_byte_w(space, 0, data);
317317   m_soundlatch2_status = 1;   // soundlatch2 has been written
318318}
319319
src/mame/drivers/pacman.c
r14896r14897
59305930GAME( 1981, abscam,   puckman,  piranha,  mspacman, eyes,     ROT90,  "GL (US Billiards license)", "Abscam", GAME_SUPPORTS_SAVE )
59315931GAME( 1981, nmouse,   0        ,  nmouse ,  nmouse,   eyes,     ROT90,  "Amenip (Palcom Queen River)", "Naughty Mouse (set 1)", GAME_SUPPORTS_SAVE )
59325932GAME( 1981, nmouseb,  nmouse ,  nmouse ,  nmouse,   eyes,     ROT90,  "Amenip Nova Games Ltd.", "Naughty Mouse (set 2)", GAME_SUPPORTS_SAVE )
5933GAME( 1981, mspacman, 0,        mspacman, mspacman, mspacman, ROT90,  "Midway", "Ms. Pac-Man", GAME_SUPPORTS_SAVE )
5934GAME( 1981, mspacmnf, mspacman, mspacman, mspacman, mspacman, ROT90,  "Midway", "Ms. Pac-Man (with speedup hack)", GAME_SUPPORTS_SAVE )
5933GAME( 1981, mspacman, 0,        mspacman, mspacman, mspacman, ROT90,  "Midway / General Computer Corporation", "Ms. Pac-Man", GAME_SUPPORTS_SAVE )
5934GAME( 1981, mspacmnf, mspacman, mspacman, mspacman, mspacman, ROT90,  "Midway / General Computer Corporation", "Ms. Pac-Man (with speedup hack)", GAME_SUPPORTS_SAVE )
59355935GAME( 1981, mspacmat, mspacman, mspacman, mspacman, mspacman, ROT90,  "hack", "Ms. Pac Attack", GAME_SUPPORTS_SAVE )
59365936GAME( 1981, woodpeck, 0,        woodpek,  woodpek,  woodpek,  ROT90,  "Amenip (Palcom Queen River)", "Woodpecker (set 1)", GAME_SUPPORTS_SAVE )
59375937GAME( 1981, woodpeca, woodpeck, woodpek,  woodpek,  woodpek,  ROT90,  "Amenip", "Woodpecker (set 2)", GAME_SUPPORTS_SAVE )
src/mame/drivers/igs011.c
r14896r14897
8585public:
8686   igs011_state(const machine_config &mconfig, device_type type, const char *tag)
8787      : driver_device(mconfig, type, tag),
88      m_maincpu(*this, "maincpu")
89      { }
88      m_maincpu(*this, "maincpu"),
89      m_priority_ram(*this, "priority_ram"),
90      m_vbowl_trackball(*this, "vbowl_trackball"){ }
9091
92   required_device<cpu_device> m_maincpu;
93   required_shared_ptr<UINT16> m_priority_ram;
94   required_shared_ptr<UINT16> m_vbowl_trackball;
9195   UINT8 *m_layer[8];
9296   UINT16 m_priority;
93   UINT16 *m_priority_ram;
9497   UINT8 m_lhb2_pen_hi;
9598   UINT16 m_igs_dips_sel;
9699   UINT16 m_igs_input_sel;
r14896r14897
104107   UINT8 m_igs012_prot_mode;
105108   UINT16 m_igs003_reg[2];
106109   UINT16 m_lhb_irq_enable;
107   UINT16 *m_vbowl_trackball;
108110   blitter_t m_blitter;
109111
110   required_device<cpu_device> m_maincpu;
111112   DECLARE_WRITE16_MEMBER(igs011_priority_w);
112113   DECLARE_READ16_MEMBER(igs011_layers_r);
113114   DECLARE_WRITE16_MEMBER(igs011_layers_w);
r14896r14897
248249   }
249250#endif
250251
251   pri_ram = &state->m_priority_ram[(state->m_priority & 7) * 512/2];
252   pri_ram = &state->m_priority_ram.target()[(state->m_priority & 7) * 512/2];
252253
253254   for (y = cliprect.min_y; y <= cliprect.max_y; y++)
254255   {
r14896r14897
23432344   AM_RANGE( 0x204000, 0x204003 ) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0x00ff )
23442345   AM_RANGE( 0x208000, 0x208003 ) AM_WRITE(lhb2_igs003_w )
23452346   AM_RANGE( 0x208002, 0x208003 ) AM_READ(lhb2_igs003_r )
2346   AM_RANGE( 0x20c000, 0x20cfff ) AM_RAM AM_BASE(m_priority_ram)
2347   AM_RANGE( 0x20c000, 0x20cfff ) AM_RAM AM_SHARE("priority_ram")
23472348   AM_RANGE( 0x210000, 0x211fff ) AM_RAM_WRITE(igs011_palette ) AM_SHARE("paletteram")
23482349   AM_RANGE( 0x214000, 0x214001 ) AM_READ_PORT( "COIN" )
23492350   AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE(igs011_layers_r, igs011_layers_w )
r14896r14897
24062407   if (vblank_on)
24072408   {
24082409      igs011_state *state = screen.machine().driver_data<igs011_state>();
2409      state->m_vbowl_trackball[0] = state->m_vbowl_trackball[1];
2410      state->m_vbowl_trackball[1] = (input_port_read(screen.machine(), "AN1") << 8) | input_port_read(screen.machine(), "AN0");
2410      state->m_vbowl_trackball.target()[0] = state->m_vbowl_trackball.target()[1];
2411      state->m_vbowl_trackball.target()[1] = (input_port_read(screen.machine(), "AN1") << 8) | input_port_read(screen.machine(), "AN0");
24112412   }
24122413}
24132414
src/mame/drivers/bwing.c
r14896r14897
103103            device_set_input_line(m_subcpu, INPUT_LINE_NMI, ASSERT_LINE); // SNMI
104104         else
105105         {
106            soundlatch_w(space, 0, data);
106            soundlatch_byte_w(space, 0, data);
107107            device_set_input_line(m_audiocpu, DECO16_IRQ_LINE, HOLD_LINE); // SNDREQ
108108         }
109109      break;
r14896r14897
178178   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE_LEGACY("ay1", ay8910_address_w)
179179   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_LEGACY("ay2", ay8910_data_w)
180180   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE_LEGACY("ay2", ay8910_address_w)
181   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
181   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
182182   AM_RANGE(0xd000, 0xd000) AM_WRITE(bwp3_nmimask_w)
183183   AM_RANGE(0xe000, 0xffff) AM_ROM AM_BASE_SIZE(m_bwp3_rombase, m_bwp3_romsize)
184184ADDRESS_MAP_END
src/mame/drivers/srmp6.c
r14896r14897
7474{
7575public:
7676   srmp6_state(const machine_config &mconfig, device_type type, const char *tag)
77      : driver_device(mconfig, type, tag) { }
77      : driver_device(mconfig, type, tag) ,
78      m_sprram(*this, "sprram"),
79      m_chrram(*this, "chrram"),
80      m_dmaram(*this, "dmaram"),
81      m_video_regs(*this, "video_regs"){ }
7882
7983   UINT16* m_tileram;
80   UINT16* m_dmaram;
81   UINT16* m_chrram;
84   required_shared_ptr<UINT16> m_sprram;
85   required_shared_ptr<UINT16> m_chrram;
86   required_shared_ptr<UINT16> m_dmaram;
87   required_shared_ptr<UINT16> m_video_regs;
8288
83   UINT16 *m_sprram;
8489   UINT16 *m_sprram_old;
8590
8691   int m_brightness;
8792   UINT16 m_input_select;
88   UINT16 *m_video_regs;
8993
9094   unsigned short m_lastb;
9195   unsigned short m_lastb2;
r14896r14897
153157   srmp6_state *state = machine.driver_data<srmp6_state>();
154158
155159   state->m_tileram = auto_alloc_array_clear(machine, UINT16, 0x100000*16/2);
156   state->m_dmaram = auto_alloc_array(machine, UINT16, 0x100/2);
160   //state->m_dmaram = auto_alloc_array(machine, UINT16, 0x100/2);
157161   state->m_sprram_old = auto_alloc_array_clear(machine, UINT16, 0x80000/2);
158162
159163   /* create the char set (gfx will then be updated dynamically from RAM) */
r14896r14897
359363         logerror("video_regs_w (PC=%06X): %04x = %04x & %04x\n", cpu_get_previouspc(&space.device()), offset*2, data, mem_mask);
360364         break;
361365   }
362   COMBINE_DATA(&m_video_regs[offset]);
366   COMBINE_DATA(&m_video_regs.target()[offset]);
363367}
364368
365369READ16_MEMBER(srmp6_state::video_regs_r)
366370{
367371
368372   logerror("video_regs_r (PC=%06X): %04x\n", cpu_get_previouspc(&space.device()), offset*2);
369   return m_video_regs[offset];
373   return m_video_regs.target()[offset];
370374}
371375
372376
r14896r14897
409413
410414WRITE16_MEMBER(srmp6_state::srmp6_dma_w)
411415{
412   UINT16* dmaram = m_dmaram;
416   UINT16* dmaram = m_dmaram.target();
413417
414418   COMBINE_DATA(&dmaram[offset]);
415419   if (offset==13 && dmaram[offset]==0x40)
r14896r14897
483487READ16_MEMBER(srmp6_state::tileram_r)
484488{
485489
486   return m_chrram[offset];
490   return m_chrram.target()[offset];
487491}
488492
489493WRITE16_MEMBER(srmp6_state::tileram_w)
490494{
491495
492496   //UINT16 tmp;
493   COMBINE_DATA(&m_chrram[offset]);
497   COMBINE_DATA(&m_chrram.target()[offset]);
494498
495499   /* are the DMA registers enabled some other way, or always mapped here, over RAM? */
496500   if (offset >= 0xfff00/2 && offset <= 0xfff1a/2 )
r14896r14897
505509   INT8 r, g, b;
506510   int brg = m_brightness - 0x60;
507511
508   paletteram16_xBBBBBGGGGGRRRRR_word_w(space, offset, data, mem_mask);
512   paletteram_xBBBBBGGGGGRRRRR_word_w(space, offset, data, mem_mask);
509513
510514   if(brg)
511515   {
r14896r14897
551555   AM_RANGE(0x4d0000, 0x4d0001) AM_READ(srmp6_irq_ack_r)
552556
553557   // OBJ RAM: checked [$400000-$47dfff]
554   AM_RANGE(0x400000, 0x47ffff) AM_RAM AM_BASE(m_sprram)
558   AM_RANGE(0x400000, 0x47ffff) AM_RAM AM_SHARE("sprram")
555559
556560   // CHR RAM: checked [$500000-$5fffff]
557   AM_RANGE(0x500000, 0x5fffff) AM_READWRITE(tileram_r,tileram_w) AM_BASE(m_chrram)
558   //AM_RANGE(0x5fff00, 0x5fffff) AM_WRITE_LEGACY(dma_w) AM_BASE(m_dmaram)
561   AM_RANGE(0x500000, 0x5fffff) AM_READWRITE(tileram_r,tileram_w) AM_SHARE("chrram")
562   //AM_RANGE(0x5fff00, 0x5fffff) AM_WRITE_LEGACY(dma_w) AM_SHARE("dmaram")
559563
560   AM_RANGE(0x4c0000, 0x4c006f) AM_READWRITE(video_regs_r, video_regs_w) AM_BASE(m_video_regs)   // ? gfx regs ST-0026 NiLe
564   AM_RANGE(0x4c0000, 0x4c006f) AM_READWRITE(video_regs_r, video_regs_w) AM_SHARE("video_regs")   // ? gfx regs ST-0026 NiLe
561565   AM_RANGE(0x4e0000, 0x4e00ff) AM_DEVREADWRITE_LEGACY("nile", nile_snd_r, nile_snd_w)
562566   AM_RANGE(0x4e0100, 0x4e0101) AM_DEVREADWRITE_LEGACY("nile", nile_sndctrl_r, nile_sndctrl_w)
563567   //AM_RANGE(0x4e0110, 0x4e0111) AM_NOP // ? accessed once ($268dc, written $b.w)
src/mame/drivers/sf.c
r14896r14897
4444
4545   if (ACCESSING_BITS_0_7)
4646   {
47      soundlatch_w(space, offset, data & 0xff);
47      soundlatch_byte_w(space, offset, data & 0xff);
4848      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
4949   }
5050}
r14896r14897
191191static ADDRESS_MAP_START( sf_map, AS_PROGRAM, 16, sf_state )
192192   AM_RANGE(0x000000, 0x04ffff) AM_ROM
193193   AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(sf_videoram_w) AM_BASE_SIZE(m_videoram, m_videoram_size)
194   AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
194   AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
195195   AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("COINS")
196196   AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN0")
197197   AM_RANGE(0xc00004, 0xc00005) AM_READ(button1_r)
r14896r14897
213213static ADDRESS_MAP_START( sfus_map, AS_PROGRAM, 16, sf_state )
214214   AM_RANGE(0x000000, 0x04ffff) AM_ROM
215215   AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(sf_videoram_w) AM_BASE_SIZE(m_videoram, m_videoram_size)
216   AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
216   AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
217217   AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0")
218218   AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1")
219219   AM_RANGE(0xc00004, 0xc00005) AM_READ(dummy_r)
r14896r14897
235235static ADDRESS_MAP_START( sfjp_map, AS_PROGRAM, 16, sf_state )
236236   AM_RANGE(0x000000, 0x04ffff) AM_ROM
237237   AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(sf_videoram_w) AM_BASE_SIZE(m_videoram, m_videoram_size)
238   AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
238   AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
239239   AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("COINS")
240240   AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("P1")
241241   AM_RANGE(0xc00004, 0xc00005) AM_READ_PORT("P2")
r14896r14897
257257static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, sf_state )
258258   AM_RANGE(0x0000, 0x7fff) AM_ROM
259259   AM_RANGE(0xc000, 0xc7ff) AM_RAM
260   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
260   AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r)
261261   AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)
262262ADDRESS_MAP_END
263263
r14896r14897
272272   ADDRESS_MAP_GLOBAL_MASK(0xff)
273273   AM_RANGE(0x00, 0x00) AM_DEVWRITE_LEGACY("msm1", msm5205_w)
274274   AM_RANGE(0x01, 0x01) AM_DEVWRITE_LEGACY("msm2", msm5205_w)
275   AM_RANGE(0x01, 0x01) AM_READ(soundlatch_r)
275   AM_RANGE(0x01, 0x01) AM_READ(soundlatch_byte_r)
276276   AM_RANGE(0x02, 0x02) AM_WRITE(sound2_bank_w)
277277ADDRESS_MAP_END
278278
src/mame/drivers/konamim2.c
r14896r14897
204204{
205205public:
206206   konamim2_state(const machine_config &mconfig, device_type type, const char *tag)
207      : driver_device(mconfig, type, tag) { }
207      : driver_device(mconfig, type, tag) ,
208      m_main_ram(*this, "main_ram"){ }
208209
209   UINT64 *m_main_ram;
210   required_shared_ptr<UINT64> m_main_ram;
210211   UINT32 m_vdl0_address;
211212   UINT32 m_vdl1_address;
212213   UINT32 m_irq_enable;
r14896r14897
261262   UINT32 fb_start = 0xffffffff;
262263   if (state->m_vdl0_address != 0)
263264   {
264      fb_start = *(UINT32*)&state->m_main_ram[(state->m_vdl0_address - 0x40000000) / 8] - 0x40000000;
265      fb_start = *(UINT32*)&state->m_main_ram.target()[(state->m_vdl0_address - 0x40000000) / 8] - 0x40000000;
265266   }
266267
267268   if (fb_start <= 0x800000)
268269   {
269      UINT16 *frame = (UINT16*)&state->m_main_ram[fb_start/8];
270      UINT16 *frame = (UINT16*)&state->m_main_ram.target()[fb_start/8];
270271      for (j=0; j < 384; j++)
271272      {
272273         UINT16 *fb = &frame[(j*512)];
r14896r14897
11341135   AM_RANGE(0x10000000, 0x10000007) AM_READ(cpu_r)
11351136   AM_RANGE(0x10000008, 0x10001007) AM_NOP      // ???
11361137   AM_RANGE(0x20000000, 0x201fffff) AM_ROM AM_SHARE("share2")
1137   AM_RANGE(0x40000000, 0x407fffff) AM_RAM AM_SHARE("share3") AM_BASE(m_main_ram)
1138   AM_RANGE(0x40000000, 0x407fffff) AM_RAM AM_SHARE("share3") AM_SHARE("main_ram")
11381139   AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("boot", 0) AM_SHARE("share2")
11391140ADDRESS_MAP_END
11401141
src/mame/drivers/cball.c
r14896r14897
1212{
1313public:
1414   cball_state(const machine_config &mconfig, device_type type, const char *tag)
15      : driver_device(mconfig, type, tag) { }
15      : driver_device(mconfig, type, tag) ,
16      m_video_ram(*this, "video_ram"){ }
1617
1718   /* memory pointers */
18   UINT8 * m_video_ram;
19   required_shared_ptr<UINT8> m_video_ram;
1920
2021   /* video-related */
2122   tilemap_t* m_bg_tilemap;
r14896r14897
3132static TILE_GET_INFO( get_tile_info )
3233{
3334   cball_state *state = machine.driver_data<cball_state>();
34   UINT8 code = state->m_video_ram[tile_index];
35   UINT8 code = state->m_video_ram.target()[tile_index];
3536
3637   SET_TILE_INFO(0, code, code >> 7, 0);
3738}
r14896r14897
4041WRITE8_MEMBER(cball_state::cball_vram_w)
4142{
4243
43   m_video_ram[offset] = data;
44   m_video_ram.target()[offset] = data;
4445   m_bg_tilemap->mark_tile_dirty(offset);
4546}
4647
r14896r14897
6162
6263   /* draw sprite */
6364   drawgfx_transpen(bitmap, cliprect, screen.machine().gfx[1],
64      state->m_video_ram[0x399] >> 4,
65      state->m_video_ram.target()[0x399] >> 4,
6566      0,
6667      0, 0,
67      240 - state->m_video_ram[0x390],
68      240 - state->m_video_ram[0x398], 0);
68      240 - state->m_video_ram.target()[0x390],
69      240 - state->m_video_ram.target()[0x398], 0);
6970   return 0;
7071}
7172
r14896r14897
112113READ8_MEMBER(cball_state::cball_wram_r)
113114{
114115
115   return m_video_ram[0x380 + offset];
116   return m_video_ram.target()[0x380 + offset];
116117}
117118
118119
119120WRITE8_MEMBER(cball_state::cball_wram_w)
120121{
121122
122   m_video_ram[0x380 + offset] = data;
123   m_video_ram.target()[0x380 + offset] = data;
123124}
124125
125126
r14896r14897
138139   AM_RANGE(0x2800, 0x2800) AM_READ_PORT("2800")
139140
140141   AM_RANGE(0x0000, 0x03ff) AM_WRITE(cball_wram_w) AM_MASK(0x7f)
141   AM_RANGE(0x0400, 0x07ff) AM_WRITE(cball_vram_w) AM_BASE(m_video_ram)
142   AM_RANGE(0x0400, 0x07ff) AM_WRITE(cball_vram_w) AM_SHARE("video_ram")
142143   AM_RANGE(0x1800, 0x1800) AM_NOP /* watchdog? */
143144   AM_RANGE(0x1810, 0x1811) AM_NOP
144145   AM_RANGE(0x1820, 0x1821) AM_NOP
src/mame/drivers/williams.c
r14896r14897
12451245   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
12461246   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
12471247   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1248   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
1248   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r)
12491249
12501250   PORT_START("IN1")
12511251   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r14896r14897
15261526
15271527   /* pia */
15281528   MCFG_PIA6821_MODIFY("pia_0", lottofun_pia_0_intf)
1529   MCFG_TICKET_DISPENSER_ADD("ticket", 70, TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
1529   MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(70), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH)
15301530MACHINE_CONFIG_END
15311531
15321532
src/mame/drivers/dec8.c
r14896r14897
461461
462462   if ((data&1)==0) device_set_input_line(m_maincpu, M6809_IRQ_LINE, CLEAR_LINE);
463463   if (data & 2) m_nmi_enable =1; else m_nmi_enable = 0;
464   flip_screen_set(machine(), data & 0x08);
464   flip_screen_set(data & 0x08);
465465}
466466
467467WRITE8_MEMBER(dec8_state::csilver_control_w)
r14896r14897
478478
479479WRITE8_MEMBER(dec8_state::dec8_sound_w)
480480{
481   soundlatch_w(space, 0, data);
481   soundlatch_byte_w(space, 0, data);
482482   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
483483}
484484
r14896r14897
576576
577577/******************************************************************************/
578578
579WRITE8_MEMBER(dec8_state::flip_screen_w){ flip_screen_set(machine(), data); }
579WRITE8_MEMBER(dec8_state::flip_screen_w){ flip_screen_set(data); }
580580
581581/******************************************************************************/
582582
583583
584584static ADDRESS_MAP_START( lastmisn_map, AS_PROGRAM, 8, dec8_state )
585585   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
586   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("share3") AM_SHARE("paletteram")
587   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("share4") AM_SHARE("paletteram2")
586   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("share3") AM_SHARE("paletteram")
587   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("share4") AM_SHARE("paletteram2")
588588   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN0")
589589   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")
590590   AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")
r14896r14897
609609
610610static ADDRESS_MAP_START( lastmisn_sub_map, AS_PROGRAM, 8, dec8_state )
611611   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
612   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("share3")
613   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("share4")
612   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("share3")
613   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("share4")
614614   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN0")
615615   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")
616616   AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")
r14896r14897
629629
630630static ADDRESS_MAP_START( shackled_map, AS_PROGRAM, 8, dec8_state )
631631   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
632   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("share3") AM_SHARE("paletteram")
633   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("share4") AM_SHARE("paletteram2")
632   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("share3") AM_SHARE("paletteram")
633   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("share4") AM_SHARE("paletteram2")
634634   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN0")
635635   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")
636636   AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")
r14896r14897
653653
654654static ADDRESS_MAP_START( shackled_sub_map, AS_PROGRAM, 8, dec8_state )
655655   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
656   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("share3")
657   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("share4")
656   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("share3")
657   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("share4")
658658   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN0")
659659   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")
660660   AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")
r14896r14897
680680   AM_RANGE(0x0000, 0x17ff) AM_RAM
681681   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(dec8_videoram_w) AM_BASE_SIZE(m_videoram, m_videoram_size)
682682   AM_RANGE(0x2000, 0x27ff) AM_READWRITE(dec8_bg_data_r, dec8_bg_data_w) AM_BASE(m_bg_data)
683   AM_RANGE(0x2800, 0x2bff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("paletteram")
684   AM_RANGE(0x2c00, 0x2fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("paletteram2")
683   AM_RANGE(0x2800, 0x2bff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram")
684   AM_RANGE(0x2c00, 0x2fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
685685   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("spriteram")   /* Sprites */
686686   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("DSW0")      /* Dip 1 */
687687   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("DSW1")      /* Dip 2 */
r14896r14897
703703   AM_RANGE(0x0000, 0x17ff) AM_RAM
704704   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(dec8_videoram_w) AM_BASE_SIZE(m_videoram, m_videoram_size)
705705   AM_RANGE(0x2000, 0x27ff) AM_READWRITE(dec8_bg_data_r, dec8_bg_data_w) AM_BASE(m_bg_data)
706   AM_RANGE(0x2800, 0x2bff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("paletteram")
707   AM_RANGE(0x2c00, 0x2fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("paletteram2")
706   AM_RANGE(0x2800, 0x2bff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram")
707   AM_RANGE(0x2c00, 0x2fff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
708708   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("spriteram") /* Sprites */
709709   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("DSW0")   /* Dip 1 */
710710   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("DSW1")   /* Dip 2 */
r14896r14897
747747
748748static ADDRESS_MAP_START( csilver_map, AS_PROGRAM, 8, dec8_state )
749749   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
750   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("share3") AM_SHARE("paletteram")
751   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("share4") AM_SHARE("paletteram2")
750   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("share3") AM_SHARE("paletteram")
751   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("share4") AM_SHARE("paletteram2")
752752   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN1")
753753   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN0")
754754   AM_RANGE(0x1803, 0x1803) AM_READ_PORT("IN2")
r14896r14897
772772
773773static ADDRESS_MAP_START( csilver_sub_map, AS_PROGRAM, 8, dec8_state )
774774   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("share1")
775   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("share3")
776   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("share4")
775   AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("share3")
776   AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("share4")
777777   AM_RANGE(0x1803, 0x1803) AM_READ_PORT("IN2")
778778   AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")
779779   AM_RANGE(0x1800, 0x1804) AM_WRITE(shackled_int_w)
r14896r14897
793793   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(dec8_videoram_w) AM_BASE_SIZE(m_videoram, m_videoram_size)
794794   AM_RANGE(0x2800, 0x2fff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_data_8bit_r, deco_bac06_pf_data_8bit_w)
795795   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("spriteram") /* Sprites */
796   AM_RANGE(0x3800, 0x3bff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_be_w) AM_SHARE("paletteram")
796   AM_RANGE(0x3800, 0x3bff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_be_w) AM_SHARE("paletteram")
797797   AM_RANGE(0x3c00, 0x3c00) AM_READ_PORT("IN0")
798798   AM_RANGE(0x3c01, 0x3c01) AM_READ_PORT("IN1")
799799   AM_RANGE(0x3c02, 0x3c02) AM_READ_PORT("IN2")   /* VBL & coins */
r14896r14897
831831   AM_RANGE(0x1805, 0x1806) AM_WRITE(srdarwin_control_w) /* Scroll & Bank */
832832   AM_RANGE(0x2000, 0x2000) AM_READWRITE(i8751_h_r, dec8_sound_w)   /* Sound */
833833   AM_RANGE(0x2001, 0x2001) AM_READWRITE(i8751_l_r, flip_screen_w)      /* Flipscreen */
834   AM_RANGE(0x2800, 0x288f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_SHARE("paletteram")
835   AM_RANGE(0x3000, 0x308f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_SHARE("paletteram2")
834   AM_RANGE(0x2800, 0x288f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w) AM_SHARE("paletteram")
835   AM_RANGE(0x3000, 0x308f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
836836   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("DSW0")   /* Dip 1 */
837837   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("IN0")   /* Player 1 */
838838   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("IN1")   /* Player 2 (cocktail) + VBL */
r14896r14897
848848   AM_RANGE(0x1800, 0x1fff) AM_RAM
849849   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(dec8_videoram_w) AM_BASE_SIZE(m_videoram, m_videoram_size)
850850   AM_RANGE(0x2800, 0x2fff) AM_RAM AM_SHARE("spriteram")
851   AM_RANGE(0x3000, 0x31ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_be_w) AM_SHARE("paletteram")
851   AM_RANGE(0x3000, 0x31ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_be_w) AM_SHARE("paletteram")
852852   AM_RANGE(0x3200, 0x37ff) AM_WRITEONLY /* Unused */
853853   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("IN0")   /* Player 1 */
854854   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("IN1")   /* Player 2 */
r14896r14897
873873   AM_RANGE(0x0000, 0x05ff) AM_RAM
874874   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
875875   AM_RANGE(0x4000, 0x4001) AM_DEVWRITE_LEGACY("ym2", ym3812_w)
876   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
876   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
877877   AM_RANGE(0x8000, 0xffff) AM_ROM
878878ADDRESS_MAP_END
879879
r14896r14897
882882   AM_RANGE(0x0000, 0x05ff) AM_RAM
883883   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
884884   AM_RANGE(0x4000, 0x4001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
885   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
885   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
886886   AM_RANGE(0x8000, 0xffff) AM_ROM
887887ADDRESS_MAP_END
888888
r14896r14897
891891   AM_RANGE(0x0000, 0x05ff) AM_RAM
892892   AM_RANGE(0x0800, 0x0801) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
893893   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
894   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
894   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
895895   AM_RANGE(0x8000, 0xffff) AM_ROM
896896ADDRESS_MAP_END
897897
r14896r14897
902902   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
903903   AM_RANGE(0x1800, 0x1800) AM_WRITE(csilver_adpcm_data_w)   /* ADPCM data for the MSM5205 chip */
904904   AM_RANGE(0x2000, 0x2000) AM_WRITE(csilver_sound_bank_w)
905   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
905   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
906906   AM_RANGE(0x3400, 0x3400) AM_DEVREAD_LEGACY("msm", csilver_adpcm_reset_r)   /* ? not sure */
907907   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank3")
908908   AM_RANGE(0x8000, 0xffff) AM_ROM
src/mame/drivers/slotcarn.c
r14896r14897
3434{
3535public:
3636   slotcarn_state(const machine_config &mconfig, device_type type, const char *tag)
37      : driver_device(mconfig, type, tag) { }
37      : driver_device(mconfig, type, tag) ,
38      m_backup_ram(*this, "backup_ram"),
39      m_ram_attr(*this, "raattr"),
40      m_ram_video(*this, "ravideo"){ }
3841
3942   pen_t m_pens[NUM_PENS];
40   UINT8 *m_ram_attr;
41   UINT8 *m_ram_video;
43   required_shared_ptr<UINT8> m_backup_ram;
44   required_shared_ptr<UINT8> m_ram_attr;
45   required_shared_ptr<UINT8> m_ram_video;
4246   UINT8 *m_ram_palette;
43   UINT8 *m_backup_ram;
4447   DECLARE_READ8_MEMBER(palette_r);
4548   DECLARE_WRITE8_MEMBER(palette_w);
4649};
r14896r14897
6063{
6164   int co;
6265
63   co = ((m_ram_attr[offset] & 0x7F) << 3) | (offset & 0x07);
66   co = ((m_ram_attr.target()[offset] & 0x7F) << 3) | (offset & 0x07);
6467   return m_ram_palette[co];
6568}
6669
r14896r14897
7174   machine().primary_screen->update_now();
7275   data &= 0x0f;
7376
74   co = ((m_ram_attr[offset] & 0x7F) << 3) | (offset & 0x07);
77   co = ((m_ram_attr.target()[offset] & 0x7F) << 3) | (offset & 0x07);
7578   m_ram_palette[co] = data;
7679
7780}
r14896r14897
117120   for (cx = 0; cx < x_count; cx++)
118121   {
119122      int i;
120      int attr = state->m_ram_attr[ma & 0x7ff];
123      int attr = state->m_ram_attr.target()[ma & 0x7ff];
121124      int region = (attr & 0x40) >> 6;
122      int addr = ((state->m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (extra_video_bank_bit)) << 4) | (ra & 0x0f);
125      int addr = ((state->m_ram_video.target()[ma & 0x7ff] | ((attr & 0x80) << 1) | (extra_video_bank_bit)) << 4) | (ra & 0x0f);
123126      int colour = (attr & 0x7f) << 3;
124127      UINT8   *data;
125128
r14896r14897
181184
182185static ADDRESS_MAP_START( slotcarn_map, AS_PROGRAM, 8, slotcarn_state )
183186   AM_RANGE(0x0000, 0x5fff) AM_ROM
184   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE(m_backup_ram)
187   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_SHARE("backup_ram")
185188   AM_RANGE(0x6800, 0x6fff) AM_RAM // spielbud
186189   AM_RANGE(0x7000, 0xafff) AM_ROM // spielbud
187190
r14896r14897
201204   AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("crtc", mc6845_device, address_w)
202205   AM_RANGE(0xe001, 0xe001) AM_DEVWRITE("crtc", mc6845_device, register_w)
203206
204   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(m_ram_attr)
205   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_BASE(m_ram_video)
207   AM_RANGE(0xe800, 0xefff) AM_RAM AM_SHARE("raattr")
208   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("ravideo")
206209   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(palette_r, palette_w)
207210ADDRESS_MAP_END
208211
src/mame/drivers/tbowl.c
r14896r14897
6969
7070WRITE8_MEMBER(tbowl_state::tbowl_sound_command_w)
7171{
72   soundlatch_w(space, offset, data);
72   soundlatch_byte_w(space, offset, data);
7373   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
7474}
7575
r14896r14897
131131   AM_RANGE(0xc000, 0xdfff) AM_READONLY
132132   AM_RANGE(0xc000, 0xd7ff) AM_WRITEONLY
133133   AM_RANGE(0xd800, 0xdfff) AM_WRITEONLY AM_BASE(m_spriteram)
134   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_be_w) AM_SHARE("paletteram") // 2x palettes, one for each monitor?
134   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_byte_be_w) AM_SHARE("paletteram") // 2x palettes, one for each monitor?
135135   AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank2")
136136   AM_RANGE(0xf800, 0xfbff) AM_READWRITE(shared_r, shared_w)
137137   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(tbowlc_bankswitch_w)
r14896r14897
192192   AM_RANGE(0xe004, 0xe005) AM_WRITE(tbowl_adpcm_vol_w)
193193   AM_RANGE(0xe006, 0xe006) AM_WRITENOP
194194   AM_RANGE(0xe007, 0xe007) AM_WRITENOP   /* NMI acknowledge */
195   AM_RANGE(0xe010, 0xe010) AM_READ(soundlatch_r)
195   AM_RANGE(0xe010, 0xe010) AM_READ(soundlatch_byte_r)
196196ADDRESS_MAP_END
197197
198198/*** Input Ports
src/mame/drivers/battlane.c
r14896r14897
3535        0x01    = Y Scroll MSB
3636    */
3737
38   flip_screen_set(machine(), data & 0x80);
38   flip_screen_set(data & 0x80);
3939
4040   /*
4141        I think that the NMI is an inhibitor. It is constantly set
src/mame/drivers/atarigt.c
r14896r14897
9797 *
9898 *************************************/
9999
100static READ32_HANDLER( special_port2_r )
100READ32_MEMBER(atarigt_state::special_port2_r)
101101{
102   int temp = input_port_read(space->machine(), "SERVICE");
102   int temp = input_port_read(machine(), "SERVICE");
103103   temp ^= 0x0001;      /* /A2DRDY always high for now */
104104   temp ^= 0x0008;      /* A2D.EOC always high for now */
105105   return (temp << 16) | temp;
106106}
107107
108108
109static READ32_HANDLER( special_port3_r )
109READ32_MEMBER(atarigt_state::special_port3_r)
110110{
111   atarigt_state *state = space->machine().driver_data<atarigt_state>();
112   int temp = input_port_read(space->machine(), "COIN");
113   if (state->m_video_int_state) temp ^= 0x0001;
114   if (state->m_scanline_int_state) temp ^= 0x0002;
111   int temp = input_port_read(machine(), "COIN");
112   if (m_video_int_state) temp ^= 0x0001;
113   if (m_scanline_int_state) temp ^= 0x0002;
115114   return (temp << 16) | temp;
116115}
117116
r14896r14897
149148#endif
150149
151150
152static READ32_HANDLER( analog_port0_r )
151READ32_MEMBER(atarigt_state::analog_port0_r)
153152{
154153#if (HACK_TMEK_CONTROLS)
155154   int pots[4];
156155   compute_fake_pots(pots);
157156   return (pots[0] << 24) | (pots[3] << 8);
158157#else
159   return (input_port_read(space->machine(), "AN1") << 24) | (input_port_read(space->machine(), "AN2") << 8);
158   return (input_port_read(machine(), "AN1") << 24) | (input_port_read(machine(), "AN2") << 8);
160159#endif
161160}
162161
163162
164static READ32_HANDLER( analog_port1_r )
163READ32_MEMBER(atarigt_state::analog_port1_r)
165164{
166165#if (HACK_TMEK_CONTROLS)
167166   int pots[4];
168167   compute_fake_pots(pots);
169168   return (pots[2] << 24) | (pots[1] << 8);
170169#else
171   return (input_port_read(space->machine(), "AN3") << 24) | (input_port_read(space->machine(), "AN4") << 8);
170   return (input_port_read(machine(), "AN3") << 24) | (input_port_read(machine(), "AN4") << 8);
172171#endif
173172}
174173
r14896r14897
180179 *
181180 *************************************/
182181
183static WRITE32_HANDLER( latch_w )
182WRITE32_MEMBER(atarigt_state::latch_w)
184183{
185184   /*
186185        D13 = 68.DISA
r14896r14897
196195   /* upper byte */
197196   if (ACCESSING_BITS_24_31)
198197   {
199      atarigt_state *state = space->machine().driver_data<atarigt_state>();
200198
201199      /* bits 13-11 are the MO control bits */
202      atarirle_control_w(state->m_rle, (data >> 27) & 7);
200      atarirle_control_w(m_rle, (data >> 27) & 7);
203201   }
204202
205203   if (ACCESSING_BITS_16_23)
206204   {
207      //cage_reset_w(space, data & 0x00100000);
208      coin_counter_w(space->machine(), 0, data & 0x00080000);
209      coin_counter_w(space->machine(), 1, data & 0x00010000);
205      //cage_reset_w(&space, data & 0x00100000);
206      coin_counter_w(machine(), 0, data & 0x00080000);
207      coin_counter_w(machine(), 1, data & 0x00010000);
210208   }
211209}
212210
213211
214static WRITE32_HANDLER( mo_command_w )
212WRITE32_MEMBER(atarigt_state::mo_command_w)
215213{
216   atarigt_state *state = space->machine().driver_data<atarigt_state>();
217   COMBINE_DATA(state->m_mo_command);
214   COMBINE_DATA(m_mo_command);
218215   if (ACCESSING_BITS_0_15)
219      atarirle_command_w(state->m_rle, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
216      atarirle_command_w(m_rle, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
220217}
221218
222219
223static WRITE32_HANDLER( led_w )
220WRITE32_MEMBER(atarigt_state::led_w)
224221{
225222//  logerror("LED = %08X & %08X\n", data, mem_mask);
226223}
r14896r14897
233230 *
234231 *************************************/
235232
236static READ32_HANDLER( sound_data_r )
233READ32_MEMBER(atarigt_state::sound_data_r)
237234{
238235   UINT32 result = 0;
239236
240237   if (ACCESSING_BITS_0_15)
241      result |= cage_control_r(space->machine());
238      result |= cage_control_r(machine());
242239   if (ACCESSING_BITS_16_31)
243      result |= cage_main_r(space) << 16;
240      result |= cage_main_r(&space) << 16;
244241   return result;
245242}
246243
247244
248static WRITE32_HANDLER( sound_data_w )
245WRITE32_MEMBER(atarigt_state::sound_data_w)
249246{
250247   if (ACCESSING_BITS_0_15)
251      cage_control_w(space->machine(), data);
248      cage_control_w(machine(), data);
252249   if (ACCESSING_BITS_16_31)
253      cage_main_w(space, data >> 16);
250      cage_main_w(&space, data >> 16);
254251}
255252
256253
r14896r14897
552549 *
553550 *************************************/
554551
555static READ32_HANDLER( colorram_protection_r )
552READ32_MEMBER(atarigt_state::colorram_protection_r)
556553{
557   atarigt_state *state = space->machine().driver_data<atarigt_state>();
558554   offs_t address = 0xd80000 + offset * 4;
559555   UINT32 result32 = 0;
560556   UINT16 result;
561557
562558   if (ACCESSING_BITS_16_31)
563559   {
564      result = atarigt_colorram_r(state, address);
565      (*state->m_protection_r)(space, address, &result);
560      result = atarigt_colorram_r(address);
561      (*m_protection_r)(&space, address, &result);
566562      result32 |= result << 16;
567563   }
568564   if (ACCESSING_BITS_0_15)
569565   {
570      result = atarigt_colorram_r(state, address + 2);
571      (*state->m_protection_r)(space, address + 2, &result);
566      result = atarigt_colorram_r(address + 2);
567      (*m_protection_r)(&space, address + 2, &result);
572568      result32 |= result;
573569   }
574570
r14896r14897
576572}
577573
578574
579static WRITE32_HANDLER( colorram_protection_w )
575WRITE32_MEMBER(atarigt_state::colorram_protection_w)
580576{
581   atarigt_state *state = space->machine().driver_data<atarigt_state>();
582577   offs_t address = 0xd80000 + offset * 4;
583578
584579   if (ACCESSING_BITS_16_31)
585580   {
586      if (!state->m_ignore_writes)
587         atarigt_colorram_w(state, address, data >> 16, mem_mask >> 16);
588      (*state->m_protection_w)(space, address, data >> 16);
581      if (!m_ignore_writes)
582         atarigt_colorram_w(address, data >> 16, mem_mask >> 16);
583      (*m_protection_w)(&space, address, data >> 16);
589584   }
590585   if (ACCESSING_BITS_0_15)
591586   {
592      if (!state->m_ignore_writes)
593         atarigt_colorram_w(state, address + 2, data, mem_mask);
594      (*state->m_protection_w)(space, address + 2, data);
587      if (!m_ignore_writes)
588         atarigt_colorram_w(address + 2, data, mem_mask);
589      (*m_protection_w)(&space, address + 2, data);
595590   }
596591}
597592
r14896r14897
605600
606601static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32, atarigt_state )
607602   AM_RANGE(0x000000, 0x1fffff) AM_ROM
608   AM_RANGE(0xc00000, 0xc00003) AM_READWRITE_LEGACY(sound_data_r, sound_data_w)
609   AM_RANGE(0xd00014, 0xd00017) AM_READ_LEGACY(analog_port0_r)
610   AM_RANGE(0xd0001c, 0xd0001f) AM_READ_LEGACY(analog_port1_r)
603   AM_RANGE(0xc00000, 0xc00003) AM_READWRITE(sound_data_r, sound_data_w)
604   AM_RANGE(0xd00014, 0xd00017) AM_READ(analog_port0_r)
605   AM_RANGE(0xd0001c, 0xd0001f) AM_READ(analog_port1_r)
611606   AM_RANGE(0xd20000, 0xd20fff) AM_READWRITE_LEGACY(atarigen_eeprom_upper32_r, atarigen_eeprom32_w) AM_SHARE("eeprom")
612607   AM_RANGE(0xd40000, 0xd4ffff) AM_WRITE_LEGACY(atarigen_eeprom_enable32_w)
613608   AM_RANGE(0xd72000, 0xd75fff) AM_WRITE_LEGACY(atarigen_playfield32_w) AM_BASE(m_playfield32)
614609   AM_RANGE(0xd76000, 0xd76fff) AM_WRITE_LEGACY(atarigen_alpha32_w) AM_BASE(m_alpha32)
615610   AM_RANGE(0xd78000, 0xd78fff) AM_DEVREADWRITE_LEGACY("rle", atarirle_spriteram32_r, atarirle_spriteram32_w)
616   AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE_LEGACY(mo_command_w) AM_BASE(m_mo_command)
611   AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_BASE(m_mo_command)
617612   AM_RANGE(0xd70000, 0xd7ffff) AM_RAM
618   AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE_LEGACY(colorram_protection_r, colorram_protection_w) AM_BASE(m_colorram)
619   AM_RANGE(0xe04000, 0xe04003) AM_WRITE_LEGACY(led_w)
620   AM_RANGE(0xe08000, 0xe08003) AM_WRITE_LEGACY(latch_w)
613   AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE(colorram_protection_r, colorram_protection_w) AM_BASE(m_colorram)
614   AM_RANGE(0xe04000, 0xe04003) AM_WRITE(led_w)
615   AM_RANGE(0xe08000, 0xe08003) AM_WRITE(latch_w)
621616   AM_RANGE(0xe0a000, 0xe0a003) AM_WRITE_LEGACY(atarigen_scanline_int_ack32_w)
622617   AM_RANGE(0xe0c000, 0xe0c003) AM_WRITE_LEGACY(atarigen_video_int_ack32_w)
623618   AM_RANGE(0xe0e000, 0xe0e003) AM_WRITENOP//watchdog_reset_w },
624619   AM_RANGE(0xe80000, 0xe80003) AM_READ_PORT("P1_P2")
625   AM_RANGE(0xe82000, 0xe82003) AM_READ_LEGACY(special_port2_r)
626   AM_RANGE(0xe82004, 0xe82007) AM_READ_LEGACY(special_port3_r)
620   AM_RANGE(0xe82000, 0xe82003) AM_READ(special_port2_r)
621   AM_RANGE(0xe82004, 0xe82007) AM_READ(special_port3_r)
627622   AM_RANGE(0xf80000, 0xffffff) AM_RAM
628623ADDRESS_MAP_END
629624
r14896r14897
12471242 *
12481243 *************************************/
12491244
1250static WRITE32_HANDLER( tmek_pf_w )
1245WRITE32_MEMBER(atarigt_state::tmek_pf_w)
12511246{
1252   offs_t pc = cpu_get_pc(&space->device());
1247   offs_t pc = cpu_get_pc(&space.device());
12531248
12541249   /* protected version */
12551250   if (pc == 0x2EB3C || pc == 0x2EB48)
12561251   {
1257      logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(&space->device()), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space->device(), M68K_A4) - 2);
1252      logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(&space.device()), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space.device(), M68K_A4) - 2);
12581253      /* skip these writes to make more stuff visible */
12591254      return;
12601255   }
12611256
12621257   /* unprotected version */
12631258   if (pc == 0x25834 || pc == 0x25860)
1264      logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(&space->device()), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space->device(), M68K_A3) - 2);
1259      logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(&space.device()), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space.device(), M68K_A3) - 2);
12651260
1266   atarigen_playfield32_w(space, offset, data, mem_mask);
1261   atarigen_playfield32_w(&space, offset, data, mem_mask);
12671262}
12681263
12691264static DRIVER_INIT( tmek )
r14896r14897
12811276   state->m_protection_w = tmek_protection_w;
12821277
12831278   /* temp hack */
1284   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xd72000, 0xd75fff, FUNC(tmek_pf_w));
1279   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd72000, 0xd75fff, write32_delegate(FUNC(atarigt_state::tmek_pf_w),state));
12851280}
12861281
12871282
src/mame/drivers/crimfght.c
r14896r14897
3232
3333WRITE8_MEMBER(crimfght_state::crimfght_sh_irqtrigger_w)
3434{
35   soundlatch_w(space, offset, data);
35   soundlatch_byte_w(space, offset, data);
3636   device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0xff);
3737}
3838
r14896r14897
9999   AM_RANGE(0x0000, 0x7fff) AM_ROM                                    /* ROM 821l01.h4 */
100100   AM_RANGE(0x8000, 0x87ff) AM_RAM                                    /* RAM */
101101   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)         /* YM2151 */
102   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r)                        /* soundlatch_r */
102   AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r)                        /* soundlatch_byte_r */
103103   AM_RANGE(0xe000, 0xe00d) AM_DEVREADWRITE_LEGACY("k007232", k007232_r, k007232_w)   /* 007232 registers */
104104ADDRESS_MAP_END
105105
r14896r14897
407407   if (lines & 0x20)
408408   {
409409      device->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x03ff, "bank3");
410      device->memory().space(AS_PROGRAM)->install_write_handler(0x0000, 0x03ff, write8_delegate(FUNC(crimfght_state::paletteram_xBBBBBGGGGGRRRRR_be_w), state));
410      device->memory().space(AS_PROGRAM)->install_write_handler(0x0000, 0x03ff, write8_delegate(FUNC(crimfght_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state));
411411      memory_set_bankptr(device->machine(), "bank3", state->m_generic_paletteram_8);
412412   }
413413   else
src/mame/drivers/pooyan.c
r14896r14897
6161   AM_RANGE(0xa0c0, 0xa0c0) AM_MIRROR(0x5e1f) AM_READ_PORT("IN2")
6262   AM_RANGE(0xa0e0, 0xa0e0) AM_MIRROR(0x5e1f) AM_READ_PORT("DSW0")
6363   AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x5e7f) AM_WRITE(watchdog_reset_w)
64   AM_RANGE(0xa100, 0xa100) AM_MIRROR(0x5e7f) AM_WRITE(soundlatch_w)
64   AM_RANGE(0xa100, 0xa100) AM_MIRROR(0x5e7f) AM_WRITE(soundlatch_byte_w)
6565   AM_RANGE(0xa180, 0xa180) AM_MIRROR(0x5e78) AM_WRITE(irq_enable_w)
6666   AM_RANGE(0xa181, 0xa181) AM_MIRROR(0x5e78) AM_WRITE_LEGACY(timeplt_sh_irqtrigger_w)
6767   AM_RANGE(0xa183, 0xa183) AM_MIRROR(0x5e78) AM_WRITENOP // ???
src/mame/drivers/rollerg.c
r14896r14897
9393   AM_RANGE(0x0300, 0x030f) AM_DEVREADWRITE_LEGACY("k053244", k053244_r, k053244_w)
9494   AM_RANGE(0x0800, 0x0fff) AM_READ(rollerg_k051316_r) AM_DEVWRITE_LEGACY("k051316", k051316_w)
9595   AM_RANGE(0x1000, 0x17ff) AM_DEVREADWRITE_LEGACY("k053244", k053245_r, k053245_w)
96   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_be_w) AM_SHARE("paletteram")
96   AM_RANGE(0x1800, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram")
9797   AM_RANGE(0x2000, 0x3aff) AM_RAM
9898   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
9999   AM_RANGE(0x8000, 0xffff) AM_ROM
src/mame/drivers/hvyunit.c
r14896r14897
7575{
7676public:
7777   hvyunit_state(const machine_config &mconfig, device_type type, const char *tag)
78      : driver_device(mconfig, type, tag) { }
78      : driver_device(mconfig, type, tag) ,
79      m_videoram(*this, "videoram"),
80      m_colorram(*this, "colorram"){ }
7981
8082   /* Video */
81   UINT8         *m_videoram;
82   UINT8         *m_colorram;
83   required_shared_ptr<UINT8> m_videoram;
84   required_shared_ptr<UINT8> m_colorram;
8385   tilemap_t      *m_bg_tilemap;
8486   UINT16         m_scrollx;
8587   UINT16         m_scrolly;
r14896r14897
162164{
163165   hvyunit_state *state = machine.driver_data<hvyunit_state>();
164166
165   int attr = state->m_colorram[tile_index];
166   int code = state->m_videoram[tile_index] + ((attr & 0x0f) << 8);
167   int attr = state->m_colorram.target()[tile_index];
168   int code = state->m_videoram.target()[tile_index] + ((attr & 0x0f) << 8);
167169   int color = (attr >> 4);
168170
169171   SET_TILE_INFO(1, code, color, 0);
r14896r14897
252254WRITE8_MEMBER(hvyunit_state::trigger_nmi_on_sound_cpu2)
253255{
254256
255   soundlatch_w(space, 0, data);
257   soundlatch_byte_w(space, 0, data);
256258   device_set_input_line(m_sound_cpu, INPUT_LINE_NMI, PULSE_LINE);
257259}
258260
259261WRITE8_MEMBER(hvyunit_state::hu_videoram_w)
260262{
261263
262   m_videoram[offset] = data;
264   m_videoram.target()[offset] = data;
263265   m_bg_tilemap->mark_tile_dirty(offset);
264266}
265267
266268WRITE8_MEMBER(hvyunit_state::hu_colorram_w)
267269{
268270
269   m_colorram[offset] = data;
271   m_colorram.target()[offset] = data;
270272   m_bg_tilemap->mark_tile_dirty(offset);
271273}
272274
r14896r14897
431433static ADDRESS_MAP_START( slave_memory, AS_PROGRAM, 8, hvyunit_state )
432434   AM_RANGE(0x0000, 0x7fff) AM_ROM
433435   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2")
434   AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(hu_videoram_w) AM_BASE(m_videoram)
435   AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(hu_colorram_w) AM_BASE(m_colorram)
436   AM_RANGE(0xd000, 0xd1ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_split2_w) AM_SHARE("paletteram2")
437   AM_RANGE(0xd800, 0xd9ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_split1_w) AM_SHARE("paletteram")
436   AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(hu_videoram_w) AM_SHARE("videoram")
437   AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(hu_colorram_w) AM_SHARE("colorram")
438   AM_RANGE(0xd000, 0xd1ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_split_hi_w) AM_SHARE("paletteram2")
439   AM_RANGE(0xd800, 0xd9ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_byte_split_lo_w) AM_SHARE("paletteram")
438440   AM_RANGE(0xd000, 0xdfff) AM_RAM
439441   AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("share1")
440442ADDRESS_MAP_END
r14896r14897
464466   ADDRESS_MAP_GLOBAL_MASK(0xff)
465467   AM_RANGE(0x00, 0x00) AM_WRITE(sound_bankswitch_w)
466468   AM_RANGE(0x02, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
467   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r)
469   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_byte_r)
468470ADDRESS_MAP_END
469471
470472
src/mame/drivers/pirates.c
r14896r14897
172172//  AM_RANGE(0x500800, 0x50080f) AM_WRITENOP
173173   AM_RANGE(0x600000, 0x600001) AM_WRITE(pirates_out_w)
174174   AM_RANGE(0x700000, 0x700001) AM_WRITEONLY AM_BASE(m_scroll)   // scroll reg
175   AM_RANGE(0x800000, 0x803fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
175   AM_RANGE(0x800000, 0x803fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
176176   AM_RANGE(0x900000, 0x90017f) AM_RAM  // more of tilemaps ?
177177   AM_RANGE(0x900180, 0x90137f) AM_RAM_WRITE(pirates_tx_tileram_w) AM_BASE(m_tx_tileram)
178178   AM_RANGE(0x901380, 0x902a7f) AM_RAM_WRITE(pirates_fg_tileram_w) AM_BASE(m_fg_tileram)
src/mame/drivers/tankbatt.c
r14896r14897
155155}
156156
157157static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tankbatt_state )
158   AM_RANGE(0x0000, 0x000f) AM_RAM AM_BASE(m_bulletsram) AM_SIZE(m_bulletsram_size)
158   AM_RANGE(0x0000, 0x000f) AM_RAM AM_BASE_SIZE(m_bulletsram,m_bulletsram_size)
159159   AM_RANGE(0x0010, 0x01ff) AM_RAM
160160   AM_RANGE(0x0200, 0x07ff) AM_RAM
161161   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(tankbatt_videoram_w) AM_BASE(m_videoram)
src/mame/drivers/wrally.c
r14896r14897
106106   AM_RANGE(0x100000, 0x103fff) AM_RAM_WRITE(wrally_vram_w) AM_BASE(m_videoram)   /* encrypted Video RAM */
107107   AM_RANGE(0x108000, 0x108007) AM_RAM AM_BASE(m_vregs)                           /* Video Registers */
108108   AM_RANGE(0x10800c, 0x10800d) AM_WRITENOP                                    /* CLR INT Video */
109   AM_RANGE(0x200000, 0x203fff) AM_RAM_WRITE(paletteram16_xxxxBBBBRRRRGGGG_word_w) AM_SHARE("paletteram")   /* Palette */
109   AM_RANGE(0x200000, 0x203fff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_word_w) AM_SHARE("paletteram")   /* Palette */
110110   AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(m_spriteram)                        /* Sprite RAM */
111111   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW")
112112   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P1_P2")
src/mame/drivers/royalmah.c
r14896r14897
103103public:
104104   royalmah_state(const machine_config &mconfig, device_type type, const char *tag)
105105      : driver_device(mconfig, type, tag),
106      m_maincpu(*this,"maincpu")
107      { }
106      m_maincpu(*this,"maincpu"),
107      m_videoram(*this, "videoram"){ }
108108
109   UINT8 *m_videoram;
109   required_device<cpu_device> m_maincpu;
110   required_shared_ptr<UINT8> m_videoram;
110111   UINT8 m_input_port_select;
111112   UINT8 m_dsw_select;
112113   UINT8 m_rombank;
r14896r14897
122123   UINT8 m_jansou_colortable[16];
123124   UINT8 m_mjifb_rom_enable;
124125
125   required_device<cpu_device> m_maincpu;
126126   DECLARE_WRITE8_MEMBER(royalmah_palbank_w);
127127   DECLARE_WRITE8_MEMBER(mjderngr_coin_w);
128128   DECLARE_WRITE8_MEMBER(mjderngr_palbank_w);
r14896r14897
278278static SCREEN_UPDATE_IND16( royalmah )
279279{
280280   royalmah_state *state = screen.machine().driver_data<royalmah_state>();
281   UINT8 *videoram = state->m_videoram;
281   UINT8 *videoram = state->m_videoram.target();
282282
283283   offs_t offs;
284284
r14896r14897
409409
410410WRITE8_MEMBER(royalmah_state::mjapinky_palbank_w)
411411{
412   flip_screen_set(machine(), ~data & 4);
412   flip_screen_set(~data & 4);
413413   m_palette_base = (data >> 3) & 0x01;
414414   coin_counter_w(machine(), 0,data & 2);   // in
415415   coin_counter_w(machine(), 1,data & 1);   // out
r14896r14897
518518   AM_RANGE( 0x0000, 0x6fff ) AM_ROM AM_WRITE(royalmah_rom_w )
519519   AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_SHARE("nvram")
520520   AM_RANGE( 0x8000, 0xffff ) AM_ROMBANK( "bank1" )   // banked ROMs not present in royalmah
521   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_BASE(m_videoram)
521   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram")
522522ADDRESS_MAP_END
523523
524524
r14896r14897
528528   AM_RANGE( 0x7800, 0x7fff ) AM_RAM
529529   AM_RANGE( 0x8000, 0x8000 ) AM_READ(mjapinky_dsw_r )
530530   AM_RANGE( 0x8000, 0xffff ) AM_ROMBANK( "bank1" )
531   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_BASE(m_videoram)
531   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram")
532532ADDRESS_MAP_END
533533
534534
r14896r14897
660660static ADDRESS_MAP_START( janoh_map, AS_PROGRAM, 8, royalmah_state )
661661   AM_RANGE( 0x0000, 0x6fff ) AM_ROM AM_WRITE(royalmah_rom_w )
662662   AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_SHARE("nvram")
663   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_BASE(m_videoram)
663   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram")
664664ADDRESS_MAP_END
665665
666666
r14896r14897
757757
758758WRITE8_MEMBER(royalmah_state::jansou_sound_w)
759759{
760   soundlatch_w(space, 0, data);
760   soundlatch_byte_w(space, 0, data);
761761   cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
762762}
763763
r14896r14897
778778   AM_RANGE( 0x6800, 0x6800 ) AM_WRITE(jansou_sound_w)
779779
780780   AM_RANGE( 0x7000, 0x77ff ) AM_RAM AM_SHARE("nvram")
781   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_BASE(m_videoram)
781   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram")
782782ADDRESS_MAP_END
783783
784784static ADDRESS_MAP_START( jansou_sub_map, AS_PROGRAM, 8, royalmah_state )
r14896r14897
788788
789789static ADDRESS_MAP_START( jansou_sub_iomap, AS_IO, 8, royalmah_state )
790790   ADDRESS_MAP_GLOBAL_MASK(0xff)
791   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r) AM_DEVWRITE_LEGACY("dac", dac_w )
791   AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r) AM_DEVWRITE_LEGACY("dac", dac_w )
792792ADDRESS_MAP_END
793793
794794
r14896r14897
801801   AM_RANGE( 0x6000, 0x6fff ) AM_RAMBANK("bank3") AM_SHARE("nvram")   // nvram
802802   AM_RANGE( 0x7000, 0x7fff ) AM_RAMBANK("bank2")   // banked nvram
803803   AM_RANGE( 0x8000, 0xffff ) AM_ROMBANK("bank1")
804   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_BASE(m_videoram)
804   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram")
805805ADDRESS_MAP_END
806806
807807WRITE8_MEMBER(royalmah_state::janptr96_dswsel_w)
r14896r14897
845845
846846WRITE8_MEMBER(royalmah_state::janptr96_coin_counter_w)
847847{
848   flip_screen_set(machine(), ~data & 4);
848   flip_screen_set(~data & 4);
849849   coin_counter_w(machine(), 0,data & 2);   // in
850850   coin_counter_w(machine(), 1,data & 1);   // out
851851}
r14896r14897
872872
873873WRITE8_MEMBER(royalmah_state::mjifb_coin_counter_w)
874874{
875   flip_screen_set(machine(),  data & 4);
875   flip_screen_set(data & 4);
876876   coin_counter_w(machine(), 0,data & 2);   // in
877877   coin_counter_w(machine(), 1,data & 1);   // out
878878}
r14896r14897
898898
899899WRITE8_MEMBER(royalmah_state::mjifb_rom_io_w)
900900{
901   UINT8 *videoram = m_videoram;
901   UINT8 *videoram = m_videoram.target();
902902   if (m_mjifb_rom_enable)
903903   {
904904      videoram[offset] = data;
r14896r14897
926926
927927WRITE8_MEMBER(royalmah_state::mjifb_videoram_w)
928928{
929   UINT8 *videoram = m_videoram;
929   UINT8 *videoram = m_videoram.target();
930930   videoram[offset + 0x4000] = data;
931931}
932932
933933static ADDRESS_MAP_START( mjifb_map, AS_PROGRAM, 8, royalmah_state )
934934   AM_RANGE( 0x0000, 0x6fff ) AM_ROM
935935   AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_SHARE("nvram")
936   AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(mjifb_rom_io_r, mjifb_rom_io_w) AM_BASE(m_videoram)
936   AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(mjifb_rom_io_r, mjifb_rom_io_w) AM_SHARE("videoram")
937937   AM_RANGE( 0xc000, 0xffff ) AM_ROM AM_WRITE(mjifb_videoram_w)
938938//  AM_RANGE( 0xc000, 0xffff ) AM_ROM AM_WRITEONLY  This should, but doesn't work
939939ADDRESS_MAP_END
r14896r14897
10071007
10081008WRITE8_MEMBER(royalmah_state::mjdejavu_rom_io_w)
10091009{
1010   UINT8 *videoram = m_videoram;
1010   UINT8 *videoram = m_videoram.target();
10111011   if (m_mjifb_rom_enable)
10121012   {
10131013      videoram[offset] = data;
r14896r14897
10331033static ADDRESS_MAP_START( mjdejavu_map, AS_PROGRAM, 8, royalmah_state )
10341034   AM_RANGE( 0x0000, 0x6fff ) AM_ROM
10351035   AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_SHARE("nvram")
1036   AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(mjdejavu_rom_io_r, mjdejavu_rom_io_w) AM_BASE(m_videoram)
1036   AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(mjdejavu_rom_io_r, mjdejavu_rom_io_w) AM_SHARE("videoram")
10371037   AM_RANGE( 0xc000, 0xffff ) AM_ROM AM_WRITE(mjifb_videoram_w)
10381038ADDRESS_MAP_END
10391039
r14896r14897
10761076   AM_RANGE( 0x6ff3, 0x6ff3 ) AM_WRITE(mjtensin_6ff3_w )
10771077   AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_SHARE("nvram")
10781078   AM_RANGE( 0x8000, 0xffff ) AM_ROMBANK( "bank1" )
1079   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_BASE(m_videoram)
1079   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram")
10801080ADDRESS_MAP_END
10811081
10821082static ADDRESS_MAP_START( mjtensin_iomap, AS_IO, 8, royalmah_state )
r14896r14897
11471147   AM_RANGE( 0x7fe4, 0x7fe4 ) AM_READ(cafetime_7fe4_r )
11481148   AM_RANGE( 0x7ff0, 0x7fff ) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
11491149   AM_RANGE( 0x8000, 0xffff ) AM_ROMBANK( "bank1" )
1150   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_BASE(m_videoram)
1150   AM_RANGE( 0x8000, 0xffff ) AM_WRITEONLY AM_SHARE("videoram")
11511151ADDRESS_MAP_END
11521152
11531153
r14896r14897
11941194
11951195WRITE8_MEMBER(royalmah_state::mjvegasa_rom_io_w)
11961196{
1197   UINT8 *videoram = m_videoram;
1197   UINT8 *videoram = m_videoram.target();
11981198   if ((m_rombank & 0x70) != 0x70)
11991199   {
12001200      videoram[offset] = data;
r14896r14897
12161216
12171217WRITE8_MEMBER(royalmah_state::mjvegasa_coin_counter_w)
12181218{
1219   flip_screen_set(machine(),  data & 4);
1219   flip_screen_set(data & 4);
12201220   coin_counter_w(machine(), 0,data & 2);   // in
12211221   coin_counter_w(machine(), 1,data & 1);   // out
12221222}
r14896r14897
12371237
12381238   AM_RANGE( 0x00000, 0x05fff ) AM_ROM
12391239   AM_RANGE( 0x06000, 0x07fff ) AM_RAM AM_SHARE("nvram")
1240   AM_RANGE( 0x08000, 0x0ffff ) AM_READWRITE(mjvegasa_rom_io_r, mjvegasa_rom_io_w) AM_BASE(m_videoram)
1240   AM_RANGE( 0x08000, 0x0ffff ) AM_READWRITE(mjvegasa_rom_io_r, mjvegasa_rom_io_w) AM_SHARE("videoram")
12411241
12421242   AM_RANGE( 0x10001, 0x10001 ) AM_DEVREAD_LEGACY("aysnd", ay8910_r )
12431243   AM_RANGE( 0x10002, 0x10003 ) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_address_w )
src/mame/drivers/crospang.c
r14896r14897
4242{
4343   if(ACCESSING_BITS_0_7)
4444   {
45      soundlatch_w(space, 0, data & 0xff);
45      soundlatch_byte_w(space, 0, data & 0xff);
4646   }
4747}
4848
r14896r14897
5858   AM_RANGE(0x10000e, 0x10000f) AM_WRITENOP
5959   AM_RANGE(0x120000, 0x1207ff) AM_RAM_WRITE(crospang_fg_videoram_w) AM_BASE(m_fg_videoram)
6060   AM_RANGE(0x122000, 0x1227ff) AM_RAM_WRITE(crospang_bg_videoram_w) AM_BASE(m_bg_videoram)
61   AM_RANGE(0x200000, 0x2005ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
61   AM_RANGE(0x200000, 0x2005ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
6262   AM_RANGE(0x210000, 0x2107ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
6363   AM_RANGE(0x270000, 0x270001) AM_WRITE(crospang_soundlatch_w)
6464   AM_RANGE(0x280000, 0x280001) AM_READ_PORT("P1_P2")
r14896r14897
7878
7979   AM_RANGE(0x120000, 0x1207ff) AM_RAM_WRITE(crospang_fg_videoram_w) AM_BASE(m_fg_videoram)
8080   AM_RANGE(0x122000, 0x1227ff) AM_RAM_WRITE(crospang_bg_videoram_w) AM_BASE(m_bg_videoram)
81   AM_RANGE(0x200000, 0x2005ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
81   AM_RANGE(0x200000, 0x2005ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
8282   AM_RANGE(0x210000, 0x2107ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
8383   AM_RANGE(0x270000, 0x270001) AM_WRITE(crospang_soundlatch_w)
8484   AM_RANGE(0x270004, 0x270005) AM_WRITENOP
r14896r14897
100100   ADDRESS_MAP_GLOBAL_MASK(0xff)
101101   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)
102102   AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("oki", okim6295_device, read, write)
103   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
103   AM_RANGE(0x06, 0x06) AM_READ(soundlatch_byte_r)
104104ADDRESS_MAP_END
105105
106106
src/mame/drivers/ajax.c
r14896r14897
2929   AM_RANGE(0x0000, 0x01c0) AM_READWRITE(ajax_ls138_f10_r, ajax_ls138_f10_w)   /* bankswitch + sound command + FIRQ command */
3030   AM_RANGE(0x0800, 0x0807) AM_DEVREADWRITE_LEGACY("k051960", k051937_r, k051937_w)               /* sprite control registers */
3131   AM_RANGE(0x0c00, 0x0fff) AM_DEVREADWRITE_LEGACY("k051960", k051960_r, k051960_w)               /* sprite RAM 2128SL at J7 */
32   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_be_w) AM_SHARE("paletteram")/* palette */
32   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram")/* palette */
3333   AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("share1")                           /* shared RAM with the 6809 */
3434   AM_RANGE(0x4000, 0x5fff) AM_RAM                                    /* RAM 6264L at K10 */
3535   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank2")                              /* banked ROM */
r14896r14897
5656   AM_RANGE(0xb80c, 0xb80c) AM_DEVWRITE_LEGACY("k007232_2", k007232_extvol_w)         /* extra volume, goes to the 007232 w/ A11 */
5757                                                /* selecting a different latch for the external port */
5858   AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)      /* YM2151 */
59   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)            /* soundlatch_r */
59   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)            /* soundlatch_byte_r */
6060ADDRESS_MAP_END
6161
6262
src/mame/drivers/rotaryf.c
r14896r14897
2121public:
2222   rotaryf_state(const machine_config &mconfig, device_type type, const char *tag)
2323      : driver_device(mconfig, type, tag),
24      m_maincpu(*this,"maincpu")
25      { }
24      m_maincpu(*this,"maincpu"),
25      m_videoram(*this, "videoram"){ }
2626
27   UINT8 *m_videoram;
28   size_t m_videoram_size;
29
3027   required_device<cpu_device> m_maincpu;
28   required_shared_ptr<UINT8> m_videoram;
3129};
3230
3331
r14896r14897
6866   rotaryf_state *state = screen.machine().driver_data<rotaryf_state>();
6967   offs_t offs;
7068
71   for (offs = 0; offs < state->m_videoram_size; offs++)
69   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
7270   {
7371      int i;
7472
7573      UINT8 x = offs << 3;
7674      int y = offs >> 5;
77      UINT8 data = state->m_videoram[offs];
75      UINT8 data = state->m_videoram.target()[offs];
7876
7977      for (i = 0; i < 8; i++)
8078      {
r14896r14897
9694//  AM_RANGE(0x6ffd, 0x6ffd) AM_READ_LEGACY(random_r) ??
9795//  AM_RANGE(0x6fff, 0x6fff) AM_READ_LEGACY(random_r) ??
9896   AM_RANGE(0x7000, 0x73ff) AM_RAM // clears to 1ff ?
99   AM_RANGE(0x8000, 0x9fff) AM_MIRROR(0x4000) AM_RAM AM_BASE(m_videoram) AM_SIZE(m_videoram_size)
97   AM_RANGE(0x8000, 0x9fff) AM_MIRROR(0x4000) AM_RAM AM_SHARE("videoram")
10098   AM_RANGE(0xa000, 0xa1ff) AM_RAM
10199ADDRESS_MAP_END
102100
src/mame/drivers/funybubl.c
r14896r14897
6767
6868WRITE8_MEMBER(funybubl_state::funybubl_soundcommand_w)
6969{
70   soundlatch_w(space, 0, data);
70   soundlatch_byte_w(space, 0, data);
7171   device_set_input_line(m_audiocpu, 0, HOLD_LINE);
7272}
7373
r14896r14897
104104   AM_RANGE(0x8000, 0x87ff) AM_RAM
105105   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("oki", funybubl_oki_bank_sw)
106106   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
107   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
107   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
108108ADDRESS_MAP_END
109109
110110
src/mame/drivers/shisen.c
r14896r14897
6767static ADDRESS_MAP_START( shisen_sound_io_map, AS_IO, 8, shisen_state )
6868   ADDRESS_MAP_GLOBAL_MASK(0xff)
6969   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
70   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
70   AM_RANGE(0x80, 0x80) AM_READ(soundlatch_byte_r)
7171   AM_RANGE(0x80, 0x81) AM_DEVWRITE_LEGACY("m72", shisen_sample_addr_w)
7272   AM_RANGE(0x82, 0x82) AM_DEVWRITE_LEGACY("m72", m72_sample_w)
7373   AM_RANGE(0x83, 0x83) AM_DEVWRITE_LEGACY("m72", m72_sound_irq_ack_w)
src/mame/drivers/nmk16.c
r14896r14897
205205{
206206   if (ACCESSING_BITS_0_7)
207207   {
208      soundlatch_w(space, 0, data & 0xff);
208      soundlatch_byte_w(space, 0, data & 0xff);
209209      cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
210210   }
211211}
r14896r14897
270270WRITE16_MEMBER(nmk16_state::macross2_sound_command_w)
271271{
272272   if (ACCESSING_BITS_0_7)
273      soundlatch_w(space,0,data & 0xff);
273      soundlatch_byte_w(space,0,data & 0xff);
274274}
275275
276276WRITE8_MEMBER(nmk16_state::macross2_sound_bank_w)
r14896r14897
302302{
303303   if (ACCESSING_BITS_0_7)
304304   {
305      soundlatch_w(space, 0, data&0xff);
305      soundlatch_byte_w(space, 0, data&0xff);
306306      cputag_set_input_line(machine(), "audiocpu", 0, HOLD_LINE);
307307   }
308308}
r14896r14897
319319   AM_RANGE(0x080016, 0x080017) AM_WRITENOP   /* IRQ enable? */
320320   AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w)
321321   AM_RANGE(0x08001e, 0x08001f) AM_WRITE_LEGACY(NMK004_w)
322   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
322   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
323323   AM_RANGE(0x08c000, 0x08c007) AM_WRITE(vandyke_scroll_w)
324324   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
325325   AM_RANGE(0x094000, 0x097fff) AM_RAM /* what is this? */
r14896r14897
338338   AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w)
339339   AM_RANGE(0x080010, 0x08001d) AM_WRITE(vandykeb_scroll_w) /* 10, 12, 1a, 1c */
340340   AM_RANGE(0x08001e, 0x08001f) AM_WRITE_LEGACY(NMK004_w)
341   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
341   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
342342   AM_RANGE(0x08c000, 0x08c007) AM_WRITENOP   /* just in case... */
343343   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
344344   AM_RANGE(0x094000, 0x097fff) AM_RAM /* what is this? */
r14896r14897
356356   AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
357357   AM_RANGE(0x08001c, 0x08001d) AM_WRITENOP         /* See notes at the top of the driver */
358358   AM_RANGE(0x08001e, 0x08001f) AM_READWRITE(soundlatch2_word_r,soundlatch_word_w)
359   AM_RANGE(0x088000, 0x0883ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
359   AM_RANGE(0x088000, 0x0883ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
360360   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
361361   AM_RANGE(0x09c000, 0x09cfff) AM_RAM_WRITE(manybloc_scroll_w) AM_BASE(m_gunnail_scrollram)
362362   AM_RANGE(0x09d000, 0x09d7ff) AM_RAM_WRITE(nmk_txvideoram_w) AM_BASE(m_nmk_txvideoram)
r14896r14897
375375//  AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w)
376376   AM_RANGE(0x08001e, 0x08001f) AM_WRITE(soundlatch_word_w)
377377   AM_RANGE(0x080202, 0x080203) AM_READ_PORT("IN2")
378   AM_RANGE(0x088000, 0x0883ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
378   AM_RANGE(0x088000, 0x0883ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
379379//  AM_RANGE(0x08c000, 0x08c007) AM_WRITE(nmk_scroll_w)
380380   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
381381   AM_RANGE(0x09c000, 0x09c7ff) AM_RAM /* Unused txvideoram area? */
r14896r14897
386386static ADDRESS_MAP_START( tharrier_sound_map, AS_PROGRAM, 8, nmk16_state )
387387   AM_RANGE(0x0000, 0xbfff) AM_ROM
388388   AM_RANGE(0xc000, 0xc7ff) AM_RAM
389   AM_RANGE(0xf000, 0xf000) AM_READWRITE(soundlatch_r,soundlatch2_w)
389   AM_RANGE(0xf000, 0xf000) AM_READWRITE(soundlatch_byte_r,soundlatch2_byte_w)
390390   AM_RANGE(0xf400, 0xf400) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
391391   AM_RANGE(0xf500, 0xf500) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
392392   AM_RANGE(0xf600, 0xf600) AM_WRITE(tharrier_oki6295_bankswitch_0_w)
r14896r14897
410410   AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
411411   AM_RANGE(0x080016, 0x080017) AM_WRITENOP   // frame number?
412412   AM_RANGE(0x08001e, 0x08001f) AM_WRITE_LEGACY(NMK004_w)
413   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
413   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
414414   AM_RANGE(0x08c000, 0x08c001) AM_WRITE(mustang_scroll_w)
415415   AM_RANGE(0x08c002, 0x08c087) AM_WRITENOP   // ??
416416   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
r14896r14897
427427   AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
428428   AM_RANGE(0x080016, 0x080017) AM_WRITENOP   // frame number?
429429   AM_RANGE(0x08001e, 0x08001f) AM_WRITE_LEGACY(seibu_main_mustb_w)
430   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
430   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
431431   AM_RANGE(0x08c000, 0x08c001) AM_WRITE(mustang_scroll_w)
432432   AM_RANGE(0x08c002, 0x08c087) AM_WRITENOP   // ??
433433   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
r14896r14897
445445   AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
446446   AM_RANGE(0x080016, 0x080017) AM_WRITENOP   // frame number?
447447   AM_RANGE(0x08001e, 0x08001f) AM_WRITE(afega_soundlatch_w)
448   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
448   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
449449   AM_RANGE(0x08c000, 0x08c001) AM_WRITE(mustang_scroll_w)
450450   AM_RANGE(0x08c002, 0x08c087) AM_WRITENOP   // ??
451451   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
r14896r14897
466466   AM_RANGE(0xc0016, 0xc0017) AM_WRITENOP
467467   AM_RANGE(0xc0018, 0xc0019) AM_WRITE(nmk_tilebank_w)
468468   AM_RANGE(0xc001e, 0xc001f) AM_WRITE_LEGACY(NMK004_w)
469   AM_RANGE(0xc4000, 0xc45ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
469   AM_RANGE(0xc4000, 0xc45ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
470470   AM_RANGE(0xc8000, 0xc8007) AM_RAM_WRITE(nmk_scroll_w)
471471   AM_RANGE(0xcc000, 0xcffff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
472472   AM_RANGE(0xd4000, 0xd47ff) AM_RAM_WRITE(nmk_txvideoram_w) AM_BASE(m_nmk_txvideoram)
r14896r14897
482482//  AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
483483   AM_RANGE(0x08001e, 0x08001f) AM_WRITE_LEGACY(NMK004_w)
484484   AM_RANGE(0x084000, 0x084001) AM_WRITE(bioship_bank_w)
485   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
485   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
486486   AM_RANGE(0x08c000, 0x08c007) AM_RAM_WRITE(bioshipbg_scroll_w)
487487   AM_RANGE(0x08c010, 0x08c017) AM_RAM_WRITE(bioship_scroll_w)
488488   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
r14896r14897
662662   AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w)
663663   AM_RANGE(0x08001e, 0x08001f) AM_WRITE_LEGACY(NMK004_w)
664664   /* Video Region */
665   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
665   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
666666   AM_RANGE(0x08c000, 0x08c007) AM_WRITE(nmk_scroll_w)
667667   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
668668   AM_RANGE(0x09c000, 0x09c7ff) AM_RAM_WRITE(nmk_txvideoram_w) AM_BASE(m_nmk_txvideoram)
r14896r14897
895895   AM_RANGE(0x0c0018, 0x0c0019) AM_WRITE(nmk_tilebank_w) /* Tile Bank ? */
896896   AM_RANGE(0x0c001e, 0x0c001f) AM_WRITE_LEGACY(NMK004_w)
897897   AM_RANGE(0x0c4000, 0x0c4007) AM_RAM_WRITE(nmk_scroll_w)
898   AM_RANGE(0x0c8000, 0x0c87ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
898   AM_RANGE(0x0c8000, 0x0c87ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
899899   AM_RANGE(0x0cc000, 0x0cffff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
900900   AM_RANGE(0x0d0000, 0x0d07ff) AM_RAM_WRITE(nmk_txvideoram_w) AM_BASE(m_nmk_txvideoram)
901901ADDRESS_MAP_END
r14896r14897
912912   AM_RANGE(0x0c0018, 0x0c0019) AM_WRITE(nmk_tilebank_w) /* Tile Bank ? */
913913   AM_RANGE(0x0c001e, 0x0c001f) AM_WRITE_LEGACY(seibu_main_mustb_w)
914914   AM_RANGE(0x0c4000, 0x0c4007) AM_RAM_WRITE(nmk_scroll_w)
915   AM_RANGE(0x0c8000, 0x0c87ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
915   AM_RANGE(0x0c8000, 0x0c87ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
916916   AM_RANGE(0x0cc000, 0x0cffff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
917917   AM_RANGE(0x0d0000, 0x0d07ff) AM_RAM_WRITE(nmk_txvideoram_w) AM_BASE(m_nmk_txvideoram)
918918ADDRESS_MAP_END
r14896r14897
928928   AM_RANGE(0x0c0018, 0x0c0019) AM_WRITE(nmk_tilebank_w) /* Tile Bank ? */
929929   AM_RANGE(0x0c001e, 0x0c001f) AM_WRITE(ssmissin_sound_w)
930930   AM_RANGE(0x0c4000, 0x0c4007) AM_RAM_WRITE(nmk_scroll_w)
931   AM_RANGE(0x0c8000, 0x0c87ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
931   AM_RANGE(0x0c8000, 0x0c87ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
932932   AM_RANGE(0x0cc000, 0x0cffff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
933933   AM_RANGE(0x0d0000, 0x0d07ff) AM_MIRROR(0x1800) AM_RAM_WRITE(nmk_txvideoram_w) AM_BASE(m_nmk_txvideoram) //mirror for airattck
934934ADDRESS_MAP_END
r14896r14897
938938   AM_RANGE(0x8000, 0x87ff) AM_RAM
939939   AM_RANGE(0x9000, 0x9000) AM_WRITE(ssmissin_soundbank_w)
940940   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
941   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
941   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
942942ADDRESS_MAP_END
943943
944944static ADDRESS_MAP_START( strahl_map, AS_PROGRAM, 16, nmk16_state )
r14896r14897
953953   AM_RANGE(0x8001e, 0x8001f) AM_WRITE_LEGACY(NMK004_w)
954954   AM_RANGE(0x84000, 0x84007) AM_RAM_WRITE(nmk_scroll_w)
955955   AM_RANGE(0x88000, 0x88007) AM_RAM_WRITE(nmk_scroll_2_w)
956   AM_RANGE(0x8c000, 0x8c7ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
956   AM_RANGE(0x8c000, 0x8c7ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBxxxx_word_w) AM_SHARE("paletteram")
957957   AM_RANGE(0x90000, 0x93fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
958958   AM_RANGE(0x94000, 0x97fff) AM_RAM_WRITE(nmk_fgvideoram_w) AM_BASE(m_nmk_fgvideoram)
959959   AM_RANGE(0x9c000, 0x9c7ff) AM_RAM_WRITE(nmk_txvideoram_w) AM_BASE(m_nmk_txvideoram)
r14896r14897
971971   AM_RANGE(0x080016, 0x080017) AM_WRITENOP   /* IRQ enable? */
972972   AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w)
973973   AM_RANGE(0x08001e, 0x08001f) AM_WRITE_LEGACY(NMK004_w)
974   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
974   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
975975   AM_RANGE(0x08c000, 0x08c007) AM_RAM_WRITE(nmk_scroll_w)
976976   AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
977977   AM_RANGE(0x09c000, 0x09c7ff) AM_RAM_WRITE(nmk_txvideoram_w) AM_BASE(m_nmk_txvideoram)
r14896r14897
989989   AM_RANGE(0x080016, 0x080017) AM_WRITENOP   /* IRQ enable? */
990990   AM_RANGE(0x080018, 0x080019) AM_WRITE(nmk_tilebank_w)
991991   AM_RANGE(0x08001e, 0x08001f) AM_WRITE_LEGACY(NMK004_w)
992   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
992   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
993993   AM_RANGE(0x08c000, 0x08c1ff) AM_WRITEONLY AM_BASE(m_gunnail_scrollram)
994994   AM_RANGE(0x08c200, 0x08c3ff) AM_WRITEONLY AM_BASE(m_gunnail_scrollramy)
995995   AM_RANGE(0x08c400, 0x08c7ff) AM_WRITEONLY   // unknown
r14896r14897
10091009   AM_RANGE(0x100016, 0x100017) AM_WRITE(macross2_sound_reset_w)   /* Z80 reset */
10101010   AM_RANGE(0x100018, 0x100019) AM_WRITE(nmk_tilebank_w)
10111011   AM_RANGE(0x10001e, 0x10001f) AM_WRITE(macross2_sound_command_w)   /* to Z80 */
1012   AM_RANGE(0x120000, 0x1207ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
1012   AM_RANGE(0x120000, 0x1207ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
10131013
10141014   AM_RANGE(0x130000, 0x1301ff) AM_RAM AM_BASE(m_gunnail_scrollram)
10151015   AM_RANGE(0x130200, 0x1303ff) AM_RAM AM_BASE(m_gunnail_scrollramy)
r14896r14897
10351035   AM_RANGE(0x100016, 0x100017) AM_WRITENOP   /* IRQ enable or z80 sound reset like in Macross 2? */
10361036   AM_RANGE(0x100018, 0x100019) AM_WRITE(nmk_tilebank_w)
10371037   AM_RANGE(0x10001e, 0x10001f) AM_WRITE(macross2_sound_command_w)   /* to Z80 */
1038   AM_RANGE(0x120000, 0x1207ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
1038   AM_RANGE(0x120000, 0x1207ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
10391039
10401040   AM_RANGE(0x130000, 0x1301ff) AM_RAM AM_BASE(m_gunnail_scrollram)
10411041   AM_RANGE(0x130200, 0x1303ff) AM_RAM AM_BASE(m_gunnail_scrollramy)
r14896r14897
10791079   AM_RANGE(0xc810, 0xc817) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_w)
10801080//  AM_RANGE(0xc810, 0xc817) AM_WRITE(okibank_w)
10811081   AM_RANGE(0xd000, 0xd000) AM_WRITE(raphero_sound_rombank_w)
1082   AM_RANGE(0xd800, 0xd800) AM_READWRITE(soundlatch_r, soundlatch2_w)   // main cpu
1082   AM_RANGE(0xd800, 0xd800) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w)   // main cpu
10831083   AM_RANGE(0xe000, 0xffff) AM_RAM
10841084ADDRESS_MAP_END
10851085
r14896r14897
10891089   AM_RANGE(0xa000, 0xa000) AM_READNOP   /* IRQ ack? watchdog? */
10901090   AM_RANGE(0xc000, 0xdfff) AM_RAM
10911091   AM_RANGE(0xe001, 0xe001) AM_WRITE(macross2_sound_bank_w)
1092   AM_RANGE(0xf000, 0xf000) AM_READWRITE(soundlatch_r,soundlatch2_w)   /* from 68000 */
1092   AM_RANGE(0xf000, 0xf000) AM_READWRITE(soundlatch_byte_r,soundlatch2_byte_w)   /* from 68000 */
10931093ADDRESS_MAP_END
10941094
10951095static ADDRESS_MAP_START( macross2_sound_io_map, AS_IO, 8, nmk16_state )
r14896r14897
11101110   AM_RANGE(0x084000, 0x084001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff)
11111111   AM_RANGE(0x084010, 0x084011) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff)
11121112   AM_RANGE(0x084020, 0x08402f) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_lsb_w)
1113   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
1113   AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
11141114   AM_RANGE(0x094000, 0x094001) AM_WRITE(nmk_tilebank_w)
11151115   AM_RANGE(0x094002, 0x094003) AM_WRITENOP   /* IRQ enable? */
11161116   AM_RANGE(0x09c000, 0x09cfff) AM_MIRROR(0x1000) AM_RAM_WRITE(nmk_bgvideoram0_w) AM_BASE(m_nmk_bgvideoram0)
r14896r14897
46244624/**/AM_RANGE(0x084000, 0x084003) AM_RAM_WRITE(afega_scroll0_w)   // Scroll on redhawkb (mirror or changed?..)
46254625/**/AM_RANGE(0x084004, 0x084007) AM_RAM_WRITE(afega_scroll1_w)   // Scroll on redhawkb (mirror or changed?..)
46264626   AM_RANGE(0x080020, 0x087fff) AM_WRITEONLY            //
4627/**/AM_RANGE(0x088000, 0x0885ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram") // Palette
4627/**/AM_RANGE(0x088000, 0x0885ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram") // Palette
46284628   AM_RANGE(0x088600, 0x08bfff) AM_WRITEONLY            //
46294629/**/AM_RANGE(0x08c000, 0x08c003) AM_RAM_WRITE(afega_scroll0_w) AM_BASE(m_afega_scroll_0)   // Scroll
46304630/**/AM_RANGE(0x08c004, 0x08c007) AM_RAM_WRITE(afega_scroll1_w) AM_BASE(m_afega_scroll_1)   //
r14896r14897
46574657WRITE16_MEMBER(nmk16_state::twinactn_flipscreen_w)
46584658{
46594659   if (ACCESSING_BITS_0_7)
4660      flip_screen_set(machine(), data & 1);
4660      flip_screen_set(data & 1);
46614661
46624662   if (data & (~1))
46634663      logerror("%06x: unknown flip screen bit written %04x\n", cpu_get_pc(&space.device()), data);
r14896r14897
46844684   AM_RANGE(0x0004, 0x0004) AM_WRITENOP // bug in sound prg?
46854685   AM_RANGE(0x0000, 0xefff) AM_ROM
46864686   AM_RANGE(0xf000, 0xf7ff) AM_RAM                           // RAM
4687   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)               // From Main CPU
4687   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)               // From Main CPU
46884688   AM_RANGE(0xf808, 0xf809) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)   // YM2151
46894689   AM_RANGE(0xf80a, 0xf80a) AM_DEVREADWRITE("oki1", okim6295_device, read, write)      // M6295
46904690ADDRESS_MAP_END
r14896r14897
46924692static ADDRESS_MAP_START( firehawk_sound_cpu, AS_PROGRAM, 8, nmk16_state )
46934693   AM_RANGE(0x0000, 0xefff) AM_ROM
46944694   AM_RANGE(0xf000, 0xf7ff) AM_RAM
4695   AM_RANGE(0xfff0, 0xfff0) AM_READ(soundlatch_r)
4695   AM_RANGE(0xfff0, 0xfff0) AM_READ(soundlatch_byte_r)
46964696   AM_RANGE(0xfff2, 0xfff2) AM_DEVWRITE_LEGACY("oki2", spec2k_oki1_banking_w )
46974697   AM_RANGE(0xfff8, 0xfff8) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
46984698   AM_RANGE(0xfffa, 0xfffa) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
r14896r14897
47154715   AM_RANGE(0x8000, 0x87ff) AM_RAM
47164716   AM_RANGE(0x9000, 0x9000) AM_DEVWRITE_LEGACY("oki1", twinactn_oki_bank_w)
47174717   AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
4718   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)      // From Main CPU
4718   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)      // From Main CPU
47194719ADDRESS_MAP_END
47204720
47214721/***************************************************************************
src/mame/drivers/miniboy7.c
r14896r14897
156156{
157157public:
158158   miniboy7_state(const machine_config &mconfig, device_type type, const char *tag)
159      : driver_device(mconfig, type, tag) { }
159      : driver_device(mconfig, type, tag) ,
160      m_videoram(*this, "videoram"),
161      m_colorram(*this, "colorram"){ }
160162
161   UINT8 *m_videoram;
162   UINT8 *m_colorram;
163   required_shared_ptr<UINT8> m_videoram;
164   required_shared_ptr<UINT8> m_colorram;
163165   tilemap_t *m_bg_tilemap;
164166   DECLARE_WRITE8_MEMBER(miniboy7_videoram_w);
165167   DECLARE_WRITE8_MEMBER(miniboy7_colorram_w);
r14896r14897
172174
173175WRITE8_MEMBER(miniboy7_state::miniboy7_videoram_w)
174176{
175   m_videoram[offset] = data;
177   m_videoram.target()[offset] = data;
176178   m_bg_tilemap->mark_tile_dirty(offset);
177179}
178180
179181WRITE8_MEMBER(miniboy7_state::miniboy7_colorram_w)
180182{
181   m_colorram[offset] = data;
183   m_colorram.target()[offset] = data;
182184   m_bg_tilemap->mark_tile_dirty(offset);
183185}
184186
r14896r14897
191193    ---- --x-   tiles bank.
192194    xx-- ---x   seems unused. */
193195
194   int attr = state->m_colorram[tile_index];
195   int code = state->m_videoram[tile_index];
196   int attr = state->m_colorram.target()[tile_index];
197   int code = state->m_videoram.target()[tile_index];
196198   int bank = (attr & 0x02) >> 1;   /* bit 1 switch the gfx banks */
197199   int color = (attr & 0x3c);   /* bits 2-3-4-5 for color? */
198200
r14896r14897
268270
269271static ADDRESS_MAP_START( miniboy7_map, AS_PROGRAM, 8, miniboy7_state )
270272   AM_RANGE(0x0000, 0x07ff) AM_RAM   AM_SHARE("nvram") /* battery backed RAM? */
271   AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(miniboy7_videoram_w) AM_BASE(m_videoram)
272   AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(miniboy7_colorram_w) AM_BASE(m_colorram)
273   AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(miniboy7_videoram_w) AM_SHARE("videoram")
274   AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(miniboy7_colorram_w) AM_SHARE("colorram")
273275   AM_RANGE(0x1800, 0x25ff) AM_RAM   /* looks like videoram */
274276   AM_RANGE(0x2600, 0x27ff) AM_RAM
275277   AM_RANGE(0x2800, 0x2800) AM_DEVWRITE("crtc", mc6845_device, address_w)
src/emu/cpu/v30mz/v30mz.c
r14896r14897
8383   UINT32   irq_state;
8484   UINT8   no_interrupt;
8585
86   device_irq_callback irq_callback;
86   device_irq_acknowledge_callback irq_callback;
8787   legacy_cpu_device *device;
8888   address_space *program;
8989   direct_read_data *direct;
r14896r14897
133133   v30mz_state *cpustate = get_safe_token(device);
134134    unsigned int i,j,c;
135135    static const BREGS reg_name[8]={ AL, CL, DL, BL, AH, CH, DH, BH };
136   device_irq_callback save_irqcallback;
136   device_irq_acknowledge_callback save_irqcallback;
137137
138138   save_irqcallback = cpustate->irq_callback;
139139   memset( cpustate, 0, sizeof(*cpustate) );
r14896r14897
933933   return necv_dasm_one(buffer, pc, oprom, cpustate->config);
934934}
935935
936static void nec_init(legacy_cpu_device *device, device_irq_callback irqcallback, int type)
936static void nec_init(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback, int type)
937937{
938938   v30mz_state *cpustate = get_safe_token(device);
939939
src/emu/cpu/m6805/m6805.c
r14896r14897
6161   UINT8   cc;          /* Condition codes */
6262
6363   UINT16   pending_interrupts; /* MB */
64   device_irq_callback irq_callback;
64   device_irq_acknowledge_callback irq_callback;
6565   legacy_cpu_device *device;
6666   address_space *program;
6767   direct_read_data *direct;
r14896r14897
487487{
488488   m6805_Regs *cpustate = get_safe_token(device);
489489
490   device_irq_callback save_irqcallback = cpustate->irq_callback;
490   device_irq_acknowledge_callback save_irqcallback = cpustate->irq_callback;
491491   memset(cpustate, 0, sizeof(*cpustate));
492492
493493   cpustate->iCount=50000;      /* Used to be global */
src/emu/cpu/m6809/m6809.c
r14896r14897
9393   UINT8   irq_state[2];
9494
9595   int    extra_cycles; /* cycles used up by interrupts */
96   device_irq_callback irq_callback;
96   device_irq_acknowledge_callback irq_callback;
9797   legacy_cpu_device *device;
9898   const m6809_config *config;
9999   int      icount;
src/emu/cpu/h83002/h8priv.h
r14896r14897
5050   UINT8  h8uflag, h8uiflag;
5151   UINT8  incheckirqs;
5252
53   device_irq_callback irq_cb;
53   device_irq_acknowledge_callback irq_cb;
5454   legacy_cpu_device *device;
5555
5656   address_space *program;
src/emu/cpu/m68000/m68kcpu.h
r14896r14897
677677   const UINT8* cyc_exception;
678678
679679   /* Callbacks to host */
680   device_irq_callback int_ack_callback;           /* Interrupt Acknowledge */
680   device_irq_acknowledge_callback int_ack_callback;           /* Interrupt Acknowledge */
681681   m68k_bkpt_ack_func bkpt_ack_callback;         /* Breakpoint Acknowledge */
682682   m68k_reset_func reset_instr_callback;         /* Called when a RESET instruction is encountered */
683683   m68k_cmpild_func cmpild_instr_callback;       /* Called when a CMPI.L #v, Dn instruction is encountered */
src/emu/cpu/m68000/m68kcpu.c
r14896r14897
27052705
27062706static READ32_HANDLER( m68340_internal_base_r )
27072707{
2708
2709
2708   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
27102709   int pc = cpu_get_pc(&space->device());
2711   logerror("%08x m68340_internal_base_r %08x, (%04x)\n", pc, offset*4,mem_mask);
2712   return 0x55555555;
2710   logerror("%08x m68340_internal_base_r %08x, (%08x)\n", pc, offset*4,mem_mask);
2711   return m68k->m68340_base;
27132712}
27142713
27152714static WRITE32_HANDLER( m68340_internal_base_w )
r14896r14897
27172716   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
27182717
27192718   int pc = cpu_get_pc(&space->device());
2720   logerror("%08x m68340_internal_base_w %08x, %04x (%04x)\n", pc, offset*4,data,mem_mask);
2719   logerror("%08x m68340_internal_base_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
27212720
27222721   // other conditions?
27232722   if (m68k->dfc==0x7)
r14896r14897
27352734      }
27362735
27372736      COMBINE_DATA(&m68k->m68340_base);
2738      logerror("%08x m68340_internal_base_w %08x, %04x (%04x) (m68340_base write)\n", pc, offset*4,data,mem_mask);
2737      logerror("%08x m68340_internal_base_w %08x, %08x (%08x) (m68340_base write)\n", pc, offset*4,data,mem_mask);
27392738
27402739      // map new modules
27412740      if (m68k->m68340_base&1)
src/emu/cpu/tms34010/tms34010.c
r14896r14897
6161   UINT8            hblank_stable;
6262   UINT8            external_host_access;
6363   UINT8            executing;
64   device_irq_callback   irq_callback;
64   device_irq_acknowledge_callback   irq_callback;
6565   legacy_cpu_device *device;
6666   address_space *program;
6767   direct_read_data *direct;
r14896r14897
679679   const tms34010_config *config = tms->config;
680680   screen_device *screen = tms->screen;
681681   UINT16 *shiftreg = tms->shiftreg;
682   device_irq_callback save_irqcallback = tms->irq_callback;
682   device_irq_acknowledge_callback save_irqcallback = tms->irq_callback;
683683   emu_timer *save_scantimer = tms->scantimer;
684684
685685   memset(tms, 0, sizeof(*tms));
src/emu/cpu/tms32031/tms32031.h
r14896r14897
803803   int               m_icount;
804804
805805   UINT32            m_iotemp;
806   device_irq_callback   m_irq_callback;
806   device_irq_acknowledge_callback   m_irq_callback;
807807   address_space *      m_program;
808808   direct_read_data *   m_direct;
809809
src/emu/cpu/mcs48/mcs48.c
r14896r14897
149149
150150   UINT16      a11;            /* A11 value, either 0x000 or 0x800 */
151151
152   device_irq_callback irq_callback;
152   device_irq_acknowledge_callback irq_callback;
153153   legacy_cpu_device *device;
154154   int         icount;
155155
r14896r14897
842842    mcs48_init - generic MCS-48 initialization
843843-------------------------------------------------*/
844844
845static void mcs48_init(legacy_cpu_device *device, device_irq_callback irqcallback, UINT8 feature_mask, UINT16 romsize)
845static void mcs48_init(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback, UINT8 feature_mask, UINT16 romsize)
846846{
847847   mcs48_state *cpustate = get_safe_token(device);
848848
src/emu/cpu/m37710/m37710.c
r14896r14897
944944
945945/* Set the callback that is called when servicing an interrupt */
946946#ifdef UNUSED_FUNCTION
947void m37710_set_irq_callback(device_irq_callback callback)
947void m37710_set_irq_callback(device_irq_acknowledge_callback callback)
948948{
949949   INT_ACK = callback;
950950}
src/emu/cpu/m37710/m37710cm.h
r14896r14897
110110   int ICount;      /* cycle count */
111111   uint source;      /* temp register */
112112   uint destination;   /* temp register */
113   device_irq_callback int_ack;
113   device_irq_acknowledge_callback int_ack;
114114   legacy_cpu_device *device;
115115   address_space *program;
116116   address_space *io;
src/emu/cpu/sharc/sharc.c
r14896r14897
124124   UINT16 *internal_ram;
125125   UINT16 *internal_ram_block0, *internal_ram_block1;
126126
127   device_irq_callback irq_callback;
127   device_irq_acknowledge_callback irq_callback;
128128   legacy_cpu_device *device;
129129   address_space *program;
130130   address_space *data;
src/emu/cpu/z180/z180.c
r14896r14897
138138   UINT8   dma0_cnt;                  /* dma0 counter / divide by 20 */
139139   UINT8   dma1_cnt;                  /* dma1 counter / divide by 20 */
140140   z80_daisy_chain daisy;
141   device_irq_callback irq_callback;
141   device_irq_acknowledge_callback irq_callback;
142142   legacy_cpu_device *device;
143143   address_space *program;
144144   direct_read_data *direct;
src/emu/cpu/i86/i86.c
r14896r14897
3939   UINT32 base[4];
4040   UINT16 sregs[4];
4141   UINT16 flags;
42   device_irq_callback irq_callback;
42   device_irq_acknowledge_callback irq_callback;
4343   INT32 AuxVal, OverVal, SignVal, ZeroVal, CarryVal, DirVal;      /* 0 or non-0 valued flags */
4444   UINT8 ParityVal;
4545   UINT8 TF, IF;               /* 0 or 1 valued flags */
r14896r14897
232232static CPU_RESET( i8086 )
233233{
234234   i8086_state *cpustate = get_safe_token(device);
235   device_irq_callback save_irqcallback;
235   device_irq_acknowledge_callback save_irqcallback;
236236
237237   save_irqcallback = cpustate->irq_callback;
238238   memset(cpustate, 0, sizeof(*cpustate));
src/emu/cpu/i86/i286.c
r14896r14897
5656      UINT16 limit;
5757      UINT8 rights;
5858   } ldtr, tr;
59   device_irq_callback irq_callback;
59   device_irq_acknowledge_callback irq_callback;
6060   legacy_cpu_device *device;
6161   address_space *program;
6262   direct_read_data *direct;
src/emu/cpu/upd7810/upd7810.c
r14896r14897
498498   const struct opcode_s *op74;
499499   void (*handle_timers)(upd7810_state *cpustate, int cycles);
500500   UPD7810_CONFIG config;
501   device_irq_callback irq_callback;
501   device_irq_acknowledge_callback irq_callback;
502502   legacy_cpu_device *device;
503503   address_space *program;
504504   direct_read_data *direct;
r14896r14897
17801780{
17811781   upd7810_state *cpustate = get_safe_token(device);
17821782   UPD7810_CONFIG save_config;
1783   device_irq_callback save_irqcallback;
1783   device_irq_acknowledge_callback save_irqcallback;
17841784
17851785   save_config = cpustate->config;
17861786   save_irqcallback = cpustate->irq_callback;
src/emu/cpu/minx/minx.c
r14896r14897
8383   UINT8   YI;
8484   UINT8   halted;
8585   UINT8   interrupt_pending;
86   device_irq_callback irq_callback;
86   device_irq_acknowledge_callback irq_callback;
8787   legacy_cpu_device *device;
8888   address_space *program;
8989   int icount;
src/emu/cpu/v60/v60.c
r14896r14897
9090   v60_flags         flags;
9191   UINT8            irq_line;
9292   UINT8            nmi_line;
93   device_irq_callback   irq_cb;
93   device_irq_acknowledge_callback   irq_cb;
9494   legacy_cpu_device *      device;
9595   address_space *program;
9696   direct_read_data *   direct;
r14896r14897
324324// Opcode jump table
325325#include "optable.c"
326326
327static void base_init(legacy_cpu_device *device, device_irq_callback irqcallback)
327static void base_init(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
328328{
329329   v60_state *cpustate = get_safe_token(device);
330330
src/emu/cpu/spc700/spc700.c
r14896r14897
8686   uint line_nmi;   /* Status of the NMI line */
8787   uint line_rst;   /* Status of the RESET line */
8888   uint ir;      /* Instruction Register */
89   device_irq_callback int_ack;
89   device_irq_acknowledge_callback int_ack;
9090   legacy_cpu_device *device;
9191   address_space *program;
9292   uint stopped;   /* stopped status */
src/emu/cpu/hd6309/hd6309.c
r14896r14897
131131   UINT8   irq_state[2];
132132
133133   int    extra_cycles; /* cycles used up by interrupts */
134   device_irq_callback irq_callback;
134   device_irq_acknowledge_callback irq_callback;
135135   legacy_cpu_device *device;
136136   int      icount;
137137   PAIR   ea;       /* effective address */
src/emu/cpu/tlcs90/tlcs90.c
r14896r14897
3131   PAIR      af2,bc2,de2,hl2;
3232   UINT8      halt, after_EI;
3333   UINT16      irq_state, irq_mask;
34   device_irq_callback irq_callback;
34   device_irq_acknowledge_callback irq_callback;
3535   legacy_cpu_device *device;
3636   address_space *program;
3737   address_space *io;
src/emu/cpu/s2650/s2650.c
r14896r14897
4141   UINT8   irq_state;
4242
4343   int      icount;
44   device_irq_callback irq_callback;
44   device_irq_acknowledge_callback irq_callback;
4545   legacy_cpu_device *device;
4646   address_space *program;
4747   direct_read_data *direct;
src/emu/cpu/se3208/se3208.c
r14896r14897
2222   UINT32 ER;
2323   UINT32 PPC;
2424
25   device_irq_callback irq_callback;
25   device_irq_acknowledge_callback irq_callback;
2626   legacy_cpu_device *device;
2727   address_space *program;
2828   direct_read_data *direct;
r14896r14897
17141714{
17151715   se3208_state_t *se3208_state = get_safe_token(device);
17161716
1717   device_irq_callback save_irqcallback = se3208_state->irq_callback;
1717   device_irq_acknowledge_callback save_irqcallback = se3208_state->irq_callback;
17181718   memset(se3208_state,0,sizeof(se3208_state_t));
17191719   se3208_state->irq_callback = save_irqcallback;
17201720   se3208_state->device = device;
src/emu/cpu/e132xs/e132xs.c
r14896r14897
318318
319319   struct _delay delay;
320320
321   device_irq_callback irq_callback;
321   device_irq_acknowledge_callback irq_callback;
322322   legacy_cpu_device *device;
323323   address_space *program;
324324   direct_read_data *direct;
r14896r14897
15271527      ISR &= ~(1 << irqline);
15281528}
15291529
1530static void hyperstone_init(legacy_cpu_device *device, device_irq_callback irqcallback, int scale_mask)
1530static void hyperstone_init(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback, int scale_mask)
15311531{
15321532   hyperstone_state *cpustate = get_safe_token(device);
15331533
r14896r14897
15501550   cpustate->clock_scale_mask = scale_mask;
15511551}
15521552
1553static void e116_init(legacy_cpu_device *device, device_irq_callback irqcallback, int scale_mask)
1553static void e116_init(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback, int scale_mask)
15541554{
15551555   hyperstone_state *cpustate = get_safe_token(device);
15561556   hyperstone_init(device, irqcallback, scale_mask);
r14896r14897
15871587   e116_init(device, irqcallback, 0);
15881588}
15891589
1590static void e132_init(legacy_cpu_device *device, device_irq_callback irqcallback, int scale_mask)
1590static void e132_init(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback, int scale_mask)
15911591{
15921592   hyperstone_state *cpustate = get_safe_token(device);
15931593   hyperstone_init(device, irqcallback, scale_mask);
r14896r14897
16411641   //TODO: Add different reset initializations for BCR, MCR, FCR, TPR
16421642
16431643   emu_timer *save_timer;
1644   device_irq_callback save_irqcallback;
1644   device_irq_acknowledge_callback save_irqcallback;
16451645   UINT32 save_opcodexor;
16461646
16471647   save_timer = cpustate->timer;
src/emu/cpu/mcs51/mcs51.c
r14896r14897
281281   UINT8   (*sfr_read)(mcs51_state_t *mcs51_state, size_t offset);
282282
283283   /* Interrupt Callback */
284   device_irq_callback irq_callback;
284   device_irq_acknowledge_callback irq_callback;
285285   legacy_cpu_device *device;
286286
287287   /* Memory spaces */
src/emu/cpu/i386/i386priv.h
r14896r14897
268268   UINT8 opcode;
269269
270270   UINT8 irq_state;
271   device_irq_callback irq_callback;
271   device_irq_acknowledge_callback irq_callback;
272272   legacy_cpu_device *device;
273273   address_space *program;
274274   direct_read_data *direct;
src/emu/cpu/i386/i386.c
r14896r14897
30253025static CPU_RESET( i386 )
30263026{
30273027   i386_state *cpustate = get_safe_token(device);
3028   device_irq_callback save_irqcallback;
3028   device_irq_acknowledge_callback save_irqcallback;
30293029
30303030   save_irqcallback = cpustate->irq_callback;
30313031   memset( cpustate, 0, sizeof(*cpustate) );
r14896r14897
35123512static CPU_RESET( i486 )
35133513{
35143514   i386_state *cpustate = get_safe_token(device);
3515   device_irq_callback save_irqcallback;
3515   device_irq_acknowledge_callback save_irqcallback;
35163516
35173517   save_irqcallback = cpustate->irq_callback;
35183518   memset( cpustate, 0, sizeof(*cpustate) );
r14896r14897
36193619static CPU_RESET( pentium )
36203620{
36213621   i386_state *cpustate = get_safe_token(device);
3622   device_irq_callback save_irqcallback;
3622   device_irq_acknowledge_callback save_irqcallback;
36233623
36243624   save_irqcallback = cpustate->irq_callback;
36253625   memset( cpustate, 0, sizeof(*cpustate) );
r14896r14897
37413741static CPU_RESET( mediagx )
37423742{
37433743   i386_state *cpustate = get_safe_token(device);
3744   device_irq_callback save_irqcallback;
3744   device_irq_acknowledge_callback save_irqcallback;
37453745
37463746   save_irqcallback = cpustate->irq_callback;
37473747   memset( cpustate, 0, sizeof(*cpustate) );
src/emu/cpu/hcd62121/hcd62121.c
r14896r14897
2929   UINT8 reg[0x80];
3030   UINT8 temp1[0x10];
3131   UINT8 temp2[0x10];
32   device_irq_callback irq_callback;
32   device_irq_acknowledge_callback irq_callback;
3333   legacy_cpu_device *device;
3434   address_space *program;
3535   address_space *io;
src/emu/cpu/mc68hc11/mc68hc11.c
r14896r14897
6262   UINT8 adctl;
6363   int ad_channel;
6464
65   device_irq_callback irq_callback;
65   device_irq_acknowledge_callback irq_callback;
6666   UINT8 irq_state[2];
6767   legacy_cpu_device *device;
6868   direct_read_data *direct;
src/emu/cpu/tlcs900/tlcs900.c
r14896r14897
7171   int halted;
7272   int icount;
7373   int regbank;
74   device_irq_callback irqcallback;
74   device_irq_acknowledge_callback irqcallback;
7575   legacy_cpu_device *device;
7676   address_space *program;
7777};
src/emu/cpu/rsp/rsp.h
r14896r14897
178178   UINT32 ppc;
179179   UINT32 nextpc;
180180
181   device_irq_callback irq_callback;
181   device_irq_acknowledge_callback irq_callback;
182182   legacy_cpu_device *device;
183183   address_space *program;
184184   direct_read_data *direct;
src/emu/cpu/rsp/rspdrc.c
r14896r14897
580580   { 7, 7, 7, 7, 7, 7, 7, 7 },      // 7
581581};
582582
583static void rspcom_init(rsp_state *rsp, legacy_cpu_device *device, device_irq_callback irqcallback)
583static void rspcom_init(rsp_state *rsp, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
584584{
585585   int regIdx = 0;
586586    int accumIdx;
src/emu/cpu/i8008/i8008.c
r14896r14897
4040   int               icount;
4141   int             pc_pos; // PC possition in ADDR
4242
43   device_irq_callback irq_callback;
43   device_irq_acknowledge_callback irq_callback;
4444   UINT8         irq_state;
4545};
4646
src/emu/cpu/jaguar/jaguar.c
r14896r14897
9898   int         icount;
9999   int         bankswitch_icount;
100100   void      (*const *table)(jaguar_state *jaguar, UINT16 op);
101   device_irq_callback irq_callback;
101   device_irq_acknowledge_callback irq_callback;
102102   jaguar_int_func cpu_interrupt;
103103   legacy_cpu_device *device;
104104   address_space *program;
r14896r14897
406406}
407407
408408
409static void init_common(int isdsp, legacy_cpu_device *device, device_irq_callback irqcallback)
409static void init_common(int isdsp, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
410410{
411411   const jaguar_cpu_config *configdata = (const jaguar_cpu_config *)device->static_config();
412412   jaguar_state *jaguar = get_safe_token(device);
src/emu/cpu/m6502/m4510.c
r14896r14897
142142   UINT16  low, high;
143143   UINT32   mem[8];
144144
145   device_irq_callback irq_callback;
145   device_irq_acknowledge_callback irq_callback;
146146   legacy_cpu_device *device;
147147   address_space *space;
148148   direct_read_data *direct;
src/emu/cpu/m6502/m6502.c
r14896r14897
6868   UINT8   irq_state;
6969   UINT8   so_state;
7070
71   device_irq_callback irq_callback;
71   device_irq_acknowledge_callback irq_callback;
7272   legacy_cpu_device *device;
7373   address_space *space;
7474   direct_read_data *direct;
r14896r14897
130130 *
131131 *****************************************************************************/
132132
133static void m6502_common_init(legacy_cpu_device *device, device_irq_callback irqcallback, UINT8 subtype, void (*const *insn)(m6502_Regs *cpustate), const char *type)
133static void m6502_common_init(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback, UINT8 subtype, void (*const *insn)(m6502_Regs *cpustate), const char *type)
134134{
135135   m6502_Regs *cpustate = get_safe_token(device);
136136   const m6502_interface *intf = (const m6502_interface *)device->static_config();
src/emu/cpu/m6502/m6509.c
r14896r14897
7777   UINT8   nmi_state;
7878   UINT8   irq_state;
7979   UINT8   so_state;
80   device_irq_callback irq_callback;
80   device_irq_acknowledge_callback irq_callback;
8181   legacy_cpu_device *device;
8282   address_space *space;
8383   direct_read_data *direct;
src/emu/cpu/m6502/m65ce02.c
r14896r14897
7474   UINT8   nmi_state;
7575   UINT8   irq_state;
7676   int      icount;
77   device_irq_callback irq_callback;
77   device_irq_acknowledge_callback irq_callback;
7878   legacy_cpu_device *device;
7979   address_space *space;
8080   direct_read_data *direct;
src/emu/cpu/i8085/i8085.c
r14896r14897
182182
183183   UINT8            ietemp;         /* import/export temp space */
184184
185   device_irq_callback   irq_callback;
185   device_irq_acknowledge_callback   irq_callback;
186186   legacy_cpu_device *device;
187187   address_space *program;
188188   direct_read_data *direct;
r14896r14897
968968}
969969
970970
971static void init_808x_common(legacy_cpu_device *device, device_irq_callback irqcallback, int type)
971static void init_808x_common(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback, int type)
972972{
973973   i8085_state *cpustate = get_safe_token(device);
974974
src/emu/cpu/arm/arm.c
r14896r14897
234234   UINT32 coproRegister[16];
235235   UINT8 pendingIrq;
236236   UINT8 pendingFiq;
237   device_irq_callback irq_callback;
237   device_irq_acknowledge_callback irq_callback;
238238   legacy_cpu_device *device;
239239   address_space *program;
240240   direct_read_data *direct;
r14896r14897
338338{
339339   ARM_REGS *cpustate = get_safe_token(device);
340340
341   device_irq_callback save_irqcallback = cpustate->irq_callback;
341   device_irq_acknowledge_callback save_irqcallback = cpustate->irq_callback;
342342   endianness_t save_endian = cpustate->endian;
343343
344344   memset(cpustate, 0, sizeof(ARM_REGS));
src/emu/cpu/powerpc/ppcdrc.c
r14896r14897
547547    ppcdrc_init - initialize the processor
548548-------------------------------------------------*/
549549
550static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy_cpu_device *device, device_irq_callback irqcallback)
550static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
551551{
552552   powerpc_state *ppc;
553553   drcbe_info beinfo;
src/emu/cpu/powerpc/ppccom.c
r14896r14897
302302    structure based on the configured type
303303-------------------------------------------------*/
304304
305void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy_cpu_device *device, device_irq_callback irqcallback)
305void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
306306{
307307   const powerpc_config *config = (const powerpc_config *)device->static_config();
308308
src/emu/cpu/powerpc/ppc.c
r14896r14897
305305
306306   UINT64 tb;         /* 56-bit timebase register */
307307
308   device_irq_callback irq_callback;
308   device_irq_acknowledge_callback irq_callback;
309309   legacy_cpu_device *device;
310310   address_space *program;
311311
src/emu/cpu/powerpc/ppccom.h
r14896r14897
551551   UINT32         mmu603_r[4];
552552
553553   /* internal stuff */
554   device_irq_callback irq_callback;
554   device_irq_acknowledge_callback irq_callback;
555555   legacy_cpu_device *   device;
556556   address_space *program;
557557   direct_read_data *direct;
r14896r14897
573573    FUNCTION PROTOTYPES
574574***************************************************************************/
575575
576void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy_cpu_device *device, device_irq_callback irqcallback);
576void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback);
577577void ppccom_exit(powerpc_state *ppc);
578578
579579void ppccom_reset(powerpc_state *ppc);
src/emu/cpu/z8000/z8000.c
r14896r14897
8181    z8000_reg_file regs;/* registers */
8282   int nmi_state;      /* NMI line state */
8383   int irq_state[2];   /* IRQ line states (NVI, VI) */
84   device_irq_callback irq_callback;
84   device_irq_acknowledge_callback irq_callback;
8585   legacy_cpu_device *device;
8686   address_space *program;
8787   direct_read_data *direct;
r14896r14897
393393{
394394   z8000_state *cpustate = get_safe_token(device);
395395
396   device_irq_callback save_irqcallback = cpustate->irq_callback;
396   device_irq_acknowledge_callback save_irqcallback = cpustate->irq_callback;
397397   memset(cpustate, 0, sizeof(*cpustate));
398398   cpustate->irq_callback = save_irqcallback;
399399   cpustate->device = device;
r14896r14897
415415{
416416   z8000_state *cpustate = get_safe_token(device);
417417
418   device_irq_callback save_irqcallback = cpustate->irq_callback;
418   device_irq_acknowledge_callback save_irqcallback = cpustate->irq_callback;
419419   memset(cpustate, 0, sizeof(*cpustate));
420420   cpustate->irq_callback = save_irqcallback;
421421   cpustate->device = device;
src/emu/cpu/sh2/sh2comn.h
r14896r14897
118118   UINT32 pcflushes[16];         // pcflush entries
119119
120120   INT8   irq_line_state[17];
121   device_irq_callback irq_callback;
121   device_irq_acknowledge_callback irq_callback;
122122   legacy_cpu_device *device;
123123   address_space *program;
124124   direct_read_data *direct;
r14896r14897
207207};
208208#endif
209209
210void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_callback irqcallback);
210void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback);
211211void sh2_recalc_irq(sh2_state *sh2);
212212void sh2_set_irq_line(sh2_state *sh2, int irqline, int state);
213213void sh2_exception(sh2_state *sh2, const char *message, int irqline);
src/emu/cpu/sh2/sh2drc.c
r14896r14897
780780   UINT32 *m;
781781
782782   void (*f)(UINT32 data);
783   device_irq_callback save_irqcallback;
783   device_irq_acknowledge_callback save_irqcallback;
784784
785785   m = sh2->m;
786786   tsave = sh2->timer;
src/emu/cpu/sh2/sh2comn.c
r14896r14897
929929   #endif
930930}
931931
932void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_callback irqcallback)
932void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
933933{
934934   const sh2_cpu_core *conf = (const sh2_cpu_core *)device->static_config();
935935   int i;
src/emu/cpu/sh2/sh2.c
r14896r14897
21522152   int save_is_slave;
21532153
21542154   void (*f)(UINT32 data);
2155   device_irq_callback save_irqcallback;
2155   device_irq_acknowledge_callback save_irqcallback;
21562156
21572157   m = sh2->m;
21582158   tsave = sh2->timer;
src/emu/cpu/sm8500/sm8500.c
r14896r14897
4949   UINT8 CheckInterrupts;
5050   int halted;
5151   int icount;
52   device_irq_callback irq_callback;
52   device_irq_acknowledge_callback irq_callback;
5353   legacy_cpu_device *device;
5454   address_space *program;
5555   UINT16 oldpc;
src/emu/cpu/mb88xx/mb88xx.c
r14896r14897
7373
7474    /* IRQ handling */
7575    UINT8 pending_interrupt;
76    device_irq_callback irqcallback;
76    device_irq_acknowledge_callback irqcallback;
7777    legacy_cpu_device *device;
7878    address_space *program;
7979    direct_read_data *direct;
src/emu/cpu/sh4/sh4.c
r14896r14897
28412841   int   savecpu_clock, savebus_clock, savepm_clock;
28422842
28432843   void (*f)(UINT32 data);
2844   device_irq_callback save_irqcallback;
2844   device_irq_acknowledge_callback save_irqcallback;
28452845
28462846   m = sh4->m;
28472847   tsaved[0] = sh4->dma_timer[0];
src/emu/cpu/sh4/sh4comn.h
r14896r14897
7272   int      exception_requesting[128];
7373
7474   INT8   irq_line_state[17];
75   device_irq_callback irq_callback;
75   device_irq_acknowledge_callback irq_callback;
7676   legacy_cpu_device *device;
7777   address_space *internal;
7878   address_space *program;
src/emu/cpu/tms32051/tms32051.c
r14896r14897
142142      INT32 treg2;
143143   } shadow;
144144
145   device_irq_callback irq_callback;
145   device_irq_acknowledge_callback irq_callback;
146146   legacy_cpu_device *device;
147147   address_space *program;
148148   direct_read_data *direct;
src/emu/cpu/g65816/g65816.c
r14896r14897
302302}
303303
304304/* Set the callback that is called when servicing an interrupt */
305static void g65816_set_irq_callback(g65816i_cpu_struct *cpustate, device_irq_callback callback)
305static void g65816_set_irq_callback(g65816i_cpu_struct *cpustate, device_irq_acknowledge_callback callback)
306306{
307307   INT_ACK = callback;
308308}
src/emu/cpu/g65816/g65816cm.h
r14896r14897
9393   uint line_nmi;      /* Status of the NMI line */
9494   uint ir;         /* Instruction Register */
9595   uint irq_delay;      /* delay 1 instruction before checking irq */
96   device_irq_callback int_ack; /* Interrupt Acknowledge */
96   device_irq_acknowledge_callback int_ack; /* Interrupt Acknowledge */
9797   legacy_cpu_device *device;
9898   address_space *program;
9999   read8_space_func read_vector;   /* Read vector override */
src/emu/cpu/nec/v25priv.h
r14896r14897
103103   UINT8   RAMEN, TB, PCK;   /* PRC register */
104104   UINT32   IDB;
105105
106   device_irq_callback irq_callback;
106   device_irq_acknowledge_callback irq_callback;
107107   legacy_cpu_device *device;
108108   address_space *program;
109109   direct_read_data *direct;
src/emu/cpu/nec/nec.c
r14896r14897
315315   return necv_dasm_one(buffer, pc, oprom, NULL);
316316}
317317
318static void nec_init(legacy_cpu_device *device, device_irq_callback irqcallback)
318static void nec_init(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
319319{
320320   nec_state_t *nec_state = get_safe_token(device);
321321
src/emu/cpu/nec/necpriv.h
r14896r14897
5555   UINT8   no_interrupt;
5656   UINT8   halted;
5757
58   device_irq_callback irq_callback;
58   device_irq_acknowledge_callback irq_callback;
5959   legacy_cpu_device *device;
6060   address_space *program;
6161   direct_read_data *direct;
src/emu/cpu/nec/v25.c
r14896r14897
403403   return necv_dasm_one(buffer, pc, oprom, nec_state->config);
404404}
405405
406static void v25_init(legacy_cpu_device *device, device_irq_callback irqcallback)
406static void v25_init(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
407407{
408408   const nec_config *config = device->static_config() ? (const nec_config *)device->static_config() : &default_config;
409409   v25_state_t *nec_state = get_safe_token(device);
src/emu/cpu/mips/mips3com.h
r14896r14897
196196
197197   /* internal stuff */
198198   mips3_flavor   flavor;
199   device_irq_callback irq_callback;
199   device_irq_acknowledge_callback irq_callback;
200200   legacy_cpu_device *   device;
201201   address_space *program;
202202   direct_read_data *direct;
r14896r14897
232232    FUNCTION PROTOTYPES
233233***************************************************************************/
234234
235void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, legacy_cpu_device *device, device_irq_callback irqcallback);
235void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback);
236236void mips3com_exit(mips3_state *mips);
237237
238238void mips3com_reset(mips3_state *mips);
src/emu/cpu/mips/mips3drc.c
r14896r14897
386386    mips3_init - initialize the processor
387387-------------------------------------------------*/
388388
389static void mips3_init(mips3_flavor flavor, int bigendian, legacy_cpu_device *device, device_irq_callback irqcallback)
389static void mips3_init(mips3_flavor flavor, int bigendian, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
390390{
391391   mips3_state *mips3;
392392   drc_cache *cache;
src/emu/cpu/mips/r3000.c
r14896r14897
137137   int         icount;
138138   int         interrupt_cycles;
139139   int         hasfpu;
140   device_irq_callback irq_callback;
140   device_irq_acknowledge_callback irq_callback;
141141   legacy_cpu_device *device;
142142   address_space *program;
143143   direct_read_data *direct;
src/emu/cpu/mips/mips3com.c
r14896r14897
6969    structure based on the configured type
7070-------------------------------------------------*/
7171
72void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, legacy_cpu_device *device, device_irq_callback irqcallback)
72void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
7373{
7474   const mips3_config *config = (const mips3_config *)device->static_config();
7575   int tlbindex;
src/emu/cpu/tms7000/tms7000.c
r14896r14897
7272   UINT8      irq_state[3];   /* State of the three IRQs */
7373   UINT8      rf[0x80];   /* Register file (SJE) */
7474   UINT8      pf[0x100];   /* Perpherial file */
75   device_irq_callback irq_callback;
75   device_irq_acknowledge_callback irq_callback;
7676   legacy_cpu_device *device;
7777   address_space *program;
7878   direct_read_data *direct;
src/emu/cpu/f8/f8.c
r14896r14897
5252   UINT8   dbus;   /* data bus value */
5353   UINT16   io;    /* last I/O address */
5454   UINT16  irq_vector;
55   device_irq_callback irq_callback;
55   device_irq_acknowledge_callback irq_callback;
5656   legacy_cpu_device *device;
5757   address_space *program;
5858   direct_read_data *direct;
r14896r14897
15451545   f8_Regs *cpustate = get_safe_token(device);
15461546   UINT8 data;
15471547   int i;
1548   device_irq_callback save_callback;
1548   device_irq_acknowledge_callback save_callback;
15491549
15501550   save_callback = cpustate->irq_callback;
15511551   memset(cpustate, 0, sizeof(f8_Regs));
src/emu/cpu/z80/z80.c
r14896r14897
157157   UINT8         after_ei;         /* are we in the EI shadow? */
158158   UINT8         after_ldair;      /* same, but for LD A,I or LD A,R */
159159   UINT32         ea;
160   device_irq_callback irq_callback;
160   device_irq_acknowledge_callback irq_callback;
161161   legacy_cpu_device *device;
162162   address_space *program;
163163   direct_read_data *direct;
src/emu/cpu/tms9900/99xxcore.h
r14896r14897
435435   /* interrupt callback */
436436   /* note that this callback is used by tms9900_set_irq_line(cpustate) and tms9980a_set_irq_line(cpustate) to
437437    retreive the value on IC0-IC3 (non-standard behaviour) */
438   device_irq_callback irq_callback;
438   device_irq_acknowledge_callback irq_callback;
439439   legacy_cpu_device *device;
440440   address_space *program;
441441   address_space *io;
src/emu/cpu/i960/i960.c
r14896r14897
3333
3434   int immediate_irq, immediate_vector, immediate_pri;
3535
36   device_irq_callback irq_cb;
36   device_irq_acknowledge_callback irq_cb;
3737   legacy_cpu_device *device;
3838   address_space *program;
3939   direct_read_data *direct;
src/emu/cpu/v810/v810.c
r14896r14897
3030   UINT8 irq_line;
3131   UINT8 irq_state;
3232   UINT8 nmi_line;
33   device_irq_callback irq_callback;
33   device_irq_acknowledge_callback irq_callback;
3434   legacy_cpu_device *device;
3535   address_space *program;
3636   direct_read_data *direct;
src/emu/cpu/tms32025/tms32025.c
r14896r14897
165165   int      init_load_addr;         /* 0=No, 1=Yes, 2=Once for repeat mode */
166166   int      tms32025_irq_cycles;
167167   int      tms32025_dec_cycles;
168   device_irq_callback irq_callback;
168   device_irq_acknowledge_callback irq_callback;
169169
170170   PAIR   oldacc;
171171   UINT32   memaccess;
src/emu/cpu/pdp1/tx0.c
r14896r14897
125125      ;
126126}
127127
128static void tx0_init_common(legacy_cpu_device *device, device_irq_callback irqcallback, int is_64kw)
128static void tx0_init_common(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback, int is_64kw)
129129{
130130   tx0_state *cpustate = get_safe_token(device);
131131
src/emu/cpu/t11/t11.c
r14896r14897
3232    UINT8            wait_state;
3333    UINT8            irq_state;
3434    int               icount;
35   device_irq_callback   irq_callback;
35   device_irq_acknowledge_callback   irq_callback;
3636   legacy_cpu_device *      device;
3737   address_space *program;
3838   direct_read_data *direct;
src/emu/cpu/arm7/arm7core.c
r14896r14897
135135{
136136    arm_state *cpustate = get_safe_token(device);
137137
138    device_irq_callback save_irqcallback = cpustate->irq_callback;
138    device_irq_acknowledge_callback save_irqcallback = cpustate->irq_callback;
139139
140140    memset(cpustate, 0, sizeof(arm_state));
141141    cpustate->irq_callback = save_irqcallback;
src/emu/cpu/arm7/arm7core.h
r14896r14897
178178    UINT8 pendingSwi;                   \
179179    INT32 iCount;         \
180180   endianness_t endian;            \
181    device_irq_callback irq_callback;      \
181    device_irq_acknowledge_callback irq_callback;      \
182182    legacy_cpu_device *device;      \
183183    address_space *program;         \
184184    direct_read_data *direct;
src/emu/cpu/h6280/h6280.c
r14896r14897
170170{
171171   h6280_Regs* cpustate = get_safe_token(device);
172172
173   device_irq_callback save_irqcallback;
173   device_irq_acknowledge_callback save_irqcallback;
174174   int i;
175175
176176   /* wipe out the h6280 structure */
src/emu/cpu/h6280/h6280.h
r14896r14897
6060    UINT8 nmi_state;
6161    UINT8 irq_state[3];
6262   UINT8 irq_pending;
63   device_irq_callback irq_callback;
63   device_irq_acknowledge_callback irq_callback;
6464   legacy_cpu_device *device;
6565   address_space *program;
6666   direct_read_data *direct;
src/emu/cpu/m6800/m6800.c
r14896r14897
123123   UINT8   ic_eddge;      /* InputCapture eddge , b.0=fall,b.1=raise */
124124   int      sc1_state;
125125
126   device_irq_callback irq_callback;
126   device_irq_acknowledge_callback irq_callback;
127127   legacy_cpu_device *device;
128128
129129   /* Memory spaces */
src/emu/cpu/cp1610/cp1610.c
r14896r14897
3737   UINT8   flags;   /* flags */
3838   int    intr_enabled;
3939   //int       (*reset_callback)(cp1610_state *cpustate);
40   device_irq_callback irq_callback;
40   device_irq_acknowledge_callback irq_callback;
4141   UINT16   intr_vector;
4242   int    reset_state;
4343   int      intr_state;
src/emu/cpu/saturn/saturn.c
r14896r14897
8181   UINT8   sleeping;       /* low-consumption state */
8282   int    monitor_id;
8383   int      monitor_in;
84   device_irq_callback irq_callback;
84   device_irq_acknowledge_callback irq_callback;
8585   legacy_cpu_device *device;
8686   address_space *program;
8787   direct_read_data *direct;
src/emu/cpu/konami/konami.c
r14896r14897
5656    UINT8   cc;
5757    UINT8   ireg;
5858    UINT8   irq_state[2];
59   device_irq_callback irq_callback;
59   device_irq_acknowledge_callback irq_callback;
6060    UINT8   int_state;  /* SYNC and CWAI flags */
6161   UINT8   nmi_state;
6262   UINT8   nmi_pending;
src/emu/video/generic.c
r14896r14897
1414
1515
1616/***************************************************************************
17    TYPE DEFINITIONS
18***************************************************************************/
19
20struct _generic_video_private
21{
22   int       flip_screen_x;
23   int         flip_screen_y;
24};
25
26
27
28/***************************************************************************
2917    COMMON GRAPHICS LAYOUTS
3018***************************************************************************/
3119
r14896r14897
10997
11098
11199/***************************************************************************
112    INLINE FUNCTIONS
113***************************************************************************/
114
115/*-------------------------------------------------
116    set_color_332 - set a 3-3-2 RGB color using
117    the 16-bit data provided and the specified
118    shift values
119-------------------------------------------------*/
120
121void driver_device::set_color_332(pen_t color, int rshift, int gshift, int bshift, UINT32 data)
122{
123   palette_set_color(machine(), color, pal332(data, rshift, gshift, bshift));
124}
125
126
127/*-------------------------------------------------
128    set_color_444 - set a 4-4-4 RGB color using
129    the 16-bit data provided and the specified
130    shift values
131-------------------------------------------------*/
132
133void driver_device::set_color_444(pen_t color, int rshift, int gshift, int bshift, UINT32 data)
134{
135   palette_set_color(machine(), color, pal444(data, rshift, gshift, bshift));
136}
137
138
139/*-------------------------------------------------
140    set_color_4444 - set a 4-4-4-4 IRGB color using
141    the 16-bit data provided and the specified
142    shift values
143-------------------------------------------------*/
144
145void driver_device::set_color_4444(pen_t color, int ishift, int rshift, int gshift, int bshift, UINT16 data)
146{
147   static const UINT8 ztable[16] =
148      { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11 };
149   int i, r, g, b;
150
151   i = ztable[(data >> ishift) & 15];
152   r = ((data >> rshift) & 15) * i;
153   g = ((data >> gshift) & 15) * i;
154   b = ((data >> bshift) & 15) * i;
155
156   palette_set_color_rgb(machine(), color, r, g, b);
157}
158
159
160/*-------------------------------------------------
161    set_color_555 - set a 5-5-5 RGB color using
162    the 16-bit data provided and the specified
163    shift values
164-------------------------------------------------*/
165
166void driver_device::set_color_555(pen_t color, int rshift, int gshift, int bshift, UINT32 data)
167{
168   palette_set_color(machine(), color, pal555(data, rshift, gshift, bshift));
169}
170
171
172/*-------------------------------------------------
173    set_color_565 - set a 5-6-5 RGB color using
174    the 16-bit data provided and the specified
175    shift values
176-------------------------------------------------*/
177
178void driver_device::set_color_565(pen_t color, int rshift, int gshift, int bshift, UINT32 data)
179{
180   palette_set_color(machine(), color, pal565(data, rshift, gshift, bshift));
181}
182
183
184/*-------------------------------------------------
185    set_color_8888 - set a 8-8-8 RGB color using
186    the 32-bit data provided and the specified
187    shift values
188-------------------------------------------------*/
189
190void driver_device::set_color_888(pen_t color, int rshift, int gshift, int bshift, UINT32 data)
191{
192   palette_set_color(machine(), color, pal888(data, rshift, gshift, bshift));
193}
194
195
196
197/***************************************************************************
198    INITIALIZATION
199***************************************************************************/
200
201/*-------------------------------------------------
202    generic_video_init - initialize globals and
203    register for save states
204-------------------------------------------------*/
205
206void generic_video_init(running_machine &machine)
207{
208   generic_video_private *state;
209
210   state = machine.generic_video_data = auto_alloc_clear(machine, generic_video_private);
211
212   machine.save().save_item(NAME(state->flip_screen_x));
213   machine.save().save_item(NAME(state->flip_screen_y));
214}
215
216
217
218/***************************************************************************
219    GLOBAL VIDEO ATTRIBUTES
220***************************************************************************/
221
222/*-------------------------------------------------
223    updateflip - handle global flipping
224-------------------------------------------------*/
225
226static void updateflip(running_machine &machine)
227{
228   generic_video_private *state = machine.generic_video_data;
229   int width = machine.primary_screen->width();
230   int height = machine.primary_screen->height();
231   attoseconds_t period = machine.primary_screen->frame_period().attoseconds;
232   rectangle visarea = machine.primary_screen->visible_area();
233
234   machine.tilemap().set_flip_all((TILEMAP_FLIPX & state->flip_screen_x) | (TILEMAP_FLIPY & state->flip_screen_y));
235
236   if (state->flip_screen_x)
237   {
238      int temp;
239
240      temp = width - visarea.min_x - 1;
241      visarea.min_x = width - visarea.max_x - 1;
242      visarea.max_x = temp;
243   }
244   if (state->flip_screen_y)
245   {
246      int temp;
247
248      temp = height - visarea.min_y - 1;
249      visarea.min_y = height - visarea.max_y - 1;
250      visarea.max_y = temp;
251   }
252
253   machine.primary_screen->configure(width, height, visarea, period);
254}
255
256
257/*-------------------------------------------------
258    flip_screen_set - set global flip
259-------------------------------------------------*/
260
261void flip_screen_set(running_machine &machine, int on)
262{
263   generic_video_private *state = machine.generic_video_data;
264   if (on) on = ~0;
265   if (state->flip_screen_x != on || state->flip_screen_y != on)
266   {
267      if (!on) updateflip(machine); // flip visarea back
268      state->flip_screen_x = state->flip_screen_y = on;
269      updateflip(machine);
270   }
271}
272
273
274/*-------------------------------------------------
275    flip_screen_set_no_update - set global flip
276       do not call update_flip.
277-------------------------------------------------*/
278
279void flip_screen_set_no_update(running_machine &machine, int on)
280{
281   /* flip_screen_y is not updated on purpose
282     * this function is for drivers which
283     * where writing to flip_screen_x to
284     * bypass update_flip
285     */
286   generic_video_private *state = machine.generic_video_data;
287   if (on) on = ~0;
288   state->flip_screen_x = on;
289}
290
291
292/*-------------------------------------------------
293    flip_screen_x_set - set global horizontal flip
294-------------------------------------------------*/
295
296void flip_screen_x_set(running_machine &machine, int on)
297{
298   generic_video_private *state = machine.generic_video_data;
299   if (on) on = ~0;
300   if (state->flip_screen_x != on)
301   {
302      state->flip_screen_x = on;
303      updateflip(machine);
304   }
305}
306
307
308/*-------------------------------------------------
309    flip_screen_y_set - set global vertical flip
310-------------------------------------------------*/
311
312void flip_screen_y_set(running_machine &machine, int on)
313{
314   generic_video_private *state = machine.generic_video_data;
315   if (on) on = ~0;
316   if (state->flip_screen_y != on)
317   {
318      state->flip_screen_y = on;
319      updateflip(machine);
320   }
321}
322
323
324/*-------------------------------------------------
325    flip_screen_get - get global flip
326-------------------------------------------------*/
327
328int flip_screen_get(running_machine &machine)
329{
330   generic_video_private *state = machine.generic_video_data;
331   return state->flip_screen_x;
332}
333
334
335/*-------------------------------------------------
336    flip_screen_x_get - get global x flip
337-------------------------------------------------*/
338
339int flip_screen_x_get(running_machine &machine)
340{
341   generic_video_private *state = machine.generic_video_data;
342   return state->flip_screen_x;
343}
344
345
346/*-------------------------------------------------
347    flip_screen_get - get global y flip
348-------------------------------------------------*/
349
350int flip_screen_y_get(running_machine &machine)
351{
352   generic_video_private *state = machine.generic_video_data;
353   return state->flip_screen_y;
354}
355
356
357
358/***************************************************************************
359100    COMMON PALETTE INITIALIZATION
360101***************************************************************************/
361102
r14896r14897
490231   for (i = 0; i < 0x10000; i++)
491232      palette_set_color(machine, i, MAKE_RGB(pal5bit(i >> 11), pal6bit(i >> 5), pal5bit(i >> 0)));
492233}
493
494
495
496/***************************************************************************
497    3-3-2 RGB PALETTE WRITE HANDLERS
498***************************************************************************/
499
500/*-------------------------------------------------
501    RRR-GGG-BB writes
502-------------------------------------------------*/
503
504WRITE8_MEMBER( driver_device::paletteram_RRRGGGBB_w )
505{
506   m_generic_paletteram_8[offset] = data;
507   palette_set_color_rgb(machine(), offset, pal3bit(data >> 5), pal3bit(data >> 2), pal2bit(data >> 0));
508}
509
510
511/*-------------------------------------------------
512    BB-GGG-RR writes
513-------------------------------------------------*/
514
515WRITE8_MEMBER( driver_device::paletteram_BBGGGRRR_w )
516{
517   m_generic_paletteram_8[offset] = data;
518   palette_set_color_rgb(machine(), offset, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6));
519}
520
521
522/*-------------------------------------------------
523    BB-GG-RR-II writes
524-------------------------------------------------*/
525
526WRITE8_MEMBER( driver_device::paletteram_BBGGRRII_w )
527{
528   int i = (data >> 0) & 3;
529
530   m_generic_paletteram_8[offset] = data;
531   palette_set_color_rgb(machine(), offset, pal4bit(((data >> 0) & 0x0c) | i),
532                                      pal4bit(((data >> 2) & 0x0c) | i),
533                                      pal4bit(((data >> 4) & 0x0c) | i));
534}
535
536/*-------------------------------------------------
537    II-BB-GG-RR writes
538-------------------------------------------------*/
539
540WRITE8_MEMBER( driver_device::paletteram_IIBBGGRR_w )
541{
542   int i = (data >> 6) & 3;
543
544   m_generic_paletteram_8[offset] = data;
545   palette_set_color_rgb(machine(), offset, pal4bit(((data << 2) & 0x0c) | i),
546                                      pal4bit(((data >> 0) & 0x0c) | i),
547                                      pal4bit(((data >> 2) & 0x0c) | i));
548}
549
550
551
552/***************************************************************************
553    4-4-4 RGB PALETTE WRITE HANDLERS
554***************************************************************************/
555
556/*-------------------------------------------------
557    xxxx-BBBB-GGGG-RRRR writes
558-------------------------------------------------*/
559
560WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_le_w )
561{
562   m_generic_paletteram_8[offset] = data;
563   set_color_444(offset / 2, 0, 4, 8, paletteram16_le(offset));
564}
565
566WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_be_w )
567{
568   m_generic_paletteram_8[offset] = data;
569   set_color_444(offset / 2, 0, 4, 8, paletteram16_be(offset));
570}
571
572WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_split1_w )
573{
574   m_generic_paletteram_8[offset] = data;
575   set_color_444(offset, 0, 4, 8, paletteram16_split(offset));
576}
577
578WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_split2_w )
579{
580   m_generic_paletteram2_8[offset] = data;
581   set_color_444(offset, 0, 4, 8, paletteram16_split(offset));
582}
583
584WRITE16_MEMBER( driver_device::paletteram16_xxxxBBBBGGGGRRRR_word_w )
585{
586   COMBINE_DATA(&m_generic_paletteram_16[offset]);
587   set_color_444(offset, 0, 4, 8, m_generic_paletteram_16[offset]);
588}
589
590
591/*-------------------------------------------------
592    xxxx-BBBB-RRRR-GGGG writes
593-------------------------------------------------*/
594
595WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_le_w )
596{
597   m_generic_paletteram_8[offset] = data;
598   set_color_444(offset / 2, 4, 0, 8, paletteram16_le(offset));
599}
600
601WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_be_w )
602{
603   m_generic_paletteram_8[offset] = data;
604   set_color_444(offset / 2, 4, 0, 8, paletteram16_be(offset));
605}
606
607WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_split1_w )
608{
609   m_generic_paletteram_8[offset] = data;
610   set_color_444(offset, 4, 0, 8, paletteram16_split(offset));
611}
612
613WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_split2_w )
614{
615   m_generic_paletteram2_8[offset] = data;
616   set_color_444(offset, 4, 0, 8, paletteram16_split(offset));
617}
618
619WRITE16_MEMBER( driver_device::paletteram16_xxxxBBBBRRRRGGGG_word_w )
620{
621   COMBINE_DATA(&m_generic_paletteram_16[offset]);
622   set_color_444(offset, 4, 0, 8, m_generic_paletteram_16[offset]);
623}
624
625
626/*-------------------------------------------------
627    xxxx-RRRR-BBBB-GGGG writes
628-------------------------------------------------*/
629
630WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRBBBBGGGG_split1_w )
631{
632   m_generic_paletteram_8[offset] = data;
633   set_color_444(offset, 8, 0, 4, paletteram16_split(offset));
634}
635
636WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRBBBBGGGG_split2_w )
637{
638   m_generic_paletteram2_8[offset] = data;
639   set_color_444(offset, 8, 0, 4, paletteram16_split(offset));
640}
641
642
643/*-------------------------------------------------
644    xxxx-RRRR-GGGG-BBBB writes
645-------------------------------------------------*/
646
647WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_le_w )
648{
649   m_generic_paletteram_8[offset] = data;
650   set_color_444(offset / 2, 8, 4, 0, paletteram16_le(offset));
651}
652
653WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_be_w )
654{
655   m_generic_paletteram_8[offset] = data;
656   set_color_444(offset / 2, 8, 4, 0, paletteram16_be(offset));
657}
658
659WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_split1_w )
660{
661   m_generic_paletteram_8[offset] = data;
662   set_color_444(offset, 8, 4, 0, paletteram16_split(offset));
663}
664
665WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_split2_w )
666{
667   m_generic_paletteram2_8[offset] = data;
668   set_color_444(offset, 8, 4, 0, paletteram16_split(offset));
669}
670
671WRITE16_MEMBER( driver_device::paletteram16_xxxxRRRRGGGGBBBB_word_w )
672{
673   COMBINE_DATA(&m_generic_paletteram_16[offset]);
674   set_color_444(offset, 8, 4, 0, m_generic_paletteram_16[offset]);
675}
676
677
678/*-------------------------------------------------
679    RRRR-GGGG-BBBB-xxxx writes
680-------------------------------------------------*/
681
682WRITE8_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_be_w )
683{
684   m_generic_paletteram_8[offset] = data;
685   set_color_444(offset / 2, 12, 8, 4, paletteram16_be(offset));
686}
687
688WRITE8_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_split1_w )
689{
690   m_generic_paletteram_8[offset] = data;
691   set_color_444(offset, 12, 8, 4, paletteram16_split(offset));
692}
693
694WRITE8_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_split2_w )
695{
696   m_generic_paletteram2_8[offset] = data;
697   set_color_444(offset, 12, 8, 4, paletteram16_split(offset));
698}
699
700WRITE16_MEMBER( driver_device::paletteram16_RRRRGGGGBBBBxxxx_word_w )
701{
702   COMBINE_DATA(&m_generic_paletteram_16[offset]);
703   set_color_444(offset, 12, 8, 4, m_generic_paletteram_16[offset]);
704}
705
706
707
708/***************************************************************************
709    5-5-5 RGB PALETTE WRITE HANDLERS
710***************************************************************************/
711
712/*-------------------------------------------------
713    x-BBBBB-GGGGG-RRRRR writes
714-------------------------------------------------*/
715
716WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_le_w )
717{
718   m_generic_paletteram_8[offset] = data;
719   set_color_555(offset / 2, 0, 5, 10, paletteram16_le(offset));
720}
721
722WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_be_w )
723{
724   m_generic_paletteram_8[offset] = data;
725   set_color_555(offset / 2, 0, 5, 10, paletteram16_be(offset));
726}
727
728WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_split1_w )
729{
730   m_generic_paletteram_8[offset] = data;
731   set_color_555(offset, 0, 5, 10, paletteram16_split(offset));
732}
733
734WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_split2_w )
735{
736   m_generic_paletteram2_8[offset] = data;
737   set_color_555(offset, 0, 5, 10, paletteram16_split(offset));
738}
739
740WRITE16_MEMBER( driver_device::paletteram16_xBBBBBGGGGGRRRRR_word_w )
741{
742   COMBINE_DATA(&m_generic_paletteram_16[offset]);
743   set_color_555(offset, 0, 5, 10, m_generic_paletteram_16[offset]);
744}
745
746
747/*-------------------------------------------------
748    x-BBBBB-RRRRR-GGGGG writes
749-------------------------------------------------*/
750
751WRITE8_MEMBER( driver_device::paletteram_xBBBBBRRRRRGGGGG_split1_w )
752{
753   m_generic_paletteram_8[offset] = data;
754   set_color_555(offset, 5, 0, 10, paletteram16_split(offset));
755}
756
757WRITE8_MEMBER( driver_device::paletteram_xBBBBBRRRRRGGGGG_split2_w )
758{
759   m_generic_paletteram2_8[offset] = data;
760   set_color_555(offset, 5, 0, 10, paletteram16_split(offset));
761}
762
763
764/*-------------------------------------------------
765    x-RRRRR-GGGGG-BBBBB writes
766-------------------------------------------------*/
767
768WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_le_w )
769{
770   m_generic_paletteram_8[offset] = data;
771   set_color_555(offset / 2, 10, 5, 0, paletteram16_le(offset));
772}
773
774WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_be_w )
775{
776   m_generic_paletteram_8[offset] = data;
777   set_color_555(offset / 2, 10, 5, 0, paletteram16_be(offset));
778}
779
780WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_split1_w )
781{
782   m_generic_paletteram_8[offset] = data;
783   set_color_555(offset, 10, 5, 0, paletteram16_split(offset));
784}
785
786WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_split2_w )
787{
788   m_generic_paletteram2_8[offset] = data;
789   set_color_555(offset, 10, 5, 0, paletteram16_split(offset));
790}
791
792WRITE16_MEMBER( driver_device::paletteram16_xRRRRRGGGGGBBBBB_word_w )
793{
794   COMBINE_DATA(&m_generic_paletteram_16[offset]);
795   set_color_555(offset, 10, 5, 0, m_generic_paletteram_16[offset]);
796}
797
798
799/*-------------------------------------------------
800    x-GGGGG-RRRRR-BBBBB writes
801-------------------------------------------------*/
802
803WRITE16_MEMBER( driver_device::paletteram16_xGGGGGRRRRRBBBBB_word_w )
804{
805   COMBINE_DATA(&m_generic_paletteram_16[offset]);
806   set_color_555(offset, 5, 10, 0, m_generic_paletteram_16[offset]);
807}
808
809
810/*-------------------------------------------------
811    x-GGGGG-BBBBB-RRRRR writes
812-------------------------------------------------*/
813
814WRITE16_MEMBER( driver_device::paletteram16_xGGGGGBBBBBRRRRR_word_w )
815{
816   COMBINE_DATA(&m_generic_paletteram_16[offset]);
817   set_color_555(offset, 0, 10, 5, m_generic_paletteram_16[offset]);
818}
819
820
821/*-------------------------------------------------
822    GGGGG-RRRRR-BBBBB-x writes
823-------------------------------------------------*/
824
825WRITE16_MEMBER( driver_device::paletteram16_GGGGGRRRRRBBBBBx_word_w )
826{
827   COMBINE_DATA(&m_generic_paletteram_16[offset]);
828   set_color_555(offset, 6, 11, 1, m_generic_paletteram_16[offset]);
829}
830
831/*-------------------------------------------------
832    RRRRR-GGGGG-BBBBB-x writes
833-------------------------------------------------*/
834
835WRITE16_MEMBER( driver_device::paletteram16_RRRRRGGGGGBBBBBx_word_w )
836{
837   COMBINE_DATA(&m_generic_paletteram_16[offset]);
838   set_color_555(offset, 11, 6, 1, m_generic_paletteram_16[offset]);
839}
840
841
842/*-------------------------------------------------
843    RRRR-GGGG-BBBB-RGBx writes
844-------------------------------------------------*/
845
846WRITE16_MEMBER( driver_device::paletteram16_RRRRGGGGBBBBRGBx_word_w )
847{
848   COMBINE_DATA(&m_generic_paletteram_16[offset]);
849   data = m_generic_paletteram_16[offset];
850   palette_set_color_rgb(machine(), offset, pal5bit(((data >> 11) & 0x1e) | ((data >> 3) & 0x01)),
851                                          pal5bit(((data >>  7) & 0x1e) | ((data >> 2) & 0x01)),
852                                          pal5bit(((data >>  3) & 0x1e) | ((data >> 1) & 0x01)));
853}
854
855
856
857/***************************************************************************
858    4-4-4-4 RGBI PALETTE WRITE HANDLERS
859***************************************************************************/
860
861/*-------------------------------------------------
862    IIII-RRRR-GGGG-BBBB writes
863-------------------------------------------------*/
864
865WRITE16_MEMBER( driver_device::paletteram16_IIIIRRRRGGGGBBBB_word_w )
866{
867   COMBINE_DATA(&m_generic_paletteram_16[offset]);
868   set_color_4444(offset, 12, 8, 4, 0, m_generic_paletteram_16[offset]);
869}
870
871
872/*-------------------------------------------------
873    RRRR-GGGG-BBBB-IIII writes
874-------------------------------------------------*/
875
876WRITE16_MEMBER( driver_device::paletteram16_RRRRGGGGBBBBIIII_word_w )
877{
878   COMBINE_DATA(&m_generic_paletteram_16[offset]);
879   set_color_4444(offset, 0, 12, 8, 4, m_generic_paletteram_16[offset]);
880}
881
882
883
884/***************************************************************************
885    8-8-8 RGB PALETTE WRITE HANDLERS
886***************************************************************************/
887
888/*-------------------------------------------------
889    xxxxxxxx-RRRRRRRR-GGGGGGGG-BBBBBBBB writes
890-------------------------------------------------*/
891
892WRITE16_MEMBER( driver_device::paletteram16_xrgb_word_be_w )
893{
894   COMBINE_DATA(&m_generic_paletteram_16[offset]);
895   set_color_888(offset / 2, 16, 8, 0, paletteram32_be(offset));
896}
897
898
899/*-------------------------------------------------
900    xxxxxxxx-BBBBBBBB-GGGGGGGG-RRRRRRRR writes
901-------------------------------------------------*/
902
903WRITE16_MEMBER( driver_device::paletteram16_xbgr_word_be_w )
904{
905   COMBINE_DATA(&m_generic_paletteram_16[offset]);
906   set_color_888(offset / 2, 0, 8, 16, paletteram32_be(offset));
907}
src/emu/video/generic.h
r14896r14897
3535    FUNCTION PROTOTYPES
3636***************************************************************************/
3737
38/* ----- initialization ----- */
39
40/* set up all the common systems */
41void generic_video_init(running_machine &machine);
42
43
44
45/* ----- global attributes ----- */
46
47/* set global attributes */
48void flip_screen_set(running_machine &machine, int on);
49void flip_screen_set_no_update(running_machine &machine, int on);   /* will not call update_flip */
50void flip_screen_x_set(running_machine &machine, int on);
51void flip_screen_y_set(running_machine &machine, int on);
52int flip_screen_get(running_machine &machine);
53int flip_screen_x_get(running_machine &machine);
54int flip_screen_y_get(running_machine &machine);
55
56//#define flip_screen flip_screen_get(machine)
57
58
59
6038/* ----- generic palette init routines ----- */
6139
6240PALETTE_INIT( all_black );
src/emu/gamedrv.h
r14896r14897
8585// static driver initialization callback
8686typedef void (*driver_init_func)(running_machine &machine);
8787
88/*
89// wrapper template to allow members
90template<class _DriverClass, void (_DriverClass::*_Function)()>
91void driver_init_wrapper(running_machine &machine)
92{
93    _DriverClass *object = machine.driver_data<_DriverClass>();
94    (object->*_Function)();
95}
96*/
97
9888// static POD structure describing each game driver entry
9989struct game_driver
10090{
src/emu/emu.h
r14896r14897
140140// generic helpers
141141#include "devcb.h"
142142#include "drivers/xtal.h"
143#include "audio/generic.h"
144143#include "machine/generic.h"
145144#include "video/generic.h"
146145
src/emu/machine.c
r14896r14897
6262                - calls render_init() [render.c] to initialize the rendering system
6363                - calls ui_init() [ui.c] to initialize the user interface
6464                - calls generic_machine_init() [machine/generic.c] to initialize generic machine structures
65                - calls generic_video_init() [video/generic.c] to initialize generic video structures
66                - calls generic_sound_init() [audio/generic.c] to initialize generic sound structures
6765                - calls timer_init() [timer.c] to reset the timer system
6866                - calls osd_init() [osdepend.h] to do platform-specific initialization
6967                - calls input_port_init() [inptport.c] to set up the input ports
r14896r14897
149147     ui_input_data(NULL),
150148     debugcpu_data(NULL),
151149     generic_machine_data(NULL),
152     generic_video_data(NULL),
153     generic_audio_data(NULL),
154150
155151     m_config(_config),
156152     m_system(_config.gamedrv()),
r14896r14897
251247   palette_init(*this);
252248   m_render = auto_alloc(*this, render_manager(*this));
253249   generic_machine_init(*this);
254   generic_sound_init(*this);
255   generic_video_init(*this);
256250
257251   // allocate a soft_reset timer
258252   m_soft_reset_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::soft_reset), this));
src/emu/machine.h
r14896r14897
189189typedef struct _ui_input_private ui_input_private;
190190typedef struct _debugcpu_private debugcpu_private;
191191typedef struct _generic_machine_private generic_machine_private;
192typedef struct _generic_video_private generic_video_private;
193typedef struct _generic_audio_private generic_audio_private;
194192
195193
196194// legacy callback functions
r14896r14897
413411   ui_input_private *      ui_input_data;      // internal data from uiinput.c
414412   debugcpu_private *      debugcpu_data;      // internal data from debugcpu.c
415413   generic_machine_private *generic_machine_data; // internal data from machine/generic.c
416   generic_video_private *   generic_video_data;   // internal data from video/generic.c
417   generic_audio_private *   generic_audio_data;   // internal data from audio/generic.c
418414
419415private:
420416   // internal helpers
src/emu/audio/generic.h
r14896r14897
1/***************************************************************************
2
3    generic.h
4
5    Generic simple sound functions.
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 __SOUND_GENERIC_H__
15#define __SOUND_GENERIC_H__
16
17
18
19/***************************************************************************
20
21    Function prototypes
22
23***************************************************************************/
24
25int generic_sound_init(running_machine &machine);
26
27/* If you're going to use soundlatchX_clear_w, and the cleared value is
28   something other than 0x00, use this function from machine_init. Note
29   that this one call effects all 4 latches */
30void soundlatch_setclearedvalue(running_machine &machine, int value);
31
32
33#endif   /* __SOUND_GENERIC_H__ */
src/emu/audio/generic.c
r14896r14897
1/***************************************************************************
2
3    generic.c
4
5    Generic simple sound functions.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "emu.h"
13
14
15
16/***************************************************************************
17    TYPE DEFINITIONS
18***************************************************************************/
19
20struct _generic_audio_private
21{
22   UINT16      latch_clear_value;
23   UINT16      latched_value[4];
24   UINT8      latch_read[4];
25};
26
27
28
29/***************************************************************************
30    INITIALIZATION
31***************************************************************************/
32
33/*-------------------------------------------------
34    generic_sound_init - initialize globals and
35    register for save states
36-------------------------------------------------*/
37
38int generic_sound_init(running_machine &machine)
39{
40   generic_audio_private *state;
41
42   state = machine.generic_audio_data = auto_alloc_clear(machine, generic_audio_private);
43
44   /* register globals with the save state system */
45   state_save_register_global_array(machine, state->latched_value);
46   state_save_register_global_array(machine, state->latch_read);
47
48   return 0;
49}
50
51
52
53/***************************************************************************
54
55    Many games use a master-slave CPU setup. Typically, the main CPU writes
56    a command to some register, and then writes to another register to trigger
57    an interrupt on the slave CPU (the interrupt might also be triggered by
58    the first write). The slave CPU, notified by the interrupt, goes and reads
59    the command.
60
61***************************************************************************/
62
63/*-------------------------------------------------
64    latch_callback - time-delayed callback to
65    set a latch value
66-------------------------------------------------*/
67
68static TIMER_CALLBACK( latch_callback )
69{
70   generic_audio_private *state = machine.generic_audio_data;
71   UINT16 value = param >> 8;
72   int which = param & 0xff;
73
74   /* if the latch hasn't been read and the value is changed, log a warning */
75   if (!state->latch_read[which] && state->latched_value[which] != value)
76      logerror("Warning: sound latch %d written before being read. Previous: %02x, new: %02x\n", which, state->latched_value[which], value);
77
78   /* store the new value and mark it not read */
79   state->latched_value[which] = value;
80   state->latch_read[which] = 0;
81}
82
83
84/*-------------------------------------------------
85    latch_w - handle a write to a given latch
86-------------------------------------------------*/
87
88INLINE void latch_w(address_space *space, int which, UINT16 value)
89{
90   space->machine().scheduler().synchronize(FUNC(latch_callback), which | (value << 8));
91}
92
93
94/*-------------------------------------------------
95    latch_r - handle a read from a given latch
96-------------------------------------------------*/
97
98INLINE UINT16 latch_r(address_space *space, int which)
99{
100   generic_audio_private *state = space->machine().generic_audio_data;
101   state->latch_read[which] = 1;
102   return state->latched_value[which];
103}
104
105
106/*-------------------------------------------------
107    latch_clear - clear a given latch
108-------------------------------------------------*/
109
110INLINE void latch_clear(address_space *space, int which)
111{
112   generic_audio_private *state = space->machine().generic_audio_data;
113   state->latched_value[which] = state->latch_clear_value;
114}
115
116
117/*-------------------------------------------------
118    soundlatch_w - global write handlers for
119    writing to sound latches
120-------------------------------------------------*/
121
122WRITE8_MEMBER( driver_device::soundlatch_w )      { latch_w(&space, 0, data); }
123WRITE16_MEMBER( driver_device::soundlatch_word_w )  { latch_w(&space, 0, data); }
124WRITE8_MEMBER( driver_device::soundlatch2_w )      { latch_w(&space, 1, data); }
125WRITE16_MEMBER( driver_device::soundlatch2_word_w ) { latch_w(&space, 1, data); }
126WRITE8_MEMBER( driver_device::soundlatch3_w )      { latch_w(&space, 2, data); }
127WRITE16_MEMBER( driver_device::soundlatch3_word_w ) { latch_w(&space, 2, data); }
128WRITE8_MEMBER( driver_device::soundlatch4_w )      { latch_w(&space, 3, data); }
129WRITE16_MEMBER( driver_device::soundlatch4_word_w ) { latch_w(&space, 3, data); }
130
131
132/*-------------------------------------------------
133    soundlatch_r - global read handlers for
134    reading from sound latches
135-------------------------------------------------*/
136
137READ8_MEMBER( driver_device::soundlatch_r )       { return latch_r(&space, 0); }
138READ16_MEMBER( driver_device::soundlatch_word_r )   { return latch_r(&space, 0); }
139READ8_MEMBER( driver_device::soundlatch2_r )      { return latch_r(&space, 1); }
140READ16_MEMBER( driver_device::soundlatch2_word_r )  { return latch_r(&space, 1); }
141READ8_MEMBER( driver_device::soundlatch3_r )      { return latch_r(&space, 2); }
142READ16_MEMBER( driver_device::soundlatch3_word_r )  { return latch_r(&space, 2); }
143READ8_MEMBER( driver_device::soundlatch4_r )      { return latch_r(&space, 3); }
144READ16_MEMBER( driver_device::soundlatch4_word_r )  { return latch_r(&space, 3); }
145
146
147/*-------------------------------------------------
148    soundlatch_clear_w - global write handlers
149    for clearing sound latches
150-------------------------------------------------*/
151
152WRITE8_MEMBER( driver_device::soundlatch_clear_w )  { latch_clear(&space, 0); }
153WRITE8_MEMBER( driver_device::soundlatch2_clear_w ) { latch_clear(&space, 1); }
154WRITE8_MEMBER( driver_device::soundlatch3_clear_w ) { latch_clear(&space, 2); }
155WRITE8_MEMBER( driver_device::soundlatch4_clear_w ) { latch_clear(&space, 3); }
156
157
158/*-------------------------------------------------
159    soundlatch_setclearedvalue - set the "clear"
160    value for all sound latches
161-------------------------------------------------*/
162
163void soundlatch_setclearedvalue(running_machine &machine, int value)
164{
165   generic_audio_private *state = machine.generic_audio_data;
166   assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
167   state->latch_clear_value = value;
168}
src/emu/devcpu.h
r14896r14897
199199#define CPU_SET_INFO_CALL(name)         CPU_SET_INFO_NAME(name)(device, state, info)
200200
201201#define CPU_INIT_NAME(name)            cpu_init_##name
202#define CPU_INIT(name)               void CPU_INIT_NAME(name)(legacy_cpu_device *device, device_irq_callback irqcallback)
202#define CPU_INIT(name)               void CPU_INIT_NAME(name)(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback)
203203#define CPU_INIT_CALL(name)            CPU_INIT_NAME(name)(device, irqcallback)
204204
205205#define CPU_RESET_NAME(name)         cpu_reset_##name
r14896r14897
262262
263263#define cpu_set_reg(cpu, _reg, val)         device_state(cpu)->set_state(_reg, val)
264264
265#define INTERRUPT_GEN(func)      void func(device_t *device)
266
267265// helpers for using machine/cputag instead of cpu objects
268266#define cputag_set_input_line(mach, tag, line, state)               device_execute((mach).device(tag))->set_input_line(line, state)
269267#define cputag_set_input_line_and_vector(mach, tag, line, state, vec)   device_execute((mach).device(tag))->set_input_line_and_vector(line, state, vec)
r14896r14897
283281// CPU interface functions
284282typedef void (*cpu_get_info_func)(legacy_cpu_device *device, UINT32 state, cpuinfo *info);
285283typedef void (*cpu_set_info_func)(legacy_cpu_device *device, UINT32 state, cpuinfo *info);
286typedef void (*cpu_init_func)(legacy_cpu_device *device, device_irq_callback irqcallback);
284typedef void (*cpu_init_func)(legacy_cpu_device *device, device_irq_acknowledge_callback irqcallback);
287285typedef void (*cpu_reset_func)(legacy_cpu_device *device);
288286typedef void (*cpu_exit_func)(legacy_cpu_device *device);
289287typedef void (*cpu_execute_func)(legacy_cpu_device *device);
src/emu/emu.mak
r14896r14897
134134   $(EMUOBJ)/sound/wavwrite.o \
135135
136136EMUAUDIOOBJS = \
137   $(EMUAUDIO)/generic.o \
138137
139138EMUDRIVEROBJS = \
140139   $(EMUDRIVERS)/empty.o \
src/emu/machine/generic.c
r14896r14897
2121
2222static void counters_load(running_machine &machine, int config_type, xml_data_node *parentnode);
2323static void counters_save(running_machine &machine, int config_type, xml_data_node *parentnode);
24static void interrupt_reset(running_machine &machine);
2524
2625
2726
r14896r14897
3938
4039   /* memory card status */
4140   int       memcard_inserted;
42
43   /* interrupt status for up to 8 CPUs */
44   device_t *   interrupt_device[8];
45   UINT8      interrupt_enable[8];
4641};
4742
4843
4944
5045/***************************************************************************
51    INLINE FUNCTIONS
52***************************************************************************/
53
54/*-------------------------------------------------
55    interrupt_enabled - return true if interrupts
56    are enabled for the given CPU
57-------------------------------------------------*/
58
59INLINE int interrupt_enabled(device_t *device)
60{
61   generic_machine_private *state = device->machine().generic_machine_data;
62   for (int index = 0; index < ARRAY_LENGTH(state->interrupt_device); index++)
63      if (state->interrupt_device[index] == device)
64         return state->interrupt_enable[index];
65   return TRUE;
66}
67
68
69
70/***************************************************************************
7146    INITIALIZATION
7247***************************************************************************/
7348
r14896r14897
9267      state->coinlockedout[counternum] = 0;
9368   }
9469
95   // map devices to the interrupt state
96   memset(state->interrupt_device, 0, sizeof(state->interrupt_device));
97   execute_interface_iterator iter(machine.root_device());
98   int index = 0;
99   for (device_execute_interface *exec = iter.first(); exec != NULL && index < ARRAY_LENGTH(state->interrupt_device); exec = iter.next())
100      state->interrupt_device[index++] = &exec->device();
101
10270   /* register coin save state */
10371   machine.save().save_item(NAME(state->coin_count));
10472   machine.save().save_item(NAME(state->coinlockedout));
r14896r14897
10775   /* reset memory card info */
10876   state->memcard_inserted = -1;
10977
110   /* register a reset callback and save state for interrupt enable */
111   machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(interrupt_reset), &machine));
112   machine.save().save_item(NAME(state->interrupt_enable));
113
11478   /* register for configuration */
11579   config_register(machine, "counters", config_saveload_delegate(FUNC(counters_load), &machine), config_saveload_delegate(FUNC(counters_save), &machine));
11680
r14896r14897
549513
550514
551515
516
552517/***************************************************************************
553    INTERRUPT ENABLE AND VECTOR HELPERS
518    PORT READING HELPERS
554519***************************************************************************/
555520
556521/*-------------------------------------------------
557    interrupt_reset - reset the interrupt enable
558    states on a reset
522    custom_port_read - act like input_port_read
523    but it is a custom port, it is useful for
524    e.g. input ports which expect the same port
525    repeated both in the upper and lower half
559526-------------------------------------------------*/
560527
561static void interrupt_reset(running_machine &machine)
528CUSTOM_INPUT_MEMBER( driver_device::custom_port_read )
562529{
563   generic_machine_private *state = machine.generic_machine_data;
564   int cpunum;
565
566   /* on a reset, enable all interrupts */
567   for (cpunum = 0; cpunum < ARRAY_LENGTH(state->interrupt_enable); cpunum++)
568      state->interrupt_enable[cpunum] = 1;
530   const char *tag = (const char *)param;
531   return input_port_read(machine(), tag);
569532}
570533
571534
572/*-------------------------------------------------
573    irq_pulse_clear - clear a "pulsed" IRQ line
574-------------------------------------------------*/
535void generic_pulse_irq_line(device_t *device, int irqline, int cycles) { device->machine().driver_data()->generic_pulse_irq_line(device->execute(), irqline, cycles); }
536void generic_pulse_irq_line_and_vector(device_t *device, int irqline, int vector, int cycles) { device->machine().driver_data()->generic_pulse_irq_line_and_vector(device->execute(), irqline, vector, cycles); }
575537
576static TIMER_CALLBACK( irq_pulse_clear )
577{
578   device_t *device = (device_t *)ptr;
579   int irqline = param;
580   device_set_input_line(device, irqline, CLEAR_LINE);
581}
538INTERRUPT_GEN( nmi_line_pulse ) { device->machine().driver_data()->nmi_line_pulse(*device); }
539INTERRUPT_GEN( nmi_line_assert ) { device->machine().driver_data()->nmi_line_assert(*device); }
582540
541INTERRUPT_GEN( irq0_line_hold ) { device->machine().driver_data()->irq0_line_hold(*device); }
542INTERRUPT_GEN( irq0_line_pulse ) { device->machine().driver_data()->irq0_line_pulse(*device); }
543INTERRUPT_GEN( irq0_line_assert ) { device->machine().driver_data()->irq0_line_assert(*device); }
583544
584/*-------------------------------------------------
585    generic_pulse_irq_line - "pulse" an IRQ line by
586    asserting it and then clearing it x cycle(s)
587    later
588-------------------------------------------------*/
545INTERRUPT_GEN( irq1_line_hold ) { device->machine().driver_data()->irq1_line_hold(*device); }
546INTERRUPT_GEN( irq1_line_pulse ) { device->machine().driver_data()->irq1_line_pulse(*device); }
547INTERRUPT_GEN( irq1_line_assert ) { device->machine().driver_data()->irq1_line_assert(*device); }
589548
590void generic_pulse_irq_line(device_t *device, int irqline, int cycles)
591{
592   assert(irqline != INPUT_LINE_NMI && irqline != INPUT_LINE_RESET && cycles > 0);
593   device_set_input_line(device, irqline, ASSERT_LINE);
549INTERRUPT_GEN( irq2_line_hold ) { device->machine().driver_data()->irq2_line_hold(*device); }
550INTERRUPT_GEN( irq2_line_pulse ) { device->machine().driver_data()->irq2_line_pulse(*device); }
551INTERRUPT_GEN( irq2_line_assert ) { device->machine().driver_data()->irq2_line_assert(*device); }
594552
595   cpu_device *cpudevice = downcast<cpu_device *>(device);
596   attotime target_time = cpudevice->local_time() + cpudevice->cycles_to_attotime(cycles * cpudevice->min_cycles());
597   device->machine().scheduler().timer_set(target_time - device->machine().time(), FUNC(irq_pulse_clear), irqline, (void *)device);
598}
553INTERRUPT_GEN( irq3_line_hold ) { device->machine().driver_data()->irq3_line_hold(*device); }
554INTERRUPT_GEN( irq3_line_pulse ) { device->machine().driver_data()->irq3_line_pulse(*device); }
555INTERRUPT_GEN( irq3_line_assert ) { device->machine().driver_data()->irq3_line_assert(*device); }
599556
557INTERRUPT_GEN( irq4_line_hold ) { device->machine().driver_data()->irq4_line_hold(*device); }
558INTERRUPT_GEN( irq4_line_pulse ) { device->machine().driver_data()->irq4_line_pulse(*device); }
559INTERRUPT_GEN( irq4_line_assert ) { device->machine().driver_data()->irq4_line_assert(*device); }
600560
601/*-------------------------------------------------
602    generic_pulse_irq_line_and_vector - "pulse" an
603    IRQ line by asserting it and then clearing it
604    x cycle(s) later, specifying a vector
605-------------------------------------------------*/
561INTERRUPT_GEN( irq5_line_hold ) { device->machine().driver_data()->irq5_line_hold(*device); }
562INTERRUPT_GEN( irq5_line_pulse ) { device->machine().driver_data()->irq5_line_pulse(*device); }
563INTERRUPT_GEN( irq5_line_assert ) { device->machine().driver_data()->irq5_line_assert(*device); }
606564
607void generic_pulse_irq_line_and_vector(device_t *device, int irqline, int vector, int cycles)
608{
609   assert(irqline != INPUT_LINE_NMI && irqline != INPUT_LINE_RESET && cycles > 0);
610   device_set_input_line_and_vector(device, irqline, ASSERT_LINE, vector);
565INTERRUPT_GEN( irq6_line_hold ) { device->machine().driver_data()->irq6_line_hold(*device); }
566INTERRUPT_GEN( irq6_line_pulse ) { device->machine().driver_data()->irq6_line_pulse(*device); }
567INTERRUPT_GEN( irq6_line_assert ) { device->machine().driver_data()->irq6_line_assert(*device); }
611568
612   cpu_device *cpudevice = downcast<cpu_device *>(device);
613   attotime target_time = cpudevice->local_time() + cpudevice->cycles_to_attotime(cycles * cpudevice->min_cycles());
614   device->machine().scheduler().timer_set(target_time - device->machine().time(), FUNC(irq_pulse_clear), irqline, (void *)device);
615}
616
617
618
619/***************************************************************************
620    INTERRUPT GENERATION CALLBACK HELPERS
621***************************************************************************/
622
623/*-------------------------------------------------
624    NMI callbacks
625-------------------------------------------------*/
626
627INTERRUPT_GEN( nmi_line_pulse )      { if (interrupt_enabled(device)) device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); }
628INTERRUPT_GEN( nmi_line_assert )   { if (interrupt_enabled(device)) device_set_input_line(device, INPUT_LINE_NMI, ASSERT_LINE); }
629
630
631/*-------------------------------------------------
632    IRQn callbacks
633-------------------------------------------------*/
634
635INTERRUPT_GEN( irq0_line_hold )      { if (interrupt_enabled(device)) device_set_input_line(device, 0, HOLD_LINE); }
636INTERRUPT_GEN( irq0_line_pulse )   { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 0, 1); }
637INTERRUPT_GEN( irq0_line_assert )   { if (interrupt_enabled(device)) device_set_input_line(device, 0, ASSERT_LINE); }
638
639INTERRUPT_GEN( irq1_line_hold )      { if (interrupt_enabled(device)) device_set_input_line(device, 1, HOLD_LINE); }
640INTERRUPT_GEN( irq1_line_pulse )   { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 1, 1); }
641INTERRUPT_GEN( irq1_line_assert )   { if (interrupt_enabled(device)) device_set_input_line(device, 1, ASSERT_LINE); }
642
643INTERRUPT_GEN( irq2_line_hold )      { if (interrupt_enabled(device)) device_set_input_line(device, 2, HOLD_LINE); }
644INTERRUPT_GEN( irq2_line_pulse )   { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 2, 1); }
645INTERRUPT_GEN( irq2_line_assert )   { if (interrupt_enabled(device)) device_set_input_line(device, 2, ASSERT_LINE); }
646
647INTERRUPT_GEN( irq3_line_hold )      { if (interrupt_enabled(device)) device_set_input_line(device, 3, HOLD_LINE); }
648INTERRUPT_GEN( irq3_line_pulse )   { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 3, 1); }
649INTERRUPT_GEN( irq3_line_assert )   { if (interrupt_enabled(device)) device_set_input_line(device, 3, ASSERT_LINE); }
650
651INTERRUPT_GEN( irq4_line_hold )      { if (interrupt_enabled(device)) device_set_input_line(device, 4, HOLD_LINE); }
652INTERRUPT_GEN( irq4_line_pulse )   { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 4, 1); }
653INTERRUPT_GEN( irq4_line_assert )   { if (interrupt_enabled(device)) device_set_input_line(device, 4, ASSERT_LINE); }
654
655INTERRUPT_GEN( irq5_line_hold )      { if (interrupt_enabled(device)) device_set_input_line(device, 5, HOLD_LINE); }
656INTERRUPT_GEN( irq5_line_pulse )   { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 5, 1); }
657INTERRUPT_GEN( irq5_line_assert )   { if (interrupt_enabled(device)) device_set_input_line(device, 5, ASSERT_LINE); }
658
659INTERRUPT_GEN( irq6_line_hold )      { if (interrupt_enabled(device)) device_set_input_line(device, 6, HOLD_LINE); }
660INTERRUPT_GEN( irq6_line_pulse )   { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 6, 1); }
661INTERRUPT_GEN( irq6_line_assert )   { if (interrupt_enabled(device)) device_set_input_line(device, 6, ASSERT_LINE); }
662
663INTERRUPT_GEN( irq7_line_hold )      { if (interrupt_enabled(device)) device_set_input_line(device, 7, HOLD_LINE); }
664INTERRUPT_GEN( irq7_line_pulse )   { if (interrupt_enabled(device)) generic_pulse_irq_line(device, 7, 1); }
665INTERRUPT_GEN( irq7_line_assert )   { if (interrupt_enabled(device)) device_set_input_line(device, 7, ASSERT_LINE); }
666
667
668
669/***************************************************************************
670    WATCHDOG READ/WRITE HELPERS
671***************************************************************************/
672
673/*-------------------------------------------------
674    8-bit reset read/write handlers
675-------------------------------------------------*/
676
677WRITE8_MEMBER( driver_device::watchdog_reset_w ) { watchdog_reset(machine()); }
678READ8_MEMBER( driver_device::watchdog_reset_r ) { watchdog_reset(machine()); return space.unmap(); }
679
680
681/*-------------------------------------------------
682    16-bit reset read/write handlers
683-------------------------------------------------*/
684
685WRITE16_MEMBER( driver_device::watchdog_reset16_w ) { watchdog_reset(machine()); }
686READ16_MEMBER( driver_device::watchdog_reset16_r ) { watchdog_reset(machine()); return space.unmap(); }
687
688
689/*-------------------------------------------------
690    32-bit reset read/write handlers
691-------------------------------------------------*/
692
693WRITE32_MEMBER( driver_device::watchdog_reset32_w ) { watchdog_reset(machine()); }
694READ32_MEMBER( driver_device::watchdog_reset32_r ) { watchdog_reset(machine()); return space.unmap(); }
695
696
697
698/***************************************************************************
699    PORT READING HELPERS
700***************************************************************************/
701
702/*-------------------------------------------------
703    custom_port_read - act like input_port_read
704    but it is a custom port, it is useful for
705    e.g. input ports which expect the same port
706    repeated both in the upper and lower half
707-------------------------------------------------*/
708
709CUSTOM_INPUT_MEMBER( driver_device::custom_port_read )
710{
711   const char *tag = (const char *)param;
712   return input_port_read(machine(), tag);
713}
569INTERRUPT_GEN( irq7_line_hold ) { device->machine().driver_data()->irq7_line_hold(*device); }
570INTERRUPT_GEN( irq7_line_pulse ) { device->machine().driver_data()->irq7_line_pulse(*device); }
571INTERRUPT_GEN( irq7_line_assert ) { device->machine().driver_data()->irq7_line_assert(*device); }
src/emu/machine/generic.h
r14896r14897
110110void generic_pulse_irq_line_and_vector(device_t *device, int irqline, int vector, int cycles);
111111
112112
113
114/* ----- common interrupt callbacks ----- */
115
116113INTERRUPT_GEN( nmi_line_pulse );
117114INTERRUPT_GEN( nmi_line_assert );
118115
src/emu/diexec.c
r14896r14897
7474   : device_interface(device),
7575//    m_cothread(cothread_entry_delegate(FUNC(device_execute_interface::run_thread_wrapper), this)),
7676     m_disabled(false),
77     m_vblank_interrupt(NULL),
77     m_vblank_interrupt_legacy(NULL),
7878     m_vblank_interrupt_screen(NULL),
79     m_timed_interrupt(NULL),
79     m_timed_interrupt_legacy(NULL),
8080     m_timed_interrupt_period(attotime::zero),
8181     m_is_octal(false),
8282     m_nextexec(NULL),
r14896r14897
138138   device_execute_interface *exec;
139139   if (!device.interface(exec))
140140      throw emu_fatalerror("MCFG_DEVICE_VBLANK_INT called on device '%s' with no execute interface", device.tag());
141   exec->m_vblank_interrupt_legacy = function;
142   exec->m_vblank_interrupt_screen = tag;
143}
144
145void device_execute_interface::static_set_vblank_int(device_t &device, device_interrupt_delegate function, const char *tag, int rate)
146{
147   device_execute_interface *exec;
148   if (!device.interface(exec))
149      throw emu_fatalerror("MCFG_DEVICE_VBLANK_INT called on device '%s' with no execute interface", device.tag());
141150   exec->m_vblank_interrupt = function;
151   exec->m_vblank_interrupt_legacy = NULL;
142152   exec->m_vblank_interrupt_screen = tag;
143153}
144154
r14896r14897
153163   device_execute_interface *exec;
154164   if (!device.interface(exec))
155165      throw emu_fatalerror("MCFG_DEVICE_PERIODIC_INT called on device '%s' with no execute interface", device.tag());
166   exec->m_timed_interrupt_legacy = function;
167   exec->m_timed_interrupt_period = rate;
168}
169
170void device_execute_interface::static_set_periodic_int(device_t &device, device_interrupt_delegate function, attotime rate)
171{
172   device_execute_interface *exec;
173   if (!device.interface(exec))
174      throw emu_fatalerror("MCFG_DEVICE_PERIODIC_INT called on device '%s' with no execute interface", device.tag());
156175   exec->m_timed_interrupt = function;
176   exec->m_timed_interrupt_legacy = NULL;
157177   exec->m_timed_interrupt_period = rate;
158178}
159179
r14896r14897
238258
239259
240260//-------------------------------------------------
241//  set_irq_callback - install a driver-specific
261//  set_irq_acknowledge_callback - install a driver-specific
242262//  callback for IRQ acknowledge
243263//-------------------------------------------------
244264
245void device_execute_interface::set_irq_callback(device_irq_callback callback)
265void device_execute_interface::set_irq_acknowledge_callback(device_irq_acknowledge_callback callback)
246266{
247267   m_driver_irq = callback;
248268}
r14896r14897
486506void device_execute_interface::interface_validity_check(validity_checker &valid) const
487507{
488508   // validate the interrupts
489   if (m_vblank_interrupt != NULL)
509   if (!m_vblank_interrupt.isnull() || m_vblank_interrupt_legacy != NULL)
490510   {
491511      screen_device_iterator iter(device().mconfig().root_device());
492512      if (iter.first() == NULL)
r14896r14897
495515         mame_printf_error("VBLANK interrupt references a non-existant screen tag '%s'\n", m_vblank_interrupt_screen);
496516   }
497517
498   if (m_timed_interrupt != NULL && m_timed_interrupt_period == attotime::zero)
518   if ((!m_timed_interrupt.isnull() || m_timed_interrupt_legacy != NULL) && m_timed_interrupt_period == attotime::zero)
499519      mame_printf_error("Timed interrupt handler specified with 0 period\n");
500   else if (m_timed_interrupt == NULL && m_timed_interrupt_period != attotime::zero)
520   else if ((m_timed_interrupt.isnull() && m_timed_interrupt_legacy == NULL) && m_timed_interrupt_period != attotime::zero)
501521      mame_printf_error("No timer interrupt handler specified, but has a non-0 period given\n");
502522}
503523
r14896r14897
699719
700720   // generate the interrupt callback
701721   if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
702      (*m_vblank_interrupt)(&device());
722   {
723      if (m_vblank_interrupt_legacy != NULL)
724         (*m_vblank_interrupt_legacy)(&device());
725      else if (!m_vblank_interrupt.isnull())
726         m_vblank_interrupt(device());
727   }
703728}
704729
705730
r14896r14897
716741void device_execute_interface::trigger_periodic_interrupt()
717742{
718743   // bail if there is no routine
719   if (m_timed_interrupt != NULL && !suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
720      (*m_timed_interrupt)(&device());
744   if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
745   {
746      if (m_timed_interrupt_legacy != NULL)
747         (*m_timed_interrupt_legacy)(&device());
748      else if (!m_timed_interrupt.isnull())
749         m_timed_interrupt(device());
750   }
721751}
722752
723753
src/emu/diexec.h
r14896r14897
106106// IRQ callback to be called by device implementations when an IRQ is actually taken
107107#define IRQ_CALLBACK(func)            int func(device_t *device, int irqline)
108108
109// interrupt generator callback called as a VBLANK or periodic interrupt
110#define INTERRUPT_GEN(func)            void func(device_t *device)
111#define INTERRUPT_GEN_MEMBER(func)      void func(device_t &device)
109112
110113
114
111115//**************************************************************************
112116//  INTERFACE CONFIGURATION MACROS
113117//**************************************************************************
r14896r14897
118122#define MCFG_DEVICE_VBLANK_INT(_tag, _func) \
119123   device_execute_interface::static_set_vblank_int(*device, _func, _tag); \
120124
125#define MCFG_DEVICE_VBLANK_INT_DRIVER(_tag, _class, _func) \
126   device_execute_interface::static_set_vblank_int(*device, device_interrupt_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device())), _tag); \
127
121128#define MCFG_DEVICE_PERIODIC_INT(_func, _rate)   \
122129   device_execute_interface::static_set_periodic_int(*device, _func, attotime::from_hz(_rate)); \
123130
131#define MCFG_DEVICE_PERIODIC_INT_DRIVER(_class, _func, _rate) \
132   device_execute_interface::static_set_vblank_int(*device, device_interrupt_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device())), attotime::from_hz(_rate)); \
124133
125134
135
126136//**************************************************************************
127137//  TYPE DEFINITIONS
128138//**************************************************************************
r14896r14897
132142
133143
134144// interrupt callback for VBLANK and timed interrupts
145typedef delegate<void (device_t &)> device_interrupt_delegate;
135146typedef void (*device_interrupt_func)(device_t *device);
136147
137148// IRQ callback to be called by executing devices when an IRQ is actually taken
138typedef int (*device_irq_callback)(device_t *device, int irqnum);
149typedef delegate<void (device_t &, int)> device_irq_acknowledge_delegate;
150typedef int (*device_irq_acknowledge_callback)(device_t *device, int irqnum);
139151
140152
141153
r14896r14897
166178   // static inline configuration helpers
167179   static void static_set_disable(device_t &device);
168180   static void static_set_vblank_int(device_t &device, device_interrupt_func function, const char *tag, int rate = 0);
181   static void static_set_vblank_int(device_t &device, device_interrupt_delegate function, const char *tag, int rate = 0);
169182   static void static_set_periodic_int(device_t &device, device_interrupt_func function, attotime rate);
183   static void static_set_periodic_int(device_t &device, device_interrupt_delegate function, attotime rate);
170184
171185   // execution management
172186   bool executing() const;
r14896r14897
180194   void set_input_line_vector(int linenum, int vector) { m_input[linenum].set_vector(vector); }
181195   void set_input_line_and_vector(int linenum, int state, int vector) { m_input[linenum].set_state_synced(state, vector); }
182196   int input_state(int linenum) { return m_input[linenum].m_curstate; }
183   void set_irq_callback(device_irq_callback callback);
197   void set_irq_acknowledge_callback(device_irq_acknowledge_callback callback);
184198
185199   // suspend/resume
186200   void suspend(UINT32 reason, bool eatcycles);
r14896r14897
274288
275289   // configuration
276290   bool               m_disabled;               // disabled from executing?
277   device_interrupt_func   m_vblank_interrupt;         // for interrupts tied to VBLANK
291   device_interrupt_delegate m_vblank_interrupt;      // for interrupts tied to VBLANK
292   device_interrupt_func    m_vblank_interrupt_legacy;   // for interrupts tied to VBLANK
278293   const char *         m_vblank_interrupt_screen;   // the screen that causes the VBLANK interrupt
279   device_interrupt_func   m_timed_interrupt;         // for interrupts not tied to VBLANK
294   device_interrupt_delegate m_timed_interrupt;      // for interrupts not tied to VBLANK
295   device_interrupt_func    m_timed_interrupt_legacy;   // for interrupts not tied to VBLANK
280296   attotime            m_timed_interrupt_period;   // period for periodic interrupts
281297   bool               m_is_octal;               // to determine if messages/debugger will show octal or hex
282298
r14896r14897
284300   device_execute_interface *m_nextexec;            // pointer to the next device to execute, in order
285301
286302   // input states and IRQ callbacks
287   device_irq_callback      m_driver_irq;            // driver-specific IRQ callback
303   device_irq_acknowledge_callback m_driver_irq;      // driver-specific IRQ callback
288304   device_input         m_input[MAX_INPUT_LINES];   // data about inputs
289305   emu_timer *            m_timedint_timer;         // reference to this device's periodic interrupt timer
290306
r14896r14897
449465}
450466
451467// install a driver-specific callback for IRQ acknowledge
452inline void device_set_irq_callback(device_t *device, device_irq_callback callback)
468inline void device_set_irq_callback(device_t *device, device_irq_acknowledge_callback callback)
453469{
454   device_execute(device)->set_irq_callback(callback);
470   device_execute(device)->set_irq_acknowledge_callback(callback);
455471}
456472
457473
src/emu/driver.c
r14896r14897
5151
5252driver_device::driver_device(const machine_config &mconfig, device_type type, const char *tag)
5353   : device_t(mconfig, type, "Driver Device", tag, NULL, 0),
54     m_system(NULL),
55     m_palette_init(NULL),
5654     m_generic_paletteram_8(*this, "paletteram"),
5755     m_generic_paletteram2_8(*this, "paletteram2"),
5856     m_generic_paletteram_16(*this, "paletteram"),
5957     m_generic_paletteram2_16(*this, "paletteram2"),
6058     m_generic_paletteram_32(*this, "paletteram"),
61     m_generic_paletteram2_32(*this, "paletteram2")
59     m_generic_paletteram2_32(*this, "paletteram2"),
60     m_system(NULL),
61     m_palette_init(NULL),
62     m_latch_clear_value(0),
63     m_flip_screen_x(0),
64     m_flip_screen_y(0)
6265{
63   memset(m_callbacks, 0, sizeof(m_callbacks));
66   memset(m_legacy_callbacks, 0, sizeof(m_legacy_callbacks));
67   memset(m_latched_value, 0, sizeof(m_latched_value));
68   memset(m_latch_read, 0, sizeof(m_latch_read));
6469}
6570
6671
r14896r14897
99104
100105
101106//-------------------------------------------------
102//  static_set_machine_start - set the legacy
103//  machine start callback in the device
104//  configuration
107//  static_set_callback - set the a callback in
108//  the device configuration
105109//-------------------------------------------------
106110
107111void driver_device::static_set_callback(device_t &device, callback_type type, legacy_callback_func callback)
108112{
113   downcast<driver_device &>(device).m_legacy_callbacks[type] = callback;
114}
115
116void driver_device::static_set_callback(device_t &device, callback_type type, driver_callback_delegate callback)
117{
109118   downcast<driver_device &>(device).m_callbacks[type] = callback;
110119}
111120
r14896r14897
139148
140149void driver_device::machine_start()
141150{
142   if (m_callbacks[CB_MACHINE_START] != NULL)
143      (*m_callbacks[CB_MACHINE_START])(machine());
144151}
145152
146153
r14896r14897
151158
152159void driver_device::sound_start()
153160{
154   if (m_callbacks[CB_SOUND_START] != NULL)
155      (*m_callbacks[CB_SOUND_START])(machine());
156161}
157162
158163
r14896r14897
163168
164169void driver_device::video_start()
165170{
166   if (m_callbacks[CB_VIDEO_START] != NULL)
167      (*m_callbacks[CB_VIDEO_START])(machine());
168171}
169172
170173
r14896r14897
185188
186189void driver_device::machine_reset()
187190{
188   if (m_callbacks[CB_MACHINE_RESET] != NULL)
189      (*m_callbacks[CB_MACHINE_RESET])(machine());
190191}
191192
192193
r14896r14897
197198
198199void driver_device::sound_reset()
199200{
200   if (m_callbacks[CB_SOUND_RESET] != NULL)
201      (*m_callbacks[CB_SOUND_RESET])(machine());
202201}
203202
204203
r14896r14897
209208
210209void driver_device::video_reset()
211210{
212   if (m_callbacks[CB_VIDEO_RESET] != NULL)
213      (*m_callbacks[CB_VIDEO_RESET])(machine());
214211}
215212
216213
r14896r14897
243240
244241void driver_device::device_start()
245242{
243   // bind our legacy callbacks
244   for (int index = 0; index < ARRAY_LENGTH(m_legacy_callbacks); index++)
245      if (m_legacy_callbacks[index] != NULL)
246         m_callbacks[index] = driver_callback_delegate(m_legacy_callbacks[index], "legacy_callback", &machine());
247
246248   // reschedule ourselves to be last
247249   device_iterator iter(*this);
248250   for (device_t *test = iter.first(); test != NULL; test = iter.next())
r14896r14897
262264
263265   // start the various pieces
264266   driver_start();
265   machine_start();
266   sound_start();
267   video_start();
267
268   if (!m_callbacks[CB_MACHINE_START].isnull())
269      m_callbacks[CB_MACHINE_START]();
270   else
271      machine_start();
272
273   if (!m_callbacks[CB_SOUND_START].isnull())
274      m_callbacks[CB_SOUND_START]();
275   else
276      sound_start();
277
278   if (!m_callbacks[CB_VIDEO_START].isnull())
279      m_callbacks[CB_VIDEO_START]();
280   else
281      video_start();
282   
283   // save generic states
284   save_item(NAME(m_flip_screen_x));
285   save_item(NAME(m_flip_screen_y));
268286}
269287
270288
r14896r14897
278296{
279297   // reset each piece
280298   driver_reset();
281   machine_reset();
282   sound_reset();
283   video_reset();
299
300   if (!m_callbacks[CB_MACHINE_RESET].isnull())
301      m_callbacks[CB_MACHINE_RESET]();
302   else
303      machine_reset();
304
305   if (!m_callbacks[CB_SOUND_RESET].isnull())
306      m_callbacks[CB_SOUND_RESET]();
307   else
308      sound_reset();
309
310   if (!m_callbacks[CB_VIDEO_RESET].isnull())
311      m_callbacks[CB_VIDEO_RESET]();
312   else
313      video_reset();
284314}
315
316
317
318//**************************************************************************
319//  INTERRUPT ENABLE AND VECTOR HELPERS
320//**************************************************************************
321
322//-------------------------------------------------
323//  irq_pulse_clear - clear a "pulsed" IRQ line
324//-------------------------------------------------
325
326void driver_device::irq_pulse_clear(void *ptr, INT32 param)
327{
328   device_execute_interface *exec = reinterpret_cast<device_execute_interface *>(ptr);
329   int irqline = param;
330   exec->set_input_line(irqline, CLEAR_LINE);
331}
332
333
334//-------------------------------------------------
335//  generic_pulse_irq_line - "pulse" an IRQ line by
336//  asserting it and then clearing it x cycle(s)
337//  later
338//-------------------------------------------------
339
340void driver_device::generic_pulse_irq_line(device_execute_interface &exec, int irqline, int cycles)
341{
342   assert(irqline != INPUT_LINE_NMI && irqline != INPUT_LINE_RESET && cycles > 0);
343   exec.set_input_line(irqline, ASSERT_LINE);
344
345   attotime target_time = exec.local_time() + exec.cycles_to_attotime(cycles * exec.min_cycles());
346   machine().scheduler().timer_set(target_time - machine().time(), timer_expired_delegate(FUNC(driver_device::irq_pulse_clear), this), irqline, (void *)&exec);
347}
348
349
350//-------------------------------------------------
351//  generic_pulse_irq_line_and_vector - "pulse" an
352//  IRQ line by asserting it and then clearing it
353//  x cycle(s) later, specifying a vector
354//-------------------------------------------------
355
356void driver_device::generic_pulse_irq_line_and_vector(device_execute_interface &exec, int irqline, int vector, int cycles)
357{
358   assert(irqline != INPUT_LINE_NMI && irqline != INPUT_LINE_RESET && cycles > 0);
359   exec.set_input_line_and_vector(irqline, ASSERT_LINE, vector);
360
361   attotime target_time = exec.local_time() + exec.cycles_to_attotime(cycles * exec.min_cycles());
362   machine().scheduler().timer_set(target_time - machine().time(), timer_expired_delegate(FUNC(driver_device::irq_pulse_clear), this), irqline, (void *)&exec);
363}
364
365
366
367//**************************************************************************
368//  INTERRUPT GENERATION CALLBACK HELPERS
369//**************************************************************************
370
371//-------------------------------------------------
372//  NMI callbacks
373//-------------------------------------------------
374
375INTERRUPT_GEN_MEMBER( driver_device::nmi_line_pulse )   { device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); }
376INTERRUPT_GEN_MEMBER( driver_device::nmi_line_assert )   { device.execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); }
377
378
379//-------------------------------------------------
380//  IRQn callbacks
381//-------------------------------------------------
382
383INTERRUPT_GEN_MEMBER( driver_device::irq0_line_hold )   { device.execute().set_input_line(0, HOLD_LINE); }
384INTERRUPT_GEN_MEMBER( driver_device::irq0_line_pulse )   { generic_pulse_irq_line(device.execute(), 0, 1); }
385INTERRUPT_GEN_MEMBER( driver_device::irq0_line_assert )   { device.execute().set_input_line(0, ASSERT_LINE); }
386
387INTERRUPT_GEN_MEMBER( driver_device::irq1_line_hold )   { device.execute().set_input_line(1, HOLD_LINE); }
388INTERRUPT_GEN_MEMBER( driver_device::irq1_line_pulse )   { generic_pulse_irq_line(device.execute(), 1, 1); }
389INTERRUPT_GEN_MEMBER( driver_device::irq1_line_assert )   { device.execute().set_input_line(1, ASSERT_LINE); }
390
391INTERRUPT_GEN_MEMBER( driver_device::irq2_line_hold )   { device.execute().set_input_line(2, HOLD_LINE); }
392INTERRUPT_GEN_MEMBER( driver_device::irq2_line_pulse )   { generic_pulse_irq_line(device.execute(), 2, 1); }
393INTERRUPT_GEN_MEMBER( driver_device::irq2_line_assert )   { device.execute().set_input_line(2, ASSERT_LINE); }
394
395INTERRUPT_GEN_MEMBER( driver_device::irq3_line_hold )   { device.execute().set_input_line(3, HOLD_LINE); }
396INTERRUPT_GEN_MEMBER( driver_device::irq3_line_pulse )   { generic_pulse_irq_line(device.execute(), 3, 1); }
397INTERRUPT_GEN_MEMBER( driver_device::irq3_line_assert )   { device.execute().set_input_line(3, ASSERT_LINE); }
398
399INTERRUPT_GEN_MEMBER( driver_device::irq4_line_hold )   { device.execute().set_input_line(4, HOLD_LINE); }
400INTERRUPT_GEN_MEMBER( driver_device::irq4_line_pulse )   { generic_pulse_irq_line(device.execute(), 4, 1); }
401INTERRUPT_GEN_MEMBER( driver_device::irq4_line_assert )   { device.execute().set_input_line(4, ASSERT_LINE); }
402
403INTERRUPT_GEN_MEMBER( driver_device::irq5_line_hold )   { device.execute().set_input_line(5, HOLD_LINE); }
404INTERRUPT_GEN_MEMBER( driver_device::irq5_line_pulse )   { generic_pulse_irq_line(device.execute(), 5, 1); }
405INTERRUPT_GEN_MEMBER( driver_device::irq5_line_assert )   { device.execute().set_input_line(5, ASSERT_LINE); }
406
407INTERRUPT_GEN_MEMBER( driver_device::irq6_line_hold )   { device.execute().set_input_line(6, HOLD_LINE); }
408INTERRUPT_GEN_MEMBER( driver_device::irq6_line_pulse )   { generic_pulse_irq_line(device.execute(), 6, 1); }
409INTERRUPT_GEN_MEMBER( driver_device::irq6_line_assert )   { device.execute().set_input_line(6, ASSERT_LINE); }
410
411INTERRUPT_GEN_MEMBER( driver_device::irq7_line_hold )   { device.execute().set_input_line(7, HOLD_LINE); }
412INTERRUPT_GEN_MEMBER( driver_device::irq7_line_pulse )   { generic_pulse_irq_line(device.execute(), 7, 1); }
413INTERRUPT_GEN_MEMBER( driver_device::irq7_line_assert )   { device.execute().set_input_line(7, ASSERT_LINE); }
414
415
416
417//**************************************************************************
418//  WATCHDOG READ/WRITE HELPERS
419//**************************************************************************
420
421//-------------------------------------------------
422//  8-bit reset read/write handlers
423//-------------------------------------------------
424
425WRITE8_MEMBER( driver_device::watchdog_reset_w ) { watchdog_reset(machine()); }
426READ8_MEMBER( driver_device::watchdog_reset_r ) { watchdog_reset(machine()); return space.unmap(); }
427
428
429//-------------------------------------------------
430//  16-bit reset read/write handlers
431//-------------------------------------------------
432
433WRITE16_MEMBER( driver_device::watchdog_reset16_w ) { watchdog_reset(machine()); }
434READ16_MEMBER( driver_device::watchdog_reset16_r ) { watchdog_reset(machine()); return space.unmap(); }
435
436
437//-------------------------------------------------
438//  32-bit reset read/write handlers
439//-------------------------------------------------
440
441WRITE32_MEMBER( driver_device::watchdog_reset32_w ) { watchdog_reset(machine()); }
442READ32_MEMBER( driver_device::watchdog_reset32_r ) { watchdog_reset(machine()); return space.unmap(); }
443
444
445
446//**************************************************************************
447//  GENERIC SOUND COMMAND LATCHING
448//**************************************************************************
449
450//-------------------------------------------------
451//  soundlatch_sync_callback - time-delayed
452//  callback to set a latch value
453//-------------------------------------------------
454
455void driver_device::soundlatch_sync_callback(void *ptr, INT32 param)
456{
457   UINT16 value = param >> 8;
458   int which = param & 0xff;
459
460   // if the latch hasn't been read and the value is changed, log a warning
461   if (!m_latch_read[which] && m_latched_value[which] != value)
462      logerror("Warning: sound latch %d written before being read. Previous: %02x, new: %02x\n", which, m_latched_value[which], value);
463
464   // store the new value and mark it not read
465   m_latched_value[which] = value;
466   m_latch_read[which] = 0;
467}
468
469
470//-------------------------------------------------
471//  soundlatch_byte_w - global write handlers for
472//  writing to sound latches
473//-------------------------------------------------
474
475WRITE8_MEMBER( driver_device::soundlatch_byte_w )      { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 0 | (data << 8)); }
476WRITE16_MEMBER( driver_device::soundlatch_word_w )  { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 0 | (data << 8)); }
477WRITE8_MEMBER( driver_device::soundlatch2_byte_w )      { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 1 | (data << 8)); }
478WRITE16_MEMBER( driver_device::soundlatch2_word_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 1 | (data << 8)); }
479WRITE8_MEMBER( driver_device::soundlatch3_byte_w )      { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 2 | (data << 8)); }
480WRITE16_MEMBER( driver_device::soundlatch3_word_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 2 | (data << 8)); }
481WRITE8_MEMBER( driver_device::soundlatch4_byte_w )   { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 3 | (data << 8)); }
482WRITE16_MEMBER( driver_device::soundlatch4_word_w ) { machine().scheduler().synchronize(timer_expired_delegate(FUNC(driver_device::soundlatch_sync_callback), this), 3 | (data << 8)); }
483
484
485//-------------------------------------------------
486//  soundlatch_byte_r - global read handlers for
487//  reading from sound latches
488//-------------------------------------------------
489
490READ8_MEMBER( driver_device::soundlatch_byte_r )       { return m_latched_value[0]; }
491READ16_MEMBER( driver_device::soundlatch_word_r )   { return m_latched_value[0]; }
492READ8_MEMBER( driver_device::soundlatch2_byte_r )      { return m_latched_value[1]; }
493READ16_MEMBER( driver_device::soundlatch2_word_r )  { return m_latched_value[1]; }
494READ8_MEMBER( driver_device::soundlatch3_byte_r )      { return m_latched_value[2]; }
495READ16_MEMBER( driver_device::soundlatch3_word_r )  { return m_latched_value[2]; }
496READ8_MEMBER( driver_device::soundlatch4_byte_r )      { return m_latched_value[3]; }
497READ16_MEMBER( driver_device::soundlatch4_word_r )  { return m_latched_value[3]; }
498
499
500//-------------------------------------------------
501//  soundlatch_clear_byte_w - global write handlers
502//  for clearing sound latches
503//-------------------------------------------------
504
505WRITE8_MEMBER( driver_device::soundlatch_clear_byte_w )  { m_latched_value[0] = m_latch_clear_value; }
506WRITE8_MEMBER( driver_device::soundlatch2_clear_byte_w ) { m_latched_value[1] = m_latch_clear_value; }
507WRITE8_MEMBER( driver_device::soundlatch3_clear_byte_w ) { m_latched_value[2] = m_latch_clear_value; }
508WRITE8_MEMBER( driver_device::soundlatch4_clear_byte_w ) { m_latched_value[3] = m_latch_clear_value; }
509
510
511
512//**************************************************************************
513//  GENERIC FLIP SCREEN HANDLING
514//**************************************************************************
515
516//-------------------------------------------------
517//  updateflip - handle global flipping
518//-------------------------------------------------
519
520void driver_device::updateflip()
521{
522   // push the flip state to all tilemaps
523   machine().tilemap().set_flip_all((TILEMAP_FLIPX & m_flip_screen_x) | (TILEMAP_FLIPY & m_flip_screen_y));
524
525   // flip the visible area within the screen width/height
526   int width = machine().primary_screen->width();
527   int height = machine().primary_screen->height();
528   rectangle visarea = machine().primary_screen->visible_area();
529   if (m_flip_screen_x)
530   {
531      int temp = width - visarea.min_x - 1;
532      visarea.min_x = width - visarea.max_x - 1;
533      visarea.max_x = temp;
534   }
535   if (m_flip_screen_y)
536   {
537      int temp = height - visarea.min_y - 1;
538      visarea.min_y = height - visarea.max_y - 1;
539      visarea.max_y = temp;
540   }
541
542   // reconfigure the screen with the new visible area
543   attoseconds_t period = machine().primary_screen->frame_period().attoseconds;
544   machine().primary_screen->configure(width, height, visarea, period);
545}
546
547
548//-------------------------------------------------
549//  flip_screen_set - set global flip
550//-------------------------------------------------
551
552void driver_device::flip_screen_set(UINT32 on)
553{
554   // normalize to all 1
555   if (on)
556      on = ~0;
557
558   // if something's changed, handle it
559   if (m_flip_screen_x != on || m_flip_screen_y != on)
560   {
561      if (!on)
562         updateflip(); // flip visarea back
563      m_flip_screen_x = m_flip_screen_y = on;
564      updateflip();
565   }
566}
567
568
569//-------------------------------------------------
570//  flip_screen_set_no_update - set global flip
571//  do not call update_flip.
572//-------------------------------------------------
573
574void driver_device::flip_screen_set_no_update(UINT32 on)
575{
576   // flip_screen_y is not updated on purpose
577    // this function is for drivers which
578    // where writing to flip_screen_x to
579    // bypass update_flip
580   if (on)
581      on = ~0;
582   m_flip_screen_x = on;
583}
584
585
586//-------------------------------------------------
587//  flip_screen_x_set - set global horizontal flip
588//-------------------------------------------------
589
590void driver_device::flip_screen_x_set(UINT32 on)
591{
592   // normalize to all 1
593   if (on)
594      on = ~0;
595   
596   // if something's changed, handle it
597   if (m_flip_screen_x != on)
598   {
599      m_flip_screen_x = on;
600      updateflip();
601   }
602}
603
604
605//-------------------------------------------------
606//  flip_screen_y_set - set global vertical flip
607//-------------------------------------------------
608
609void driver_device::flip_screen_y_set(UINT32 on)
610{
611   // normalize to all 1
612   if (on)
613      on = ~0;
614   
615   // if something's changed, handle it
616   if (m_flip_screen_y != on)
617   {
618      m_flip_screen_y = on;
619      updateflip();
620   }
621}
622
623
624
625//**************************************************************************
626//  8-BIT PALETTE WRITE HANDLERS
627//**************************************************************************
628
629// 3-3-2 RGB palette write handlers
630WRITE8_MEMBER( driver_device::paletteram_BBGGGRRR_byte_w ) { palette_8bit_byte_w<3,3,2, 0,3,6>(space, offset, data, mem_mask); }
631WRITE8_MEMBER( driver_device::paletteram_RRRGGGBB_byte_w ) { palette_8bit_byte_w<3,3,2, 5,2,0>(space, offset, data, mem_mask); }
632WRITE8_MEMBER( driver_device::paletteram_BBGGRRII_byte_w )
633{
634   m_generic_paletteram_8[offset] = data;
635   int i = (data >> 0) & 3;
636   palette_set_color_rgb(machine(), offset, pal4bit(((data >> 0) & 0x0c) | i),
637                                      pal4bit(((data >> 2) & 0x0c) | i),
638                                      pal4bit(((data >> 4) & 0x0c) | i));
639}
640
641
642
643//**************************************************************************
644//  16-BIT PALETTE WRITE HANDLERS
645//**************************************************************************
646
647// 4-4-4 RGB palette write handlers
648WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_byte_le_w ) { palette_16bit_byte_le_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
649WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_byte_be_w ) { palette_16bit_byte_be_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
650WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
651WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
652WRITE16_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_word_w ) { palette_16bit_word_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
653
654WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_byte_le_w ) { palette_16bit_byte_le_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
655WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_byte_be_w ) { palette_16bit_byte_be_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
656WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
657WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
658WRITE16_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_word_w ) { palette_16bit_word_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
659
660WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRBBBBGGGG_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 8,0,4>(space, offset, data, mem_mask); }
661WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRBBBBGGGG_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 8,0,4>(space, offset, data, mem_mask); }
662
663WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_byte_le_w ) { palette_16bit_byte_le_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
664WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_byte_be_w ) { palette_16bit_byte_be_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
665WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
666WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
667WRITE16_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_word_w ) { palette_16bit_word_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
668
669WRITE8_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_byte_be_w ) { palette_16bit_byte_be_w<4,4,4, 12,8,4>(space, offset, data, mem_mask); }
670WRITE8_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 12,8,4>(space, offset, data, mem_mask); }
671WRITE8_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 12,8,4>(space, offset, data, mem_mask); }
672WRITE16_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_word_w ) { palette_16bit_word_w<4,4,4, 12,8,4>(space, offset, data, mem_mask); }
673
674// 4-4-4-4 IRGB palette write handlers
675template<int _IShift, int _RShift, int _GShift, int _BShift>
676inline void set_color_irgb(running_machine &machine, pen_t color, UINT16 data)
677{
678   static const UINT8 ztable[16] = { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11 };
679   UINT8 i = ztable[(data >> _IShift) & 15];
680   UINT8 r = ((data >> _RShift) & 15) * i;
681   UINT8 g = ((data >> _GShift) & 15) * i;
682   UINT8 b = ((data >> _BShift) & 15) * i;
683   palette_set_color_rgb(machine, color, r, g, b);
684}
685
686WRITE16_MEMBER( driver_device::paletteram_IIIIRRRRGGGGBBBB_word_w )
687{
688   COMBINE_DATA(&m_generic_paletteram_16[offset]);
689   set_color_irgb<12,8,4,0>(machine(), offset, m_generic_paletteram_16[offset]);
690}
691
692WRITE16_MEMBER( driver_device::paletteram_RRRRGGGGBBBBIIII_word_w )
693{
694   COMBINE_DATA(&m_generic_paletteram_16[offset]);
695   set_color_irgb<0,12,8,4>(machine(), offset, m_generic_paletteram_16[offset]);
696}
697
698// 5-5-5 RGB palette write handlers
699WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_le_w ) { palette_16bit_byte_le_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
700WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_be_w ) { palette_16bit_byte_be_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
701WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
702WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
703WRITE16_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_word_w ) { palette_16bit_word_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
704
705WRITE8_MEMBER( driver_device::paletteram_xBBBBBRRRRRGGGGG_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<5,5,5, 5,0,10>(space, offset, data, mem_mask); }
706WRITE8_MEMBER( driver_device::paletteram_xBBBBBRRRRRGGGGG_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<5,5,5, 5,0,10>(space, offset, data, mem_mask); }
707
708WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_byte_le_w ) { palette_16bit_byte_le_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
709WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_byte_be_w ) { palette_16bit_byte_be_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
710WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
711WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
712WRITE16_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_word_w ) { palette_16bit_word_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
713WRITE32_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_dword_be_w ) { palette_16bit_dword_be_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
714WRITE32_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_dword_le_w ) { palette_16bit_dword_le_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
715
716WRITE16_MEMBER( driver_device::paletteram_xGGGGGRRRRRBBBBB_word_w ) { palette_16bit_word_w<5,5,5, 5,10,0>(space, offset, data, mem_mask); }
717WRITE16_MEMBER( driver_device::paletteram_xGGGGGBBBBBRRRRR_word_w ) { palette_16bit_word_w<5,5,5, 0,10,5>(space, offset, data, mem_mask); }
718WRITE16_MEMBER( driver_device::paletteram_RRRRRGGGGGBBBBBx_word_w ) { palette_16bit_word_w<5,5,5, 11,6,1>(space, offset, data, mem_mask); }
719WRITE16_MEMBER( driver_device::paletteram_GGGGGRRRRRBBBBBx_word_w ) { palette_16bit_word_w<5,5,5, 6,11,1>(space, offset, data, mem_mask); }
720WRITE16_MEMBER( driver_device::paletteram_RRRRGGGGBBBBRGBx_word_w )
721{
722   COMBINE_DATA(&m_generic_paletteram_16[offset]);
723   data = m_generic_paletteram_16[offset];
724   palette_set_color_rgb(machine(), offset, pal5bit(((data >> 11) & 0x1e) | ((data >> 3) & 0x01)),
725                                          pal5bit(((data >>  7) & 0x1e) | ((data >> 2) & 0x01)),
726                                          pal5bit(((data >>  3) & 0x1e) | ((data >> 1) & 0x01)));
727}
728
729
730//**************************************************************************
731//  32-BIT PALETTE WRITE HANDLERS
732//**************************************************************************
733
734// 8-8-8 RGB palette write handlers
735WRITE16_MEMBER( driver_device::paletteram_xrgb_word_be_w ) { palette_32bit_word_be_w<8,8,8, 16,8,0>(space, offset, data, mem_mask); }
736WRITE16_MEMBER( driver_device::paletteram_xbgr_word_be_w ) { palette_32bit_word_be_w<8,8,8, 0,8,16>(space, offset, data, mem_mask); }
src/emu/driver.h
r14896r14897
5151//  TYPE DEFINITIONS
5252//**************************************************************************
5353
54typedef delegate<void ()> driver_callback_delegate;
5455
56
5557// ======================> driver_device
5658
5759// base class for machine driver-specific devices
r14896r14897
6163   // construction/destruction
6264   driver_device(const machine_config &mconfig, device_type type, const char *tag);
6365   virtual ~driver_device();
66   
67   // getters
68   const game_driver &system() const { assert(m_system != NULL); return *m_system; }
6469
6570   // indexes into our generic callbacks
6671   enum callback_type
r14896r14897
7782   // inline configuration helpers
7883   static void static_set_game(device_t &device, const game_driver &game);
7984   static void static_set_callback(device_t &device, callback_type type, legacy_callback_func callback);
85   static void static_set_callback(device_t &device, callback_type type, driver_callback_delegate callback);
8086   static void static_set_palette_init(device_t &device, palette_init_func callback);
8187
8288   // generic helpers
89   template<class _DriverClass, void (_DriverClass::*_Function)()>
90   static void static_wrapper(driver_device &device)
91   {
92      (downcast<_DriverClass &>(device).*_Function)();
93   }
94   
95   // generic interrupt generators   
96   void generic_pulse_irq_line(device_execute_interface &exec, int irqline, int cycles);
97   void generic_pulse_irq_line_and_vector(device_execute_interface &exec, int irqline, int vector, int cycles);
8398
99   INTERRUPT_GEN_MEMBER( nmi_line_pulse );
100   INTERRUPT_GEN_MEMBER( nmi_line_assert );
101
102   INTERRUPT_GEN_MEMBER( irq0_line_hold );
103   INTERRUPT_GEN_MEMBER( irq0_line_pulse );
104   INTERRUPT_GEN_MEMBER( irq0_line_assert );
105
106   INTERRUPT_GEN_MEMBER( irq1_line_hold );
107   INTERRUPT_GEN_MEMBER( irq1_line_pulse );
108   INTERRUPT_GEN_MEMBER( irq1_line_assert );
109
110   INTERRUPT_GEN_MEMBER( irq2_line_hold );
111   INTERRUPT_GEN_MEMBER( irq2_line_pulse );
112   INTERRUPT_GEN_MEMBER( irq2_line_assert );
113
114   INTERRUPT_GEN_MEMBER( irq3_line_hold );
115   INTERRUPT_GEN_MEMBER( irq3_line_pulse );
116   INTERRUPT_GEN_MEMBER( irq3_line_assert );
117
118   INTERRUPT_GEN_MEMBER( irq4_line_hold );
119   INTERRUPT_GEN_MEMBER( irq4_line_pulse );
120   INTERRUPT_GEN_MEMBER( irq4_line_assert );
121
122   INTERRUPT_GEN_MEMBER( irq5_line_hold );
123   INTERRUPT_GEN_MEMBER( irq5_line_pulse );
124   INTERRUPT_GEN_MEMBER( irq5_line_assert );
125
126   INTERRUPT_GEN_MEMBER( irq6_line_hold );
127   INTERRUPT_GEN_MEMBER( irq6_line_pulse );
128   INTERRUPT_GEN_MEMBER( irq6_line_assert );
129
130   INTERRUPT_GEN_MEMBER( irq7_line_hold );
131   INTERRUPT_GEN_MEMBER( irq7_line_pulse );
132   INTERRUPT_GEN_MEMBER( irq7_line_assert );
133
84134   // watchdog read/write handlers
85135   DECLARE_WRITE8_MEMBER( watchdog_reset_w );
86136   DECLARE_READ8_MEMBER( watchdog_reset_r );
r14896r14897
89139   DECLARE_WRITE32_MEMBER( watchdog_reset32_w );
90140   DECLARE_READ32_MEMBER( watchdog_reset32_r );
91141
142   // generic audio
143   void soundlatch_setclearedvalue(UINT16 value) { m_latch_clear_value = value; }
144
92145   // sound latch readers
93   DECLARE_READ8_MEMBER( soundlatch_r );
94   DECLARE_READ8_MEMBER( soundlatch2_r );
95   DECLARE_READ8_MEMBER( soundlatch3_r );
96   DECLARE_READ8_MEMBER( soundlatch4_r );
146   DECLARE_READ8_MEMBER( soundlatch_byte_r );
147   DECLARE_READ8_MEMBER( soundlatch2_byte_r );
148   DECLARE_READ8_MEMBER( soundlatch3_byte_r );
149   DECLARE_READ8_MEMBER( soundlatch4_byte_r );
97150   DECLARE_READ16_MEMBER( soundlatch_word_r );
98151   DECLARE_READ16_MEMBER( soundlatch2_word_r );
99152   DECLARE_READ16_MEMBER( soundlatch3_word_r );
100153   DECLARE_READ16_MEMBER( soundlatch4_word_r );
101154
102155   // sound latch writers
103   DECLARE_WRITE8_MEMBER( soundlatch_w );
104   DECLARE_WRITE8_MEMBER( soundlatch2_w );
105   DECLARE_WRITE8_MEMBER( soundlatch3_w );
106   DECLARE_WRITE8_MEMBER( soundlatch4_w );
156   DECLARE_WRITE8_MEMBER( soundlatch_byte_w );
157   DECLARE_WRITE8_MEMBER( soundlatch2_byte_w );
158   DECLARE_WRITE8_MEMBER( soundlatch3_byte_w );
159   DECLARE_WRITE8_MEMBER( soundlatch4_byte_w );
107160   DECLARE_WRITE16_MEMBER( soundlatch_word_w );
108161   DECLARE_WRITE16_MEMBER( soundlatch2_word_w );
109162   DECLARE_WRITE16_MEMBER( soundlatch3_word_w );
110163   DECLARE_WRITE16_MEMBER( soundlatch4_word_w );
111164
112165   // sound latch clearers
113   DECLARE_WRITE8_MEMBER( soundlatch_clear_w );
114   DECLARE_WRITE8_MEMBER( soundlatch2_clear_w );
115   DECLARE_WRITE8_MEMBER( soundlatch3_clear_w );
116   DECLARE_WRITE8_MEMBER( soundlatch4_clear_w );
166   DECLARE_WRITE8_MEMBER( soundlatch_clear_byte_w );
167   DECLARE_WRITE8_MEMBER( soundlatch2_clear_byte_w );
168   DECLARE_WRITE8_MEMBER( soundlatch3_clear_byte_w );
169   DECLARE_WRITE8_MEMBER( soundlatch4_clear_byte_w );
117170
118   // general palette helpers
119   void set_color_332(pen_t color, int rshift, int gshift, int bshift, UINT32 data);
120   void set_color_444(pen_t color, int rshift, int gshift, int bshift, UINT32 data);
121   void set_color_555(pen_t color, int rshift, int gshift, int bshift, UINT32 data);
122   void set_color_565(pen_t color, int rshift, int gshift, int bshift, UINT32 data);
123   void set_color_888(pen_t color, int rshift, int gshift, int bshift, UINT32 data);
124   void set_color_4444(pen_t color, int ishift, int rshift, int gshift, int bshift, UINT16 data);
171   // generic video
172   void flip_screen_set(UINT32 on);
173   void flip_screen_set_no_update(UINT32 on);
174   void flip_screen_x_set(UINT32 on);
175   void flip_screen_y_set(UINT32 on);
176   UINT32 flip_screen() const { return m_flip_screen_x; }
177   UINT32 flip_screen_x() const { return m_flip_screen_x; }
178   UINT32 flip_screen_y() const { return m_flip_screen_y; }
125179
180   // templatized palette writers for 8-bit palette data
181   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_8bit_byte_w );
182
183   // templatized palette writers for 16-bit palette data
184   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_16bit_byte_le_w );
185   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_16bit_byte_be_w );
186   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_16bit_byte_split_lo_w );
187   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_16bit_byte_split_hi_w );
188   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE16_MEMBER( palette_16bit_word_w );
189   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE32_MEMBER( palette_16bit_dword_le_w );
190   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE32_MEMBER( palette_16bit_dword_be_w );
191
192   // templatized palette writers for 32-bit palette data
193   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE16_MEMBER( palette_32bit_word_le_w );
194   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE16_MEMBER( palette_32bit_word_be_w );
195   template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE32_MEMBER( palette_32bit_dword_w );
196
126197   // 3-3-2 RGB palette write handlers
127   DECLARE_WRITE8_MEMBER( paletteram_BBGGGRRR_w );
128   DECLARE_WRITE8_MEMBER( paletteram_RRRGGGBB_w );
129   DECLARE_WRITE8_MEMBER( paletteram_BBGGRRII_w );
130   DECLARE_WRITE8_MEMBER( paletteram_IIBBGGRR_w );
198   DECLARE_WRITE8_MEMBER( paletteram_BBGGGRRR_byte_w );
199   DECLARE_WRITE8_MEMBER( paletteram_RRRGGGBB_byte_w );
200   DECLARE_WRITE8_MEMBER( paletteram_BBGGRRII_byte_w );
131201
132202   // 4-4-4 RGB palette write handlers
133   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_le_w );
134   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_be_w );
135   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_split1_w );   // uses paletteram
136   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_split2_w );   // uses paletteram2
137   DECLARE_WRITE16_MEMBER( paletteram16_xxxxBBBBGGGGRRRR_word_w );
203   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_byte_le_w );
204   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_byte_be_w );
205   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w );
206   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w );
207   DECLARE_WRITE16_MEMBER( paletteram_xxxxBBBBGGGGRRRR_word_w );
138208
139   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_le_w );
140   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_be_w );
141   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_split1_w );   // uses paletteram
142   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_split2_w );   // uses paletteram2
143   DECLARE_WRITE16_MEMBER( paletteram16_xxxxBBBBRRRRGGGG_word_w );
209   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_byte_le_w );
210   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_byte_be_w );
211   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_byte_split_lo_w );
212   DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_byte_split_hi_w );
213   DECLARE_WRITE16_MEMBER( paletteram_xxxxBBBBRRRRGGGG_word_w );
144214
145   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRBBBBGGGG_split1_w );   // uses paletteram
146   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRBBBBGGGG_split2_w );   // uses paletteram2
215   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRBBBBGGGG_byte_split_lo_w );
216   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRBBBBGGGG_byte_split_hi_w );
147217
148   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_le_w );
149   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_be_w );
150   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_split1_w );   // uses paletteram
151   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_split2_w );   // uses paletteram2
152   DECLARE_WRITE16_MEMBER( paletteram16_xxxxRRRRGGGGBBBB_word_w );
218   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_byte_le_w );
219   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_byte_be_w );
220   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_byte_split_lo_w );
221   DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_byte_split_hi_w );
222   DECLARE_WRITE16_MEMBER( paletteram_xxxxRRRRGGGGBBBB_word_w );
153223
154   DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_be_w );
155   DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_split1_w );   // uses paletteram
156   DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_split2_w );   // uses paletteram2
157   DECLARE_WRITE16_MEMBER( paletteram16_RRRRGGGGBBBBxxxx_word_w );
224   DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_byte_be_w );
225   DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_byte_split_lo_w );
226   DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_byte_split_hi_w );
227   DECLARE_WRITE16_MEMBER( paletteram_RRRRGGGGBBBBxxxx_word_w );
158228
159229   // 4-4-4-4 IRGB palette write handlers
160   DECLARE_WRITE16_MEMBER( paletteram16_IIIIRRRRGGGGBBBB_word_w );
161   DECLARE_WRITE16_MEMBER( paletteram16_RRRRGGGGBBBBIIII_word_w );
230   DECLARE_WRITE16_MEMBER( paletteram_IIIIRRRRGGGGBBBB_word_w );
231   DECLARE_WRITE16_MEMBER( paletteram_RRRRGGGGBBBBIIII_word_w );
162232
163233   // 5-5-5 RGB palette write handlers
164   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_le_w );
165   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_be_w );
166   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_split1_w );   // uses paletteram
167   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_split2_w );   // uses paletteram2
168   DECLARE_WRITE16_MEMBER( paletteram16_xBBBBBGGGGGRRRRR_word_w );
234   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_byte_le_w );
235   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_byte_be_w );
236   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w );
237   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w );
238   DECLARE_WRITE16_MEMBER( paletteram_xBBBBBGGGGGRRRRR_word_w );
169239
170   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBRRRRRGGGGG_split1_w );  // uses paletteram
171   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBRRRRRGGGGG_split2_w );  // uses paletteram2
240   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBRRRRRGGGGG_byte_split_lo_w );
241   DECLARE_WRITE8_MEMBER( paletteram_xBBBBBRRRRRGGGGG_byte_split_hi_w );
172242
173   DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_le_w );
174   DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_be_w );
175   DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_split1_w );
176   DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_split2_w );
177   DECLARE_WRITE16_MEMBER( paletteram16_xRRRRRGGGGGBBBBB_word_w );
243   DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_byte_le_w );
244   DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_byte_be_w );
245   DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_byte_split_lo_w );
246   DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_byte_split_hi_w );
247   DECLARE_WRITE16_MEMBER( paletteram_xRRRRRGGGGGBBBBB_word_w );
248   DECLARE_WRITE32_MEMBER( paletteram_xRRRRRGGGGGBBBBB_dword_be_w );
249   DECLARE_WRITE32_MEMBER( paletteram_xRRRRRGGGGGBBBBB_dword_le_w );
178250
179   DECLARE_WRITE16_MEMBER( paletteram16_xGGGGGRRRRRBBBBB_word_w );
180   DECLARE_WRITE16_MEMBER( paletteram16_xGGGGGBBBBBRRRRR_word_w );
251   DECLARE_WRITE16_MEMBER( paletteram_xGGGGGRRRRRBBBBB_word_w );
252   DECLARE_WRITE16_MEMBER( paletteram_xGGGGGBBBBBRRRRR_word_w );
253   DECLARE_WRITE16_MEMBER( paletteram_RRRRRGGGGGBBBBBx_word_w );
254   DECLARE_WRITE16_MEMBER( paletteram_GGGGGRRRRRBBBBBx_word_w );
255   DECLARE_WRITE16_MEMBER( paletteram_RRRRGGGGBBBBRGBx_word_w );
181256
182   DECLARE_WRITE16_MEMBER( paletteram16_RRRRRGGGGGBBBBBx_word_w );
183   DECLARE_WRITE16_MEMBER( paletteram16_GGGGGRRRRRBBBBBx_word_w );
184   DECLARE_WRITE16_MEMBER( paletteram16_RRRRGGGGBBBBRGBx_word_w );
185
186257   // 8-8-8 RGB palette write handlers
187   DECLARE_WRITE16_MEMBER( paletteram16_xrgb_word_be_w );
188   DECLARE_WRITE16_MEMBER( paletteram16_xbgr_word_be_w );
258   DECLARE_WRITE16_MEMBER( paletteram_xrgb_word_be_w );
259   DECLARE_WRITE16_MEMBER( paletteram_xbgr_word_be_w );
189260   
190261   // generic input port helpers
191262   // custom handler
r14896r14897
216287   inline UINT16 paletteram16_split(offs_t offset) const { return m_generic_paletteram_8[offset] | (m_generic_paletteram2_8[offset] << 8); }
217288   inline UINT32 paletteram32_be(offs_t offset) const { return m_generic_paletteram_16[offset | 1] | (m_generic_paletteram_16[offset & ~1] << 16); }
218289
219   // internal state
220   const game_driver *      m_system;               // pointer to the game driver
221
222   legacy_callback_func   m_callbacks[CB_COUNT];      // generic legacy callbacks
223   palette_init_func      m_palette_init;            // one-time palette init callback
224
225290public:
226291   // generic pointers
227292   optional_shared_ptr<UINT8> m_generic_paletteram_8;
r14896r14897
230295   optional_shared_ptr<UINT16> m_generic_paletteram2_16;
231296   optional_shared_ptr<UINT32> m_generic_paletteram_32;
232297   optional_shared_ptr<UINT32> m_generic_paletteram2_32;
298
299private:
300   // helpers
301   void irq_pulse_clear(void *ptr, INT32 param);
302   void soundlatch_sync_callback(void *ptr, INT32 param);
303   void updateflip();
304
305   // internal state
306   const game_driver *      m_system;               // pointer to the game driver
307   palette_init_func      m_palette_init;            // one-time palette init callback
308   driver_callback_delegate m_callbacks[CB_COUNT];      // start/reset callbacks
309   legacy_callback_func    m_legacy_callbacks[CB_COUNT]; // legacy start/reset callbacks
310
311   // generic audio
312   UINT16               m_latch_clear_value;
313   UINT16               m_latched_value[4];
314   UINT8               m_latch_read[4];
315
316   // generic video
317   UINT32                m_flip_screen_x;
318   UINT32                m_flip_screen_y;
233319};
234320
235321
r14896r14897
243329}
244330
245331
332
333//**************************************************************************
334//  PALETTE WRITER TEMPLATES
335//**************************************************************************
336
337// write 8-bit palette data
338template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
339WRITE8_MEMBER(driver_device::palette_8bit_byte_w)
340{
341   m_generic_paletteram_8[offset] = data;
342   UINT8 paldata = m_generic_paletteram_8[offset];
343   palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
344}
345
346// write 16-bit palette data to consecutive 8-bit addresses with LSB first
347template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
348WRITE8_MEMBER(driver_device::palette_16bit_byte_le_w)
349{
350   m_generic_paletteram_8[offset] = data;
351   UINT16 paldata = m_generic_paletteram_8[offset & ~1] | (m_generic_paletteram_8[offset | 1] << 8);
352   palette_set_color_rgb(machine(), offset / 2, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
353}
354
355// write 16-bit palette data to consecutive 8-bit addresses with MSB first
356template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
357WRITE8_MEMBER(driver_device::palette_16bit_byte_be_w)
358{
359   m_generic_paletteram_8[offset] = data;
360   UINT16 paldata = m_generic_paletteram_8[offset | 1] | (m_generic_paletteram_8[offset & ~1] << 8);
361   palette_set_color_rgb(machine(), offset / 2, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
362}
363
364// write 16-bit palette data to split 8-bit addresses (LSB)
365template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
366WRITE8_MEMBER(driver_device::palette_16bit_byte_split_lo_w)
367{
368   m_generic_paletteram_8[offset] = data;
369   UINT16 paldata = m_generic_paletteram_8[offset] | (m_generic_paletteram2_8[offset] << 8);
370   palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
371}
372
373// write 16-bit palette data to split 8-bit addresses (MSB)
374template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
375WRITE8_MEMBER(driver_device::palette_16bit_byte_split_hi_w)
376{
377   m_generic_paletteram2_8[offset] = data;
378   UINT16 paldata = m_generic_paletteram_8[offset] | (m_generic_paletteram2_8[offset] << 8);
379   palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
380}
381
382// write 16-bit palette data to 16-bit addresses
383template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
384WRITE16_MEMBER(driver_device::palette_16bit_word_w)
385{
386   COMBINE_DATA(&m_generic_paletteram_16[offset]);
387   UINT16 paldata = m_generic_paletteram_16[offset];
388   palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
389}
390
391// write 16-bit palette data to packed 32-bit addresses (lower entry in lower 16 bits)
392template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
393WRITE32_MEMBER(driver_device::palette_16bit_dword_le_w)
394{
395   COMBINE_DATA(&m_generic_paletteram_32[offset]);
396   if (ACCESSING_BITS_0_15)
397   {
398      UINT16 paldata = m_generic_paletteram_32[offset];
399      palette_set_color_rgb(machine(), offset * 2 + 0, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_GreenBits>(paldata >> _BlueShift));
400   }
401   if (ACCESSING_BITS_16_31)
402   {
403      UINT16 paldata = m_generic_paletteram_32[offset] >> 16;
404      palette_set_color_rgb(machine(), offset * 2 + 1, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_GreenBits>(paldata >> _BlueShift));
405   }
406}
407
408// write 16-bit palette data to packed 32-bit addresses (lower entry in upper 16 bits)
409template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
410WRITE32_MEMBER(driver_device::palette_16bit_dword_be_w)
411{
412   COMBINE_DATA(&m_generic_paletteram_32[offset]);
413   if (ACCESSING_BITS_16_31)
414   {
415      UINT16 paldata = m_generic_paletteram_32[offset] >> 16;
416      palette_set_color_rgb(machine(), offset * 2 + 0, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
417   }
418   if (ACCESSING_BITS_0_15)
419   {
420      UINT16 paldata = m_generic_paletteram_32[offset];
421      palette_set_color_rgb(machine(), offset * 2 + 1, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
422   }
423}
424
425// write 32-bit palette data to consecutive 16-bit addresses with LSW first
426template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
427WRITE16_MEMBER(driver_device::palette_32bit_word_le_w)
428{
429   COMBINE_DATA(&m_generic_paletteram_16[offset]);
430   UINT32 paldata = m_generic_paletteram_16[offset & ~1] | (m_generic_paletteram_16[offset | 1] << 16);
431   palette_set_color_rgb(machine(), offset / 2, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
432}
433
434// write 32-bit palette data to consecutive 16-bit addresses with MSW first
435template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
436WRITE16_MEMBER(driver_device::palette_32bit_word_be_w)
437{
438   COMBINE_DATA(&m_generic_paletteram_16[offset]);
439   UINT32 paldata = m_generic_paletteram_16[offset | 1] | (m_generic_paletteram_16[offset & ~1] << 16);
440   palette_set_color_rgb(machine(), offset / 2, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
441}
442
443// write 32-bit palette data to 32-bit addresses
444template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
445WRITE32_MEMBER(driver_device::palette_32bit_dword_w)
446{
447   COMBINE_DATA(&m_generic_paletteram_32[offset]);
448   UINT32 paldata = m_generic_paletteram_32[offset];
449   palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
450}
451
246452#endif   /* __DRIVER_H__ */
src/emu/mconfig.h
r14896r14897
270270#define MCFG_MACHINE_START(_func) \
271271   driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_START, MACHINE_START_NAME(_func)); \
272272
273#define MCFG_MACHINE_START_DRIVER(_class, _func) \
274   driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_START, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device())));
275
273276#define MCFG_MACHINE_RESET(_func) \
274277   driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_RESET, MACHINE_RESET_NAME(_func)); \
275278
279#define MCFG_MACHINE_RESET_DRIVER(_class, _func) \
280   driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_RESET, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device())));
276281
282
277283// core sound functions
278284#define MCFG_SOUND_START(_func) \
279285   driver_device::static_set_callback(*owner, driver_device::CB_SOUND_START, SOUND_START_NAME(_func)); \
280286
287#define MCFG_SOUND_START_DRIVER(_class, _func) \
288   driver_device::static_set_callback(*owner, driver_device::CB_SOUND_START, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device())));
289
281290#define MCFG_SOUND_RESET(_func) \
282291   driver_device::static_set_callback(*owner, driver_device::CB_SOUND_RESET, SOUND_RESET_NAME(_func)); \
283292
293#define MCFG_SOUND_RESET_DRIVER(_class, _func) \
294   driver_device::static_set_callback(*owner, driver_device::CB_SOUND_RESET, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device())));
284295
296
285297// core video functions
286298#define MCFG_PALETTE_INIT(_func) \
287299   driver_device::static_set_palette_init(*owner, PALETTE_INIT_NAME(_func)); \
r14896r14897
289301#define MCFG_VIDEO_START(_func) \
290302   driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_START, VIDEO_START_NAME(_func)); \
291303
304#define MCFG_VIDEO_START_DRIVER(_class, _func) \
305   driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_START, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device())));
306
292307#define MCFG_VIDEO_RESET(_func) \
293308   driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_RESET, VIDEO_RESET_NAME(_func)); \
294309
310#define MCFG_VIDEO_RESET_DRIVER(_class, _func) \
311   driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_RESET, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device())));
295312
313
296314// add/remove devices
297315#define MCFG_DEVICE_ADD(_tag, _type, _clock) \
298316   device = config.device_add(owner, _tag, _type, _clock); \
src/lib/util/palette.h
r14896r14897
296296}
297297
298298
299//-------------------------------------------------
300//  palexpand - expand a palette value to 8 bits
301//-------------------------------------------------
302
303template<int _NumBits>
304inline UINT8 palexpand(UINT8 data)
305{
306   if (_NumBits == 1) return pal1bit(data);
307   if (_NumBits == 2) return pal2bit(data);
308   if (_NumBits == 3) return pal3bit(data);
309   if (_NumBits == 4) return pal4bit(data);
310   if (_NumBits == 5) return pal5bit(data);
311   if (_NumBits == 6) return pal6bit(data);
312   if (_NumBits == 7) return pal7bit(data);
313   return data;
314}
315
316
299317/*-------------------------------------------------
300318    pal332 - create a 3-3-2 color by extracting
301319    bits from a UINT32
src/mess/drivers/ng_aes.c
r14896r14897
487487   /* accessing the LSB only is not mapped */
488488   if (mem_mask != 0x00ff)
489489   {
490      state->soundlatch_w(*space, 0, data >> 8);
490      state->soundlatch_byte_w(*space, 0, data >> 8);
491491
492492      audio_cpu_assert_nmi(space->machine());
493493
r14896r14897
502502static READ8_HANDLER( audio_command_r )
503503{
504504   ng_aes_state *state = space->machine().driver_data<ng_aes_state>();
505   UINT8 ret = state->soundlatch_r(*space, 0);
505   UINT8 ret = state->soundlatch_byte_r(*space, 0);
506506
507507   if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", cpu_get_pc(&space->device()), ret);
508508
src/mess/drivers/supracan.c
r14896r14897
11131113   AM_RANGE( 0xe90000, 0xe9001f ) AM_READWRITE( supracan_sound_r, supracan_sound_w )
11141114   AM_RANGE( 0xe90020, 0xe9003f ) AM_WRITE( supracan_dma_w )
11151115   AM_RANGE( 0xf00000, 0xf001ff ) AM_READWRITE( supracan_video_r, supracan_video_w )
1116   AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
1116   AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM AM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
11171117   AM_RANGE( 0xf40000, 0xf5ffff ) AM_READWRITE(supracan_vram_r, supracan_vram_w)
11181118   AM_RANGE( 0xfc0000, 0xfdffff ) AM_MIRROR(0x30000) AM_RAM /* System work ram */
11191119ADDRESS_MAP_END

Previous 15994 Revisions Next


© 1998-2018 The MESS Team